@pega/custom-dx-components 0.242.51 → 0.242.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.242.51",
3
+ "version": "0.242.53",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -11,6 +11,7 @@ import {
11
11
  deleteLocalArchiveLibrary,
12
12
  deleteLocalArchiveLibraryVersion,
13
13
  deleteLocalComponent,
14
+ getHaveDependencyDifference,
14
15
  getComponents,
15
16
  getLibraryArchiveDirectories,
16
17
  deleteArchives,
@@ -174,6 +175,15 @@ addDebugLog("deleteLibraryVersion", "END", "-");
174
175
  console.log(`\nSwitched to ${chalk.green(`${configDef.displayLibVersion}`)}`);
175
176
  await showCurrentStatus();
176
177
 
178
+ if (getHaveDependencyDifference()) {
179
+
180
+ console.log('\n***************************************************************');
181
+ console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
182
+ console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
183
+ console.log('***************************************************************\n');
184
+
185
+ }
186
+
177
187
  }
178
188
  }
179
189
  else {
@@ -182,6 +192,16 @@ addDebugLog("deleteLibraryVersion", "END", "-");
182
192
  }
183
193
 
184
194
  }
195
+ else {
196
+ // switch to another version, if no versions to switch to then delete /store so will be back to state of nothing
197
+ const archiveLibraries = await getLibraryArchiveDirectories("");
198
+ if (!archiveLibraries || archiveLibraries.length === 0) {
199
+ // no libraries, so remove "/store"
200
+ await deleteArchives();
201
+ }
202
+
203
+ }
204
+
185
205
 
186
206
  addDebugLog("deleteLibraryVersion", "END", "-");
187
207
 
@@ -51,7 +51,7 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
51
51
  configData.version = version;
52
52
 
53
53
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
54
- fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8' });
54
+ fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
55
55
 
56
56
  };
57
57
 
@@ -69,7 +69,7 @@ addDebugLog("updateFile", `fileName: ${fileName}, oldComponentKeyPC: ${oldCompon
69
69
  if (fileData.indexOf(oldComponentKeyPC) >= 0) {
70
70
  fileData = fileData.replaceAll(oldComponentKeyPC, newComponentKeyPC);
71
71
 
72
- fs.writeFileSync(join(targetDirectory, "/", fileName), fileData, { encoding: 'utf8' });
72
+ fs.writeFileSync(join(targetDirectory, "/", fileName), fileData, { encoding: 'utf8', flag:'w' });
73
73
  }
74
74
 
75
75
  };
@@ -139,6 +139,25 @@ addDebugLog("exportArch", `exportPath: ${exportPath}, orgLibName: ${orgLibName},
139
139
  }
140
140
  }
141
141
 
