@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.
- package/package.json +1 -1
- package/src/constants.js +3 -0
- 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/export-archive/helper.js +14 -0
- package/src/tasks/export-archive/index.js +151 -28
- 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 +5 -4
- package/src/tasks/publish/index.js +34 -18
- package/src/tasks/publish-lib/index.js +19 -2
- 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/util.js +144 -16
- 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/localLibCreateLibExportImportLib.test.js +1 -1
- package/tests/functional/localLibCreateLibExportLib.test.js +1 -1
- package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "{{projectName}}",
|
|
3
3
|
"description": "{{description}}",
|
|
4
4
|
"organization": "{{organization}}",
|
|
5
|
+
"version": "1.0.0",
|
|
5
6
|
"main": "src/index.js",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"scripts": {
|
|
@@ -77,9 +78,9 @@
|
|
|
77
78
|
"author": "",
|
|
78
79
|
"license": "Enter License",
|
|
79
80
|
"dependencies": {
|
|
80
|
-
"@pega/cosmos-react-condition-builder": "
|
|
81
|
-
"@pega/cosmos-react-core": "
|
|
82
|
-
"@pega/cosmos-react-work": "
|
|
81
|
+
"@pega/cosmos-react-condition-builder": "^7.1.2",
|
|
82
|
+
"@pega/cosmos-react-core": "^7.1.2",
|
|
83
|
+
"@pega/cosmos-react-work": "^7.1.2",
|
|
83
84
|
"@pega/eslint-config": "^0.10.2",
|
|
84
85
|
"@pega/tsconfig": "^0.15.1",
|
|
85
86
|
"babel-loader": "^9.1.3",
|
|
@@ -100,7 +101,7 @@
|
|
|
100
101
|
},
|
|
101
102
|
"devDependencies": {
|
|
102
103
|
"@pega/configs": "^0.15.1",
|
|
103
|
-
"@pega/custom-dx-components": "~0.242.
|
|
104
|
+
"@pega/custom-dx-components": "~0.242.68",
|
|
104
105
|
"@pega/pcore-pconnect-typedefs": "3.2.1",
|
|
105
106
|
"@storybook/addon-actions": "^7.6.19",
|
|
106
107
|
"@storybook/addon-essentials": "^7.6.19",
|
|
@@ -6,7 +6,7 @@ import fs from 'fs';
|
|
|
6
6
|
import validate from '../validator/index.js';
|
|
7
7
|
import bundleComponent from '../bundle/index.js';
|
|
8
8
|
import { lintComponent } from '../linter/index.js';
|
|
9
|
-
import { getComponentDirectoryPath, showVersion, getLibraryBased, addDebugLog, getPegaServerConfig, updateServerConfigRuleSetAndVersion, checkLibraryAndArchives, getConfigDevBuild, checkJWTExpiration, getConfigDefaults } from '../../util.js';
|
|
9
|
+
import { getComponentDirectoryPath, showVersion, getLibraryBased, getUseInputConfig, addDebugLog, getPegaServerConfig, updateServerConfigRuleSetAndVersion, checkLibraryAndArchives, getConfigDevBuild, checkJWTExpiration, getConfigDefaults, getInputConfigForCommand } from '../../util.js';
|
|
10
10
|
|
|
11
11
|
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
12
12
|
import { default as buildLibrary } from '../build-lib/index.js';
|
|
@@ -21,6 +21,7 @@ export default async options => {
|
|
|
21
21
|
await showVersion();
|
|
22
22
|
await checkLibraryAndArchives();
|
|
23
23
|
const isLibraryBased = getLibraryBased();
|
|
24
|
+
const useInputConfig = getUseInputConfig();
|
|
24
25
|
|
|
25
26
|
addDebugLog("publish", "", "+");
|
|
26
27
|
|
|
@@ -37,34 +38,49 @@ addDebugLog("publish", "", "+");
|
|
|
37
38
|
const currentVersion = orgLib.buildVersion;
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
if (useInputConfig) {
|
|
42
|
+
const inputConfig = await getInputConfigForCommand("publish");
|
|
43
|
+
|
|
44
|
+
console.log("Input config: ");
|
|
45
|
+
console.log(inputConfig);
|
|
46
|
+
|
|
47
|
+
if (inputConfig.okToPublish ) {
|
|
48
|
+
if (devBuild || (!devBuild && inputConfig.okToPublishPermanent)) {
|
|
49
|
+
okToPublish = true;
|
|
50
|
+
}
|
|
40
51
|
|
|
41
|
-
const publishThisVersion = await inquirer.prompt([
|
|
42
|
-
{
|
|
43
|
-
name: 'confirmPublish',
|
|
44
|
-
type: 'confirm',
|
|
45
|
-
message: `Publish ${chalk.bold.green(`${orgLib.displayLibVersion}`)}, proceed ?`,
|
|
46
|
-
default: true
|
|
47
52
|
}
|
|
48
|
-
]);
|
|
49
53
|
|
|
50
|
-
if (publishThisVersion.confirmPublish) {
|
|
51
|
-
okToPublish = true;
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
okToPublish = false;
|
|
56
|
-
console.log("");
|
|
57
|
-
const publishAnswers = await inquirer.prompt([
|
|
55
|
+
else {
|
|
56
|
+
const publishThisVersion = await inquirer.prompt([
|
|
58
57
|
{
|
|
59
58
|
name: 'confirmPublish',
|
|
60
59
|
type: 'confirm',
|
|
61
|
-
message: `
|
|
62
|
-
default:
|
|
60
|
+
message: `Publish ${chalk.bold.green(`${orgLib.displayLibVersion}`)}, proceed ?`,
|
|
61
|
+
default: true
|
|
63
62
|
}
|
|
64
63
|
]);
|
|
65
|
-
|
|
64
|
+
|
|
65
|
+
if (publishThisVersion.confirmPublish) {
|
|
66
66
|
okToPublish = true;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
if (okToPublish && !devBuild) {
|
|
70
|
+
okToPublish = false;
|
|
71
|
+
console.log("");
|
|
72
|
+
const publishAnswers = await inquirer.prompt([
|
|
73
|
+
{
|
|
74
|
+
name: 'confirmPublish',
|
|
75
|
+
type: 'confirm',
|
|
76
|
+
message: `You are about to publish a ${chalk.bold.yellow('PRODUCTION')} version which can ${chalk.bold.yellow('NOT')} be deleted, proceed ?`,
|
|
77
|
+
default: false
|
|
78
|
+
}
|
|
79
|
+
]);
|
|
80
|
+
if (publishAnswers.confirmPublish) {
|
|
81
|
+
okToPublish = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
if (okToPublish) {
|
|
@@ -4,7 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
6
|
import { lintComponent } from '../linter/index.js';
|
|
7
|
-
import { getComponentDirectoryPath, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deletePublishExtras, addDebugLog, checkLibraryAndArchives, checkJWTExpiration, getConfigDefaults } from '../../util.js';
|
|
7
|
+
import { getComponentDirectoryPath, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deletePublishExtras, addDebugLog, checkLibraryAndArchives, checkJWTExpiration, getConfigDefaults, getUseInputConfig, getInputConfigForCommand } from '../../util.js';
|
|
8
8
|
|
|
9
9
|
import { publishLib, listLibJSONResponse, deleteLibVersion } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
10
10
|
|
|
@@ -178,6 +178,11 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
178
178
|
({version} = versionAnswers);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
const useInputConfig = getUseInputConfig();
|
|
182
|
+
let inputConfig = {};
|
|
183
|
+
if (useInputConfig) {
|
|
184
|
+
inputConfig = await getInputConfigForCommand("publish");
|
|
185
|
+
}
|
|
181
186
|
|
|
182
187
|
let okToPublish = true;
|
|
183
188
|
|
|
@@ -190,6 +195,8 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
190
195
|
|
|
191
196
|
if (!version.includes("-dev") && !internalPublish) {
|
|
192
197
|
okToPublish = false;
|
|
198
|
+
|
|
199
|
+
|
|
193
200
|
const publishAnswers = await inquirer.prompt([
|
|
194
201
|
|
|
195
202
|
{
|
|
@@ -204,6 +211,9 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
213
|
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
207
217
|
if (noRealPublish) {
|
|
208
218
|
// this is as far as JEST test can go since need server for rest and don't want to use server.
|
|
209
219
|
console.log("OK to publish.");
|
|
@@ -218,8 +228,15 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
218
228
|
|
|
219
229
|
await deletePublishExtras(libraryName, version);
|
|
220
230
|
|
|
231
|
+
if (useInputConfig) {
|
|
232
|
+
if (inputConfig.okToOverride) {
|
|
233
|
+
// to override
|
|
234
|
+
overrideExisting = true;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
221
237
|
|
|
222
|
-
|
|
238
|
+
|
|
239
|
+
if (libVersionExists && !overrideExisting) {
|
|
223
240
|
console.log("\nLibrary " + chalk.bold.yellow(`${libraryName}/${version}`) + " already exists.");
|
|
224
241
|
const questions = [
|
|
225
242
|
{
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
setConfigDevBuild,
|
|
14
14
|
updateConfigVersion,
|
|
15
15
|
checkLibraryAndArchives,
|
|
16
|
+
getUseInputConfig,
|
|
17
|
+
getInputConfigForCommand,
|
|
16
18
|
forceDefaultsUpdate } from '../../util.js';
|
|
17
19
|
import { showCurrentStatus } from '../show-status/index.js';
|
|
18
20
|
|
|
@@ -126,6 +128,8 @@ addDebugLog("setPermanent", "", "");
|
|
|
126
128
|
|
|
127
129
|
export default async options => {
|
|
128
130
|
const isLibraryBased = getLibraryBased();
|
|
131
|
+
const useInputConfig = getUseInputConfig();
|
|
132
|
+
|
|
129
133
|
if (!isLibraryBased) {
|
|
130
134
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
|
|
131
135
|
process.exit();
|
|
@@ -136,9 +140,17 @@ addDebugLog("setPerm", "", "+");
|
|
|
136
140
|
await checkLibraryAndArchives();
|
|
137
141
|
|
|
138
142
|
let inputYN = "";
|
|
143
|
+
if (useInputConfig) {
|
|
144
|
+
const inputConfig = await getInputConfigForCommand("setPermanent");
|
|
145
|
+
inputYN = inputConfig.makePermanent;
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
|
|
150
|
+
if (options.params.length >= 4) {
|
|
151
|
+
inputYN = options.params[3];
|
|
152
|
+
}
|
|
139
153
|
|
|
140
|
-
if (options.params.length >= 4) {
|
|
141
|
-
inputYN = options.params[3];
|
|
142
154
|
}
|
|
143
155
|
|
|
144
156
|
// await showCurrentStatus();
|
|
@@ -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;
|