@pega/custom-dx-components 0.242.66 → 0.242.68

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 (62) hide show
  1. package/package.json +1 -1
  2. package/src/constants.js +3 -0
  3. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.tsx.mustache +2 -2
  4. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +2 -2
  5. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -2
  6. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +3 -3
  7. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +3 -3
  8. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +2 -2
  9. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +4 -4
  10. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +2 -2
  11. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -3
  12. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -2
  13. package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +4 -4
  14. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +2 -2
  15. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -3
  16. package/src/tasks/create-lib/index.js +85 -1
  17. package/src/tasks/create-version/index.js +60 -16
  18. package/src/tasks/delete-lib/index.js +43 -14
  19. package/src/tasks/delete-version/index.js +30 -9
  20. package/src/tasks/export-archive/helper.js +14 -0
  21. package/src/tasks/export-archive/index.js +151 -28
  22. package/src/tasks/import-archive/index.js +27 -14
  23. package/src/tasks/import-comp/index.js +144 -82
  24. package/src/tasks/init/template/package.json.mustache +5 -4
  25. package/src/tasks/publish/index.js +34 -18
  26. package/src/tasks/publish-lib/index.js +19 -2
  27. package/src/tasks/set-perm/index.js +14 -2
  28. package/src/tasks/switch-lib/index.js +83 -34
  29. package/src/tasks/switch-version/index.js +69 -14
  30. package/src/util.js +144 -16
  31. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
  32. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
  33. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
  34. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
  35. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
  36. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
  37. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
  38. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
  39. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
  40. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
  41. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
  42. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
  43. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
  44. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
  45. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
  46. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
  47. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
  48. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
  49. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
  50. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
  51. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
  52. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
  53. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
  54. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
  55. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
  56. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
  57. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
  58. package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +1 -1
  59. package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +1 -1
  60. package/tests/functional/localLibCreateLibExportImportLib.test.js +1 -1
  61. package/tests/functional/localLibCreateLibExportLib.test.js +1 -1
  62. package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.242.66",
3
+ "version": "0.242.68",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
package/src/constants.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // cSpell:ignore words timeofday caseview casepreview objectview
2
2
  export const TASKS_CONFIG_JSON_FILENAME = 'tasks.config.json';
3
+ export const INPUT_CONFIG_JSON_FILENAME = 'input.config.json';
3
4
  export const PACKAGE_JSON_FILENAME = 'package.json';
4
5
  export const BUILD_CONFIG_JSON_FILENAME = 'build.config.json';
5
6
  export const WEBPACK_CONFIG_JS_FILENAME = 'webpack.config.js';
@@ -12,9 +13,11 @@ export const COMPONENTS_PATH = 'component';
12
13
  export const TOKEN_PATH = 'node_modules/@pega/custom-dx-components/.access_token';
13
14
  export const OOTB_COMPONENTS = 'node_modules/@pega/custom-dx-components/.ootb_components';
14
15
  export const LIBRARY_BASED = 'libraryMode';
16
+ export const USE_INPUT_CONFIG = 'useInputConfig';
15
17
  export const SHARED_DIRECTORY = 'shared';
16
18
  export const SHOW_DEBUG = 'showDebug';
17
19
  export const ARCHIVES_PATH = 'store';
20
+ export const BIN_ARCHIVES_PATH = 'bin-arch';
18
21
  export const TEMP_PATH = 'store/temp';
19
22
  export const COMPONENTS_CONFIG_FILE_NAME = 'componentsconfig.json';
20
23
 
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  window.PCore.getEnvironmentInfo = () => {
@@ -26,7 +26,7 @@ window.PCore.getEnvironmentInfo = () => {
26
26
  getLocale: () => {
27
27
  return 'en-GB';
28
28
  }
29
- };
29
+ } as any;
30
30
  };
31
31
 
32
32
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
@@ -14,7 +14,7 @@ type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
14
14
 
15
15
 
16
16
  if (!window.PCore) {
17
- window.PCore = {};
17
+ window.PCore = {} as any;
18
18
  }