142
+ if (fs.existsSync(exportFile)) {
143
+ console.log(`\nFile: ${chalk.yellow(`${fileName}`)} already exists in ${chalk.yellow(`${exportPath}`)}.`);
144
+ const overwriteQuestion = await inquirer.prompt([
145
+ {
146
+ name: 'overWriteFile',
147
+ type: 'confirm',
148
+ message: 'Overrwrite',
149
+ default: true
150
+ },
151
+ ]);
152
+
153
+ if (!overwriteQuestion.overWriteFile) {
154
+ console.log(chalk.green("Store not exported."));
155
+ process.exit();
156
+ }
157
+ }
158
+
159
+
160
+
142
161
  if (archiveBeforeStore) {
143
162
  // archive it
144
163
  output = await zipVersionAndArchive(configDef.currentOrgLib, configDef.buildVersion);
@@ -25,7 +25,7 @@ addDebugLog("setTasksConfig", `libraryName: ${libraryName}, version: ${version},
25
25
 
26
26
  // update file
27
27
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
28
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
28
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
29
29
  }
30
30
 
31
31
  export const setPackageOrg = async (organization, currDir) => {
@@ -38,7 +38,7 @@ addDebugLog("setPackageOrg", "", "");
38
38
 
39
39
  // update file
40
40
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
41
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageData, null, 4), { encoding: 'utf8' });
41
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageData, null, 4), { encoding: 'utf8',flag:'w' });
42
42
 
43
43
  }
44
44
 
@@ -65,7 +65,7 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
65
65
  configData.version = version;
66
66
 
67
67
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
68
- fs.writeFileSync(join(currentDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8' });
68
+ fs.writeFileSync(join(currentDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
69
69
 
70
70
  };
71
71
 
@@ -83,7 +83,7 @@ addDebugLog("updateFile", `fileName: ${fileName}, oldComponentKeyPC: ${oldCompon
83
83
  if (fileData.indexOf(oldComponentKeyPC) >= 0) {
84
84
  fileData = fileData.replaceAll(oldComponentKeyPC, newComponentKeyPC);
85
85
 
86
- fs.writeFileSync(join(currentDirectory, "/", fileName), fileData, { encoding: 'utf8' });
86
+ fs.writeFileSync(join(currentDirectory, "/", fileName), fileData, { encoding: 'utf8',flag:'w' });
87
87
  }
88
88
 
89
89
  };
@@ -65,7 +65,7 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
65
65
  configData.version = version;
66
66
 
67
67
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
68
- fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8' });
68
+ fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
69
69
 
70
70
  };
71
71
 
@@ -83,7 +83,7 @@ addDebugLog("updateFile", `fileName: ${fileName}, oldComponentKeyPC: ${oldCompon
83
83
  if (fileData.indexOf(oldComponentKeyPC) >= 0) {
84
84
  fileData = fileData.replaceAll(oldComponentKeyPC, newComponentKeyPC);
85
85
 
86
- fs.writeFileSync(join(targetDirectory, "/", fileName), fileData, { encoding: 'utf8' });
86
+ fs.writeFileSync(join(targetDirectory, "/", fileName), fileData, { encoding: 'utf8',flag:'w' });
87
87
  }
88
88
 
89
89
  };
@@ -247,7 +247,8 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
247
247
  let organization = await getPackgeOrg(tempPackage);
248
248
  let localConfig = await getLocalConfigData(tempTasksConfig);
249
249
 
250
- let orgLibName = `${organization}_${localConfig.library}`;
250
+ let libName = localConfig.library;
251
+ let orgLibName = `${organization}_${libName}`;
251
252
  const version = localConfig.buildVersion;
252
253
  const devBuild = localConfig.devBuild;
253
254
 
@@ -365,8 +366,8 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
365
366
 
366
367
  console.log('\n***************************************************************');
367
368
  console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
368
- console.log(`PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
369
- console.log('****************************************************************\n');
369
+ console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
370
+ console.log('***************************************************************\n');
370
371
  }
371
372
 
372
373
 
@@ -134,11 +134,19 @@ export default async options => {
134
134
  task: () => initGit(options),
135
135
  enabled: () => options.git
136
136
  },
137
+ /*
137
138
  {
138
139
  title: installDependenciesText,
139
140
  task: () =>
140
141
  execPromise('npm i --force --production=false', { cwd: options.targetDirectory })
141
142
  },
143
+ */
144
+ {
145
+ title: installDependenciesText,
146
+ task: () =>
147
+ execPromise('npm i --force --dev', { cwd: options.targetDirectory })
148
+ },
149
+ /*
142
150
  {
143
151
  title: 'Installing tasks dependencies',
144
152
  task: () =>
@@ -151,6 +159,7 @@ export default async options => {
151
159
  cwd: options.componentLibraryUtilsDirectory
152
160
  })
153
161
  },
162
+ */
154
163
  {
155
164
  title: 'Updating',
156
165
  task: () => execPromise('npm update --dev', { cwd: options.targetDirectory })
@@ -100,7 +100,7 @@
100
100
  },
101
101
  "devDependencies": {
102
102
  "@pega/configs": "^0.15.1",
103
- "@pega/custom-dx-components": "~0.242.51",
103
+ "@pega/custom-dx-components": "~0.242.53",
104
104
  "@pega/pcore-pconnect-typedefs": "~3.2.0-alpha.1",
105
105
  "@storybook/addon-actions": "^7.6.19",
106
106
  "@storybook/addon-essentials": "^7.6.19",
@@ -69,7 +69,7 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
69
69
  }
70
70
 
71
71
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
72
- fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8' });
72
+ fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8', flag:'w' });
73
73
 
74
74
  };
75
75
 
