@pega/custom-dx-components 0.242.23 → 0.242.25
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 +1 -0
- package/src/tasks/authenticate/index.js +1 -1
- package/src/tasks/build-all/helper.js +5 -18
- package/src/tasks/build-all/index.js +43 -10
- package/src/tasks/build-comp/helper.js +6 -2
- package/src/tasks/build-comp/index.js +19 -3
- package/src/tasks/build-jest-assets/index.js +1 -1
- package/src/tasks/build-lib/helper.js +10 -2
- package/src/tasks/build-lib/index.js +15 -3
- package/src/tasks/bundle/builder/index.js +11 -3
- package/src/tasks/bundle/builder/webpack.config.js +3 -1
- package/src/tasks/bundle/index.js +3 -1
- package/src/tasks/create/index.js +11 -4
- package/src/tasks/create-all/index.js +10 -4
- package/src/tasks/delete/helper.js +7 -2
- package/src/tasks/delete/index.js +6 -2
- package/src/tasks/delete-all/helper.js +6 -2
- package/src/tasks/delete-all/index.js +7 -2
- package/src/tasks/delete-lib/helper.js +6 -1
- package/src/tasks/delete-lib/index.js +10 -4
- package/src/tasks/init/template/package.json.mustache +1 -2
- package/src/tasks/init/template/tasks.config.json +2 -1
- package/src/tasks/linter/index.js +4 -0
- package/src/tasks/list/helper.js +9 -2
- package/src/tasks/list/index.js +10 -2
- package/src/tasks/list-lib/helper.js +8 -2
- package/src/tasks/list-lib/index.js +12 -3
- package/src/tasks/promote-webpack/index.js +7 -2
- package/src/tasks/promote-webpack/webpack.config.js +3 -1
- package/src/tasks/publish/helper.js +5 -1
- package/src/tasks/publish/index.js +6 -2
- package/src/tasks/publish-all/helper.js +8 -1
- package/src/tasks/publish-all/index.js +8 -2
- package/src/tasks/publish-lib/helper.js +4 -2
- package/src/tasks/publish-lib/index.js +17 -8
- package/src/tasks/rename/index.js +10 -3
- package/src/tasks/rename-lib/index.js +23 -5
- package/src/tasks/revert-webpack/index.js +5 -2
- package/src/tasks/validator/index.js +4 -1
- package/src/util.js +135 -5
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -11,6 +11,7 @@ export const TOKEN_PATH = 'node_modules/@pega/custom-dx-components/.access_token
|
|
|
11
11
|
export const OOTB_COMPONENTS = 'node_modules/@pega/custom-dx-components/.ootb_components';
|
|
12
12
|
export const LIBRARY_BASED = 'libraryBased';
|
|
13
13
|
export const SHARED_DIRECTORY = 'shared';
|
|
14
|
+
export const SHOW_DEBUG = 'showDebug';
|
|
14
15
|
|
|
15
16
|
/* REST end points */
|
|
16
17
|
export const PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT = 'PRRestService/dev/v1/publish_component';
|
|
@@ -4,27 +4,12 @@ import path from 'path';
|
|
|
4
4
|
import archiver from 'archiver';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
|
|
7
|
-
import { getComponentDirectoryPath, getComponents, getPegaServerConfig } from '../../util.js';
|
|
8
|
-
|
|
9
|
-
export const cleanUp = async () => {
|
|
10
|
-
if (fs.existsSync('dist/components')) {
|
|
11
|
-
fs.rm('dist/components', { recursive: true }, err => {
|
|
12
|
-
if (err) {
|
|
13
|
-
throw err;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
7
|
+
import { getComponentDirectoryPath, getComponents, getPegaServerConfig, addDebugLog } from '../../util.js';
|
|
17
8
|
|
|
18
|
-
if (fs.existsSync('lib')) {
|
|
19
|
-
fs.rm('lib', { recursive: true }, err => {
|
|
20
|
-
if (err) {
|
|
21
|
-
throw err;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
9
|
|
|
27
10
|
export const getBuildComponentQuestions = async () => {
|
|
11
|
+
addDebugLog("getBuildComponentQuestions", "", "");
|
|
12
|
+
|
|
28
13
|
const components = await getComponents();
|
|
29
14
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
30
15
|
|
|
@@ -44,6 +29,8 @@ export const getBuildComponentQuestions = async () => {
|
|
|
44
29
|
};
|
|
45
30
|
|
|
46
31
|
export const zipComponent = async componentKey => {
|
|
32
|
+
addDebugLog("zipComponent", `componentKey: ${componentKey}`, "");
|
|
33
|
+
|
|
47
34
|
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
48
35
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
49
36
|
const configJson = `${srcDirectory}/config.json`;
|
|
@@ -5,11 +5,14 @@ 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, getComponents } from '../../util.js';
|
|
8
|
+
import { getComponentDirectoryPath, showVersion, getComponents, addDebugLog, cleanUp, getLibraryBased } from '../../util.js';
|
|
9
9
|
|
|
10
|
-
import { getBuildComponentQuestions
|
|
10
|
+
import { getBuildComponentQuestions } from './helper.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export function getCustomTasks(componentKey, sourceMap, devBuild, options, showStats, skipBuild) {
|
|
14
|
+
addDebugLog("getCustomTasks", `componentKey: ${componentKey}, sourceMap: ${sourceMap}, devBuild: ${devBuild}, skipBuild: ${skipBuild}`, "");
|
|
11
15
|
|
|
12
|
-
export function getCustomTasks(componentKey, sourceMap, devBuild, options) {
|
|
13
16
|
const sDevBuild = devBuild ? '(dev build)' : '';
|
|
14
17
|
return new Listr(
|
|
15
18
|
[
|
|
@@ -29,8 +32,8 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, options) {
|
|
|
29
32
|
},
|
|
30
33
|
{
|
|
31
34
|
title: `Bundle component ${sDevBuild}`,
|
|
32
|
-
task: async () => bundleComponent(componentKey, sourceMap, devBuild),
|
|
33
|
-
|
|
35
|
+
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, showStats),
|
|
36
|
+
enabled: () => !skipBuild
|
|
34
37
|
}
|
|
35
38
|
],
|
|
36
39
|
{ concurrent: false, exitOnError: true }
|
|
@@ -38,25 +41,44 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, options) {
|
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
export default async options => {
|
|
41
|
-
showVersion();
|
|
44
|
+
await showVersion();
|
|
45
|
+
|
|
46
|
+
const isLibraryBased = await getLibraryBased();
|
|
42
47
|
|
|
48
|
+
addDebugLog("buildAllComponents", "", "+");
|
|
43
49
|
const components = await getComponents();
|
|
44
50
|
let sourceMap;
|
|
45
51
|
let devBuild;
|
|
52
|
+
let showStats = false;
|
|
53
|
+
let skipBuild = true;
|
|
54
|
+
let firstComponent = null;
|
|
46
55
|
|
|
47
56
|
if (options.params.length >= 4) {
|
|
48
57
|
const dBuild = options.params[3];
|
|
49
58
|
devBuild = !!(dBuild === 'Y' || dBuild === 'y' || dBuild === true || dBuild === 'true');
|
|
50
59
|
} else {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
if (!isLibraryBased) {
|
|
61
|
+
const questions = await getBuildComponentQuestions();
|
|
62
|
+
const answers = await inquirer.prompt(questions);
|
|
63
|
+
({ sourceMap, devBuild } = answers);
|
|
64
|
+
showStats = true;
|
|
65
|
+
skipBuild = false;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
devBuild = false;
|
|
69
|
+
}
|
|
70
|
+
|
|
54
71
|
}
|
|
55
72
|
|
|
56
73
|
for await (const componentKey of components) {
|
|
57
74
|
console.log(chalk.bold.green(`Building ${componentKey}`));
|
|
58
75
|
|
|
59
|
-
|
|
76
|
+
// capture first component
|
|
77
|
+
if (firstComponent == null) {
|
|
78
|
+
firstComponent = componentKey;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const myCustomTasks = getCustomTasks(componentKey, sourceMap, devBuild, options, showStats, skipBuild);
|
|
60
82
|
|
|
61
83
|
try {
|
|
62
84
|
await myCustomTasks.run();
|
|
@@ -66,8 +88,19 @@ export default async options => {
|
|
|
66
88
|
}
|
|
67
89
|
}
|
|
68
90
|
|
|
91
|
+
// if skipBuild, then do a build here as opposed to every step (v1 is every step, v2, just once)
|
|
92
|
+
if (skipBuild && firstComponent) {
|
|
93
|
+
console.log();
|
|
94
|
+
console.log(chalk.bold.green("Test compile..."));
|
|
95
|
+
await bundleComponent(firstComponent, sourceMap, devBuild, showStats);
|
|
96
|
+
}
|
|
97
|
+
|
|
69
98
|
// once done, remove leftover directories
|
|
70
99
|
await cleanUp();
|
|
71
100
|
|
|
101
|
+
console.log();
|
|
102
|
+
console.log(chalk.bold.green("Done."));
|
|
103
|
+
|
|
104
|
+
addDebugLog("buildAllComponents", "END", "-");
|
|
72
105
|
return true;
|
|
73
106
|
};
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
getComponentDirectoryPath,
|
|
11
11
|
getComponents,
|
|
12
12
|
getPegaServerConfig,
|
|
13
|
-
getHttpsAgent
|
|
13
|
+
getHttpsAgent,
|
|
14
|
+
getLibraryBased
|
|
14
15
|
} from '../../util.js';
|
|
15
16
|
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH } from '../../constants.js';
|
|
16
17
|
|
|
@@ -24,6 +25,8 @@ export const getPublishComponentQuestions = async componentKey => {
|
|
|
24
25
|
|
|
25
26
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
26
27
|
|
|
28
|
+
const isLibraryBased = await getLibraryBased();
|
|
29
|
+
|
|
27
30
|
return [
|
|
28
31
|
{
|
|
29
32
|
name: 'componentKey',
|
|
@@ -44,7 +47,8 @@ export const getPublishComponentQuestions = async componentKey => {
|
|
|
44
47
|
name: 'devBuild',
|
|
45
48
|
type: 'confirm',
|
|
46
49
|
message: 'Generate development build ?',
|
|
47
|
-
default: defaultPegaConfig.devBuild
|
|
50
|
+
default: defaultPegaConfig.devBuild,
|
|
51
|
+
when: () => !isLibraryBased
|
|
48
52
|
}
|
|
49
53
|
];
|
|
50
54
|
};
|
|
@@ -7,15 +7,18 @@ import validate from '../validator/index.js';
|
|
|
7
7
|
import bundleComponent from '../bundle/index.js';
|
|
8
8
|
import lintComponent from '../linter/index.js';
|
|
9
9
|
import { getPublishComponentQuestions } from './helper.js';
|
|
10
|
-
import { getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
10
|
+
import { getComponentDirectoryPath, showVersion, addDebugLog, cleanUp, getLibraryBased } from '../../util.js';
|
|
11
11
|
|
|
12
12
|
export default async options => {
|
|
13
|
-
showVersion();
|
|
13
|
+
await showVersion();
|
|
14
|
+
|
|
15
|
+
addDebugLog("buildComponent", "", "+");
|
|
14
16
|
|
|
15
17
|
let componentKey;
|
|
16
18
|
let sourceMap;
|
|
17
19
|
let devBuild;
|
|
18
20
|
let content;
|
|
21
|
+
let showStats = true;
|
|
19
22
|
|
|
20
23
|
if (options.params.length >= 6) {
|
|
21
24
|
componentKey = options.params[3];
|
|
@@ -40,6 +43,13 @@ export default async options => {
|
|
|
40
43
|
const answers = await inquirer.prompt(questions);
|
|
41
44
|
({ componentKey = paramComponentKey, sourceMap, devBuild } = answers);
|
|
42
45
|
|
|
46
|
+
const isLibraryBased = await getLibraryBased();
|
|
47
|
+
|
|
48
|
+
if (isLibraryBased) {
|
|
49
|
+
devBuild = false;
|
|
50
|
+
showStats = false;
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
content = {
|
|
44
54
|
...answers
|
|
45
55
|
};
|
|
@@ -67,7 +77,7 @@ export default async options => {
|
|
|
67
77
|
{
|
|
68
78
|
title: `Bundle Component ${sDevBuild}`,
|
|
69
79
|
type: 'confirm',
|
|
70
|
-
task: async () => await bundleComponent(componentKey, sourceMap, devBuild),
|
|
80
|
+
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, showStats),
|
|
71
81
|
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
72
82
|
}
|
|
73
83
|
],
|
|
@@ -80,5 +90,11 @@ export default async options => {
|
|
|
80
90
|
console.log(chalk.bold.red(err.toString()));
|
|
81
91
|
process.exit(1);
|
|
82
92
|
});
|
|
93
|
+
|
|
94
|
+
// remove dist/lib stuff
|
|
95
|
+
await cleanUp();
|
|
96
|
+
|
|
97
|
+
addDebugLog("buildComponent", "END", "-");
|
|
98
|
+
|
|
83
99
|
return true;
|
|
84
100
|
};
|
|
@@ -192,7 +192,7 @@ const createJestLibraryAssets = async(isLaunchPad = false) => {
|
|
|
192
192
|
|
|
193
193
|
|
|
194
194
|
export default async options => {
|
|
195
|
-
showVersion();
|
|
195
|
+
await showVersion();
|
|
196
196
|
|
|
197
197
|
const questions = await getBuildAssetsQuestions();
|
|
198
198
|
const answers = await inquirer.prompt(questions);
|
|
@@ -7,13 +7,16 @@ import {
|
|
|
7
7
|
getPegaServerConfig,
|
|
8
8
|
checkPathAccess,
|
|
9
9
|
getComponentDefaults,
|
|
10
|
-
validateSemver
|
|
10
|
+
validateSemver,
|
|
11
|
+
addDebugLog,
|
|
12
|
+
getLibraryBased
|
|
11
13
|
} from '../../util.js';
|
|
12
14
|
import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH } from '../../constants.js';
|
|
13
15
|
|
|
14
16
|
const pegaConfigJsonPath = path.join(path.resolve(), TASKS_CONFIG_JSON_FILENAME);
|
|
15
17
|
|
|
16
18
|
export const getOrgLib = async () => {
|
|
19
|
+
addDebugLog("getOrgLib", "", "+");
|
|
17
20
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
18
21
|
|
|
19
22
|
await checkPathAccess(pegaConfigJsonPath);
|
|
@@ -35,14 +38,19 @@ export const getOrgLib = async () => {
|
|
|
35
38
|
const componentDefaults = await getComponentDefaults();
|
|
36
39
|
componentDefaults.library = library;
|
|
37
40
|
componentDefaults.organization = organization;
|
|
41
|
+
addDebugLog("getOrgLib", `componentsDefaults: ${JSON.stringify(componentDefaults)}`, "");
|
|
42
|
+
addDebugLog("getOrgLib", "END", "-");
|
|
38
43
|
|
|
39
44
|
return componentDefaults;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
export const getBuildComponentQuestions = async (defaultVersion) => {
|
|
48
|
+
addDebugLog("getBuildComoponentQuestions", `defaultVerion: ${defaultVersion}`, "");
|
|
43
49
|
const components = await getComponents();
|
|
44
50
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
45
51
|
|
|
52
|
+
const isLibraryBased = await getLibraryBased();
|
|
53
|
+
|
|
46
54
|
|
|
47
55
|
if (components.length == 0) {
|
|
48
56
|
console.log(chalk.redBright("No components to build"));
|
|
@@ -64,7 +72,7 @@ export const getBuildComponentQuestions = async (defaultVersion) => {
|
|
|
64
72
|
{
|
|
65
73
|
name: 'devBuild',
|
|
66
74
|
type: 'confirm',
|
|
67
|
-
message: '
|
|
75
|
+
message: 'When publish, make deletable ?',
|
|
68
76
|
default: defaultPegaConfig.devBuild
|
|
69
77
|
}
|
|
70
78
|
];
|
|
@@ -16,7 +16,9 @@ import {
|
|
|
16
16
|
getLibraryBased,
|
|
17
17
|
getC11NB2STokenAndStaticServer,
|
|
18
18
|
updateComponentDefaultVersion,
|
|
19
|
-
getAboutData
|
|
19
|
+
getAboutData,
|
|
20
|
+
addDebugLog,
|
|
21
|
+
cleanUp
|
|
20
22
|
} from '../../util.js';
|
|
21
23
|
import bundleComponent from '../bundle/index.js';
|
|
22
24
|
|
|
@@ -25,6 +27,7 @@ import { getBuildComponentQuestions, getOrgLib } from './helper.js';
|
|
|
25
27
|
const isLibraryBased = await getLibraryBased();
|
|
26
28
|
|
|
27
29
|
export const updateConfigVersion = async (componentKey, buildVersion, currentOrgLib, token) => {
|
|
30
|
+
addDebugLog("updateConfigVersion", `componentKey: ${componentKey}, buildVersion: ${buildVersion}, currentOrgLib: ${currentOrgLib}`, "");
|
|
28
31
|
const componentDirectory = await getComponentDirectoryPath(componentKey);
|
|
29
32
|
const configFileName = 'config.json';
|
|
30
33
|
|
|
@@ -93,6 +96,7 @@ export const updateConfigVersion = async (componentKey, buildVersion, currentOrg
|
|
|
93
96
|
};
|
|
94
97
|
|
|
95
98
|
export function getCustomTasks(componentKey, devBuild, buildVersion, currentOrgLib, token) {
|
|
99
|
+
addDebugLog("getCustomTasks", `componentKey: ${componentKey}, devBuild: ${devBuild}, buildVersion: ${buildVersion}, currentOrgLib: ${currentOrgLib}`,"");
|
|
96
100
|
return new Listr(
|
|
97
101
|
[
|
|
98
102
|
{
|
|
@@ -117,7 +121,7 @@ export function getCustomTasks(componentKey, devBuild, buildVersion, currentOrgL
|
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
export const localBuildLibrary = async(organization, library, version, devBuild) => {
|
|
120
|
-
|
|
124
|
+
addDebugLog("localBuildLibrary", `organization: ${organization}, library: ${library}, version: ${version}, devBuild: ${devBuild}`, "");
|
|
121
125
|
const components = await getComponents();
|
|
122
126
|
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
123
127
|
const currentOrgLib = organization.concat('_').concat(library);
|
|
@@ -160,17 +164,22 @@ export const localBuildLibrary = async(organization, library, version, devBuild)
|
|
|
160
164
|
await bundleComponent(components[0], null, devBuild, false);
|
|
161
165
|
console.log('');
|
|
162
166
|
|
|
167
|
+
// remove dist/lib stuff
|
|
168
|
+
await cleanUp();
|
|
169
|
+
|
|
163
170
|
console.log(chalk.green.bold('Building Library... '));
|
|
164
171
|
|
|
165
172
|
// call constellation-dx-components-build-utils build library, which will create a directory of the "buildLibName"
|
|
166
173
|
// with subdirectories for each version.
|
|
167
174
|
// If "buildDev", we append to version "-dev". Currently, only "-dev" versions, when published, can be deleted.
|
|
175
|
+
addDebugLog("buildLib", "services call", "");
|
|
168
176
|
buildLib(
|
|
169
177
|
buildLibName,
|
|
170
178
|
buildVersion,
|
|
171
179
|
tokenAndStaticServer.C11NB2S,
|
|
172
180
|
tokenAndStaticServer.appStaticContentServer
|
|
173
181
|
);
|
|
182
|
+
addDebugLog("buildLIb", "services end", "");
|
|
174
183
|
|
|
175
184
|
}
|
|
176
185
|
|
|
@@ -180,7 +189,8 @@ export default async options => {
|
|
|
180
189
|
process.exit();
|
|
181
190
|
}
|
|
182
191
|
|
|
183
|
-
showVersion();
|
|
192
|
+
await showVersion();
|
|
193
|
+
addDebugLog("buildLibrary", "", "+");
|
|
184
194
|
|
|
185
195
|
const compDef = await getOrgLib();
|
|
186
196
|
const organization = compDef.organization;
|
|
@@ -201,8 +211,10 @@ export default async options => {
|
|
|
201
211
|
({ version, devBuild } = answers);
|
|
202
212
|
}
|
|
203
213
|
|
|
214
|
+
|
|
204
215
|
await localBuildLibrary(organization, library, version, devBuild);
|
|
205
216
|
|
|
217
|
+
addDebugLog("buildLibrary", "END", "-");
|
|
206
218
|
|
|
207
219
|
return true;
|
|
208
220
|
};
|
|
@@ -3,7 +3,7 @@ import fs from 'fs-extra';
|
|
|
3
3
|
import webpack from 'webpack';
|
|
4
4
|
import FileSizeReporter from 'react-dev-utils/FileSizeReporter.js';
|
|
5
5
|
import printBuildError from 'react-dev-utils/printBuildError.js';
|
|
6
|
-
import { getUseWebPackPromotion} from '../../../util.js';
|
|
6
|
+
import { getUseWebPackPromotion, addDebugLog} from '../../../util.js';
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
const usePromoted = await getUseWebPackPromotion();
|
|
@@ -48,8 +48,11 @@ let compilationErrors = null;
|
|
|
48
48
|
|
|
49
49
|
// Create the build and print the deployment instructions.
|
|
50
50
|
function build(config, previousFileSizes, showStats = true) {
|
|
51
|
-
|
|
51
|
+
addDebugLog("bundle build", `config: ${JSON.stringify(config)}, \npreviousFileSizes: ${JSON.stringify(previousFileSizes)}, showStats: ${showStats}`, "");
|
|
52
52
|
|
|
53
|
+
if (showStats) {
|
|
54
|
+
console.log(`Creating a ${Env} build...`);
|
|
55
|
+
}
|
|
53
56
|
|
|
54
57
|
|
|
55
58
|
const compiler = webpack(config);
|
|
@@ -65,7 +68,9 @@ function build(config, previousFileSizes, showStats = true) {
|
|
|
65
68
|
}
|
|
66
69
|
if (stats != null & typeof(stats) == "object") {
|
|
67
70
|
if (stats.errors != undefined) {
|
|
68
|
-
|
|
71
|
+
if (showStats) {
|
|
72
|
+
console.log("stats:" + stats);
|
|
73
|
+
}
|
|
69
74
|
}
|
|
70
75
|
else if (stats.compilation != undefined && stats.compilation.errors != undefined) {
|
|
71
76
|
|
|
@@ -189,6 +194,9 @@ export default ({
|
|
|
189
194
|
WARN_AFTER_CHUNK_GZIP_SIZE
|
|
190
195
|
);
|
|
191
196
|
}
|
|
197
|
+
else {
|
|
198
|
+
|
|
199
|
+
}
|
|
192
200
|
|
|
193
201
|
resolve('done emitting');
|
|
194
202
|
},
|
|
@@ -354,7 +354,9 @@ export default (
|
|
|
354
354
|
/* isEnvProduction && new CompressionPlugin(compressionGZConfObj) */
|
|
355
355
|
].filter(Boolean),
|
|
356
356
|
performance: {
|
|
357
|
-
hints:
|
|
357
|
+
hints: false,
|
|
358
|
+
maxEntrypointSize: 512000,
|
|
359
|
+
maxAssetSize: 512000
|
|
358
360
|
},
|
|
359
361
|
externals
|
|
360
362
|
};
|
|
@@ -3,13 +3,15 @@ import fs from 'fs';
|
|
|
3
3
|
import { stat } from 'fs/promises';
|
|
4
4
|
|
|
5
5
|
import { BUILD_CONFIG_JSON_FILENAME } from '../../constants.js';
|
|
6
|
-
import { getComponentDirectoryPath } from '../../util.js';
|
|
6
|
+
import { getComponentDirectoryPath, addDebugLog } from '../../util.js';
|
|
7
7
|
|
|
8
8
|
import buildComponent from './builder/index.js';
|
|
9
9
|
|
|
10
10
|
const extensions = ['ts', 'tsx', 'js', 'jsx'];
|
|
11
11
|
|
|
12
12
|
const bundleComponent = async (componentKey, sourceMap, devBuild, showStats = true) => {
|
|
13
|
+
addDebugLog("bundleComponent", `componentKey: ${componentKey}, sourceMap: ${sourceMap}, devBuild: ${devBuild}, showStats: ${showStats}`, "");
|
|
14
|
+
|
|
13
15
|
const componentDirectory = await getComponentDirectoryPath(componentKey);
|
|
14
16
|
|
|
15
17
|
const idx = (
|
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
updateComponentDefaultLibrary,
|
|
21
21
|
updateComponentDefaultVersion,
|
|
22
22
|
copyFileToShared,
|
|
23
|
-
getLibraryBased
|
|
23
|
+
getLibraryBased,
|
|
24
|
+
addDebugLog
|
|
24
25
|
} from '../../util.js';
|
|
25
26
|
import { COMPONENT_SCHEMA, SHARED_FILE_NAMES } from '../../constants.js';
|
|
26
27
|
|
|
@@ -46,7 +47,7 @@ const compileMustacheTemplates = async (
|
|
|
46
47
|
subtype,
|
|
47
48
|
description,
|
|
48
49
|
organization,
|
|
49
|
-
allowedApplications
|
|
50
|
+
allowedApplications = ''
|
|
50
51
|
}
|
|
51
52
|
) => {
|
|
52
53
|
const files = fs.readdirSync(componentDirectory);
|
|
@@ -258,7 +259,10 @@ const validateCompile = async (
|
|
|
258
259
|
};
|
|
259
260
|
|
|
260
261
|
export default async options => {
|
|
261
|
-
showVersion();
|
|
262
|
+
await showVersion();
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
addDebugLog("create", "", "+");
|
|
262
266
|
|
|
263
267
|
if (options.params.length >= 12) {
|
|
264
268
|
|
|
@@ -390,7 +394,8 @@ export default async options => {
|
|
|
390
394
|
{
|
|
391
395
|
name: 'allowedApplications',
|
|
392
396
|
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
393
|
-
suffix: 'Keep empty for all applications'
|
|
397
|
+
suffix: 'Keep empty for all applications',
|
|
398
|
+
when: () => !isLibraryBased
|
|
394
399
|
},
|
|
395
400
|
{
|
|
396
401
|
name: 'description',
|
|
@@ -427,4 +432,6 @@ export default async options => {
|
|
|
427
432
|
);
|
|
428
433
|
});
|
|
429
434
|
}
|
|
435
|
+
|
|
436
|
+
addDebugLog("create", "END", "-");
|
|
430
437
|
};
|
|
@@ -21,7 +21,8 @@ import { checkPathAccess, showVersion ,
|
|
|
21
21
|
updateComponentDefaultLibrary,
|
|
22
22
|
updateComponentDefaultVersion,
|
|
23
23
|
copyFileToShared,
|
|
24
|
-
getLibraryBased
|
|
24
|
+
getLibraryBased,
|
|
25
|
+
addDebugLog
|
|
25
26
|
} from '../../util.js';
|
|
26
27
|
|
|
27
28
|
import { COMPONENT_SCHEMA, COMPONENTS_DIRECTORY_PATH, TASKS_CONFIG_JSON_FILENAME, COMPONENTS_PATH, CATEGORY_CONSTELLATION, SHARED_FILE_NAMES } from '../../constants.js';
|
|
@@ -53,7 +54,7 @@ const copyComponentTemplate = async (options) => {
|
|
|
53
54
|
|
|
54
55
|
export const compileMustacheTemplates = async (
|
|
55
56
|
componentDirectory,
|
|
56
|
-
{ componentKey, componentName, componentLabel, library, version, type, subtype, description, organization, allowedApplications }
|
|
57
|
+
{ componentKey, componentName, componentLabel, library, version, type, subtype, description, organization, allowedApplications = '' }
|
|
57
58
|
) => {
|
|
58
59
|
const files = fs.readdirSync(componentDirectory);
|
|
59
60
|
const componentClassName = convertIntoPascalCase(componentKey);
|
|
@@ -352,7 +353,9 @@ export const validateCompileAll = async ({ prefix, library, version, allowedAppl
|
|
|
352
353
|
|
|
353
354
|
|
|
354
355
|
export default async (options) => {
|
|
355
|
-
showVersion();
|
|
356
|
+
await showVersion();
|
|
357
|
+
|
|
358
|
+
addDebugLog("createAll", "", "+");
|
|
356
359
|
|
|
357
360
|
await checkPathAccess(pegaConfigJsonPath);
|
|
358
361
|
|
|
@@ -428,7 +431,8 @@ export default async (options) => {
|
|
|
428
431
|
{
|
|
429
432
|
name: 'allowedApplications',
|
|
430
433
|
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
431
|
-
suffix: 'Keep empty for all applications'
|
|
434
|
+
suffix: 'Keep empty for all applications',
|
|
435
|
+
when: () => !isLibraryBased
|
|
432
436
|
}
|
|
433
437
|
];
|
|
434
438
|
|
|
@@ -449,4 +453,6 @@ export default async (options) => {
|
|
|
449
453
|
);
|
|
450
454
|
});
|
|
451
455
|
}
|
|
456
|
+
|
|
457
|
+
addDebugLog("createAll", "END", "-");
|
|
452
458
|
};
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
getComponents,
|
|
14
14
|
getPegaServerConfig,
|
|
15
15
|
standardizeStr,
|
|
16
|
-
sanitize
|
|
16
|
+
sanitize,
|
|
17
|
+
addDebugLog
|
|
17
18
|
} from '../../util.js';
|
|
18
19
|
import { getComponentsFromServer } from '../list/helper.js';
|
|
19
20
|
|
|
@@ -29,6 +30,8 @@ let organization;
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
export const getDeleteComponentsQuestions = async (options) => {
|
|
33
|
+
addDebugLog("getDeleteComponentsQuestions", "", "");
|
|
34
|
+
|
|
32
35
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
33
36
|
|
|
34
37
|
return [
|
|
@@ -46,6 +49,7 @@ export const getDeleteComponentsQuestions = async (options) => {
|
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
export const getLaunchPadFilterQuestions = async () => {
|
|
52
|
+
addDebugLog("getLaunchPadFilterQuestions", "", "");
|
|
49
53
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
50
54
|
|
|
51
55
|
const currentDirectory = process.cwd();
|
|
@@ -93,6 +97,7 @@ export const getLaunchPadFilterQuestions = async () => {
|
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
100
|
+
addDebugLog("deleteLocalComponents", `sourceOfComponnents: ${sourceOfComponents}`, "" );
|
|
96
101
|
const localComponents = await getComponents();
|
|
97
102
|
|
|
98
103
|
if (localComponents.length > 0) {
|
|
@@ -128,7 +133,7 @@ export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
|
128
133
|
};
|
|
129
134
|
|
|
130
135
|
export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
131
|
-
|
|
136
|
+
addDebugLog("deleteServerComponents", `sourceOfComponents: ${sourceOfComponents}`, "");
|
|
132
137
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
133
138
|
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
134
139
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
|
|
3
|
-
import { showVersion, getLibraryBased } from '../../util.js';
|
|
3
|
+
import { showVersion, getLibraryBased, addDebugLog } from '../../util.js';
|
|
4
4
|
|
|
5
5
|
import { deleteLocalComponents, SOURCE_OF_COMPONENT_TYPES, deleteServerComponents, getDeleteComponentsQuestions } from './helper.js';
|
|
6
6
|
|
|
7
7
|
const isLibraryBased = await getLibraryBased();
|
|
8
8
|
|
|
9
9
|
const deleteComponentsFn = async (sourceOfComponents, answers, options) => {
|
|
10
|
+
addDebugLog("deleteComponentsFn", `sourceOfComponents: ${sourceOfComponents}`, "");
|
|
10
11
|
switch (sourceOfComponents) {
|
|
11
12
|
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
12
13
|
await deleteLocalComponents(sourceOfComponents, options);
|
|
@@ -24,7 +25,9 @@ const deleteComponentsFn = async (sourceOfComponents, answers, options) => {
|
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
export default async (options) => {
|
|
27
|
-
showVersion();
|
|
28
|
+
await showVersion();
|
|
29
|
+
|
|
30
|
+
addDebugLog("delete", "", "+");
|
|
28
31
|
|
|
29
32
|
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
30
33
|
if (isLibraryBased) {
|
|
@@ -45,4 +48,5 @@ export default async (options) => {
|
|
|
45
48
|
const { sourceOfComponents } = answers;
|
|
46
49
|
await deleteComponentsFn(sourceOfComponents, answers, options);
|
|
47
50
|
}
|
|
51
|
+
addDebugLog("delete", "END", "-");
|
|
48
52
|
};
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
getComponents,
|
|
13
13
|
getPegaServerConfig,
|
|
14
14
|
standardizeStr,
|
|
15
|
-
validateRulesetVersion
|
|
15
|
+
validateRulesetVersion,
|
|
16
|
+
addDebugLog
|
|
16
17
|
} from '../../util.js';
|
|
17
18
|
import { getComponentsFromServer } from '../list/helper.js';
|
|
18
19
|
import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH } from '../../constants.js';
|
|
@@ -27,6 +28,7 @@ let organization;
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
export const getDeleteComponentsQuestions = async (options) => {
|
|
31
|
+
addDebugLog("getDeleteComponentsQuestions", "", "");
|
|
30
32
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
31
33
|
|
|
32
34
|
return [
|
|
@@ -44,6 +46,7 @@ export const getDeleteComponentsQuestions = async (options) => {
|
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
export const getLaunchPadFilterQuestions = async () => {
|
|
49
|
+
addDebugLog("getLaunchPadFilterQuestions", "", "");
|
|
47
50
|
const currentDirectory = process.cwd();
|
|
48
51
|
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
49
52
|
|
|
@@ -89,6 +92,7 @@ export const getLaunchPadFilterQuestions = async () => {
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
95
|
+
addDebugLog("deleteLocalComponents", `sourceOfCompnents: ${sourceOfComponents}`, "");
|
|
92
96
|
const localComponents = await getComponents();
|
|
93
97
|
|
|
94
98
|
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
@@ -132,7 +136,7 @@ export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
|
132
136
|
};
|
|
133
137
|
|
|
134
138
|
export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
135
|
-
|
|
139
|
+
addDebugLog("deleteServerComponents", `sourceOfCompnents: ${sourceOfComponents}`, "");
|
|
136
140
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
137
141
|
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
138
142
|
|