19
19
 
20
20
  window.PCore.getEnvironmentInfo = () => {
@@ -25,7 +25,7 @@ window.PCore.getEnvironmentInfo = () => {
25
25
  getLocale: () => {
26
26
  return 'en-GB';
27
27
  }
28
- };
28
+ } as any;
29
29
  };
30
30
 
31
31
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  const statelistData = {
@@ -49,7 +49,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
49
49
  resolve(statelistData);
50
50
  });
51
51
  }
52
- };
52
+ } as any;
53
53
  };
54
54
 
55
55
  const props = {
@@ -21,7 +21,7 @@ export default meta;
21
21
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
22
22
 
23
23
  if (!window.PCore) {
24
- window.PCore = {};
24
+ window.PCore = {} as any;
25
25
  }
26
26
 
27
27
  window.PCore.getLocaleUtils = () => {
@@ -29,7 +29,7 @@ window.PCore.getLocaleUtils = () => {
29
29
  getLocaleValue: (value: any) => {
30
30
  return value;
31
31
  }
32
- };
32
+ } as any;
33
33
  };
34
34
 
35
35
  window.PCore.getUserApi = () => {
@@ -39,7 +39,7 @@ window.PCore.getUserApi = () => {
39
39
  resolve(operatorDetails);
40
40
  });
41
41
  }
42
- };
42
+ } as any;
43
43
  };
44
44
 
45
45
  const Region = (props: any) => {
@@ -20,7 +20,7 @@ export default meta;
20
20
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
21
21
 
22
22
  if (!window.PCore) {
23
- window.PCore = {};
23
+ window.PCore = {} as any;
24
24
  }
25
25
 
26
26
  window.PCore.getLocaleUtils = () => {
@@ -28,7 +28,7 @@ window.PCore.getLocaleUtils = () => {
28
28
  getLocaleValue: (value: any) => {
29
29
  return value;
30
30
  }
31
- };
31
+ } as any;
32
32
  };
33
33
 
34
34
  window.PCore.getUserApi = () => {
@@ -38,7 +38,7 @@ window.PCore.getUserApi = () => {
38
38
  resolve(operatorDetails);
39
39
  });
40
40
  }
41
- };
41
+ } as any;
42
42
  };
43
43
 
44
44
  const Region = (props: any) => {
@@ -19,7 +19,7 @@ type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
19
19
 
20
20
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
21
21
  if (!window.PCore) {
22
- window.PCore = {};
22
+ window.PCore = {} as any;
23
23
  }
24
24
 
25
25
  window.PCore.getLocaleUtils = () => {
@@ -27,7 +27,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
27
27
  getLocaleValue: (val: any) => {
28
28
  return val;
29
29
  }
30
- };
30
+ } as any;
31
31
  };
32
32
 
33
33
  const configProps = pyHome1Resolved.children[0].children[0].config;
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -25,7 +25,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
25
25
  CASE_INFO: {
26
26
  CASE_INFO_ID: 'caseInfo.ID'
27
27
  }
28
- };
28
+ } as any;
29
29
  };
30
30
 
31
31
  window.PCore.getLocaleUtils = () => {
@@ -33,7 +33,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
33
33
  getLocaleValue: (value: any) => {
34
34
  return value;
35
35
  }
36
- };
36
+ } as any;
37
37
  };
38
38
 
39
39
  window.PCore.getDataApiUtils = () => {
@@ -43,7 +43,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
43
43
  resolve(historyData);
44
44
  });
45
45
  }
46
- };
46
+ } as any;
47
47
  };
48
48
 
49
49
  const props = {
@@ -17,7 +17,7 @@ export default meta;
17
17
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
18
18
 
19
19
  if (!window.PCore) {
20
- window.PCore = {};
20
+ window.PCore = {} as any;
21
21
  }
22
22
 
23
23
  const worklistData = {
@@ -59,7 +59,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
59
59
  resolve(worklistData);
60
60
  });
61
61
  }
