@pega/custom-dx-components 0.242.67 → 0.242.69
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 +1 -1
- package/src/constants.js +2 -0
- package/src/tasks/create/index.js +3 -1
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +4 -4
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +4 -4
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create-lib/index.js +85 -1
- package/src/tasks/create-version/index.js +60 -16
- package/src/tasks/delete-lib/index.js +43 -14
- package/src/tasks/delete-version/index.js +30 -9
- package/src/tasks/import-archive/index.js +27 -14
- package/src/tasks/import-comp/index.js +144 -82
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/publish/index.js +43 -20
- package/src/tasks/publish-lib/index.js +21 -3
- package/src/tasks/set-perm/index.js +14 -2
- package/src/tasks/switch-lib/index.js +83 -34
- package/src/tasks/switch-version/index.js +69 -14
- package/src/tasks/validator/index.js +16 -6
- package/src/util.js +104 -3
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +1 -1
|
@@ -17,7 +17,11 @@ import {
|
|
|
17
17
|
forceDefaultsUpdate,
|
|
18
18
|
getHaveDependencyDifference,
|
|
19
19
|
cleanUpTemp,
|
|
20
|
-
getLibraryArchiveDirectories
|
|
20
|
+
getLibraryArchiveDirectories,
|
|
21
|
+
getUseInputConfig,
|
|
22
|
+
getInputConfigForCommand,
|
|
23
|
+
convertYNToBoolean,
|
|
24
|
+
hasArchives
|
|
21
25
|
} from '../../util.js';
|
|
22
26
|
|
|
23
27
|
import { getSwitchLibraryComponentQuestions, getSwitchVersionComponentQuestions } from './helper.js';
|
|
@@ -27,6 +31,8 @@ import { arch } from 'os';
|
|
|
27
31
|
|
|
28
32
|
export default async options => {
|
|
29
33
|
const isLibraryBased = getLibraryBased();
|
|
34
|
+
const useInputConfig = getUseInputConfig();
|
|
35
|
+
|
|
30
36
|
if (!isLibraryBased) {
|
|
31
37
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
|
|
32
38
|
process.exit();
|
|
@@ -48,61 +54,104 @@ addDebugLog("switchLibrary", "", "+");
|
|
|
48
54
|
const currentDirectory = process.cwd();
|
|
49
55
|
const componentDirectory = join (currentDirectory, "src", "components");
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
if (options.params.length >= 6) {
|
|
53
|
-
newOrgLib = options.params[3];
|
|
54
|
-
version = options.params[4];
|
|
57
|
+
const orgLib = getConfigDefaults();
|
|
55
58
|
|
|
56
|
-
const okToCont = options.params[5];
|
|
57
|
-
okToContinue = !!(okToCont === 'Y' || okToCont === 'y' || okToCont === true || okToCont === 'true');
|
|
58
59
|
|
|
60
|
+
// if we have choosen to use INPUT CONFIG FILE
|
|
61
|
+
// process and no inputs
|
|
62
|
+
if (useInputConfig) {
|
|
63
|
+
const inputConfig = await getInputConfigForCommand("switchLib");
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
if (convertYNToBoolean(inputConfig.okToContinue)) {
|
|
66
|
+
const newLibraryName = inputConfig.libraryName;
|
|
67
|
+
newOrgLib = `${orgLib.organization}_${newLibraryName}`;
|
|
68
|
+
version = inputConfig.libraryVersion;
|
|
69
|
+
const isPermanent = inputConfig.isPermanent;
|
|
70
|
+
const permBuild = convertYNToBoolean(isPermanent);
|
|
61
71
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
const hasArch = await hasArchives();
|
|
73
|
+
if (hasArch) {
|
|
74
|
+
if (orgLib.currentOrgLib === newOrgLib) {
|
|
75
|
+
console.log(`${chalk.bold.red(`Your current library is already ${orgLib.displayLibVersion}`)}`);
|
|
76
|
+
process.exit();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
console.log(`${chalk.bold.red(`No libraries exist.`)}`);
|
|
81
|
+
console.log("You need to create a library first via 'npm run createLib'.\n")
|
|
82
|
+
process.exit();
|
|
83
|
+
}
|
|
69
84
|
|
|
70
|
-
|
|
85
|
+
// version here includes -dev if appropriate
|
|
86
|
+
if (!permBuild) {
|
|
87
|
+
version = version.concat("-dev");
|
|
88
|
+
}
|
|
71
89
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
console.log(chalk.red(`No other available libraries to switch to.`));
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
75
92
|
process.exit();
|
|
76
93
|
}
|
|
77
94
|
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// params are in different order then questions, because want of VS Code pluggin
|
|
98
|
+
if (options.params.length >= 6) {
|
|
99
|
+
newOrgLib = options.params[3];
|
|
100
|
+
version = options.params[4];
|
|
78
101
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
({ okToContinue, newOrgLib } = answers);
|
|
102
|
+
const okToCont = options.params[5];
|
|
103
|
+
okToContinue = !!(okToCont === 'Y' || okToCont === 'y' || okToCont === true || okToCont === 'true');
|
|
82
104
|
|
|
83
|
-
if (!answers.okToContinue) {
|
|
84
|
-
process.exit()
|
|
85
|
-
}
|
|
86
105
|
|
|
87
|
-
if (newOrgLib === ""|| newOrgLib === undefined ) {
|
|
88
|
-
newOrgLib = inputOrgLib;
|
|
89
106
|
}
|
|
107
|
+
else {
|
|
90
108
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
109
|
+
if (options.params.length >= 5) {
|
|
110
|
+
inputOrgLib = options.params[3];
|
|
111
|
+
version = options.params[4];
|
|
112
|
+
}
|
|
113
|
+
else if (options.params.length >= 4) {
|
|
114
|
+
inputOrgLib = options.params[3];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const orgLib = getConfigDefaults();
|
|
96
118
|
|
|
119
|
+
const archVersionList = await getLibraryArchiveDirectories(orgLib.currentOrgLib);
|
|
120
|
+
if (archVersionList.length === 0) {
|
|
121
|
+
console.log(chalk.red(`No other available libraries to switch to.`));
|
|
122
|
+
process.exit();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
const questions = await getSwitchLibraryComponentQuestions(archVersionList, inputOrgLib);
|
|
127
|
+
const answers = await inquirer.prompt(questions);
|
|
128
|
+
({ okToContinue, newOrgLib } = answers);
|
|
129
|
+
|
|
130
|
+
if (!answers.okToContinue) {
|
|
131
|
+
process.exit()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (newOrgLib === ""|| newOrgLib === undefined ) {
|
|
135
|
+
newOrgLib = inputOrgLib;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (version === "" || version === undefined) {
|
|
139
|
+
const nextQuestion = await getSwitchVersionComponentQuestions(newOrgLib);
|
|
140
|
+
const nextAnswers = await inquirer.prompt(nextQuestion);
|
|
141
|
+
({ version } = nextAnswers);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
}
|
|
97
145
|
}
|
|
98
146
|
|
|
99
|
-
// in this scenario, version contains "-dev", if appropriate
|
|
100
147
|
|
|
101
|
-
|
|
148
|
+
|
|
149
|
+
// in this scenario, version contains "-dev", if appropriate
|
|
102
150
|
const newVersion = version;
|
|
103
151
|
const existingOrgLib = orgLib.currentOrgLib;
|
|
104
152
|
let oldVersion = orgLib.buildVersion;
|
|
105
153
|
|
|
154
|
+
|
|
106
155
|
const switchToFileName = `${newOrgLib}_${newVersion}.zip`;
|
|
107
156
|
|
|
108
157
|
console.log("");
|
|
@@ -18,7 +18,12 @@ import {
|
|
|
18
18
|
getHaveDependencyDifference,
|
|
19
19
|
forceDefaultsUpdate,
|
|
20
20
|
modAddAboutData,
|
|
21
|
-
cleanUpTemp
|
|
21
|
+
cleanUpTemp,
|
|
22
|
+
getUseInputConfig,
|
|
23
|
+
getInputConfigForCommand,
|
|
24
|
+
convertYNToBoolean,
|
|
25
|
+
hasArchives,
|
|
26
|
+
hasLibraryAndVersion
|
|
22
27
|
} from '../../util.js';
|
|
23
28
|
|
|
24
29
|
import { getSwitchVersionComponentQuestions } from './helper.js';
|
|
@@ -27,6 +32,8 @@ import { showCurrentStatus } from '../show-status/index.js';
|
|
|
27
32
|
|
|
28
33
|
export default async options => {
|
|
29
34
|
const isLibraryBased = getLibraryBased();
|
|
35
|
+
const useInputConfig = getUseInputConfig();
|
|
36
|
+
|
|
30
37
|
if (!isLibraryBased) {
|
|
31
38
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
|
|
32
39
|
process.exit();
|
|
@@ -46,31 +53,79 @@ addDebugLog("switchVersion", "", "+");
|
|
|
46
53
|
const serverConfig = await getPegaServerConfig();
|
|
47
54
|
const currentDirectory = process.cwd();
|
|
48
55
|
const componentDirectory = join (currentDirectory, "src", "components");
|
|
56
|
+
const orgLib = getConfigDefaults();
|
|
57
|
+
|
|
58
|
+
// if we have choosen to use INPUT CONFIG FILE
|
|
59
|
+
// process and no inputs
|
|
60
|
+
if (useInputConfig) {
|
|
61
|
+
const inputConfig = await getInputConfigForCommand("switchLibVersion");
|
|
62
|
+
|
|
63
|
+
okToContinue = convertYNToBoolean(inputConfig.okToContinue);
|
|
64
|
+
if (okToContinue) {
|
|
65
|
+
version = inputConfig.libraryVersion;
|
|
66
|
+
const isPermanent = inputConfig.isPermanent;
|
|
67
|
+
const permBuild = convertYNToBoolean(isPermanent);
|
|
68
|
+
|
|
69
|
+
|
|
49
70
|
|
|
71
|
+
const hasArch = await hasArchives();
|
|
72
|
+
const orgLib = getConfigDefaults();
|
|
73
|
+
const hasLib = await hasLibraryAndVersion(orgLib.library, version, !permBuild);
|
|
50
74
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
// version here includes -dev if appropriate
|
|
76
|
+
if (!permBuild) {
|
|
77
|
+
version = version.concat("-dev");
|
|
78
|
+
}
|
|
54
79
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
if (hasArch) {
|
|
81
|
+
if (orgLib.buildVersion == version ) {
|
|
82
|
+
console.log(`${chalk.bold.red(`Your current library/version is already ${orgLib.displayLibVersion}.`)}`);
|
|
83
|
+
process.exit();
|
|
84
|
+
}
|
|
85
|
+
if (!hasLib) {
|
|
86
|
+
console.log(`${chalk.bold.red(`${orgLib.library}/${version} does not exist.`)}`);
|
|
87
|
+
process.exit();
|
|
88
|
+
}
|
|
59
89
|
}
|
|
90
|
+
else {
|
|
91
|
+
console.log(`${chalk.bold.red(`No libraries exist.`)}`);
|
|
92
|
+
console.log("You need to create a library first via 'npm run createLib'.\n")
|
|
93
|
+
process.exit();
|
|
94
|
+
}
|
|
95
|
+
|
|
60
96
|
}
|
|
97
|
+
else {
|
|
98
|
+
process.exit();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
if (options.params.length >= 5) {
|
|
104
|
+
const okToCont = options.params[3];
|
|
105
|
+
version = options.params[4];
|
|
106
|
+
|
|
107
|
+
// if have [5] will be "NoAbout" from Jest, to turn off build date
|
|
108
|
+
if (options.params.length >= 6 ) {
|
|
109
|
+
if (options.params[5] === "NoAbout") {
|
|
110
|
+
modAddAboutData(false);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
61
113
|
|
|
62
|
-
|
|
114
|
+
okToContinue = !!(okToCont === 'Y' || okToCont === 'y' || okToCont === true || okToCont === 'true');
|
|
63
115
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
116
|
+
} else {
|
|
117
|
+
const questions = await getSwitchVersionComponentQuestions();
|
|
118
|
+
const answers = await inquirer.prompt(questions);
|
|
119
|
+
({ okToContinue, version } = answers);
|
|
120
|
+
}
|
|
68
121
|
}
|
|
69
122
|
|
|
123
|
+
|
|
124
|
+
|
|
70
125
|
if (okToContinue) {
|
|
71
126
|
// in this scenario, version contains "-dev", if appropriate
|
|
72
127
|
|
|
73
|
-
|
|
128
|
+
|
|
74
129
|
const newVersion = version;
|
|
75
130
|
const existingOrgLib = orgLib.currentOrgLib;
|
|
76
131
|
const oldVersion = orgLib.buildVersion;
|
|
@@ -315,11 +315,13 @@ const validateOverideSchema = ajv.compile(overrideSchema);
|
|
|
315
315
|
|
|
316
316
|
|
|
317
317
|
export default async (option) => {
|
|
318
|
-
// addDebugLog("validate","", "");
|
|
318
|
+
// addDebugLog("validate","", "");
|
|
319
319
|
|
|
320
320
|
let componentToValidate = null;
|
|
321
|
+
let throwTheError = false;
|
|
321
322
|
if (option.params && option.params[3]) {
|
|
322
323
|
componentToValidate = option.params[3];
|
|
324
|
+
throwTheError = true;
|
|
323
325
|
} else if (option && option.task === 'validateSchema') {
|
|
324
326
|
const localComponents = await getComponents();
|
|
325
327
|
const answer = await inquirer.prompt({
|
|
@@ -332,8 +334,10 @@ export default async (option) => {
|
|
|
332
334
|
componentToValidate = answer.component;
|
|
333
335
|
} else if (option.name) {
|
|
334
336
|
componentToValidate = option.value;
|
|
337
|
+
throwTheError = true;
|
|
335
338
|
} else {
|
|
336
339
|
componentToValidate = option;
|
|
340
|
+
throwTheError = true;
|
|
337
341
|
}
|
|
338
342
|
|
|
339
343
|
const componentDirectory = await getComponentDirectoryPath(componentToValidate);
|
|
@@ -365,17 +369,23 @@ export default async (option) => {
|
|
|
365
369
|
|
|
366
370
|
if (valid) {
|
|
367
371
|
|
|
372
|
+
if (data.description === "") {
|
|
373
|
+
throw new Error(`Invalid schema json in config.json: 'description' cannot be blank.`);
|
|
374
|
+
process.exit(1);
|
|
375
|
+
}
|
|
376
|
+
|
|
368
377
|
if (
|
|
369
378
|
componentToValidate &&
|
|
370
379
|
!/^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$/.test(componentToValidate)
|
|
371
380
|
) {
|
|
372
|
-
const ootbComponents = await getOOTBComponents();
|
|
373
|
-
if (ootbComponents.includes(componentToValidate)) {
|
|
374
|
-
throw new Error(`Invalid: Error occurred in validating ${componentToValidate}`);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
381
|
|
|
382
|
+
if (throwTheError) {
|
|
383
|
+
throw new Error (`${chalk.redBright(`Error: Invalid name of component '${componentToValidate}' .\n Component name (and component folder) MUST be of the form: 'Org_Lib_ComponentName'.`)}`);
|
|
378
384
|
|
|
385
|
+
}
|
|
386
|
+
console.log(`${chalk.redBright(`Error: Invalid name of component '${componentToValidate}' .\n Component name (and component folder) MUST be of the form: 'Org_Lib_ComponentName'.`)}`);
|
|
387
|
+
process.exit(1);
|
|
388
|
+
}
|
|
379
389
|
|
|
380
390
|
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
381
391
|
} else {
|
package/src/util.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
COMPONENTS_DIRECTORY_PATH,
|
|
21
21
|
COMPONENTS_CONFIG_FILE_NAME,
|
|
22
22
|
TASKS_CONFIG_JSON_FILENAME,
|
|
23
|
+
INPUT_CONFIG_JSON_FILENAME,
|
|
23
24
|
PACKAGE_JSON_FILENAME,
|
|
24
25
|
TOKEN_PATH,
|
|
25
26
|
OOTB_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
USE_PROMOTED_WEB_PACK,
|
|
30
31
|
BOOTSTRAP_CONFIG,
|
|
31
32
|
LIBRARY_BASED,
|
|
33
|
+
USE_INPUT_CONFIG,
|
|
32
34
|
SHARED_DIRECTORY,
|
|
33
35
|
SHOW_DEBUG,
|
|
34
36
|
COMPONENTS_PATH,
|
|
@@ -62,7 +64,8 @@ let defaultConfigs = {
|
|
|
62
64
|
displayLibVersion: "",
|
|
63
65
|
showDebug: false,
|
|
64
66
|
importRelativePath: "",
|
|
65
|
-
exportRelativePath: ""
|
|
67
|
+
exportRelativePath: "",
|
|
68
|
+
useInputConfig: false
|
|
66
69
|
};
|
|
67
70
|
|
|
68
71
|
let pegaConfig = null;
|
|
@@ -117,7 +120,8 @@ export const setUpDefaults = async () => {
|
|
|
117
120
|
displayLibVersion: "",
|
|
118
121
|
showDebug: false,
|
|
119
122
|
importRelativePath: "",
|
|
120
|
-
exportRelativePath: ""
|
|
123
|
+
exportRelativePath: "",
|
|
124
|
+
useInputConfig: false
|
|
121
125
|
};
|
|
122
126
|
|
|
123
127
|
// retrievedConfigData
|
|
@@ -143,6 +147,11 @@ export const setUpDefaults = async () => {
|
|
|
143
147
|
if (data[LIBRARY_BASED]) {
|
|
144
148
|
retrievedConfigData.isLibraryBased = data[LIBRARY_BASED];
|
|
145
149
|
}
|
|
150
|
+
|
|
151
|
+
if (data[USE_INPUT_CONFIG]) {
|
|
152
|
+
retrievedConfigData.useInputConfig = data[USE_INPUT_CONFIG];
|
|
153
|
+
}
|
|
154
|
+
|
|
146
155
|
retrievedConfigData.library = data.component.library;
|
|
147
156
|
retrievedConfigData.version = data.component.version;
|
|
148
157
|
|
|
@@ -172,6 +181,65 @@ export const setUpDefaults = async () => {
|
|
|
172
181
|
return JSON.parse(JSON.stringify(retrievedConfigData));
|
|
173
182
|
}
|
|
174
183
|
|
|
184
|
+
|
|
185
|
+
export const convertYNToBoolean = (inputYN) => {
|
|
186
|
+
switch (inputYN) {
|
|
187
|
+
case 'Y':
|
|
188
|
+
case 'y':
|
|
189
|
+
case 'Yes':
|
|
190
|
+
case 'YES':
|
|
191
|
+
case 't':
|
|
192
|
+
case 'true':
|
|
193
|
+
case 'True':
|
|
194
|
+
case 'TRUE':
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const getInputConfigForCommand = async (commandName) => {
|
|
202
|
+
// retrievedConfigData
|
|
203
|
+
const currentDirectory = process.cwd();
|
|
204
|
+
const inputConfigJsonPath = join(currentDirectory, INPUT_CONFIG_JSON_FILENAME);
|
|
205
|
+
const isLibraryBased = getLibraryBased();
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
// force to throw error and not console log
|
|
209
|
+
await checkPathAccess(inputConfigJsonPath, {}, true);
|
|
210
|
+
|
|
211
|
+
let data = fs.readFileSync(inputConfigJsonPath, { encoding: 'utf8' });
|
|
212
|
+
data = JSON.parse(data);
|
|
213
|
+
|
|
214
|
+
if (isLibraryBased) {
|
|
215
|
+
const libraryCommands = data["libraryMode"];
|
|
216
|
+
|
|
217
|
+
if (libraryCommands[commandName]) {
|
|
218
|
+
return libraryCommands[commandName];
|
|
219
|
+
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
const standardCommands = data["standard"];
|
|
224
|
+
|
|
225
|
+
if (standardCommands[commandName]) {
|
|
226
|
+
return standardCommands[commandName];
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
catch (ex) {
|
|
233
|
+
// when can't find it, always be false, assume no library based.
|
|
234
|
+
// This is IMPORTANT for init (npx install)
|
|
235
|
+
return {};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return {};
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
175
243
|
// initialize
|
|
176
244
|
// await setUpDefaults();
|
|
177
245
|
|
|
@@ -332,6 +400,15 @@ if (showDebug) addDebugLog("getLibraryBased", "", "");
|
|
|
332
400
|
return defaultConfigs.isLibraryBased;
|
|
333
401
|
}
|
|
334
402
|
|
|
403
|
+
export const getUseInputConfig = () => {
|
|
404
|
+
if (showDebug) addDebugLog("getUseInputConfig", "", "");
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
return defaultConfigs.useInputConfig;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
335
412
|
export const setLibraryBased = async (isLibraryBased) => {
|
|
336
413
|
if (showDebug) addDebugLog("setLibraryBased", "", "");
|
|
337
414
|
const currentDirectory = process.cwd();
|
|
@@ -563,6 +640,7 @@ if (showDebug) addDebugLog("removeTopLevelConfigFiles", `directory: ${directory}
|
|
|
563
640
|
if (configF !== "package-lock.json" &&
|
|
564
641
|
configF !== "package.json" &&
|
|
565
642
|
configF !== "tasks.config.json" &&
|
|
643
|
+
configF !== "input.config.json" &&
|
|
566
644
|
configF !== ".gitignore" &&
|
|
567
645
|
configF !== ".npmrc" &&
|
|
568
646
|
configF !== ".prettierignore") {
|
|
@@ -758,6 +836,28 @@ export const getPegaServerConfig = async () => {
|
|
|
758
836
|
if (showDebug) addDebugLog("getPegaServerConfig", "", "+");
|
|
759
837
|
if (!pegaConfig) {
|
|
760
838
|
pegaConfig = await getPegaConfig();
|
|
839
|
+
|
|
840
|
+
if (getServerType() === "launchpad") {
|
|
841
|
+
|
|
842
|
+
// need to append isolation id for now
|
|
843
|
+
let OAuthData;
|
|
844
|
+
try {
|
|
845
|
+
OAuthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
846
|
+
}
|
|
847
|
+
catch (ex) {
|
|
848
|
+
return ({});
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
if (OAuthData) {
|
|
852
|
+
const oOAuthData = JSON.parse(OAuthData);
|
|
853
|
+
if (oOAuthData["isolation-ids"]) {
|
|
854
|
+
const isolationId = oOAuthData["isolation-ids"].write;
|
|
855
|
+
pegaConfig['server-config'].isolationId = isolationId[0];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
}
|
|
761
861
|
sPegaServerConfig = JSON.stringify(pegaConfig['server-config']);
|
|
762
862
|
}
|
|
763
863
|
|
|
@@ -1356,7 +1456,8 @@ if (showDebug) addDebugLog("updateC11NB2SForInfinity", "", "");
|
|
|
1356
1456
|
|
|
1357
1457
|
const objOauthData = JSON.parse(OAuthData);
|
|
1358
1458
|
objOauthData["C11NB2S"] = bootstrap.tokens.C11NB2S;
|
|
1359
|
-
objOauthData["appStaticContentServer"] = bootstrap.serviceConfig.appStaticContentServer;
|
|
1459
|
+
// objOauthData["appStaticContentServer"] = bootstrap.serviceConfig.appStaticContentServer;
|
|
1460
|
+
objOauthData["appStaticContentServer"] = (bootstrap.serviceConfig.appStaticContentServer != "no-cdn" && bootstrap.serviceConfig.appStaticContentServer != "") ? bootstrap.serviceConfig.appStaticContentServer : bootstrap.serviceConfig.staticContentServer;
|
|
1360
1461
|
|
|
1361
1462
|
// write out file
|
|
1362
1463
|
fs.writeFileSync(TOKEN_PATH, JSON.stringify(objOauthData), { encoding: 'utf8',flag:'w' });
|
|
@@ -15,7 +15,7 @@ export default meta;
|
|
|
15
15
|
type Story = StoryObj<typeof PegaDxilMyCaseWidget>;
|
|
16
16
|
|
|
17
17
|
if (!window.PCore) {
|
|
18
|
-
window.PCore = {};
|
|
18
|
+
window.PCore = {} as any;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const BasePegaDxilMyCaseWidget: Story = (args: any) => {
|
|
@@ -25,7 +25,7 @@ export const BasePegaDxilMyCaseWidget: 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 BasePegaDxilMyCaseWidget: 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 BasePegaDxilMyCaseWidget: Story = (args: any) => {
|
|
|
43
43
|
resolve(historyData);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
};
|
|
46
|
+
} as any;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
const props = {
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx
CHANGED
|
@@ -15,7 +15,7 @@ export default meta;
|
|
|
15
15
|
type Story = StoryObj<typeof PegaDxilMyDate>;
|
|
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 BasePegaDxilMyDate: Story = args => {
|
|
@@ -14,7 +14,7 @@ type Story = StoryObj<typeof PegaDxilMyDateTime>;
|
|
|
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 BasePegaDxilMyDateTime: Story = (args: any) => {
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export default meta;
|
|
|
21
21
|
type Story = StoryObj<typeof PegaDxilMyDetails>;
|
|
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) => {
|
|
@@ -15,7 +15,7 @@ export default meta;
|
|
|
15
15
|
type Story = StoryObj<typeof PegaDxilMyIconButtonUrl>;
|
|
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 BasePegaDxilMyIconButtonUrl: Story = (args: any) => {
|
|
|
49
49
|
resolve(statelistData);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
};
|
|
52
|
+
} as any;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const props = {
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx
CHANGED
|
@@ -19,7 +19,7 @@ type Story = StoryObj<typeof PegaDxilMyPage>;
|
|
|
19
19
|
|
|
20
20
|
export const BasePegaDxilMyPage: 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 BasePegaDxilMyPage: 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 PegaDxilMyPageCaseWidget>;
|
|
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 BasePegaDxilMyPageCaseWidget: Story = (args: any) => {
|
|
@@ -17,7 +17,7 @@ export default meta;
|
|
|
17
17
|
type Story = StoryObj<typeof PegaDxilMyPageWidget>;
|
|
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 BasePegaDxilMyPageWidget: Story = (args: any) => {
|
|
|
59
59
|
resolve(worklistData);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
};
|
|
62
|
+
} as any;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
const props = {
|