@@ -87,7 +87,7 @@ addDebugLog("updateFile", `fileName: ${fileName}, oldComponentKeyPC: ${oldCompon
87
87
  if (fileData.indexOf(oldComponentKeyPC) >= 0) {
88
88
  fileData = fileData.replaceAll(oldComponentKeyPC, newComponentKeyPC);
89
89
 
90
- fs.writeFileSync(join(targetDirectory, "/", fileName), fileData, { encoding: 'utf8' });
90
+ fs.writeFileSync(join(targetDirectory, "/", fileName), fileData, { encoding: 'utf8',flag:'w' });
91
91
  }
92
92
 
93
93
  };
@@ -77,7 +77,7 @@ addDebugLog("updateConfig", "", "");
77
77
 
78
78
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
79
79
  fs.writeFileSync(join(targetDirectory, '/config.json'), JSON.stringify(configData, null, 4), {
80
- encoding: 'utf8'
80
+ encoding: 'utf8',flag:'w'
81
81
  });
82
82
  };
83
83
 
@@ -94,7 +94,7 @@ addDebugLog("updateFile", "", "");
94
94
  if (fileData.indexOf(oldComponentKeyPC) >= 0) {
95
95
  fileData = fileData.replaceAll(oldComponentKeyPC, newComponentKeyPC);
96
96
 
97
- fs.writeFileSync(join(targetDirectory, '/', fileName), fileData, { encoding: 'utf8' });
97
+ fs.writeFileSync(join(targetDirectory, '/', fileName), fileData, { encoding: 'utf8',flag:'w' });
98
98
  }
99
99
  };
100
100
 
@@ -139,8 +139,8 @@ addDebugLog("switchLibrary", "", "+");
139
139
 
140
140
  console.log('\n***************************************************************');
141
141
  console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
142
- console.log(`PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
143
- console.log('****************************************************************\n');
142
+ console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
143
+ console.log('***************************************************************\n');
144
144
 
145
145
  }
146
146
 
@@ -103,25 +103,6 @@ addDebugLog("switchVersion", "", "+");
103
103
  });
104
104
 
105
105
 
106
- // const anotherTask = new Listr(
107
- // [
108
- // {
109
- // title: `npm update (may take a few minutes)`,
110
- // task: async () => {
111
- // await runNpmUpdate();
112
- // }
113
- // }
114
- // ],
115
- // { concurrent: false, exitOnError: true }
116
- // );
117
-
118
-
119
- // archive existing
120
- // await zipVersionAndArchive(existingOrgLib, oldVersion);
121
-
122
- // restore from archive
123
- //
124
-
125
106
  console.log(`${chalk.bold.green(`\nSwitched to ${orgLib.currentOrgLib}/${newVersion}!\n`)}`);
126
107
 
127
108
  await forceDefaultsUpdate();
@@ -131,19 +112,9 @@ addDebugLog("switchVersion", "", "+");
131
112
 
132
113
  console.log('\n***************************************************************');
133
114
  console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
134
- console.log(`PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
135
- console.log('****************************************************************\n');
136
-
137
- // const upateQuestions = await getRunNpmQuestions();
138
- // const answers = await inquirer.prompt(upateQuestions);
139
- // const { updateNpm } = answers;
140
-
141
- // if (updateNpm) {
142
- // await anotherTask.run().catch(err => {
143
- // console.log(chalk.bold.red(err.toString()));
144
- // process.exit(1);
145
- // });
146
- // }
115
+ console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
116
+ console.log('***************************************************************\n');
117
+
147
118
  }
148
119
 
149
120
 
package/src/util.js CHANGED
@@ -256,7 +256,7 @@ if (showDebug) addDebugLog("updateUseWebPackPromotion", "", "");
256
256
 
257
257
  data["usePromotedWebPack"] = useValue;
258
258
 
259
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8' });
259
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8',flag:'w' });
260
260
 
261
261
  }
262
262
 
@@ -285,12 +285,19 @@ export const checkJWTExpiration = async () => {
285
285
  }
286
286
 
287
287
  const jwt = jwtDecode(tokenAndStaticServer.C11NB2S);
288
- const { exp } = jwt;
288
+ const { exp, customer_org } = jwt;
289
289
  if (exp < (new Date().getTime() + 1) / 1000) {
290
290
  console.log(chalk.redBright("JWT token has expired, please reauthenticate."));
291
291
  process.exit(1);
292
292
  }
293
293
 
294
+ // check that there is customer_org
295
+ if (!customer_org || customer_org === "") {
296
+ console.log(chalk.red(`PegaInfinity server DSS setting ${chalk.redBright.bold(`C11nCCv2CustomerOrg`)} is NOT set.`));
297
+ console.log(chalk.red("Please update DSS setting, save and then reauthenticate."));
298
+ process.exit(1);
299
+ }
300
+
294
301
  }
295
302
 
296
303
  export const getLibraryBased = () => {
@@ -348,7 +355,7 @@ if (showDebug) addDebugLog("setLibraryBased", "", "");
348
355
  // update file
349
356
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
350
357
  try {
351
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8' });
358
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8',flag:'w' });
352
359
  }
353
360
  catch (err) {
354
361
  console.error(err);
@@ -631,7 +638,7 @@ if (showDebug) addDebugLog("updateServerConfigRuleSetAndVersion", `rulesetName:
631
638
 
632
639
  // update file
633
640
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
634
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
641
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
635
642
 
636
643
  }
