@pega/custom-dx-components 0.24.16 → 0.242.2
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 +2 -1
- package/src/cli.js +32 -2
- package/src/constants.js +9 -0
- package/src/tasks/authenticate/index.js +12 -1
- package/src/tasks/build-lib/helper.js +71 -0
- package/src/tasks/build-lib/index.js +165 -0
- package/src/tasks/create/index.js +59 -6
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/HighlightRender.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/HighlightRender.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +1 -0
- package/src/tasks/create-all/index.js +57 -6
- package/src/tasks/delete/index.js +8 -2
- package/src/tasks/delete-all/index.js +8 -2
- package/src/tasks/delete-lib/helper.js +75 -0
- package/src/tasks/delete-lib/index.js +97 -0
- package/src/tasks/index.js +5 -0
- package/src/tasks/init/template/package.json.mustache +32 -9
- package/src/tasks/init/template/tasks.config.json +3 -2
- package/src/tasks/list/index.js +9 -3
- package/src/tasks/list-lib/helper.js +72 -0
- package/src/tasks/list-lib/index.js +75 -0
- package/src/tasks/promote-webpack/index.js +8 -1
- package/src/tasks/promote-webpack/webpack.config.js +26 -0
- package/src/tasks/publish/index.js +8 -1
- package/src/tasks/publish-all/index.js +8 -1
- package/src/tasks/publish-lib/helper.js +53 -0
- package/src/tasks/publish-lib/index.js +212 -0
- package/src/tasks/rename-lib/index.js +353 -0
- package/src/tasks/revert-webpack/index.js +8 -1
- package/src/util.js +201 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
|
|
3
|
-
import { showVersion } from '../../util.js';
|
|
3
|
+
import { showVersion, getLibraryBased } from '../../util.js';
|
|
4
4
|
|
|
5
5
|
import { deleteLocalComponents, SOURCE_OF_COMPONENT_TYPES, deleteServerComponents, getDeleteComponentsQuestions } from './helper.js';
|
|
6
6
|
|
|
7
|
+
const isLibraryBased = await getLibraryBased();
|
|
8
|
+
|
|
7
9
|
const deleteComponentsFn = async (sourceOfComponents, answers, options) => {
|
|
8
10
|
switch (sourceOfComponents) {
|
|
9
11
|
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
@@ -25,7 +27,11 @@ export default async (options) => {
|
|
|
25
27
|
showVersion();
|
|
26
28
|
|
|
27
29
|
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
28
|
-
if (
|
|
30
|
+
if (isLibraryBased) {
|
|
31
|
+
sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
32
|
+
await deleteComponentsFn(sourceOfComponentsOption, null, options);
|
|
33
|
+
}
|
|
34
|
+
else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
|
|
29
35
|
sourceOfComponentsOption = options.params[3];
|
|
30
36
|
await deleteComponentsFn(sourceOfComponentsOption, null, options);
|
|
31
37
|
} else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
|
|
3
|
-
import { showVersion } from '../../util.js';
|
|
3
|
+
import { showVersion, getLibraryBased } from '../../util.js';
|
|
4
4
|
|
|
5
5
|
import { deleteLocalComponents, SOURCE_OF_COMPONENT_TYPES, deleteServerComponents, getDeleteComponentsQuestions } from './helper.js';
|
|
6
6
|
|
|
7
|
+
const isLibraryBased = await getLibraryBased();
|
|
8
|
+
|
|
7
9
|
const deleteComponentsFn = async (sourceOfComponents, answers, options) => {
|
|
8
10
|
switch (sourceOfComponents) {
|
|
9
11
|
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
@@ -25,7 +27,11 @@ export default async (options) => {
|
|
|
25
27
|
showVersion();
|
|
26
28
|
|
|
27
29
|
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
28
|
-
if (
|
|
30
|
+
if (isLibraryBased) {
|
|
31
|
+
sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
32
|
+
await deleteComponentsFn(sourceOfComponentsOption, null, options);
|
|
33
|
+
}
|
|
34
|
+
else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
|
|
29
35
|
sourceOfComponentsOption = options.params[3];
|
|
30
36
|
await deleteComponentsFn(sourceOfComponentsOption, null, options);
|
|
31
37
|
} else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import AdmZip from 'adm-zip';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
getPegaServerConfig,
|
|
9
|
+
checkPathAccess,
|
|
10
|
+
getComponentDefaults,
|
|
11
|
+
} from '../../util.js';
|
|
12
|
+
import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH } from '../../constants.js';
|
|
13
|
+
|
|
14
|
+
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
15
|
+
SERVER: 'Server',
|
|
16
|
+
LOCAL: 'Local'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const pegaConfigJsonPath = path.join(path.resolve(), TASKS_CONFIG_JSON_FILENAME);
|
|
21
|
+
|
|
22
|
+
export const getOrgLib = async () => {
|
|
23
|
+
const defaultPegaConfig = await getPegaServerConfig();
|
|
24
|
+
|
|
25
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
26
|
+
|
|
27
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
28
|
+
data = data && JSON.parse(data);
|
|
29
|
+
|
|
30
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
31
|
+
console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const componentData = data[COMPONENTS_PATH];
|
|
36
|
+
|
|
37
|
+
let library;
|
|
38
|
+
({ library } = componentData);
|
|
39
|
+
let { organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
40
|
+
|
|
41
|
+
const componentDefaults = await getComponentDefaults();
|
|
42
|
+
componentDefaults.library = library;
|
|
43
|
+
componentDefaults.organization = organization;
|
|
44
|
+
|
|
45
|
+
return componentDefaults;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const getDeleteLibraryQuestions = async () => {
|
|
49
|
+
const defaultPegaConfig = await getPegaServerConfig();
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
return [
|
|
53
|
+
{
|
|
54
|
+
name: 'sourceOfLibrary',
|
|
55
|
+
type: 'rawlist',
|
|
56
|
+
message: 'Delete library from Server or Local ?',
|
|
57
|
+
choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
|
|
58
|
+
default: defaultPegaConfig.sourceOfComponents,
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export const getLibraryVersionQuestion = async(libraryName, libVersions) => {
|
|
65
|
+
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
name: 'version',
|
|
69
|
+
type: 'rawlist',
|
|
70
|
+
message: `Select ${chalk.green.bold(`${libraryName}`)} library version (or ALL) to delete`,
|
|
71
|
+
choices: libVersions
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
|
|
5
|
+
import { showVersion, getC11NB2STokenAndStaticServer, getLibraryVersions, getLibraryBased, deleteLocalLibrary, deleteLocalLibraryVersion } from '../../util.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { deleteLib } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
9
|
+
|
|
10
|
+
import { getDeleteLibraryQuestions, getLibraryVersionQuestion, getOrgLib, SOURCE_OF_COMPONENT_TYPES } from './helper.js';
|
|
11
|
+
|
|
12
|
+
const isLibraryBased = await getLibraryBased();
|
|
13
|
+
|
|
14
|
+
export default async (options) => {
|
|
15
|
+
if (!isLibraryBased) {
|
|
16
|
+
console.log(`Command only supported for ${chalk.bold.green('library based')} components.`)
|
|
17
|
+
process.exit();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
showVersion();
|
|
21
|
+
|
|
22
|
+
let sourceOfLibrary;
|
|
23
|
+
let organization;
|
|
24
|
+
let library;
|
|
25
|
+
let version;
|
|
26
|
+
let devBuild;
|
|
27
|
+
|
|
28
|
+
const compDef = await getOrgLib();
|
|
29
|
+
organization = compDef.organization;
|
|
30
|
+
library = compDef.library;
|
|
31
|
+
const libraryName = organization.concat("_").concat(library);
|
|
32
|
+
|
|
33
|
+
if (options.params.length >= 5) {
|
|
34
|
+
sourceOfLibrary = options.param[3];
|
|
35
|
+
version = options.params[4];
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
|
|
40
|
+
const questions = await getDeleteLibraryQuestions();
|
|
41
|
+
const answers = await inquirer.prompt(questions);
|
|
42
|
+
({ sourceOfLibrary } = answers);
|
|
43
|
+
|
|
44
|
+
if (sourceOfLibrary === SOURCE_OF_COMPONENT_TYPES.LOCAL ) {
|
|
45
|
+
// local
|
|
46
|
+
|
|
47
|
+
let libVersions = await getLibraryVersions(libraryName);
|
|
48
|
+
|
|
49
|
+
if (libVersions.length > 0) {
|
|
50
|
+
// ALL option
|
|
51
|
+
libVersions.unshift('ALL');
|
|
52
|
+
|
|
53
|
+
const versionQuestions = await getLibraryVersionQuestion(libraryName, libVersions);
|
|
54
|
+
const versionAnswers = await inquirer.prompt(versionQuestions);
|
|
55
|
+
|
|
56
|
+
({version} = versionAnswers);
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// No library with that name
|
|
61
|
+
console.log(chalk.redBright(`No local library named: ${libraryName} exists.`));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if (sourceOfLibrary === SOURCE_OF_COMPONENT_TYPES.LOCAL ) {
|
|
72
|
+
if (version === 'ALL') {
|
|
73
|
+
await deleteLocalLibrary(libraryName);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
await deleteLocalLibraryVersion(libraryName, version);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// server
|
|
82
|
+
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
83
|
+
|
|
84
|
+
if (tokenAndStaticServer.C11NB2S === undefined) {
|
|
85
|
+
console.log(chalk.redBright("Need to authenticate, missing services token.\nDeleting a library requires authentication to acquire a token to delete."));
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
await deleteLib(tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
};
|
package/src/tasks/index.js
CHANGED
|
@@ -2,17 +2,22 @@ export { default as createComponent } from './create/index.js';
|
|
|
2
2
|
export { default as createAllComponents } from './create-all/index.js';
|
|
3
3
|
export { default as deleteComponent } from './delete/index.js';
|
|
4
4
|
export { default as deleteAllComponents } from './delete-all/index.js';
|
|
5
|
+
export { default as deleteLibrary } from './delete-lib/index.js';
|
|
5
6
|
export { default as initProject } from './init/index.js';
|
|
6
7
|
export { default as promoteWebPack } from './promote-webpack/index.js';
|
|
7
8
|
export { default as publishComponent } from './publish/index.js';
|
|
8
9
|
export { default as publishAllComponents } from './publish-all/index.js';
|
|
10
|
+
export { default as publishLibrary } from './publish-lib/index.js';
|
|
9
11
|
export { default as renameComponent } from './rename/index.js';
|
|
12
|
+
export { default as renameLibrary } from './rename-lib/index.js';
|
|
10
13
|
export { default as revertWebPack } from './revert-webpack/index.js';
|
|
11
14
|
export { default as listComponents } from './list/index.js';
|
|
15
|
+
export { default as listLibrary } from './list-lib/index.js';
|
|
12
16
|
export { default as updateComponent } from './update/index.js';
|
|
13
17
|
export { default as validate } from './validator/index.js';
|
|
14
18
|
export { default as authenticate } from './authenticate/index.js';
|
|
15
19
|
export { default as upgrade } from './upgrade/index.js';
|
|
16
20
|
export { default as buildComponent } from './build-comp/index.js';
|
|
17
21
|
export { default as buildAllComponents } from './build-all/index.js';
|
|
22
|
+
export { default as buildLibrary } from './build-lib/index.js';
|
|
18
23
|
export { default as buildJestAssets } from './build-jest-assets/index.js';
|
|
@@ -11,16 +11,21 @@
|
|
|
11
11
|
"authenticate": "custom-dx-components authenticate",
|
|
12
12
|
"buildComponent": "custom-dx-components buildComponent",
|
|
13
13
|
"buildAllComponents": "custom-dx-components buildAllComponents",
|
|
14
|
+
"buildLibrary": "custom-dx-components buildLibrary",
|
|
14
15
|
"create": "custom-dx-components create",
|
|
15
16
|
"createAll": "custom-dx-components createAll",
|
|
16
17
|
"publish": "custom-dx-components publish",
|
|
17
18
|
"publishAll": "custom-dx-components publishAll",
|
|
19
|
+
"publishLibrary": "custom-dx-components publishLibrary",
|
|
18
20
|
"rename": "custom-dx-components rename",
|
|
21
|
+
"renameLibrary": "custom-dx-components renameLibrary",
|
|
19
22
|
"list": "custom-dx-components list",
|
|
23
|
+
"listLibrary": "custom-dx-components listLibrary",
|
|
20
24
|
"validate-schema": "custom-dx-components validateSchema",
|
|
21
25
|
"update": "custom-dx-components update",
|
|
22
26
|
"delete": "custom-dx-components delete",
|
|
23
27
|
"deleteAll": "custom-dx-components deleteAll",
|
|
28
|
+
"deleteLibrary": "custom-dx-components deleteLibrary",
|
|
24
29
|
"promoteWebPack": "custom-dx-components promoteWebPack",
|
|
25
30
|
"revertWebPack": "custom-dx-components revertWebPack",
|
|
26
31
|
"_internal-test-coverage": "node --input-type=module --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand node_modules/@pega/custom-dx-component --ci --testResultsProcessor='jest-junit' --coverage",
|
|
@@ -49,30 +54,47 @@
|
|
|
49
54
|
],
|
|
50
55
|
"author": "",
|
|
51
56
|
"license": "Enter License",
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@babel/cli": "^7.23.0",
|
|
59
|
+
"@babel/core": "^7.23.3",
|
|
60
|
+
"@babel/preset-env": "^7.23.3",
|
|
61
|
+
"@babel/preset-react": "^7.23.3",
|
|
62
|
+
"@material-ui/core": "^4.12.4",
|
|
63
|
+
"@pega/constellation-dx-components-build-utils": "^1.0.1-dev-0.10",
|
|
64
|
+
"@pega/cosmos-react-condition-builder": "7.0.0-build.6.0",
|
|
65
|
+
"@pega/cosmos-react-core": "7.0.0-build.6.0",
|
|
66
|
+
"@pega/cosmos-react-work": "7.0.0-build.6.0",
|
|
67
|
+
"babel-loader": "^9.1.3",
|
|
57
68
|
"dayjs": "^1.11.10",
|
|
69
|
+
"lodash": "^4.17.21",
|
|
58
70
|
"lodash.get": "^4.4.2",
|
|
71
|
+
"npm": "^10.5.0",
|
|
59
72
|
"polished": "^4.2.2",
|
|
60
73
|
"prop-types": "^15.8.1",
|
|
61
74
|
"react": "^17.0.2",
|
|
62
75
|
"react-autosuggest": "^10.1.0",
|
|
63
76
|
"react-dom": "^17.0.2",
|
|
64
|
-
"react-is": "^
|
|
77
|
+
"react-is": "^18.2.0",
|
|
65
78
|
"react-player": "^2.10.1",
|
|
66
79
|
"react-redux": "^7.2.6",
|
|
80
|
+
"serve": "^14.2.1",
|
|
81
|
+
"shelljs": "^0.8.5",
|
|
67
82
|
"styled-components": "^5.3.5",
|
|
68
|
-
"ts-loader": "^9.5.1"
|
|
83
|
+
"ts-loader": "^9.5.1",
|
|
84
|
+
"webpack": "5.74.0",
|
|
85
|
+
"webpack-cli": "^5.1.4"
|
|
69
86
|
},
|
|
70
87
|
"devDependencies": {
|
|
88
|
+
"@babel/cli": "^7.23.0",
|
|
89
|
+
"@babel/core": "^7.23.3",
|
|
90
|
+
"@babel/preset-env": "^7.23.3",
|
|
91
|
+
"@babel/preset-react": "^7.23.3",
|
|
71
92
|
"@pega/configs": "^0.6.0",
|
|
72
|
-
"@pega/custom-dx-components": "0.
|
|
73
|
-
"@pega/pcore-pconnect-typedefs": "
|
|
93
|
+
"@pega/custom-dx-components": "0.242.2",
|
|
94
|
+
"@pega/pcore-pconnect-typedefs": "2.0.0",
|
|
74
95
|
"@storybook/addon-actions": "^7.6.7",
|
|
75
96
|
"@storybook/addon-essentials": "^7.6.7",
|
|
97
|
+
"@storybook/addon-knobs": "^7.0.2",
|
|
76
98
|
"@storybook/addon-links": "^7.6.7",
|
|
77
99
|
"@storybook/addon-storysource": "^7.6.7",
|
|
78
100
|
"@storybook/react": "^7.6.7",
|
|
@@ -84,6 +106,7 @@
|
|
|
84
106
|
"@types/react-dom": "^17.0.11",
|
|
85
107
|
"@types/styled-components": "^5.1.34",
|
|
86
108
|
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
109
|
+
"babel-loader": "^9.1.3",
|
|
87
110
|
"eslint": "^8.56.0",
|
|
88
111
|
"eslint-plugin-import": "^2.29.1",
|
|
89
112
|
"eslint-plugin-jest": "^27.6.1",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"rulesetName": "CustomDXComponents",
|
|
5
5
|
"rulesetVersion": "01-01-01",
|
|
6
6
|
"sourceOfComponents": "Server",
|
|
7
|
-
"devBuild":
|
|
7
|
+
"devBuild": true,
|
|
8
8
|
"serverType": "infinity",
|
|
9
9
|
"server": "https://localhost:1080/prweb",
|
|
10
10
|
"clientId": "10095186356008396159",
|
|
@@ -35,5 +35,6 @@
|
|
|
35
35
|
"description": "",
|
|
36
36
|
"icon": ""
|
|
37
37
|
},
|
|
38
|
-
"usePromotedWebPack": false
|
|
38
|
+
"usePromotedWebPack": false,
|
|
39
|
+
"libraryBased": false
|
|
39
40
|
}
|
package/src/tasks/list/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import inquirer from 'inquirer';
|
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
|
|
5
|
-
import { showVersion, getPegaServerConfig } from '../../util.js';
|
|
5
|
+
import { showVersion, getPegaServerConfig, getLibraryBased } from '../../util.js';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
listLocalComponents,
|
|
@@ -13,6 +13,9 @@ import {
|
|
|
13
13
|
getListComponentsQuestions
|
|
14
14
|
} from './helper.js';
|
|
15
15
|
|
|
16
|
+
const isLibraryBased = await getLibraryBased();
|
|
17
|
+
|
|
18
|
+
|
|
16
19
|
const getList = async (sourceOfComponents, answers) => {
|
|
17
20
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
18
21
|
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
@@ -69,8 +72,11 @@ export default async (options) => {
|
|
|
69
72
|
showVersion();
|
|
70
73
|
|
|
71
74
|
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
if (isLibraryBased) {
|
|
76
|
+
sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
77
|
+
await getList(sourceOfComponentsOption);
|
|
78
|
+
}
|
|
79
|
+
else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
|
|
74
80
|
sourceOfComponentsOption = options.params[3];
|
|
75
81
|
await getList(sourceOfComponentsOption);
|
|
76
82
|
} else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getPegaServerConfig,
|
|
7
|
+
checkPathAccess,
|
|
8
|
+
getComponentDefaults
|
|
9
|
+
} from '../../util.js';
|
|
10
|
+
import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH } from '../../constants.js';
|
|
11
|
+
|
|
12
|
+
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
13
|
+
SERVER: 'Server',
|
|
14
|
+
LOCAL: 'Local'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const pegaConfigJsonPath = path.join(path.resolve(), TASKS_CONFIG_JSON_FILENAME);
|
|
18
|
+
|
|
19
|
+
export const getOrgLib = async () => {
|
|
20
|
+
const defaultPegaConfig = await getPegaServerConfig();
|
|
21
|
+
|
|
22
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
23
|
+
|
|
24
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
25
|
+
data = data && JSON.parse(data);
|
|
26
|
+
|
|
27
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
28
|
+
console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const componentData = data[COMPONENTS_PATH];
|
|
33
|
+
|
|
34
|
+
let library;
|
|
35
|
+
({ library } = componentData);
|
|
36
|
+
let { organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
37
|
+
|
|
38
|
+
const componentDefaults = await getComponentDefaults();
|
|
39
|
+
componentDefaults.library = library;
|
|
40
|
+
componentDefaults.organization = organization;
|
|
41
|
+
|
|
42
|
+
return componentDefaults;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const getListLibraryQuestions = async (libraryName) => {
|
|
46
|
+
const defaultPegaConfig = await getPegaServerConfig();
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
name: 'sourceOfLibrary',
|
|
52
|
+
type: 'rawlist',
|
|
53
|
+
message: `List library ${chalk.bold.green(`${libraryName}`)} from Server or Local ?`,
|
|
54
|
+
choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
|
|
55
|
+
default: defaultPegaConfig.sourceOfComponents,
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export const getLibraryVersionQuestion = async(libraryName, libVersions) => {
|
|
62
|
+
|
|
63
|
+
return [
|
|
64
|
+
{
|
|
65
|
+
name: 'version',
|
|
66
|
+
type: 'rawlist',
|
|
67
|
+
message: `Select ${chalk.green.bold(`${libraryName}`)} library version (or ALL) to delete`,
|
|
68
|
+
choices: libVersions
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
import {showVersion, getC11NB2STokenAndStaticServer, getLibraryVersions, getLibraryBased } from '../../util.js';
|
|
5
|
+
|
|
6
|
+
import { listLib } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
7
|
+
|
|
8
|
+
import { getListLibraryQuestions, getLibraryVersionQuestion, getOrgLib, SOURCE_OF_COMPONENT_TYPES } from './helper.js';
|
|
9
|
+
|
|
10
|
+
const isLibraryBased = await getLibraryBased();
|
|
11
|
+
|
|
12
|
+
export default async (options) => {
|
|
13
|
+
if (!isLibraryBased) {
|
|
14
|
+
console.log(`Command only supported for ${chalk.bold.green('library based')} components.`)
|
|
15
|
+
process.exit();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
showVersion();
|
|
19
|
+
|
|
20
|
+
let sourceOfLibrary;
|
|
21
|
+
let organization;
|
|
22
|
+
let library;
|
|
23
|
+
|
|
24
|
+
const compDef = await getOrgLib();
|
|
25
|
+
organization = compDef.organization;
|
|
26
|
+
library = compDef.library;
|
|
27
|
+
const libraryName = organization.concat("_").concat(library);
|
|
28
|
+
|
|
29
|
+
if (options.params.length >= 4) {
|
|
30
|
+
sourceOfLibrary = options.param[3];
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
|
|
35
|
+
const questions = await getListLibraryQuestions(libraryName);
|
|
36
|
+
const answers = await inquirer.prompt(questions);
|
|
37
|
+
({ sourceOfLibrary } = answers);
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (sourceOfLibrary === SOURCE_OF_COMPONENT_TYPES.LOCAL ) {
|
|
42
|
+
// local
|
|
43
|
+
|
|
44
|
+
let libVersions = await getLibraryVersions(libraryName);
|
|
45
|
+
|
|
46
|
+
if (libVersions.length > 0) {
|
|
47
|
+
libVersions = libVersions.map((name) => ({ 'Version': name}));
|
|
48
|
+
console.log(chalk.bold.blueBright(`\nList of ${libraryName} library versions`));
|
|
49
|
+
console.table(libVersions, ['Version']);
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// No library with that name
|
|
54
|
+
console.log(chalk.redBright(`No local library named: ${libraryName} exists.`));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// server
|
|
62
|
+
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
63
|
+
|
|
64
|
+
if (tokenAndStaticServer.C11NB2S === undefined) {
|
|
65
|
+
console.log(chalk.redBright("Need to authenticate, missing services token.\nDeleting a library requires authentication to acquire a token to delete."));
|
|
66
|
+
process.e
|
|
67
|
+
exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
await listLib(tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
convertIntoPascalCase,
|
|
11
11
|
checkPathAccess,
|
|
12
12
|
showVersion,
|
|
13
|
-
updateUseWebPackPromotion
|
|
13
|
+
updateUseWebPackPromotion,
|
|
14
|
+
getLibraryBased
|
|
14
15
|
} from '../../util.js';
|
|
15
16
|
|
|
16
17
|
import {
|
|
@@ -21,6 +22,7 @@ import {
|
|
|
21
22
|
BUILDER_DIR_FILE_PATH
|
|
22
23
|
} from '../../constants.js';
|
|
23
24
|
|
|
25
|
+
const isLibraryBased = await getLibraryBased();
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
export const copyWebPack = async () => {
|
|
@@ -92,6 +94,11 @@ export const copyWebPack = async () => {
|
|
|
92
94
|
|
|
93
95
|
|
|
94
96
|
export default async options => {
|
|
97
|
+
if (isLibraryBased) {
|
|
98
|
+
console.log(`Command only supported for ${chalk.bold.green('non library based')} components.`)
|
|
99
|
+
process.exit();
|
|
100
|
+
}
|
|
101
|
+
|
|
95
102
|
showVersion();
|
|
96
103
|
|
|
97
104
|
await copyWebPack();
|
|
@@ -345,6 +345,7 @@ module.exports = (
|
|
|
345
345
|
resourceRegExp: /^\.\/locale$/,
|
|
346
346
|
contextRegExp: /moment$/
|
|
347
347
|
}),
|
|
348
|
+
/* cosmos 4.x and below */
|
|
348
349
|
/* Ignore cosmos icons */
|
|
349
350
|
new webpack.IgnorePlugin({
|
|
350
351
|
resourceRegExp: /^\.\/icons$/,
|
|
@@ -357,6 +358,31 @@ module.exports = (
|
|
|
357
358
|
contextRegExp: /@pega\\cosmos-react-core\\lib\\components\\Icon$/
|
|
358
359
|
}),
|
|
359
360
|
|
|
361
|
+
/* Ignore cosmos streamline-icons */
|
|
362
|
+
new webpack.IgnorePlugin({
|
|
363
|
+
resourceRegExp: /^\.\/streamline-icons$/,
|
|
364
|
+
contextRegExp: /@pega\/cosmos-react-core\/lib\/components\/Icon$/
|
|
365
|
+
}),
|
|
366
|
+
|
|
367
|
+
/* Ignore cosmos streamline-icons - windows */
|
|
368
|
+
new webpack.IgnorePlugin({
|
|
369
|
+
resourceRegExp: /^\.\/streamline-icons$/,
|
|
370
|
+
contextRegExp: /@pega\\cosmos-react-core\\lib\\components\\Icon$/
|
|
371
|
+
}),
|
|
372
|
+
|
|
373
|
+
/* cosmos 6.x and above */
|
|
374
|
+
/* Ignore cosmos icons */
|
|
375
|
+
new webpack.IgnorePlugin({
|
|
376
|
+
resourceRegExp: /^\.\/.*\/.*\.icon$/,
|
|
377
|
+
contextRegExp: /@pega\/cosmos-react-core\/lib\/components\/Icon$/
|
|
378
|
+
}),
|
|
379
|
+
|
|
380
|
+
/* Ignore cosmos icons - windows */
|
|
381
|
+
new webpack.IgnorePlugin({
|
|
382
|
+
resourceRegExp: /^\.\/.*\/.*\.icon$/,
|
|
383
|
+
contextRegExp: /@pega\\cosmos-react-core\\lib\\components\\Icon$/
|
|
384
|
+
}),
|
|
385
|
+
|
|
360
386
|
new webpack.optimize.LimitChunkCountPlugin({
|
|
361
387
|
maxChunks: 1
|
|
362
388
|
}),
|
|
@@ -5,11 +5,18 @@ import chalk from 'chalk';
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
6
|
import bundleComponent from '../bundle/index.js';
|
|
7
7
|
import { lintComponent } from '../linter/index.js';
|
|
8
|
-
import { getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
8
|
+
import { getComponentDirectoryPath, showVersion, getLibraryBased } from '../../util.js';
|
|
9
9
|
|
|
10
10
|
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
11
11
|
|
|
12
|
+
const isLibraryBased = await getLibraryBased();
|
|
13
|
+
|
|
12
14
|
export default async options => {
|
|
15
|
+
if (isLibraryBased) {
|
|
16
|
+
console.log(`Command only supported for ${chalk.bold.green('non library based')} components.`)
|
|
17
|
+
process.exit();
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
showVersion();
|
|
14
21
|
|
|
15
22
|
let componentKey;
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk';
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
6
|
import bundleComponent from '../bundle/index.js';
|
|
7
7
|
import { lintComponent } from '../linter/index.js';
|
|
8
|
-
import { getComponents, getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
8
|
+
import { getComponents, getComponentDirectoryPath, showVersion, getLibraryBased } from '../../util.js';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
getPublishComponentQuestions,
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
cleanUp
|
|
15
15
|
} from './helper.js';
|
|
16
16
|
|
|
17
|
+
const isLibraryBased = await getLibraryBased();
|
|
18
|
+
|
|
17
19
|
export function getCustomTasks(componentKey, sourceMap, devBuild, content, options) {
|
|
18
20
|
const sDevBuild = devBuild ? '(dev build)' : '';
|
|
19
21
|
// eslint-disable no-unneeded-ternary,no-nested-ternary
|
|
@@ -60,6 +62,11 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, content, optio
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
export default async options => {
|
|
65
|
+
if (isLibraryBased) {
|
|
66
|
+
console.log(`Command only supported for ${chalk.bold.green('non library based')} components.`)
|
|
67
|
+
process.exit();
|
|
68
|
+
}
|
|
69
|
+
|
|
63
70
|
showVersion();
|
|
64
71
|
|
|
65
72
|
const components = await getComponents();
|