@pega/custom-dx-components 0.25.26 → 0.25.28
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 +27 -27
- package/src/constants.js +2 -0
- package/src/tasks/create-lib/index.js +89 -1
- package/src/tasks/create-version/index.js +68 -21
- package/src/tasks/delete-lib/index.js +43 -15
- package/src/tasks/delete-version/index.js +37 -9
- package/src/tasks/import-archive/index.js +144 -102
- package/src/tasks/import-comp/index.js +33 -14
- package/src/tasks/init/template/.storybook/{main.js → main.ts} +4 -3
- package/src/tasks/init/template/.storybook/manager.ts +6 -0
- package/src/tasks/init/template/.storybook/preview.tsx +4 -1
- package/src/tasks/init/template/.storybook/theme.js +1 -1
- package/src/tasks/init/template/package.json.mustache +40 -38
- package/src/tasks/publish/index.js +37 -11
- package/src/tasks/set-perm/index.js +15 -2
- package/src/tasks/switch-lib/index.js +89 -36
- package/src/tasks/switch-version/index.js +74 -14
- package/src/util.js +75 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/custom-dx-components",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.28",
|
|
4
4
|
"description": "Utility for building custom UI components",
|
|
5
5
|
"bin": "./bin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,53 +15,53 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/core": "^7.
|
|
19
|
-
"@babel/plugin-transform-class-properties": "^7.
|
|
20
|
-
"@babel/preset-react": "^7.
|
|
21
|
-
"@pega/auth": "^0.2.
|
|
18
|
+
"@babel/core": "^7.27.1",
|
|
19
|
+
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
20
|
+
"@babel/preset-react": "^7.27.1",
|
|
21
|
+
"@pega/auth": "^0.2.24",
|
|
22
22
|
"@pega/constellation-dx-components-build-utils": "^2.0.3-dev",
|
|
23
23
|
"@pega/inquirer-fuzzy-path": "^3.0.0",
|
|
24
24
|
"ajv": "^8.17.1",
|
|
25
25
|
"ajv-keywords": "^5.1.0",
|
|
26
26
|
"archiver": "^7.0.1",
|
|
27
27
|
"arg": "^5.0.2",
|
|
28
|
-
"babel-loader": "^
|
|
28
|
+
"babel-loader": "^10.0.0",
|
|
29
29
|
"chalk": "^5.4.1",
|
|
30
30
|
"check-git": "^2.0.2",
|
|
31
|
-
"compression-webpack-plugin": "^
|
|
32
|
-
"css-loader": "
|
|
33
|
-
"css-minimizer-webpack-plugin": "^
|
|
31
|
+
"compression-webpack-plugin": "^11.1.0",
|
|
32
|
+
"css-loader": "7.1.2",
|
|
33
|
+
"css-minimizer-webpack-plugin": "^7.0.2",
|
|
34
34
|
"eslint": "^8.56.0",
|
|
35
|
-
"execa": "^
|
|
35
|
+
"execa": "^9.5.2",
|
|
36
36
|
"file-loader": "6.2.0",
|
|
37
37
|
"fs-extra": "^11.3.0",
|
|
38
38
|
"gitignore": "^0.7.0",
|
|
39
39
|
"inquirer": "^9.3.7",
|
|
40
40
|
"jwt-decode": "^4.0.0",
|
|
41
|
-
"listr2": "^8.
|
|
42
|
-
"mini-css-extract-plugin": "2.
|
|
41
|
+
"listr2": "^8.3.3",
|
|
42
|
+
"mini-css-extract-plugin": "2.9.2",
|
|
43
43
|
"mustache": "^4.2.0",
|
|
44
44
|
"ncp": "^2.0.0",
|
|
45
45
|
"node-fetch": "^3.3.2",
|
|
46
46
|
"node-stream-zip": "^1.15.0",
|
|
47
|
-
"ora": "^8.
|
|
47
|
+
"ora": "^8.2.0",
|
|
48
48
|
"pascalcase": "^2.0.0",
|
|
49
|
-
"postcss": "^8.5.
|
|
50
|
-
"postcss-loader": "
|
|
51
|
-
"postcss-preset-env": "
|
|
49
|
+
"postcss": "^8.5.3",
|
|
50
|
+
"postcss-loader": "8.1.1",
|
|
51
|
+
"postcss-preset-env": "10.1.6",
|
|
52
52
|
"prop-types": "^15.8.1",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-dev-utils": "^12.0.1",
|
|
55
55
|
"resolve": "1.22.10",
|
|
56
56
|
"resolve-url-loader": "^5.0.0",
|
|
57
|
-
"sass-loader": "^
|
|
58
|
-
"terser-webpack-plugin": "5.3.
|
|
57
|
+
"sass-loader": "^16.0.5",
|
|
58
|
+
"terser-webpack-plugin": "5.3.14",
|
|
59
59
|
"ts-loader": "^9.5.2",
|
|
60
|
-
"typescript": "~5.
|
|
60
|
+
"typescript": "~5.8.3",
|
|
61
61
|
"unarchive": "^1.1.3",
|
|
62
62
|
"url-loader": "4.1.1",
|
|
63
|
-
"webpack": "5.
|
|
64
|
-
"webpack-cli": "^
|
|
63
|
+
"webpack": "5.99.8",
|
|
64
|
+
"webpack-cli": "^6.0.1"
|
|
65
65
|
},
|
|
66
66
|
"author": "Custom component dev",
|
|
67
67
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -70,16 +70,16 @@
|
|
|
70
70
|
"custom-components"
|
|
71
71
|
],
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@babel/preset-env": "^7.
|
|
74
|
-
"@pega/configs": "^0.16.
|
|
75
|
-
"@pega/prettier-config": "^0.16.
|
|
73
|
+
"@babel/preset-env": "^7.27.2",
|
|
74
|
+
"@pega/configs": "^0.16.3",
|
|
75
|
+
"@pega/prettier-config": "^0.16.3",
|
|
76
76
|
"@types/jest": "^29.5.14",
|
|
77
77
|
"babel-jest": "^29.7.0",
|
|
78
|
-
"cspell": "^8.
|
|
78
|
+
"cspell": "^8.19.4",
|
|
79
79
|
"jest": "^29.7.0",
|
|
80
80
|
"jest-environment-jsdom": "^29.7.0",
|
|
81
81
|
"jest-junit": "^16.0.0",
|
|
82
|
-
"prettier": "3.
|
|
83
|
-
"ts-jest": "^29.2
|
|
82
|
+
"prettier": "3.5.3",
|
|
83
|
+
"ts-jest": "^29.3.2"
|
|
84
84
|
}
|
|
85
85
|
}
|
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 PACKAGE_LOCK_JSON_FILENAME = 'package-lock.json';
|
|
5
6
|
export const BUILD_CONFIG_JSON_FILENAME = 'build.config.json';
|
|
@@ -14,6 +15,7 @@ export const TOKEN_PATH = 'node_modules/@pega/custom-dx-components/.access_token
|
|
|
14
15
|
export const OOTB_COMPONENTS = 'node_modules/@pega/custom-dx-components/.ootb_components';
|
|
15
16
|
export const LIBRARY_BASED = 'libraryMode';
|
|
16
17
|
export const LIBRARY_BASED_CL = 'libraryModeCL';
|
|
18
|
+
export const USE_INPUT_CONFIG = 'useInputConfig';
|
|
17
19
|
export const SHARED_DIRECTORY = 'shared';
|
|
18
20
|
export const SHOW_DEBUG = 'showDebug';
|
|
19
21
|
export const ARCHIVES_PATH = 'store';
|
|
@@ -19,7 +19,10 @@ import {
|
|
|
19
19
|
cleanUpTemp,
|
|
20
20
|
restoreTopLevelConfigFilesFromTemplate,
|
|
21
21
|
getHaveDependencyDifference,
|
|
22
|
-
setConfigDevBuild
|
|
22
|
+
setConfigDevBuild,
|
|
23
|
+
getUseInputConfig,
|
|
24
|
+
getInputConfigForCommand,
|
|
25
|
+
convertYNToBoolean
|
|
23
26
|
} from '../../util.js';
|
|
24
27
|
|
|
25
28
|
import { getCreateLibComponentQuestions, getOkToProceedQuestion, updateAllComponentsConfig, getCurrentOrOriginalQuestion } from './helper.js';
|
|
@@ -28,6 +31,7 @@ import { showCurrentStatus } from '../show-status/index.js';
|
|
|
28
31
|
export default async options => {
|
|
29
32
|
const isLibraryBased = getLibraryBased();
|
|
30
33
|
const isLibraryBasedCL = getLibraryBasedCL();
|
|
34
|
+
const useInputConfig = getUseInputConfig();
|
|
31
35
|
if (!isLibraryBased) {
|
|
32
36
|
console.log(`Command only supported for ${chalk.bold.green('library based')} components.`);
|
|
33
37
|
process.exit();
|
|
@@ -36,6 +40,90 @@ export default async options => {
|
|
|
36
40
|
await showVersion();
|
|
37
41
|
await cleanUpTemp();
|
|
38
42
|
|
|
43
|
+
// if we have choosen to use INPUT CONFIG FILE
|
|
44
|
+
// process and exit
|
|
45
|
+
if (useInputConfig) {
|
|
46
|
+
const inputConfig = await getInputConfigForCommand("createLib");
|
|
47
|
+
|
|
48
|
+
if (convertYNToBoolean(inputConfig.okToContinue)) {
|
|
49
|
+
const libraryName = inputConfig.libraryName;
|
|
50
|
+
let version = inputConfig.libraryVersion;
|
|
51
|
+
const currentOrOriginal = inputConfig.currentOrOriginal;
|
|
52
|
+
const isPermanent = inputConfig.isPermanent;
|
|
53
|
+
let permBuild = convertYNToBoolean(isPermanent);
|
|
54
|
+
|
|
55
|
+
// if have store, then that means there is a current library, so
|
|
56
|
+
// store it before clearing out /src/components
|
|
57
|
+
|
|
58
|
+
const hasArch = await hasArchives();
|
|
59
|
+
const orgLib = getConfigDefaults();
|
|
60
|
+
const newOrgLib = `${orgLib.organization}_${libraryName}`;
|
|
61
|
+
|
|
62
|
+
if (hasArch) {
|
|
63
|
+
const hasLib = await hasLibraryAndVersion(libraryName, version, !permBuild);
|
|
64
|
+
if (hasLib) {
|
|
65
|
+
console.log(`${chalk.bold.red(`Library ${orgLib.organization}_${libraryName} already exists.`)}`);
|
|
66
|
+
console.log("You can switch to that library by entering 'npm run switchLib'.\n")
|
|
67
|
+
process.exit();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const currentOrgLib = orgLib.currentOrgLib;
|
|
71
|
+
const currentVersion = orgLib.buildVersion;
|
|
72
|
+
await zipVersionAndArchive(currentOrgLib, currentVersion);
|
|
73
|
+
await clearSrcComponentsDirectory();
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (isLibraryBasedCL) {
|
|
78
|
+
// no -dev for PegaInfinity
|
|
79
|
+
permBuild = true;
|
|
80
|
+
}
|
|
81
|
+
// await setConfigDevBuild(!permBuild);
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if (!permBuild) {
|
|
85
|
+
version = version.concat("-dev");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (currentOrOriginal === 'Original') {
|
|
89
|
+
await restoreTopLevelConfigFilesFromTemplate();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// update library name in config and create a blank archive
|
|
93
|
+
await updateComponentDefaultLibrary(libraryName);
|
|
94
|
+
await zipVersionAndArchive(newOrgLib, version);
|
|
95
|
+
|
|
96
|
+
// if didn't have an archive, in case you currently have components there
|
|
97
|
+
// update the config jsons
|
|
98
|
+
if (!hasArch) {
|
|
99
|
+
await updateAllComponentsConfig(version);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
console.log(`${chalk.bold.green(`\nLibrary ${newOrgLib}/${version} has been created!\n`)}`);
|
|
103
|
+
|
|
104
|
+
await forceDefaultsUpdate();
|
|
105
|
+
await showCurrentStatus();
|
|
106
|
+
|
|
107
|
+
if (currentOrOriginal === 'Original') {
|
|
108
|
+
if (getHaveDependencyDifference()) {
|
|
109
|
+
|
|
110
|
+
console.log('\n***************************************************************');
|
|
111
|
+
console.log(chalk.bold.yellow('Dependencies have changed between libraries, recommend updating.'));
|
|
112
|
+
console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
|
|
113
|
+
console.log('***************************************************************\n');
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
process.exit();
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
39
127
|
addDebugLog("createLibrary", "", "+");
|
|
40
128
|
let libraryName = "";
|
|
41
129
|
let version;
|
|
@@ -18,7 +18,12 @@ import {
|
|
|
18
18
|
getConfigDefaults,
|
|
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 { getCreateVersionComponentQuestions, updateAllComponentsConfig, getCreateVersionComponentCLQuestions } from './helper.js';
|
|
@@ -26,7 +31,8 @@ import { showCurrentStatus } from '../show-status/index.js';
|
|
|
26
31
|
|
|
27
32
|
export default async options => {
|
|
28
33
|
const isLibraryBased = getLibraryBased();
|
|
29
|
-
const isLibraryBasedCL = getLibraryBasedCL()
|
|
34
|
+
const isLibraryBasedCL = getLibraryBasedCL();
|
|
35
|
+
const useInputConfig = getUseInputConfig();
|
|
30
36
|
|
|
31
37
|
if (!isLibraryBased) {
|
|
32
38
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
|
|
@@ -48,35 +54,76 @@ addDebugLog("createVersion", "", "+");
|
|
|
48
54
|
const currentDirectory = process.cwd();
|
|
49
55
|
const componentDirectory = join (currentDirectory, "src", "components");
|
|
50
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");
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
if (convertYNToBoolean(inputConfig.okToContinue)) {
|
|
63
|
+
version = inputConfig.libraryVersion;
|
|
64
|
+
const isPermanent = inputConfig.isPermanent;
|
|
65
|
+
permBuild = convertYNToBoolean(isPermanent);
|
|
66
|
+
copyExisting = convertYNToBoolean(inputConfig.copyComponents);
|
|
56
67
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
if (isLibraryBasedCL) {
|
|
69
|
+
// no -dev for PegaInfinity
|
|
70
|
+
permBuild = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const hasArch = await hasArchives();
|
|
74
|
+
const orgLib = getConfigDefaults();
|
|
75
|
+
const hasLib = await hasLibraryAndVersion(orgLib.library, version, !permBuild);
|
|
76
|
+
if (hasArch) {
|
|
77
|
+
if (hasLib) {
|
|
78
|
+
console.log(`${chalk.bold.red(`Library ${orgLib.displayLibVersion} already exists.`)}`);
|
|
79
|
+
console.log("You can switch to that library by entering 'npm run switchLib'.\n")
|
|
80
|
+
process.exit();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
console.log(`${chalk.bold.red(`No libraries exist.`)}`);
|
|
85
|
+
console.log("You need to create a library first via 'npm run createLib'.\n")
|
|
86
|
+
process.exit();
|
|
61
87
|
}
|
|
62
|
-
}
|
|
63
88
|
|
|
64
|
-
permBuild = !!(dPerm === 'Y' || dPerm === 'y' || dPerm === true || dPerm === 'true');
|
|
65
|
-
copyExisting = !!(copyExist === 'Y' || copyExist === 'y' || copyExist === true || copyExist === 'true');
|
|
66
89
|
|
|
67
|
-
} else {
|
|
68
|
-
if (isLibraryBasedCL) {
|
|
69
|
-
const questions = await getCreateVersionComponentCLQuestions();
|
|
70
|
-
const answers = await inquirer.prompt(questions);
|
|
71
|
-
({ version, copyExisting } = answers);
|
|
72
90
|
}
|
|
73
91
|
else {
|
|
74
|
-
|
|
75
|
-
const answers = await inquirer.prompt(questions);
|
|
76
|
-
({ version, permBuild, copyExisting } = answers);
|
|
92
|
+
process.exit();
|
|
77
93
|
}
|
|
78
94
|
|
|
79
95
|
}
|
|
96
|
+
else {
|
|
97
|
+
if (options.params.length >= 6) {
|
|
98
|
+
version = options.params[3];
|
|
99
|
+
const dPerm = options.params[4];
|
|
100
|
+
const copyExist = options.params[5]
|
|
101
|
+
|
|
102
|
+
// if have [6] will be "NoAbout" from Jest, to turn off build date
|
|
103
|
+
if (options.params.length >= 7 ) {
|
|
104
|
+
if (options.params[6] === "NoAbout") {
|
|
105
|
+
modAddAboutData(false);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
permBuild = !!(dPerm === 'Y' || dPerm === 'y' || dPerm === true || dPerm === 'true');
|
|
110
|
+
copyExisting = !!(copyExist === 'Y' || copyExist === 'y' || copyExist === true || copyExist === 'true');
|
|
111
|
+
|
|
112
|
+
} else {
|
|
113
|
+
if (isLibraryBasedCL) {
|
|
114
|
+
const questions = await getCreateVersionComponentCLQuestions();
|
|
115
|
+
const answers = await inquirer.prompt(questions);
|
|
116
|
+
({ version, copyExisting } = answers);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const questions = await getCreateVersionComponentQuestions();
|
|
120
|
+
const answers = await inquirer.prompt(questions);
|
|
121
|
+
({ version, permBuild, copyExisting } = answers);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
80
127
|
|
|
81
128
|
if (isLibraryBasedCL) {
|
|
82
129
|
// no -dev for PegaInfinity
|
|
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import {
|
|
5
5
|
showVersion,
|
|
6
6
|
getLibraryBased,
|
|
7
|
+
getLibraryBasedCL,
|
|
7
8
|
checkLibraryAndArchives,
|
|
8
9
|
addDebugLog,
|
|
9
10
|
getConfigDefaults,
|
|
@@ -17,7 +18,10 @@ import {
|
|
|
17
18
|
deleteArchives,
|
|
18
19
|
forceDefaultsUpdate,
|
|
19
20
|
restoreFromArchive,
|
|
20
|
-
cleanUpTemp
|
|
21
|
+
cleanUpTemp,
|
|
22
|
+
getUseInputConfig,
|
|
23
|
+
getInputConfigForCommand,
|
|
24
|
+
convertYNToBoolean
|
|
21
25
|
} from '../../util.js';
|
|
22
26
|
|
|
23
27
|
import { getDeleteLibraryQuestions, getLibraryVersionQuestion } from './helper.js';
|
|
@@ -209,6 +213,9 @@ addDebugLog("deleteLibraryVersion", "END", "-");
|
|
|
209
213
|
|
|
210
214
|
export default async (options) => {
|
|
211
215
|
const isLibraryBased = getLibraryBased();
|
|
216
|
+
const isLibraryBasedCL = getLibraryBasedCL();
|
|
217
|
+
const useInputConfig = getUseInputConfig();
|
|
218
|
+
|
|
212
219
|
if (!isLibraryBased) {
|
|
213
220
|
console.log(`Command only supported for ${chalk.bold.green('library based')} components.`)
|
|
214
221
|
process.exit();
|
|
@@ -227,33 +234,54 @@ addDebugLog("deleteLibrary", "", "+");
|
|
|
227
234
|
const compDef = getConfigDefaults();
|
|
228
235
|
let libraryName;
|
|
229
236
|
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
|
|
237
|
+
if (useInputConfig) {
|
|
238
|
+
const inputConfig = await getInputConfigForCommand("deleteLib");
|
|
239
|
+
libraryName = inputConfig.libraryName;
|
|
240
|
+
version = inputConfig.libraryVersion;
|
|
241
|
+
const isPermanent = inputConfig.isPermanent;
|
|
242
|
+
let permBuild = convertYNToBoolean(isPermanent);
|
|
243
|
+
|
|
244
|
+
if (isLibraryBasedCL) {
|
|
245
|
+
// no -dev for PegaInfinity
|
|
246
|
+
permBuild = true;
|
|
247
|
+
}
|
|
233
248
|
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
|
|
249
|
+
if (!permBuild && version != "ALL") {
|
|
250
|
+
version = version.concat("-dev");
|
|
237
251
|
}
|
|
238
252
|
|
|
253
|
+
okToDelete = convertYNToBoolean(inputConfig.confirmDelete);
|
|
239
254
|
|
|
240
255
|
}
|
|
241
256
|
else {
|
|
242
|
-
|
|
243
|
-
if (options.params.length === 4) {
|
|
257
|
+
if (options.params.length >= 5) {
|
|
244
258
|
libraryName = options.params[3];
|
|
245
|
-
version =
|
|
259
|
+
version = options.params[4];
|
|
260
|
+
|
|
261
|
+
if (options.params.length >=6 ) {
|
|
262
|
+
const okToDel = options.params[5];
|
|
263
|
+
okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
246
267
|
}
|
|
247
268
|
else {
|
|
248
|
-
const questions = await getDeleteLibraryQuestions();
|
|
249
|
-
const answers = await inquirer.prompt(questions);
|
|
250
|
-
({ libraryName } = answers);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
269
|
|
|
270
|
+
if (options.params.length === 4) {
|
|
271
|
+
libraryName = options.params[3];
|
|
272
|
+
version = "ALL"
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
const questions = await getDeleteLibraryQuestions();
|
|
276
|
+
const answers = await inquirer.prompt(questions);
|
|
277
|
+
({ libraryName } = answers);
|
|
278
|
+
}
|
|
254
279
|
|
|
280
|
+
}
|
|
255
281
|
}
|
|
256
282
|
|
|
283
|
+
|
|
284
|
+
|
|
257
285
|
await deleteLibraryVersion(libraryName, version, okToDelete);
|
|
258
286
|
|
|
259
287
|
|
|
@@ -3,10 +3,14 @@ import chalk from 'chalk';
|
|
|
3
3
|
import {
|
|
4
4
|
showVersion,
|
|
5
5
|
getLibraryBased,
|
|
6
|
+
getLibraryBasedCL,
|
|
6
7
|
checkLibraryAndArchives,
|
|
7
8
|
getConfigDefaults,
|
|
8
9
|
addDebugLog,
|
|
9
|
-
cleanUpTemp
|
|
10
|
+
cleanUpTemp,
|
|
11
|
+
getUseInputConfig,
|
|
12
|
+
getInputConfigForCommand,
|
|
13
|
+
convertYNToBoolean
|
|
10
14
|
} from '../../util.js';
|
|
11
15
|
|
|
12
16
|
import { deleteLibraryVersion } from '../delete-lib/index.js';
|
|
@@ -14,6 +18,9 @@ import { deleteLibraryVersion } from '../delete-lib/index.js';
|
|
|
14
18
|
|
|
15
19
|
export default async (options) => {
|
|
16
20
|
const isLibraryBased = getLibraryBased();
|
|
21
|
+
const isLibraryBasedCL = getLibraryBasedCL();
|
|
22
|
+
const useInputConfig = getUseInputConfig();
|
|
23
|
+
|
|
17
24
|
if (!isLibraryBased) {
|
|
18
25
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
|
|
19
26
|
process.exit();
|
|
@@ -32,19 +39,40 @@ addDebugLog("deleteVersion", "", "+");
|
|
|
32
39
|
const configDef = getConfigDefaults();
|
|
33
40
|
let libraryName = configDef.currentOrgLib;
|
|
34
41
|
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
version =
|
|
42
|
+
if (useInputConfig) {
|
|
43
|
+
const inputConfig = await getInputConfigForCommand("deleteLibVersion");
|
|
44
|
+
version = inputConfig.libraryVersion;
|
|
45
|
+
const isPermanent = inputConfig.isPermanent;
|
|
46
|
+
let permBuild = convertYNToBoolean(isPermanent);
|
|
47
|
+
|
|
48
|
+
if (isLibraryBasedCL) {
|
|
49
|
+
// no -dev for PegaInfinity
|
|
50
|
+
permBuild = true;
|
|
51
|
+
}
|
|
38
52
|
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
|
|
53
|
+
if (!permBuild && version != "ALL") {
|
|
54
|
+
version = version.concat("-dev");
|
|
42
55
|
}
|
|
56
|
+
|
|
57
|
+
okToDelete = convertYNToBoolean(inputConfig.confirmDelete);
|
|
43
58
|
}
|
|
44
|
-
else
|
|
45
|
-
|
|
59
|
+
else {
|
|
60
|
+
if (options.params.length >= 5) {
|
|
61
|
+
libraryName = options.params[3]
|
|
62
|
+
version = options.params[4];
|
|
63
|
+
|
|
64
|
+
if (options.params.length >=6 ) {
|
|
65
|
+
const okToDel = options.params[5];
|
|
66
|
+
okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (options.params.length >= 4) {
|
|
70
|
+
libraryName = options.params[3];
|
|
71
|
+
}
|
|
46
72
|
}
|
|
47
73
|
|
|
74
|
+
|
|
75
|
+
|
|
48
76
|
await deleteLibraryVersion(libraryName, version, okToDelete);
|
|
49
77
|
|
|
50
78
|
|