637
644
 
@@ -647,7 +654,7 @@ if (showDebug) addDebugLog("updateComponentDefaultLibrary", `library: ${library}
647
654
  componentsDefault.library = library;
648
655
 
649
656
 
650
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(config, null, 4), { encoding: 'utf8' });
657
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(config, null, 4), { encoding: 'utf8',flag:'w' });
651
658
 
652
659
  }
653
660
 
@@ -663,7 +670,7 @@ if (showDebug) addDebugLog("updateComponentDefaultVersion", `version: ${version}
663
670
  componentsDefault.version = version;
664
671
 
665
672
 
666
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(config, null, 4), { encoding: 'utf8' });
673
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(config, null, 4), { encoding: 'utf8',flag:'w' });
667
674
 
668
675
  }
669
676
 
@@ -686,7 +693,7 @@ if (showDebug) addDebugLog("setConfigDevBuild", `devBuild: ${devBuild}`, "");
686
693
 
687
694
  // update file
688
695
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
689
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
696
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
690
697
  }
691
698
 
692
699
  export const setConfigImportRelativePath = async (importRelativePath) => {
@@ -698,7 +705,7 @@ if (showDebug) addDebugLog("setConfigImportRelativePath", `importRelativePath: $
698
705
 
699
706
  // update file
700
707
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
701
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
708
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
702
709
  }
703
710
 
704
711
  export const setConfigExportRelativePath = async (exportRelativePath) => {
@@ -710,7 +717,7 @@ if (showDebug) addDebugLog("setConfigImportRelativePath", `exportRelativePath: $
710
717
 
711
718
  // update file
712
719
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
713
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
720
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
714
721
  }
715
722
 
716
723
  export const updateDefaultOrganization = async (organization) => {
@@ -719,7 +726,7 @@ if (showDebug) addDebugLog("updateDefaultOrganization", `organization: ${organiz
719
726
 
720
727
  packageData.organization = organization;
721
728
 
722
- fs.writeFileSync(path.resolve('package.json'), JSON.stringify(packageData, null, 4), { encoding: 'utf8' });
729
+ fs.writeFileSync(path.resolve('package.json'), JSON.stringify(packageData, null, 4), { encoding: 'utf8',flag:'w' });
723
730
 
724
731
  }
725
732
 
@@ -798,7 +805,7 @@ if (showDebug) addDebugLog("updateConfigVersion", `componentKey: ${componentKey}
798
805
 
799
806
 
800
807
  // write back file
801
- fs.writeFileSync(configFile, JSON.stringify(data, null, 4), { encoding: 'utf8' });
808
+ fs.writeFileSync(configFile, JSON.stringify(data, null, 4), { encoding: 'utf8',flag:'w' });
802
809
  };
803
810
 
804
811
  export const getServerType = () => {
@@ -820,7 +827,7 @@ if (showDebug) addDebugLog("setServerType", `serverType: ${serverType}`, "");
820
827
 
821
828
  // update file
822
829
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
823
- fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
830
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8',flag:'w' });
824
831
 
825
832
  // reset
826
833
  pegaData = null;
@@ -1199,7 +1206,7 @@ if (showDebug) addDebugLog("updateC11NB2SForInfinity", "", "");
1199
1206
  objOauthData["appStaticContentServer"] = bootstrap.serviceConfig.appStaticContentServer;
1200
1207
 
1201
1208
  // write out file
1202
- fs.writeFileSync(TOKEN_PATH, JSON.stringify(objOauthData), { encoding: 'utf8' });
1209
+ fs.writeFileSync(TOKEN_PATH, JSON.stringify(objOauthData), { encoding: 'utf8',flag:'w' });
1203
1210
  }
1204
1211
 
1205
1212
  }
@@ -1258,17 +1265,18 @@ if (showDebug) addDebugLog("getLocalLibraryVersions", `libraryName: ${libraryNam
1258
1265
  };
1259
1266
 
1260
1267
  export const getLocalArchivedLibraryVersions = async (libraryName, currentVersion = "0.0.0") => {
1261
- if (showDebug) addDebugLog("getLocalArchivedLibraryVersions", `libraryName: ${libraryName}` , "");
1262
- const currentDirectory = process.cwd();
1263
- const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${libraryName}`);
1268
+ if (showDebug) addDebugLog("getLocalArchivedLibraryVersions", `libraryName: ${libraryName}` , "");
1269
+ const currentDirectory = process.cwd();
1270
+ const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${libraryName}`);
1264
1271
 
1265
- return fs
1266
- .readdirSync(archiveDirectory, { withFileTypes: true })
1267
- .filter(dirent => dirent.isDirectory() && dirent.name != currentVersion)
1268
- .map(dirent => dirent.name);
1269
- };
1272
+ return fs
1273
+ .readdirSync(archiveDirectory, { withFileTypes: true })
1274
+ .filter(dirent => dirent.isDirectory() && dirent.name != currentVersion)
1275
+ .map(dirent => dirent.name);
1276
+ };
1270
1277
 
1271
1278
  export const getLocalArchivedLibrraryVersionData = async(libraryName, libraryVersion) => {
1279
+ if (showDebug) addDebugLog("getLocalArchivedLibrraryVersionData", `libraryName: ${libraryName}, libraryVersion: ${libraryVersion}`, "");
1272
1280
  const currentDirectory = process.cwd();
1273
1281
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${libraryName}`, `${libraryVersion}`);
1274
1282
 
