@pega/custom-dx-components 0.242.34 → 0.242.36

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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +12 -0
  3. package/src/constants.js +1 -0
  4. package/src/tasks/build-lib/helper.js +0 -1
  5. package/src/tasks/create-lib/index.js +5 -3
  6. package/src/tasks/create-version/index.js +12 -1
  7. package/src/tasks/delete-lib/index.js +4 -1
  8. package/src/tasks/delete-version/index.js +3 -1
  9. package/src/tasks/export-archive/index.js +58 -41
  10. package/src/tasks/import-archive/index.js +5 -1
  11. package/src/tasks/import-comp/helper.js +47 -0
  12. package/src/tasks/import-comp/index.js +320 -0
  13. package/src/tasks/index.js +2 -0
  14. package/src/tasks/init/template/package.json.mustache +5 -3
  15. package/src/tasks/list-lib/index.js +25 -16
  16. package/src/tasks/list-pub/index.js +18 -14
  17. package/src/tasks/move/helper.js +6 -3
  18. package/src/tasks/move/index.js +99 -58
  19. package/src/tasks/publish/helper.js +8 -5
  20. package/src/tasks/publish/index.js +4 -4
  21. package/src/tasks/publish-all/helper.js +16 -10
  22. package/src/tasks/quarantine/index.js +84 -0
  23. package/src/tasks/rename-lib/index.js +0 -1
  24. package/src/tasks/revert-webpack/index.js +0 -2
  25. package/src/tasks/set-perm/index.js +18 -2
  26. package/src/tasks/show-help/index.js +6 -4
  27. package/src/tasks/store/index.js +4 -1
  28. package/src/tasks/switch-lib/index.js +3 -1
  29. package/src/tasks/switch-version/index.js +11 -1
  30. package/src/util.js +84 -25
  31. package/tests/functional/localCreateAllListDeleteAll.test.js +56 -10
  32. package/tests/functional/localCreateBuildAllDeleteAll.test.js +56 -48
  33. package/tests/functional/localCreateBuildDelete.test.js +57 -10
  34. package/tests/functional/localCreateListDelete.test.js +55 -102
  35. package/tests/functional/localCreatePublishAllDeleteAll.test.js +68 -61
  36. package/tests/functional/localCreatePublishDelete.test.js +62 -21
  37. package/tests/functional/localCreateRenameDelete.test.js +55 -140
  38. package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +118 -0
  39. package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +241 -0
  40. package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +246 -0
  41. package/tests/functional/localLibCreateLibDeleteLib.test.js +109 -0
  42. package/tests/functional/localLibCreateLibExportImportLib.test.js +242 -0
  43. package/tests/functional/localLibCreateLibExportLib.test.js +219 -0
  44. package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +131 -0
  45. package/tests/functional/localLibCreateLibListDeleteLib.test.js +261 -0
  46. package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +236 -0
  47. package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +237 -0
  48. package/tests/functional/localLibCreateLibPermDeleteLib.test.js +144 -0
  49. package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +194 -0
  50. package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +453 -0
  51. package/tests/functional/localPromoteRevertWP.test.js +83 -38
@@ -7,6 +7,7 @@ import ncp from 'ncp';
7
7
  import chalk from 'chalk';
8
8
 
9
9
  import {
10
+ sanitize,
10
11
  checkPathAccess,
11
12
  showVersion,
12
13
  getComponentsObj,
@@ -18,9 +19,10 @@ import {
18
19
  unZipFromArchive,
19
20
  zipVersionAndArchive,
20
21
  getLibraryArchivesVersions,
21
- getLibraryArchiveDirectories
22
+ getLibraryArchiveDirectories,
23
+ cleanUpTemp
22
24
  } from '../../util.js';
23
- import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH, ARCHIVES_PATH, TEMP_PATH } from '../../constants.js';
25
+ import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, ARCHIVES_PATH, TEMP_PATH } from '../../constants.js';
24
26
  import { getComponentKeyQuestion, getLibraryQuestions, getLibraryVersionQuestion } from './helper.js';