62
- };
62
+ } as any;
63
63
  };
64
64
 
65
65
  const props = {
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  window.PCore.getLocaleUtils = () => {
@@ -23,7 +23,7 @@ window.PCore.getLocaleUtils = () => {
23
23
  getLocaleValue: (value: any) => {
24
24
  return value;
25
25
  }
26
- };
26
+ } as any;
27
27
  };
28
28
 
29
29
  window.PCore.getUserApi = () => {
@@ -33,7 +33,7 @@ window.PCore.getUserApi = () => {
33
33
  resolve(operatorDetails);
34
34
  });
35
35
  }
36
- };
36
+ } as any;
37
37
  };
38
38
 
39
39
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  const countrylistData = {
@@ -47,7 +47,7 @@ window.PCore.getDataPageUtils = () => {
47
47
  resolve(countrylistData);
48
48
  });
49
49
  }
50
- };
50
+ } as any;
51
51
  };
52
52
 
53
53
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  window.PCore.getConstants = () => {
@@ -23,7 +23,7 @@ window.PCore.getConstants = () => {
23
23
  CASE_INFO: {
24
24
  CASE_INFO_ID: 'caseInfo.ID'
25
25
  }
26
- };
26
+ } as any;
27
27
  };
28
28
 
29
29
  window.PCore.getLocaleUtils = () => {
@@ -31,7 +31,7 @@ window.PCore.getLocaleUtils = () => {
31
31
  getLocaleValue: (value: any) => {
32
32
  return value;
33
33
  }
34
- };
34
+ } as any;
35
35
  };
36
36
 
37
37
  window.PCore.getDataApiUtils = () => {
@@ -41,7 +41,7 @@ window.PCore.getDataApiUtils = () => {
41
41
  resolve(historyData);
42
42
  });
43
43
  }
44
- };
44
+ } as any;
45
45
  };
46
46
 
47
47
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -16,7 +16,7 @@ export default meta;
16
16
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
17
17
 
18
18
  if (!window.PCore) {
19
- window.PCore = {};
19
+ window.PCore = {} as any;
20
20
  }
21
21
 
22
22
  const worklistData = {
@@ -57,7 +57,7 @@ window.PCore.getDataApiUtils = () => {
57
57
  resolve(worklistData);
58
58
  });
59
59
  }
60
- };
60
+ } as any;
61
61
  };
62
62
 
63
63
 
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  window.PCore.getLocaleUtils = () => {
@@ -23,7 +23,7 @@ window.PCore.getLocaleUtils = () => {
23
23
  getLocaleValue: (value: any) => {
24
24
  return value;
25
25
  }
26
- };
26
+ } as any;
27
27
  };
28
28
 
29
29
  window.PCore.getUserApi = () => {
@@ -33,7 +33,7 @@ window.PCore.getUserApi = () => {
33
33
  resolve(operatorDetails);
34
34
  });
35
35
  }
36
- };
36
+ } as any;
37
37
  };
38
38
 
39
39
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -17,7 +17,10 @@ import {
17
17
  forceDefaultsUpdate,
18
18
  cleanUpTemp,
19
19
  restoreTopLevelConfigFilesFromTemplate,
20
- getHaveDependencyDifference
20
+ getHaveDependencyDifference,
21
+ getUseInputConfig,
22
+ getInputConfigForCommand,
23
+ convertYNToBoolean
21
24
  } from '../../util.js';
22
25
 
23
26
  import { getCreateLibComponentQuestions, getOkToProceedQuestion, updateAllComponentsConfig, getCurrentOrOriginalQuestion } from './helper.js';
@@ -25,6 +28,7 @@ import { showCurrentStatus } from '../show-status/index.js';
25
28
 