@@ -1415,7 +1423,7 @@ if (showDebug) addDebugLog("createComponentsConfigFile", `filePath: ${filePath}`
1415
1423
  const compConfgFile = join(filePath, COMPONENTS_CONFIG_FILE_NAME);
1416
1424
 
1417
1425
  // write out file
1418
- fs.writeFileSync(compConfgFile, JSON.stringify(componentsConfigJSON), { encoding: 'utf8' });
1426
+ fs.writeFileSync(compConfgFile, JSON.stringify(componentsConfigJSON), { encoding: 'utf8',flag:'w' });
1419
1427
 
1420
1428
  };
1421
1429
 
@@ -1504,11 +1512,13 @@ if (showDebug) addDebugLog("zipVersionAndArchive", `orgLibName: ${orgLibName}, v
1504
1512
  };
1505
1513
 
1506
1514
  export const unZipFromArchive = async (fileName) => {
1515
+ if (showDebug) addDebugLog("unZipFromArchive", `fileName: ${fileName}`, "");
1507
1516
  await unarchive(fileName, TEMP_PATH);
1508
1517
  };
1509
1518
 
1510
1519
 
1511
1520
  export const updateComponentTaskConfig = async () => {
1521
+ if (showDebug) addDebugLog("updateComponentTaskConfig", "", "");
1512
1522
  const currentDirectory = process.cwd();
1513
1523
  const tempDirectory = join(currentDirectory, TEMP_PATH);
1514
1524
 
@@ -1526,11 +1536,12 @@ export const updateComponentTaskConfig = async () => {
1526
1536
  originalContentsData["server-config"].devBuild = contentsData["server-config"].devBuild;
1527
1537
  originalContentsData["component"] = contentsData["component"];
1528
1538
 
1529
- fs.writeFileSync(currentConfigPath, JSON.stringify(originalContentsData, null, 4), { encoding: 'utf8' });
1539
+ fs.writeFileSync(currentConfigPath, JSON.stringify(originalContentsData, null, 4), { encoding: 'utf8',flag:'w' });
1530
1540
 
1531
1541
  }
1532
1542
 
1533
1543
  export const restoreDependenciesFromPackage = async () => {
1544
+ if (showDebug) addDebugLog("restoreDependenciesFromPackage", "", "");
1534
1545
  const currentDirectory = process.cwd();
1535
1546
  const tempDirectory = join(currentDirectory, TEMP_PATH);
1536
1547
  const tempPackagePath = join (tempDirectory, PACKAGE_JSON_FILENAME);
@@ -1603,16 +1614,18 @@ export const restoreDependenciesFromPackage = async () => {
1603
1614
 
1604
1615
 
1605
1616
  // update current package json file
1606
- fs.writeFileSync(currentPackagePath, JSON.stringify(cData, null, 4), { encoding: 'utf8' });
1617
+ fs.writeFileSync(currentPackagePath, JSON.stringify(cData, null, 4), { encoding: 'utf8',flag:'w' });
1607
1618
 
1608
1619
 
1609
1620
  }
1610
1621
 
1611
1622
  export const getHaveDependencyDifference = () => {
1623
+ if (showDebug) addDebugLog("getHaveDependencyDifference", ``, "");
1612
1624
  return haveDependencyDifference;
1613
1625
  }
1614
1626
 
1615
1627
  export const restoreFromArchive = async (fileName, orgLibName, version) => {
1628
+ if (showDebug) addDebugLog("restoreFromArchive", `fileName: ${fileName}, orgLibName: ${orgLibName}, version: ${version}`, "");
1616
1629
  const currentDirectory = process.cwd();
1617
1630
  const tempDirectory = join(currentDirectory, TEMP_PATH);
1618
1631
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${version}`);
@@ -1668,6 +1681,7 @@ export const restoreFromArchive = async (fileName, orgLibName, version) => {
1668
1681
  };