25
27
 
26
28
  export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
@@ -32,7 +34,6 @@ import {
32
34
  convertIntoPascalCase,
33
35
  getComponentDirectoryPath
34
36
  } from '../../util.js';
35
- import { or } from 'ajv/dist/compile/codegen/index.js';
36
37
 
37
38
 
38
39
  const copy = promisify(ncp);
@@ -42,8 +43,10 @@ export const updateConfig = async (
42
43
  {
43
44
  oldComponentKey,
44
45
  newComponentKey,
46
+ compName,
45
47
  library,
46
48
  version,
49
+ compLabel,
47
50
  targetDirectory,
48
51
  },
49
52
  options,
@@ -60,6 +63,11 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
60
63
  configData.library = library;
61
64
  configData.version = version;
62
65
 
66
+ if (compLabel != "") {
67
+ configData.label = compLabel;
68
+ configData.description = compLabel;
69
+ }
70
+
63
71
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
64
72
  fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8' });
65
73
 
@@ -91,31 +99,28 @@ export const renameComponent = async (
91
99
  library,
92
100
  version,
93
101
  copyMove,
102
+ compName = "",
103
+ compLabel = "",
94
104
  options
95
105
  ) => {
96
106
 
97
107
  addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKey}`, "");
98
108
 
99
-
100
- const componentName = componentKey.split("_")[2];
101
-
102
- const configDef = getConfigDefaults();
103
-
104
- const newComponentKey = `${library}_${componentName}`;
105
-
109
+ // const componentName = componentKey.split("_")[2];
110
+ const newComponentKey = `${library}_${compName}`;
106
111
  const oldComponentKey = componentKey;
107
112
  const newComponentKeyPC = convertIntoPascalCase(newComponentKey);
108
113
  const oldComponentKeyPC = convertIntoPascalCase(oldComponentKey);
109
114
 
110
- const currentDirectory = await getComponentDirectoryPath(componentKey);
111
- const targetDirectory = await getComponentDirectoryPath(newComponentKey);
112
-
113
-
115
+ const currentDirectory = process.cwd();
116
+ const tempDirectory = join(currentDirectory, TEMP_PATH, "src", "components");
117
+ const existingDirectory = await getComponentDirectoryPath(componentKey);
118
+ const targetDirectory = await getComponentDirectoryPath(newComponentKey, tempDirectory);
114
119
 
115
120
  if (copyMove === "Move") {
116
121
  // custom component
117
122
  try {
118
- fs.renameSync(currentDirectory, targetDirectory);
123
+ fs.renameSync(existingDirectory, targetDirectory);
119
124
  } catch(err) {
120
125
  console.log(err)
121
126
  }
@@ -124,15 +129,12 @@ addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKe
124
129
  // copy
125
130
  // custom component
126
131
  try {
127
- fs.cpSync(currentDirectory, targetDirectory, { recursive: true});
132
+ fs.cpSync(existingDirectory, targetDirectory, { recursive: true});
128
133
  } catch(err) {
129
134
  console.log(err)
130
135
  }
131
136
  }
132
137
 
133
-
134
-
135
-
136
138
  const targetFileList = await getDirectoryFiles(targetDirectory);
137
139
 
138
140
  for (var fileIndex in targetFileList) {
@@ -143,9 +145,10 @@ addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKe
143
145
  {
144
146
  oldComponentKey,
145
147
  newComponentKey,
146
- componentName,
148
+ compName,
147
149
  library,
148
150
  version,
151
+ compLabel,
149
152
  targetDirectory,
150
153
  },
151
154
  options
@@ -177,6 +180,7 @@ export const moveComp = async(componentKey, copyMove, orgLibName, version, copyS
177
180
  const archFileName = join(archiveDirectory, fileName);
178
181
  const currentCompPath = join(currentDirectory, "src", "components");
179
182
  const tempCompPath = join(tempDirectory, "src", "components");
183
+ const configDef = getConfigDefaults();
180
184
 
181
185
  await unZipFromArchive(archFileName);
182
186
 
@@ -214,18 +218,9 @@ export const moveComp = async(componentKey, copyMove, orgLibName, version, copyS
214
218
  // delete temp directory
215
219
  fs.rmSync(tempDirectory, { recursive: true, force: true, maxRetries: 5 });
216
220
 
217
-
218
-
219
221
  }
220
222
  else {
221
223
 
222
- // if (copyMove === "Move") {
223
- // await localMoveComp(componentKey, orgLibName, version, currentDirectory, tempDirectory);
224
- // }
225
- // else {
226
- // await localCopyComp(componentKey, orgLibName, version, currentDirectory, tempDirectory);
227
- // }
228
-
229
224
  const newComponentKey = await localMoveCopyComp(componentKey, orgLibName, version, copyMove, currentDirectory, tempDirectory);
230
225
 
231
226
  if (newComponentKey) {
@@ -237,34 +232,75 @@ export const moveComp = async(componentKey, copyMove, orgLibName, version, copyS
237
232
  fs.cpSync(currentSharedPath, targetSharedPatah, { recursive: true, force: true });
238
233
  }
239
234
 
240
-
241
235
  console.log(`\n${copiedOrMoved} ${chalk.green(`${componentKey}`)} to ${chalk.green(`${orgLibName}/${version}`)} as ${chalk.green(`${newComponentKey}`)}\n`);
242
236
 
243
237
  // rearchive temp directory
244
238
  await zipVersionAndArchive(orgLibName, version, tempDirectory);
239
+
240
+ // update current /src/components because we copied to it (as well as the archive)
241
+ if (orgLibName === configDef.currentOrgLib && version === configDef.buildVersion && copyMove === "Copy") {
242
+ fs.cpSync(join(tempCompPath, newComponentKey), join(currentCompPath, newComponentKey), { recursive: true, force: true });
243
+ }
244
+
245
245
  }
246
246
  else {
247
247
  console.log(chalk.yellow(`No components were ${copiedOrMoved}`));
248
248
  }
249
249
 
250
-
251
250
  // delete temp directory
252
251
  fs.rmSync(tempDirectory, { recursive: true, force: true, maxRetries: 5 });
253
252
  }
254
-
255
-
256
-
257
253
  }
258
254
 
259
255
  export const localMoveCopyComp = async(componentKey, orgLibName, version, copyMove, currentDirectory, tempDirectory ) => {
260
256
  const currentCompPath = join(currentDirectory, "src", "components");
261
257
  const tempCompPath = join(tempDirectory, "src", "components");
258
+ const configDef = getConfigDefaults();
262
259
 
263
260
  const tempCompName = componentKey.split("_")[2];
264
- const newTempComponentKey = `${orgLibName}_${tempCompName}`;
261
+ let newTempComponentKey = `${orgLibName}_${tempCompName}`;
265
262
  const tempDirComp = join(tempCompPath, `${newTempComponentKey}`);
266
263
 
267
- if (fs.existsSync(tempDirComp)) {
264
+ let compLabel = "";
265
+ let compName = tempCompName;
266
+
267
+ if (fs.existsSync(join(currentCompPath, componentKey)) && version === configDef.buildVersion && copyMove === "Copy") {
268
+ // need to rename
269
+ console.log(`\n${chalk.yellow(`${tempCompName}`)} exists, select new name and label for copied component.`);
270
+ const nameAnswers = await inquirer.prompt([
271
+ {
272
+ name: 'componentName',
273
+ message: 'Enter component name (required)',
274
+ validate: value => {
275
+ /* value should not be empty
276
+ It should not have spaces
277
+ It should not start with a number
278
+ Only case-insensitive alphanumeric values are allowed
279
+ */
280
+ if (value && !/^\d/.test(value) && value === sanitize(value)) {
281
+ return true;
282
+ }
283
+ return 'Only alphanumeric values are allowed, starting with alphabets, no spaces.';
284
+ }
285
+ },
286
+ {
287
+ name: 'componentLabel',
288
+ message: 'Enter component label for display (required)',
289
+ validate: value => {
290
+ if (value) {
291
+ return true;
292
+ }
293
+ return 'Please provide value for label';
294
+ }
295
+ }
296
+ ]);
297
+
298
+ //
299
+ compName = nameAnswers.componentName;
300
+ compLabel = nameAnswers.componentLabel;
301
+
302
+ }
303
+ else if (fs.existsSync(tempDirComp)) {
268
304
  const answers = await inquirer.prompt([
269
305
  {
270
306
  name: 'confirmOverride',
@@ -276,23 +312,14 @@ export const localMoveCopyComp = async(componentKey, orgLibName, version, copyMo
276
312
  if (!answers.confirmOverride) {
277
313
  return null;
278
314
  }
315
+ else {
316
+ // delete the one in the temp directory, so can move/copy latest
317
+ fs.rmSync(tempDirComp, { recursive: true, force: true, maxRetries: 2 });
318
+ }
279
319
  }
280
320
 
281
-
282
321
  // rename the component
283
- const newComponentKey = await renameComponent(componentKey, orgLibName, version, copyMove);
284
-
285
-
286
-
287
-
288
- const currentComponentsPath = join(currentCompPath, `${newComponentKey}`);
289
- const tempDirectoryComponents = join(tempCompPath, `${newComponentKey}`);
290
-
291
- // copy component into temp directory
292
- fs.cpSync(currentComponentsPath, tempDirectoryComponents, { recursive: true, force: true });
293
-
294
- // remove from components
295
- fs.rmSync(currentComponentsPath, { recursive: true, force: true, maxRetries: 2 });
322
+ const newComponentKey = await renameComponent(componentKey, orgLibName, version, copyMove, compName, compLabel);
296
323
 
297
324
  return newComponentKey;
298
325
  }
@@ -312,6 +339,8 @@ addDebugLog("move", "", "+");
312
339
  process.exit();
313
340
  }
314
341
 
342
+ await cleanUpTemp();
343
+
315
344
  let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
316
345
  data = data && JSON.parse(data);
317
346
 
@@ -331,14 +360,16 @@ addDebugLog("move", "", "+");
331
360
 
332
361
  let localComponents = await getComponentsObj();
333
362
 
363
+ const configDef = getConfigDefaults();
364
+
334
365
  if (!localComponents || localComponents.length === 0 ) {
335
366
  console.log(chalk.red.bold("No components to move/copy."));
336
367
  process.exit();
337
368
  }
338
369
 
339
370
  if (options.params.length >= 8) {
340
- componentKey = options.params[3];
341
- copyMove = options.param[4];
371
+ copyMove = options.params[3];
372
+ componentKey = options.params[4];
342
373
  orgLibName = options.params[5];
343
374
  version = options.params[6];
344
375
  copyShared = options.params[7];
@@ -371,7 +402,8 @@ addDebugLog("move", "", "+");
371
402
  let removeOrgLib = "";
372
403
  let libVersions;
373
404
  try {
374
- libVersions = await getLibraryArchivesVersions(configDef.currentOrgLib, configDef.buildVersion);
405
+ // libVersions = await getLibraryArchivesVersions(configDef.currentOrgLib, configDef.buildVersion);
406
+ libVersions = await getLibraryArchivesVersions(configDef.currentOrgLib, "0.0.0");
375
407
  }
376
408
  catch (ex) {}
377
409
  if (!libVersions || libVersions.length === 0) {
@@ -399,10 +431,11 @@ addDebugLog("move", "", "+");
399
431
  ({copyMove} = copyMoveAnswer);
400
432
  copyMoveLC = copyMove.toLowerCase();
401
433
 
402
- if (localComponents && localComponents.length > 1) {
434
+ if (localComponents && localComponents.length > 1 ) {
403
435
  localComponents.unshift({name: 'ALL', value: 'ALL'});
404
436
  }
405
437
 
438
+
406
439
  const keyQuestions = await getComponentKeyQuestion(localComponents, copyMoveLC, paramComponentKey);
407
440
 
408
441
  const answers = await inquirer.prompt(keyQuestions);
@@ -415,12 +448,20 @@ addDebugLog("move", "", "+");
415
448
  orgLibName = libAnswers.libraryName;
416
449
  const buildVersion = configDef.currentOrgLib === orgLibName ? configDef.buildVersion : "";
417
450
 
418
- try {
419
- libVersions = await getLibraryArchivesVersions(orgLibName, buildVersion);
451
+ // can copy (will rename) to same version, but can't move
452
+ if (copyMove === "Move") {
453
+ try {
454
+ libVersions = await getLibraryArchivesVersions(orgLibName, buildVersion);
455
+ }
456
+ catch (ex) {}
457
+ }
458
+
459
+ if (libVersions.length == 0) {
460
+ console.log(`Current library: ${chalk.green(`${orgLibName}`)} has NO available versions to move to.`);
461
+ process.exit();
420
462
  }
421
- catch (ex) {}
422
463
 
423
- const versionQuestions = await getLibraryVersionQuestion(orgLibName, libVersions);
464
+ const versionQuestions = await getLibraryVersionQuestion(orgLibName, libVersions, copyMoveLC);
424
465
  const versionAnswers = await inquirer.prompt(versionQuestions);
425
466
  ({version, copyShared} = versionAnswers);
426
467
 
@@ -119,11 +119,14 @@ addDebugLog("zipComponent", `componentKey: ${componentKey}`, "");
119
119
 
120
120
  const configContent = Buffer.from(fs.readFileSync(configJson)).toString();
121
121
 
122
- fs.rm('dist', { recursive: true }, err => {
123
- if (err) {
124
- throw err;
125
- }
126
- });
122
+ if (fs.existsSync('dist')) {
123
+ fs.rm('dist', { recursive: true }, err => {
124
+ if (err) {
125
+ throw err;
126
+ }
127
+ });
128
+ }
129
+
127
130
 
128
131
  return { zipContent, configContent };
129
132
  };
@@ -17,6 +17,8 @@ export default async options => {
17
17
  await checkLibraryAndArchives();
18
18
  const isLibraryBased = getLibraryBased();
19
19
 
20
+ addDebugLog("publish", "", "+");
21
+
20
22
  if (isLibraryBased) {
21
23
 
22
24
  await checkJWTExpiration();
@@ -61,7 +63,7 @@ export default async options => {
61
63
  }
62
64
 
63
65
  if (okToPublish) {
64
- // marking as intenral, so no questions will be ask
66
+ // marking as internal, so no questions will be ask
65
67
  options.params.push("internal");
66
68
 
67
69
  await buildLibrary(options);
@@ -72,9 +74,7 @@ export default async options => {
72
74
  }
73
75
 
74
76
 
75
-
76
- addDebugLog("publish", "", "+");
77
-
77
+ // non library based publish
78
78
  let componentKey;
79
79
  let sourceMap;
80
80
  let devBuild;
@@ -109,17 +109,23 @@ addDebugLog("zipComponent", `componentKey: ${componentKey}`, "");
109
109
 
110
110
  export const cleanUp = async () => {
111
111
  addDebugLog("cleanUp", "", "");
112
- fs.rm('dist/components', { recursive: true }, err => {
113
- if (err) {
114
- throw err;
115
- }
116
- });
117
112
 
118
- fs.rm('lib', { recursive: true }, err => {
119
- if (err) {
120
- throw err;
121
- }
122
- });
113
+ if (fs.existsSync('dist/components')) {
114
+ fs.rm('dist/components', { recursive: true }, err => {
115
+ if (err) {
116
+ throw err;
117
+ }
118
+ });
119
+ }
120
+
121
+ if (fs.existsSync('lib')) {
122
+ fs.rm('lib', { recursive: true }, err => {
123
+ if (err) {
124
+ throw err;
125
+ }
126
+ });
127
+ }
128
+
123
129
  };
124
130
 
125
131
  export const publishComponentToServer = async (data, doFetch) => {
@@ -0,0 +1,84 @@
1
+ import fs from 'fs';
2
+ import path, {join} from 'path';
3
+ import inquirer from 'inquirer';
4
+ import chalk from 'chalk';
5
+
6
+
7
+ import {
8
+ showVersion,
9
+ addDebugLog,
10
+ getJestFunctionalTestList } from '../../util.js';
11
+
12
+ import { JEST_TESTS_FUNCTIONAL_PATH } from '../../constants.js';
13
+
14
+
15
+ export const quarnUnquarnTests = async(answers) => {
16
+ switch (answers.QuarUnQuar) {
17
+ case "Quarantine" :
18
+ await quarantineTests(answers);
19
+ break;
20
+ case "Unquarantine" :
21
+ await unquarantineTests(answers);
22
+ break;
23
+ }
24
+ }
25
+
26
+
27
+
28
+ export const quarantineTests = async(answers) => {
29
+ const testList = await getJestFunctionalTestList(answers.whichTests);
30
+ const functionalPath = join(path.resolve(), JEST_TESTS_FUNCTIONAL_PATH);
31
+
32
+ // rename .test to .notest
33
+ for (const testName of testList) {
34
+ const quarantineName = testName.replace(".test", ".notest");
35
+ fs.renameSync(join(functionalPath, testName), join(functionalPath, quarantineName));
36
+ }
37
+
38
+ }
39
+
40
+ export const unquarantineTests = async(answers) => {
41
+ const testList = await getJestFunctionalTestList(answers.whichTests);
42
+ const functionalPath = join(path.resolve(), JEST_TESTS_FUNCTIONAL_PATH);
43
+
44
+ // rename .test to .notest
45
+ for (const testName of testList) {
46
+ const restoreName = testName.replace(".notest", ".test");
47
+ fs.renameSync(join(functionalPath, testName), join(functionalPath, restoreName));
48
+ }
49
+
50
+ }
51
+
52
+
53
+ export default async options => {
54
+
55
+ addDebugLog("quarantine", "", "+");
56
+
57
+ await showVersion();
58
+
59
+ const quaranAnswers = await inquirer.prompt([
60
+
61
+ {
62
+ name: 'QuarUnQuar',
63
+ type: 'rawlist',
64
+ message: `Quarantine or UnQuarantine tests`,
65
+ choices: ["Quarantine", "Unquarantine"],
66
+ default: 'Quarantine'
67
+
68
+ },
69
+ {
70
+ name: 'whichTests',
71
+ type: 'rawlist',
72
+ message: (answers) => `Which tests to ${answers.QuarUnQuar}`,
73
+ default: 'ALL',
74
+ choices: ["ALL", "Original", "Library"]
75
+ }
76
+ ]);
77
+
78
+ // await showCurrentStatus();
79
+ await quarnUnquarnTests(quaranAnswers);
80
+
81
+
82
+ addDebugLog("quarantine", "END", "-");
83
+
84
+ }
@@ -12,7 +12,6 @@ import {
12
12
  showVersion,
13
13
  getComponentsObj,
14
14
  getDirectoryFiles,
15
- getPegaServerConfig,
16
15
  getLibraryBased,
17
16
  deleteLocalLibrary,
18
17
  getC11NB2STokenAndStaticServer,
@@ -8,8 +8,6 @@ import { WEBPACK_CONFIG_JS_FILENAME } from '../../constants.js';
8
8
 
9
9
  export const renamePromotedWebPack = async () => {
10
10
  addDebugLog("renamePromotedWebPack","", "");
11
- // call this function from top level
12
- // fs.copyFileSync("./webpack.config.js", "webpack.config.js")
13
11
 
14
12
  const promoteWebPackDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
15
13
  const renamedPromoteWebPackDir = path.resolve(`${WEBPACK_CONFIG_JS_FILENAME}.notused`);
@@ -49,11 +49,20 @@ addDebugLog("setPermVersion", `isPerm: ${isPerm}`, "");
49
49
  }
50
50
 
51
51
 
52
- export const setPermanent = async () => {
52
+ export const setPermanent = async ( inputYN = "" ) => {
53
53
  addDebugLog("setPermanent", "", "");
54
54
 
55
55
  const configDefaults = await getConfigDefaults();
56
56
 
57
+ if (inputYN != "") {
58
+ const makePerm = (inputYN === 'Y' || inputYN === 'y' || inputYN === true || inputYN === 'true');
59
+ await setPermVersion(makePerm);
60
+
61
+ await forceDefaultsUpdate();
62
+ await showCurrentStatus();
63
+ process.exit();
64
+ }
65
+
57
66
  const isOrNot = configDefaults.devBuild ? "NOT PERMANENT" : "PERMANENT";
58
67
 
59
68
  console.log(`Currently ${chalk.green(`${configDefaults.displayLibVersion}`)} is ${chalk.yellow(`${isOrNot}`)}.`);
@@ -125,8 +134,15 @@ addDebugLog("setPerm", "", "+");
125
134
 
126
135
  await showVersion();
127
136
  await checkLibraryAndArchives();
137
+
138
+ let inputYN = "";
139
+
140
+ if (options.params.length >= 4) {
141
+ inputYN = options.params[3];
142
+ }
143
+
128
144
  // await showCurrentStatus();
129
- await setPermanent();
145
+ await setPermanent(inputYN);
130
146
 
131
147
 
132
148
  addDebugLog("setPerm", "END", "-");
@@ -43,6 +43,7 @@ export const showHelpV1 = () => {
43
43
  console.log(`${chalk.cyan('npm run buildAllComponents')}\tvalidate and build a component before publishing, checking for errors`);
44
44
  console.log(`${chalk.cyan('npm run validateAll ')}\tvalidate and build ALL components before publishing, checking for errors`);
45
45
  console.log(`${chalk.cyan('npm run rename ')}\trename a component`);
46
+ console.log(`${chalk.cyan('npm run importComponent ')}\timport a component from a path`);
46
47
  console.log(`${chalk.cyan('npm run startStorybook ')}\tstorybook components for testing`);
47
48
 
48
49
  console.log(`\n${chalk.underline(`Local and Server`)}`);
@@ -79,8 +80,7 @@ export const showHelpV2 = () => {
79
80
  console.log(`${chalk.cyan('npm run createLibVersion')}\tcreate a new version within the current library`);
80
81
  console.log(`${chalk.cyan('npm run switchLibVersion')}\tswitch to different version within the current library`);
81
82
  console.log(`${chalk.cyan('npm run deleteLibVersion')}\tdelete current version, move to another version`);
82
- console.log(`${chalk.cyan('npm run moveLibVersion ')}\tmove (or copy) single component or ALL in current version to another version or library`);
83
- console.log(`${chalk.cyan('npm run storeLibVersion ')}\tstore current version to local storage`);
83
+ console.log(`${chalk.cyan('npm run storeLibVersion ')}\tstore current version to local storage (must SAVE before)`);
84
84
  console.log(`${chalk.cyan('npm run exportLibVersion')}\texport currnet version as a zip file to a given local path`);
85
85
  console.log(`${chalk.cyan('npm run importLibVersion')}\timport a zip file (created by export) from a given local path`);
86
86
  console.log(`${chalk.cyan('npm run setPermanent ')}\tmake current version permanent or non permanent upon publish`);
@@ -96,6 +96,8 @@ export const showHelpV2 = () => {
96
96
  console.log(`${chalk.cyan('npm run validate ')}\t\tvalidate a component before publishing, checking for errors`);
97
97
  console.log(`${chalk.cyan('npm run validateAll')}\t\tvalidate ALL components before publishing, checking for errors`);
98
98
  console.log(`${chalk.cyan('npm run rename ')}\t\trename a component`);
99
+ console.log(`${chalk.cyan('npm run move ')}\t\tmove (or copy) single component or ALL in current version to another version or library`);
100
+ console.log(`${chalk.cyan('npm run importComponent')}\t\timport a component from a path`);
99
101
  console.log(`${chalk.cyan('npm run list ')}\t\tget list of components`);
100
102
  console.log(`${chalk.cyan('npm run delete ')}\t\tdelete a component`);
101
103
  console.log(`${chalk.cyan('npm run deleteAll ')}\t\tdelete ALL components`);
@@ -105,8 +107,8 @@ export const showHelpV2 = () => {
105
107
  console.log(`\n${chalk.underline(`Notes`)}`);
106
108
  console.log(`The following commands will store existing version in storage before executing the command:`);
107
109
  console.log(`${chalk.cyan(`createLib, switchLib, createLibVersion, switchLibVersion, publishLibVersion, exportLibVersion`)}`);
108
- console.log(`\nWhen in an IDE, always ${chalk.yellow("SAVE")} changes to components before doing a library/version context switch`);
109
- console.log(`or changes will be lost.`);
110
+ console.log(`\nWhen editing in an IDE, always ${chalk.yellow("SAVE")} changes to components before doing a library/version context switch`);
111
+ console.log(`or changes will be lost!`);
110
112
  console.log("");
111
113
  }
112
114
 
@@ -9,7 +9,8 @@ import {
9
9
  checkLibraryAndArchives,
10
10
  getConfigDefaults,
11
11
  getLibraryBased,
12
- zipVersionAndArchive
12
+ zipVersionAndArchive,
13
+ cleanUpTemp
13
14
  } from '../../util.js';
14
15
 
15
16
  export default async options => {
@@ -18,6 +19,8 @@ export default async options => {
18
19
 
19
20
  addDebugLog("storeComponents", "", "+");
20
21
 
22
+ await cleanUpTemp();
23
+
21
24
  const isLibraryBased = getLibraryBased();
22
25
  if (!isLibraryBased) {
23
26
  console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
@@ -15,7 +15,8 @@ import {
15
15
  checkLibraryAndArchives,
16
16
  getConfigDefaults,
17
17
  forceDefaultsUpdate,
18
- getHaveDependencyDifference
18
+ getHaveDependencyDifference,
19
+ cleanUpTemp
19
20
  } from '../../util.js';
20
21
 
21
22
  import { getSwitchLibraryComponentQuestions, getSwitchVersionComponentQuestions } from './helper.js';
@@ -31,6 +32,7 @@ export default async options => {
31
32
 
32
33
  await showVersion();
33
34
  await checkLibraryAndArchives();
35
+ await cleanUpTemp();
34
36
 
35
37
  addDebugLog("switchLibrary", "", "+");
36
38
  let libraryName;
@@ -16,7 +16,9 @@ import {
16
16
  checkLibraryAndArchives,
17
17
  getConfigDefaults,
18
18
  getHaveDependencyDifference,
19
- forceDefaultsUpdate
19
+ forceDefaultsUpdate,
20
+ modAddAboutData,
21
+ cleanUpTemp
20
22
  } from '../../util.js';
21
23
 
22
24
  import { getSwitchVersionComponentQuestions } from './helper.js';
@@ -32,6 +34,7 @@ export default async options => {
32
34
 
33
35
  await showVersion();
34
36
  await checkLibraryAndArchives();
37
+ await cleanUpTemp();
35
38
 
36
39
  addDebugLog("switchVersion", "", "+");
37
40
  let libraryName;
@@ -49,6 +52,13 @@ addDebugLog("switchVersion", "", "+");
49
52
  const okToCont = options.params[3];
50
53
  version = options.params[4];
51
54
 
55
+ // if have [5] will be "NoAbout" from Jest, to turn off build date
56
+ if (options.params.length >= 6 ) {
57
+ if (options.params[5] === "NoAbout") {
58
+ modAddAboutData(false);
59
+ }
60
+ }
61
+
52
62
  okToContinue = !!(okToCont === 'Y' || okToCont === 'y' || okToCont === true || okToCont === 'true');
53
63
 
54
64
  } else {