Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Commit 609e2bb

Browse files
author
Mohith Shrivastava
committed
fix aura and lwc deploy errors
1 parent 98a405b commit 609e2bb

File tree

4 files changed

+267
-422
lines changed

4 files changed

+267
-422
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "mo-dx-plugin",
3-
"version": "0.2.7",
3+
"version": "0.2.8",
44
"author": "Mohith Shrivastava",
55
"bugs": "https://github.com/ForceProjects/mo-dx-plugin/issues",
66
"dependencies": {
77
"@oclif/command": "^1.5.8",
88
"@oclif/config": "^1.12.6",
99
"@oclif/errors": "^1.2.2",
10-
"@salesforce/command": "^2.1.3",
10+
"@salesforce/command": "^3.0.0",
1111
"@salesforce/ts-types": "^1.0.1",
1212
"adm-zip": "^0.4.13",
1313
"chalk": "^3.0.0",
@@ -23,8 +23,8 @@
2323
"@salesforce/dev-config": "1.1.4",
2424
"@types/adm-zip": "^0.4.31",
2525
"@types/chai": "^4",
26-
"@types/fs-extra": "^5.0.3",
27-
"@types/jsforce": "1.9.8",
26+
"@types/fs-extra": "^8.0.1",
27+
"@types/jsforce": "1.9.13",
2828
"@types/lodash": "^4.14.13",
2929
"@types/mime-types": "^2.1.0",
3030
"@types/mocha": "^5",

src/commands/deploy/aura.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,33 +148,37 @@ export default class AuraDeploy extends SfdxCommand {
148148
);
149149
}
150150

151+
// There is a bug in the JSforce for bulk inserts so executing insert/updates in loop instead of array
152+
151153
// function to update all the AuraDefinition
152154
async function upsertAuraDefinition(auraDefinitions: AuraDefinition[] , files: string[], bundleId: string) {
153-
const auraDefinitionsToCreate: AuraDefinition[] = [];
154-
const auraDefinitionsToUpdate: AuraDefinition[] = [];
155+
// const auraDefinitionsToCreate: AuraDefinition[] = [];
156+
// const auraDefinitionsToUpdate: AuraDefinition[] = [];
155157
const promiseArray = [];
156158
fileKey.forEach ( key => {
157159
const auraDef = auraDefinitions.find(auraDefinition => auraDefinition.DefType === key);
158160
if (auraDef) {
159161
const definitionToUpdate = {} as AuraDefinition;
160162
definitionToUpdate.Id = auraDef.Id;
161163
definitionToUpdate.Source = files[fileKey.indexOf(auraDef.DefType)];
162-
auraDefinitionsToUpdate.push(definitionToUpdate);
164+
// auraDefinitionsToUpdate.push(definitionToUpdate);
165+
promiseArray.push(conn.tooling.sobject('AuraDefinition').update(definitionToUpdate));
163166
} else {
164167
const definitionToInsert = {} as AuraDefinition;
165168
definitionToInsert.AuraDefinitionBundleId = bundleId;
166169
definitionToInsert.DefType = key;
167170
definitionToInsert.Format = getAuraFormat((validFiles[fileKey.indexOf(key)].split('.'))[1]);
168171
definitionToInsert.Source = files[fileKey.indexOf(key)];
169-
auraDefinitionsToCreate.push(definitionToInsert);
172+
// auraDefinitionsToCreate.push(definitionToInsert);
173+
promiseArray.push(conn.tooling.sobject('AuraDefinition').create(definitionToInsert));
170174
}
171175
});
172-
if (auraDefinitionsToUpdate.length > 0) {
176+
/*if (auraDefinitionsToUpdate.length > 0) {
173177
promiseArray.push(conn.tooling.sobject('AuraDefinition').update(auraDefinitionsToUpdate));
174178
}
175179
if (auraDefinitionsToCreate.length > 0) {
176180
promiseArray.push(conn.tooling.sobject('AuraDefinition').create(auraDefinitionsToCreate));
177-
}
181+
}*/
178182
return Promise.all(promiseArray);
179183
}
180184

src/commands/deploy/lwc.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,32 +198,34 @@ export default class LWCDeploy extends SfdxCommand {
198198
}
199199

200200
// function to update all the LightningComponentResource
201+
// There is a bug in the JSforce for bulk inserts so executing insert/updates in loop instead of array
201202
async function upsertLWCDefinition(lwcResources: LightningComponentResource[] , files: string[], bundleId: string) {
202-
const lwcResourcesToCreate: LightningComponentResource[] = [];
203-
const lwcResourcesToUpdate: LightningComponentResource[] = [];
203+
// const lwcResourcesToCreate: LightningComponentResource[] = [];
204+
// const lwcResourcesToUpdate: LightningComponentResource[] = [];
204205
const promiseArray = [];
205206
validFiles.forEach ( filename => {
206207
const lwcMatch = lwcResources.find(lwc => lwc.FilePath === getFilepath( _fileOrDirName, filename));
207208
if (lwcMatch) {
208209
const lwcResourceToUpdate = {} as LightningComponentResource;
209210
lwcResourceToUpdate.Id = lwcMatch.Id;
210211
lwcResourceToUpdate.Source = files[filePath.indexOf(lwcMatch.FilePath)];
211-
lwcResourcesToUpdate.push(lwcResourceToUpdate);
212+
promiseArray.push(conn.tooling.sobject('LightningComponentResource').update(lwcResourceToUpdate));
212213
} else {
213214
const lwcResourceToInsert = {} as LightningComponentResource;
214215
lwcResourceToInsert.LightningComponentBundleId = bundleId;
215216
lwcResourceToInsert.FilePath = getFilepath( _fileOrDirName, filename);
216217
lwcResourceToInsert.Format = (filename.split('.'))[(filename.split('.').length - 1)];
217218
lwcResourceToInsert.Source = files[filePath.indexOf(getFilepath( _fileOrDirName, filename))];
218-
lwcResourcesToCreate.push(lwcResourceToInsert);
219+
promiseArray.push(conn.tooling.sobject('LightningComponentResource').create(lwcResourceToInsert));
220+
// lwcResourcesToCreate.push(lwcResourceToInsert);
219221
}
220222
});
221-
if (lwcResourcesToUpdate.length > 0) {
223+
/*if (lwcResourcesToUpdate.length > 0) {
222224
promiseArray.push(conn.tooling.sobject('LightningComponentResource').update(lwcResourcesToUpdate));
223225
}
224226
if (lwcResourcesToCreate.length > 0) {
225227
promiseArray.push(conn.tooling.sobject('LightningComponentResource').create(lwcResourcesToCreate));
226-
}
228+
}*/
227229
return Promise.all(promiseArray);
228230
}
229231

0 commit comments

Comments
 (0)