1669
1682
 
1670
1683
  export const clearSrcComponentsDirectory = async () => {
1684
+ if (showDebug) addDebugLog("clearSrcComponentsDirectory", ``, "");
1671
1685
  const currentDirectory = process.cwd();
1672
1686
  const currentComponentsPath = join(currentDirectory, "src", "components");
1673
1687
 
@@ -1700,6 +1714,7 @@ if (showDebug) addDebugLog("hasArchives", `${hasArc}`, "");
1700
1714
  };
1701
1715
 
1702
1716
  export const deleteArchives = async () => {
1717
+ if (showDebug) addDebugLog("deleteArchives", ``, "");
1703
1718
  const currentDirectory = process.cwd();
1704
1719
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH);
1705
1720
  const hasArc = fs.existsSync(archiveDirectory);
@@ -1713,7 +1728,7 @@ export const deleteArchives = async () => {
1713
1728
  }
1714
1729
 
1715
1730
  export const checkLibraryAndArchives = async () => {
1716
-
1731
+ if (showDebug) addDebugLog("checkLibraryAndArchives", ``, "");
1717
1732
  const isLibraryBased = getLibraryBased();
1718
1733
  const hasArch = await hasArchives();
1719
1734
 
@@ -1774,59 +1789,14 @@ if (showDebug) addDebugLog("getLibraryArchiveDirectories", "", "");
1774
1789
  .map(dirent => dirent.name);
1775
1790
  };
1776
1791
 
1777
- // export const getLibraryArchivesFiles = async (orgLibName, version) => {
1778
- // if (showDebug) addDebugLog("getLibraryArchives", `orgLibName: ${orgLibName}`, "");
1779
- // const currentDirectory = process.cwd();
1780
- // const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${version}`);
1781
1792
 
1782
- // if (!fs.existsSync(archiveDirectory)) {
1783
- // return [];
1784
- // }
1785
-
1786
- // return fs
1787
- // .readdirSync(archiveDirectory, { withFileTypes: true })
1788
- // .filter(dirent => !dirent.isDirectory() && !isHiddenFile(dirent.name) )
1789
- // .map(dirent => dirent.name);
1790
-
1791
- // };
1792
1793
 