26
29
  export default async options => {
27
30
  const isLibraryBased = getLibraryBased();
31
+ const useInputConfig = getUseInputConfig();
28
32
  if (!isLibraryBased) {
29
33
  console.log(`Command only supported for ${chalk.bold.green('library based')} components.`);
30
34
  process.exit();
@@ -33,9 +37,89 @@ export default async options => {
33
37
  await showVersion();
34
38
  await cleanUpTemp();
35
39
 
40
+
41
+ // if we have choosen to use INPUT CONFIG FILE
42
+ // process and exit
43
+ if (useInputConfig) {
44
+ const inputConfig = await getInputConfigForCommand("createLib");
45
+
46
+ if (convertYNToBoolean(inputConfig.okToContinue)) {
47
+ const libraryName = inputConfig.libraryName;
48
+ let version = inputConfig.libraryVersion;
49
+ const currentOrOriginal = inputConfig.currentOrOriginal;
50
+ const isPermanent = inputConfig.isPermanent;
51
+ const permBuild = convertYNToBoolean(isPermanent);
52
+
53
+
54
+ // if have store, then that means there is a current library, so
55
+ // store it before clearing out /src/components
56
+
57
+ const hasArch = await hasArchives();
58
+ const orgLib = getConfigDefaults();
59
+ const newOrgLib = `${orgLib.organization}_${libraryName}`;
60
+
61
+ if (hasArch) {
62
+ const hasLib = await hasLibraryAndVersion(libraryName, version, !permBuild);
63
+ if (hasLib) {
64
+ console.log(`${chalk.bold.red(`Library ${orgLib.organization}_${libraryName} already exists.`)}`);
65
+ console.log("You can switch to that library by entering 'npm run switchLib'.\n")
66
+ process.exit();
67
+ }
68
+
69
+ const currentOrgLib = orgLib.currentOrgLib;
70
+ const currentVersion = orgLib.buildVersion;
71
+ await zipVersionAndArchive(currentOrgLib, currentVersion);
72
+ await clearSrcComponentsDirectory();
73
+
74
+ }
75
+
76
+ if (!permBuild) {
77
+ version = version.concat("-dev");
78
+ }
79
+
80
+ if (currentOrOriginal === 'Original') {
81
+ await restoreTopLevelConfigFilesFromTemplate();
82
+ }
83
+
84
+ // update library name in config and create a blank archive
85
+ await updateComponentDefaultLibrary(libraryName);
86
+ await zipVersionAndArchive(newOrgLib, version);
87
+
88
+ // if didn't have an archive, in case you currently have components there
89
+ // update the config jsons
90
+ if (!hasArch) {
91
+ await updateAllComponentsConfig(version);
92
+ }
93
+
94
+ console.log(`${chalk.bold.green(`\nLibrary ${newOrgLib}/${version} has been created!\n`)}`);
95
+
96
+ await forceDefaultsUpdate();
97
+ await showCurrentStatus();
98
+
99
+ if (currentOrOriginal === 'Original') {
100
+ if (getHaveDependencyDifference()) {
101
+
102
+ console.log('\n***************************************************************');
103
+ console.log(chalk.bold.yellow('Dependencies have changed between libraries, recommend updating.'));
104
+ console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
105
+ console.log('***************************************************************\n');
106
+
107
+ }
108
+ }
109
+
110
+
111
+
112
+ }
113
+
114
+ process.exit();
115
+
116
+
117
+ }
118
+
36
119
  addDebugLog("createLibrary", "", "+");
37
120
  let libraryName = "";
38
121
  let version;
122
+
39
123
  // permBuild is the opposite of devBuild
40
124
  let permBuild;
41
125
  const orgLib = getConfigDefaults();
@@ -17,7 +17,12 @@ import {
17
17
  getConfigDefaults,
18
18
  forceDefaultsUpdate,
19
19
  modAddAboutData,
20
- cleanUpTemp
20
+ cleanUpTemp,
21
+ getUseInputConfig,
22
+ getInputConfigForCommand,
23
+ convertYNToBoolean,
24
+ hasArchives,
25
+ hasLibraryAndVersion
21
26
  } from '../../util.js';
22
27
 
23
28
  import { getCreateVersionComponentQuestions, updateAllComponentsConfig } from './helper.js';
@@ -25,6 +30,8 @@ import { showCurrentStatus } from '../show-status/index.js';
25
30
 
26
31
  export default async options => {
27
32
  const isLibraryBased = getLibraryBased();
33
+ const useInputConfig = getUseInputConfig();
34
+
28
35
  if (!isLibraryBased) {
29
36
  console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
30
37
  process.exit();
@@ -34,6 +41,8 @@ export default async options => {
34
41
  await checkLibraryAndArchives();
35
42
  await cleanUpTemp();
36
43
 
44
+
45
+
37
46
  addDebugLog("createVersion", "", "+");
38
47
  let libraryName;
39
48
  let version;
@@ -45,26 +54,61 @@ addDebugLog("createVersion", "", "+");
45
54
  const currentDirectory = process.cwd();
46
55
  const componentDirectory = join (currentDirectory, "src", "components");
47
56
 
57
+ // if we have choosen to use INPUT CONFIG FILE
58
+ // process and no inputs
59
+ if (useInputConfig) {
60
+ const inputConfig = await getInputConfigForCommand("createLibVersion");
61
+
62
+ if (convertYNToBoolean(inputConfig.okToContinue)) {
63
+ version = inputConfig.libraryVersion;
64
+ const isPermanent = inputConfig.isPermanent;
65
+ permBuild = convertYNToBoolean(isPermanent);
66
+ copyExisting = convertYNToBoolean(inputConfig.copyComponents);
67
+
68
+ const hasArch = await hasArchives();
69
+ const orgLib = getConfigDefaults();
70
+ const hasLib = await hasLibraryAndVersion(orgLib.library, version, !permBuild);
71
+ if (hasArch) {
72
+ if (hasLib) {
73
+ console.log(`${chalk.bold.red(`Library ${orgLib.displayLibVersion} already exists.`)}`);
74
+ console.log("You can switch to that library by entering 'npm run switchLib'.\n")
75
+ process.exit();
76
+ }
77
+ }
78
+ else {
79
+ console.log(`${chalk.bold.red(`No libraries exist.`)}`);
80
+ console.log("You need to create a library first via 'npm run createLib'.\n")
81
+ process.exit();
82
+ }
48
83
 
49
- if (options.params.length >= 6) {
50
- version = options.params[3];
51
- const dPerm = options.params[4];
52
- const copyExist = options.params[5]
53
84
 
54
- // if have [6] will be "NoAbout" from Jest, to turn off build date
55
- if (options.params.length >= 7 ) {
56
- if (options.params[6] === "NoAbout") {
57
- modAddAboutData(false);
58
- }
59
85
  }
86
+ else {
87
+ process.exit();
88
+ }
89
+
90
+ }
91
+ else {
92
+ if (options.params.length >= 6) {
93
+ version = options.params[3];
94
+ const dPerm = options.params[4];
95
+ const copyExist = options.params[5]
96
+
97
+ // if have [6] will be "NoAbout" from Jest, to turn off build date
98
+ if (options.params.length >= 7 ) {
99
+ if (options.params[6] === "NoAbout") {
100
+ modAddAboutData(false);
101
+ }
102
+ }
60
103
 
61
- permBuild = !!(dPerm === 'Y' || dPerm === 'y' || dPerm === true || dPerm === 'true');
62
- copyExisting = !!(copyExist === 'Y' || copyExist === 'y' || copyExist === true || copyExist === 'true');
104
+ permBuild = !!(dPerm === 'Y' || dPerm === 'y' || dPerm === true || dPerm === 'true');
105
+ copyExisting = !!(copyExist === 'Y' || copyExist === 'y' || copyExist === true || copyExist === 'true');
63
106
 
64
- } else {
65
- const questions = await getCreateVersionComponentQuestions();
66
- const answers = await inquirer.prompt(questions);
67
- ({ version, permBuild, copyExisting } = answers);
107
+ } else {
108
+ const questions = await getCreateVersionComponentQuestions();
109
+ const answers = await inquirer.prompt(questions);
110
+ ({ version, permBuild, copyExisting } = answers);
111
+ }
68
112
  }
69
113
 
70
114
  const orgLib = getConfigDefaults();
@@ -17,7 +17,10 @@ import {
17
17
  deleteArchives,
18
18
  forceDefaultsUpdate,
19
19
  restoreFromArchive,
20
- cleanUpTemp
20
+ cleanUpTemp,
21
+ getUseInputConfig,
22
+ getInputConfigForCommand,
23
+ convertYNToBoolean
21
24
  } from '../../util.js';
22
25
 
23
26
  import { getDeleteLibraryQuestions, getLibraryVersionQuestion } from './helper.js';
@@ -29,6 +32,7 @@ export const deleteLibraryVersion = async (libraryName, version = "", okToDelete
29
32
  addDebugLog("deleteLibraryVersion", "", "+");
30
33
 
31
34
  const isLibraryBased = getLibraryBased();
35
+
32
36
  const compDef = getConfigDefaults();
33
37
  let libVersions = [];
34
38
  let confirmDeletion;
@@ -38,6 +42,10 @@ addDebugLog("deleteLibraryVersion", "", "+");
38
42
  process.exit();
39
43
  }
40
44
 
45
+
46
+
47
+
48
+
41
49
  try {
42
50
  libVersions = await getLibraryArchivesVersions(libraryName, "");
43
51
  }
@@ -209,6 +217,8 @@ addDebugLog("deleteLibraryVersion", "END", "-");
209
217
 
210
218
  export default async (options) => {
211
219
  const isLibraryBased = getLibraryBased();
220
+ const useInputConfig = getUseInputConfig();
221
+
212
222
  if (!isLibraryBased) {
213
223
  console.log(`Command only supported for ${chalk.bold.green('library based')} components.`)
214
224
  process.exit();
@@ -227,33 +237,52 @@ addDebugLog("deleteLibrary", "", "+");
227
237
  const compDef = getConfigDefaults();
228
238
  let libraryName;
229
239
 
230
- if (options.params.length >= 5) {
231
- libraryName = options.params[3];
232
- version = options.params[4];
240
+ if (useInputConfig) {
241
+ const inputConfig = await getInputConfigForCommand("deleteLib");
242
+ libraryName = inputConfig.libraryName;
243
+ version = inputConfig.libraryVersion;
244
+ const isPermanent = inputConfig.isPermanent;
245
+ const permBuild = convertYNToBoolean(isPermanent);
233
246
 
234
- if (options.params.length >=6 ) {
235
- const okToDel = options.params[5];
236
- okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
247
+ if (!permBuild && version != "ALL") {
248
+ version = version.concat("-dev");
237
249
  }
238
250
 
251
+ okToDelete = convertYNToBoolean(inputConfig.confirmDelete);
239
252
 
240
253
  }
241
254
  else {
242
-
243
- if (options.params.length === 4) {
255
+ if (options.params.length >= 5) {
244
256
  libraryName = options.params[3];
245
- version = "ALL"
257
+ version = options.params[4];
258
+
259
+ if (options.params.length >=6 ) {
260
+ const okToDel = options.params[5];
261
+ okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
262
+ }
263
+
264
+
246
265
  }
247
266
  else {
248
- const questions = await getDeleteLibraryQuestions();
249
- const answers = await inquirer.prompt(questions);
250
- ({ libraryName } = answers);
251
- }
267
+
268
+ if (options.params.length === 4) {
269
+ libraryName = options.params[3];
270
+ version = "ALL"
271
+ }
272
+ else {
273
+ const questions = await getDeleteLibraryQuestions();
274
+ const answers = await inquirer.prompt(questions);
275
+ ({ libraryName } = answers);
276
+ }
277
+
252
278
 
253
279
 
280
+ }
254
281
 
255
282
  }
256
283
 
284
+
285
+
257
286
  await deleteLibraryVersion(libraryName, version, okToDelete);
258
287
 
259
288