1793
1794
  export const getLibraryArchivesVersions = async (orgLibName, currentVersion) => {
1794
1795
  if (showDebug) addDebugLog("getLibraryArchivesVersions", `orgLibName: ${orgLibName}`, "");
1795
- // const archFileList = await getLibraryArchivesFiles(orgLibName, currentVersion);
1796
- // let archiveVersionList = [];
1797
-
1798
- // if (archFileList && archFileList.length > 0) {
1799
- // for (let index in archFileList) {
1800
- // let fileName = archFileList[index];
1801
- // let fVersion = fileName.replace(orgLibName.concat("_"), "");
1802
- // fVersion = fVersion.replace(".zip", "");
1803
- // if (currentVersion != fVersion) {
1804
- // archiveVersionList.push(fVersion);
1805
- // }
1806
-
1807
- // }
1808
- // }
1809
- // else {
1810
- // console.error(
1811
- // `${chalk.red.bold(`No archives found for ${orgLibName}.`)}`
1812
- // );
1813
- // process.exit(1);
1814
- // }
1815
-
1816
- // if (archiveVersionList.length == 0) {
1817
- // console.error(
1818
- // `${chalk.red.bold(`No archives found for ${orgLibName} beyond current version.`)}`
1819
- // );
1820
- // process.exit(1);
1821
- // }
1822
-
1823
- // return archiveVersionList;
1824
1796
 
1825
1797
  const currentDirectory = process.cwd();
1826
1798
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`);
1827
1799
 
1828
- // const currentVersion = getConfigDefaults().buildVersion;
1829
-
1830
1800
  if (!fs.existsSync(archiveDirectory)) {
1831
1801
  return [];
1832
1802
  }
@@ -1841,6 +1811,7 @@ if (showDebug) addDebugLog("getLibraryArchivesVersions", `orgLibName: ${orgLibNa
1841
1811
  };
1842
1812
 
1843
1813
  export const deleteLocalArchiveLibrary = async(libraryName) => {
1814
+ if (showDebug) addDebugLog("deleteLocalArchiveLibrary", `libraryName: ${libraryName}`, "");
1844
1815
  const currentDirectory = process.cwd();
1845
1816
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, libraryName);
1846
1817
 
@@ -1863,6 +1834,7 @@ export const deleteLocalArchiveLibrary = async(libraryName) => {
1863
1834
  }
1864
1835
 
1865
1836
  export const deleteLocalArchiveLibraryVersion = async(libraryName, version) => {
1837
+ if (showDebug) addDebugLog("deleteLocalArchiveLibraryVersion", `libraryName: ${libraryName}, version: ${version}`, "");
1866
1838
  const currentDirectory = process.cwd();
1867
1839
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, libraryName, version);
1868
1840
 
@@ -1880,6 +1852,7 @@ export const deleteLocalArchiveLibraryVersion = async(libraryName, version) => {
1880
1852
  }
1881
1853
 
1882
1854
  export const cleanUpTemp = async() => {
1855
+ if (showDebug) addDebugLog("cleanUpTemp", ``, "");
1883
1856
  const currentDirectory = process.cwd();
1884
1857
  const tempDirectory = join (currentDirectory, TEMP_PATH);
1885
1858
 
@@ -1891,6 +1864,7 @@ export const cleanUpTemp = async() => {
1891
1864
 
1892
1865
 
1893
1866
  export const getJestFunctionalTestList = async(whichTests) => {
1867
+ if (showDebug) addDebugLog("getJestFunctionalTestList", ``, "");
1894
1868
  const functionalDir = path.join(path.resolve(), JEST_TESTS_FUNCTIONAL_PATH);
1895
1869
  const libFilter = "localLib";
1896
1870
 
@@ -111,7 +111,7 @@ describe(`create library delete Library: ${serverDir} - ${compType}`, () => {
111
111
  expect(stdout).toContain(`${newFileName} schema is valid`);
112
112
  // expect(stdout).toContain('Compiled successfully.');
113
113
  // done();
114
- }, 30000);
114
+ }, 50000);
115
115
 
116
116
  it('npm run delete Local', async () => {
117
117
  const fileName = 'MyTestText';
@@ -125,7 +125,7 @@ describe(`createLib createAll exportStore importStore deleteLib: ${serverDir} -
125
125
  // // remove it
126
126
  // fs.rmdirSync(fileDir, { recursive: true });
127
127
  // }
128
- }, 10000);
128
+ }, 30000);
129
129
 
130
130
  it('npm run list', async () => {
131
131
  const script = 'npm run list --prefix ../../..';