@pega/custom-dx-components 0.25.44 → 0.25.45
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/README.md +1 -1
- package/package.json +26 -32
- package/src/tasks/bundle/builder/index.js +15 -15
- package/src/tasks/export-archive/index.js +0 -11
- package/src/tasks/import-archive/helper.js +38 -39
- package/src/tasks/import-archive/index.js +2 -9
- package/src/tasks/import-comp/index.js +0 -9
- package/src/tasks/init/index.js +59 -62
- package/src/tasks/init/template/README.md +1 -1
- package/src/tasks/init/template/package.json.mustache +1 -2
- package/src/tasks/list-pub/helper.js +0 -3
- package/src/tasks/publish/index.js +5 -1
- package/src/tasks/publish-lib/index.js +0 -7
- package/src/tasks/restore/index.js +0 -3
- package/src/tasks/show-status/index.js +2 -1
- package/src/util.js +463 -458
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/custom-dx-components",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.45",
|
|
4
4
|
"description": "Utility for building custom UI components",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pega",
|
|
7
|
+
"custom-components"
|
|
8
|
+
],
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"author": "Custom component dev",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"type": "module",
|
|
5
13
|
"bin": "./bin/index.js",
|
|
6
14
|
"scripts": {
|
|
15
|
+
"fix:es": "eslint --fix .",
|
|
16
|
+
"fix:format": "prettier -w .",
|
|
7
17
|
"lint:es": "eslint .",
|
|
8
18
|
"lint:format": "prettier -c .",
|
|
9
19
|
"lint:spelling": "cspell **/*",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"test:unit:local": "node --input-type=module --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand /tests/unit",
|
|
13
|
-
"test:functional:local": "jest --runInBand /tests/functional --detectOpenHandles --coverage"
|
|
20
|
+
"test:functional:local": "jest --runInBand /tests/functional --detectOpenHandles --coverage",
|
|
21
|
+
"test:unit:local": "node --input-type=module --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand /tests/unit"
|
|
14
22
|
},
|
|
15
|
-
"type": "module",
|
|
16
|
-
"sideEffects": false,
|
|
17
23
|
"dependencies": {
|
|
18
|
-
"@babel/core": "^7.
|
|
19
|
-
"@babel/
|
|
20
|
-
"@
|
|
21
|
-
"@pega/
|
|
24
|
+
"@babel/core": "^7.28.0",
|
|
25
|
+
"@babel/preset-env": "^7.28.0",
|
|
26
|
+
"@pega/auth": "^0.2.27",
|
|
27
|
+
"@pega/configs": "^0.16.3",
|
|
22
28
|
"@pega/constellation-dx-components-build-utils": "^2.0.6",
|
|
23
29
|
"@pega/inquirer-fuzzy-path": "^3.0.0",
|
|
30
|
+
"@pega/prettier-config": "^0.16.3",
|
|
24
31
|
"ajv": "^8.17.1",
|
|
25
|
-
"ajv-keywords": "^5.1.0",
|
|
26
32
|
"archiver": "^7.0.1",
|
|
27
33
|
"arg": "^5.0.2",
|
|
28
34
|
"babel-loader": "^10.0.0",
|
|
29
35
|
"chalk": "^5.4.1",
|
|
30
|
-
"check-git": "^2.0.2",
|
|
31
36
|
"compression-webpack-plugin": "^11.1.0",
|
|
37
|
+
"cspell": "^8.19.4",
|
|
32
38
|
"css-loader": "7.1.2",
|
|
33
39
|
"css-minimizer-webpack-plugin": "^7.0.2",
|
|
34
|
-
"eslint": "^9.
|
|
35
|
-
"execa": "^9.
|
|
40
|
+
"eslint": "^9.30.1",
|
|
41
|
+
"execa": "^9.6.0",
|
|
36
42
|
"file-loader": "6.2.0",
|
|
37
|
-
"fs-extra": "^11.3.0",
|
|
38
43
|
"gitignore": "^0.7.0",
|
|
39
44
|
"inquirer": "^9.3.7",
|
|
40
45
|
"jwt-decode": "^4.0.0",
|
|
@@ -46,10 +51,10 @@
|
|
|
46
51
|
"node-stream-zip": "^1.15.0",
|
|
47
52
|
"ora": "^8.2.0",
|
|
48
53
|
"pascalcase": "^2.0.0",
|
|
49
|
-
"postcss": "^8.5.
|
|
54
|
+
"postcss": "^8.5.6",
|
|
50
55
|
"postcss-loader": "8.1.1",
|
|
51
|
-
"postcss-preset-env": "10.
|
|
52
|
-
"
|
|
56
|
+
"postcss-preset-env": "10.2.4",
|
|
57
|
+
"prettier": "3.6.2",
|
|
53
58
|
"react": "^18.2.0",
|
|
54
59
|
"react-dev-utils": "^12.0.1",
|
|
55
60
|
"resolve": "1.22.10",
|
|
@@ -60,26 +65,15 @@
|
|
|
60
65
|
"typescript": "~5.8.3",
|
|
61
66
|
"unarchive": "^1.1.3",
|
|
62
67
|
"url-loader": "4.1.1",
|
|
63
|
-
"webpack": "5.99.
|
|
68
|
+
"webpack": "5.99.9",
|
|
64
69
|
"webpack-cli": "^6.0.1"
|
|
65
70
|
},
|
|
66
|
-
"author": "Custom component dev",
|
|
67
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
68
|
-
"keywords": [
|
|
69
|
-
"pega",
|
|
70
|
-
"custom-components"
|
|
71
|
-
],
|
|
72
71
|
"devDependencies": {
|
|
73
|
-
"@babel/preset-env": "^7.27.2",
|
|
74
|
-
"@pega/configs": "^0.16.3",
|
|
75
|
-
"@pega/prettier-config": "^0.16.3",
|
|
76
72
|
"@types/jest": "^29.5.14",
|
|
77
73
|
"babel-jest": "^29.7.0",
|
|
78
|
-
"cspell": "^8.19.4",
|
|
79
74
|
"jest": "^29.7.0",
|
|
80
75
|
"jest-environment-jsdom": "^29.7.0",
|
|
81
76
|
"jest-junit": "^16.0.0",
|
|
82
|
-
"
|
|
83
|
-
"ts-jest": "^29.3.2"
|
|
77
|
+
"ts-jest": "^29.4.0"
|
|
84
78
|
}
|
|
85
79
|
}
|
|
@@ -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, addDebugLog} from '../../../util.js';
|
|
6
|
+
import { getUseWebPackPromotion, addDebugLog, emptyDirSync } from '../../../util.js';
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -44,7 +44,7 @@ let compilationErrors = null;
|
|
|
44
44
|
|
|
45
45
|
// Create the build and print the deployment instructions.
|
|
46
46
|
function build(config, previousFileSizes, showStats = true) {
|
|
47
|
-
addDebugLog("bundle build", `config: ${JSON.stringify(config)}, \npreviousFileSizes: ${JSON.stringify(previousFileSizes)}, showStats: ${showStats}`, "");
|
|
47
|
+
addDebugLog("bundle build", `config: ${JSON.stringify(config)}, \npreviousFileSizes: ${JSON.stringify(previousFileSizes)}, showStats: ${showStats}`, "");
|
|
48
48
|
|
|
49
49
|
if (showStats) {
|
|
50
50
|
console.log(`Creating a ${Env} build...`);
|
|
@@ -55,14 +55,14 @@ addDebugLog("bundle build", `config: ${JSON.stringify(config)}, \npreviousFileSi
|
|
|
55
55
|
return new Promise((resolve, reject) => {
|
|
56
56
|
compiler.run((err, stats) => {
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
if (err != null && typeof (err) == "object") {
|
|
59
|
+
if (err.error != undefined) {
|
|
60
|
+
//store and print elsewhere
|
|
61
|
+
compilationErrors = err.error;
|
|
62
|
+
//console.log("err:" + err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (stats != null & typeof (stats) == "object") {
|
|
66
66
|
if (stats.errors != undefined) {
|
|
67
67
|
if (showStats) {
|
|
68
68
|
console.log("stats:" + stats);
|
|
@@ -79,7 +79,7 @@ addDebugLog("bundle build", `config: ${JSON.stringify(config)}, \npreviousFileSi
|
|
|
79
79
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
}
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
let messages;
|
|
@@ -118,7 +118,7 @@ addDebugLog("bundle build", `config: ${JSON.stringify(config)}, \npreviousFileSi
|
|
|
118
118
|
console.log(
|
|
119
119
|
chalk.yellow(
|
|
120
120
|
'\nTreating warnings as errors because process.env.CI = true.\n' +
|
|
121
|
-
|
|
121
|
+
'Most CI servers set it automatically.\n'
|
|
122
122
|
)
|
|
123
123
|
);
|
|
124
124
|
return reject(new Error(messages.warnings.join('\n\n')));
|
|
@@ -148,7 +148,7 @@ export default async ({
|
|
|
148
148
|
// used by promote and revert webPack commands, do not change
|
|
149
149
|
const configFactory = (
|
|
150
150
|
await import(`${usePromoted ? `../../../../../../../webpack.config.js` : `./webpack.config.js`}`)
|
|
151
|
-
).default
|
|
151
|
+
).default;
|
|
152
152
|
|
|
153
153
|
// Generate configuration
|
|
154
154
|
const config = configFactory(Env, {
|
|
@@ -170,7 +170,7 @@ export default async ({
|
|
|
170
170
|
.then(previousFileSizes => {
|
|
171
171
|
// Remove all content but keep the directory so that
|
|
172
172
|
// if you're in it, you don't end up in Trash
|
|
173
|
-
|
|
173
|
+
emptyDirSync(paths.appBuild);
|
|
174
174
|
// Start the webpack build
|
|
175
175
|
return build(config, previousFileSizes, showStats);
|
|
176
176
|
})
|
|
@@ -202,7 +202,7 @@ export default async ({
|
|
|
202
202
|
|
|
203
203
|
resolve('done emitting');
|
|
204
204
|
},
|
|
205
|
-
err
|
|
205
|
+
err => {
|
|
206
206
|
reject();
|
|
207
207
|
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
|
|
208
208
|
if (tscCompileOnError) {
|
|
@@ -159,7 +159,6 @@ addDebugLog("exportCLArch", `exportPath: ${exportPath}, orgLibName: ${orgLibName
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
|
|
162
|
-
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
|
|
@@ -370,9 +369,6 @@ export default async options => {
|
|
|
370
369
|
exportTo = "Directory";
|
|
371
370
|
}
|
|
372
371
|
|
|
373
|
-
//exportTo = "Directory"; // remove this line when above is uncommented out
|
|
374
|
-
|
|
375
|
-
|
|
376
372
|
if (exportTo === "Directory") {
|
|
377
373
|
inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);
|
|
378
374
|
|
|
@@ -382,12 +378,6 @@ export default async options => {
|
|
|
382
378
|
|
|
383
379
|
await updateSavedExportFilePath(filePath);
|
|
384
380
|
|
|
385
|
-
// if (path.sep === "/") {
|
|
386
|
-
// if (filePath.lastIndexOf(path.sep) != filePath.length - 1) {
|
|
387
|
-
// filePath = filePath.concat(path.sep);
|
|
388
|
-
// }
|
|
389
|
-
// }
|
|
390
|
-
|
|
391
381
|
await exportArch( filePath, orgLibName, selectedVersion, fullArchive);
|
|
392
382
|
|
|
393
383
|
}
|
|
@@ -397,7 +387,6 @@ export default async options => {
|
|
|
397
387
|
// archive it
|
|
398
388
|
await zipVersionAndArchive(orgLibName, selectedVersion);
|
|
399
389
|
|
|
400
|
-
|
|
401
390
|
// publish to server
|
|
402
391
|
await publishArchive(orgLibName, selectedVersion);
|
|
403
392
|
|
|
@@ -141,57 +141,56 @@ export const renameComponent = async (
|
|
|
141
141
|
addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKey}`, "");
|
|
142
142
|
|
|
143
143
|
|
|
144
|
-
const componentName = componentKey.split("_")[2];
|
|
144
|
+
const componentName = componentKey.split("_")[2];
|
|
145
145
|
|
|
146
|
-
const configDef = getConfigDefaults();
|
|
147
|
-
const orgLibName = `${configDef.organization}_${library}`;
|
|
148
|
-
const organization = configDef.organization;
|
|
149
|
-
|
|
150
|
-
const newComponentKey = `${orgLibName}_${componentName}`;
|
|
151
|
-
|
|
152
|
-
const oldComponentKey = componentKey;
|
|
153
|
-
const newComponentKeyPC = convertIntoPascalCase(newComponentKey);
|
|
154
|
-
const oldComponentKeyPC = convertIntoPascalCase(oldComponentKey);
|
|
146
|
+
const configDef = getConfigDefaults();
|
|
147
|
+
const orgLibName = `${configDef.organization}_${library}`;
|
|
148
|
+
const organization = configDef.organization;
|
|
155
149
|
|
|
156
|
-
const
|
|
157
|
-
const targetDirectory = await getComponentDirectoryPath(newComponentKey, currDir);
|
|
150
|
+
const newComponentKey = `${orgLibName}_${componentName}`;
|
|
158
151
|
|
|
159
|
-
const
|
|
152
|
+
const oldComponentKey = componentKey;
|
|
153
|
+
const newComponentKeyPC = convertIntoPascalCase(newComponentKey);
|
|
154
|
+
const oldComponentKeyPC = convertIntoPascalCase(oldComponentKey);
|
|
160
155
|
|
|
161
|
-
|
|
162
|
-
const
|
|
156
|
+
const currentDirectory = await getComponentDirectoryPath(componentKey, currDir);
|
|
157
|
+
const targetDirectory = await getComponentDirectoryPath(newComponentKey, currDir);
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
await updateConfig(
|
|
166
|
-
{
|
|
167
|
-
oldComponentKey,
|
|
168
|
-
newComponentKey,
|
|
169
|
-
componentName,
|
|
170
|
-
organization,
|
|
171
|
-
library,
|
|
172
|
-
version,
|
|
173
|
-
currentDirectory,
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
await updateFile(
|
|
179
|
-
fileName,
|
|
180
|
-
oldComponentKeyPC,
|
|
181
|
-
newComponentKeyPC,
|
|
182
|
-
currentDirectory );
|
|
159
|
+
const targetFileList = await getDirectoryFiles(currentDirectory);
|
|
183
160
|
|
|
184
|
-
|
|
161
|
+
for (const fileIndex in targetFileList) {
|
|
162
|
+
const fileName = targetFileList[fileIndex];
|
|
163
|
+
|
|
164
|
+
if (fileName === "config.json") {
|
|
165
|
+
await updateConfig(
|
|
166
|
+
{
|
|
167
|
+
oldComponentKey,
|
|
168
|
+
newComponentKey,
|
|
169
|
+
componentName,
|
|
170
|
+
organization,
|
|
171
|
+
library,
|
|
172
|
+
version,
|
|
173
|
+
currentDirectory,
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
await updateFile(
|
|
179
|
+
fileName,
|
|
180
|
+
oldComponentKeyPC,
|
|
181
|
+
newComponentKeyPC,
|
|
182
|
+
currentDirectory );
|
|
185
183
|
|
|
186
|
-
}
|
|
184
|
+
}
|
|
187
185
|
|
|
186
|
+
} // for
|
|
188
187
|
|
|
189
188
|
|
|
190
|
-
// rename the directory
|
|
191
|
-
await reanmeDirectory(currentDirectory, targetDirectory);
|
|
189
|
+
// rename the directory
|
|
190
|
+
await reanmeDirectory(currentDirectory, targetDirectory);
|
|
192
191
|
|
|
193
192
|
|
|
194
|
-
return newComponentKey;
|
|
193
|
+
return newComponentKey;
|
|
195
194
|
|
|
196
195
|
};
|
|
197
196
|
|
|
@@ -648,11 +648,9 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
648
648
|
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
|
|
652
651
|
}
|
|
653
652
|
|
|
654
653
|
|
|
655
|
-
|
|
656
654
|
export const getZipFileList = async(filePath) => {
|
|
657
655
|
|
|
658
656
|
if (fs.existsSync(filePath)) {
|
|
@@ -782,6 +780,7 @@ export default async options => {
|
|
|
782
780
|
}
|
|
783
781
|
catch (ex) {
|
|
784
782
|
console.log(chalk.redBright(ex));
|
|
783
|
+
process.exit(1);
|
|
785
784
|
}
|
|
786
785
|
|
|
787
786
|
|
|
@@ -844,7 +843,7 @@ export default async options => {
|
|
|
844
843
|
else {
|
|
845
844
|
// No library with that name
|
|
846
845
|
console.log(chalk.redBright(`No library archives exist on server.`));
|
|
847
|
-
process.exit(
|
|
846
|
+
process.exit();
|
|
848
847
|
|
|
849
848
|
}
|
|
850
849
|
|
|
@@ -913,12 +912,6 @@ export default async options => {
|
|
|
913
912
|
}
|
|
914
913
|
|
|
915
914
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
915
|
}
|
|
923
916
|
|
|
924
917
|
addDebugLog("importArchive", "END", "-");
|
|
@@ -273,14 +273,8 @@ addDebugLog("importComp", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
276
|
}
|
|
280
277
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
278
|
}
|
|
285
279
|
|
|
286
280
|
|
|
@@ -379,9 +373,6 @@ addDebugLog("importComponent", "", "+");
|
|
|
379
373
|
await importComp( filePath, fileName, true);
|
|
380
374
|
}
|
|
381
375
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
376
|
}
|
|
386
377
|
|
|
387
378
|
addDebugLog("importComponent", "END", "-");
|
package/src/tasks/init/index.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
+
|
|
1
2
|
import path from 'path';
|
|
2
3
|
import fs from 'fs';
|
|
3
4
|
import { fileURLToPath } from 'url';
|
|
4
5
|
import { promisify } from 'util';
|
|
5
|
-
import { exec } from 'child_process';
|
|
6
|
-
|
|
7
6
|
import chalk from 'chalk';
|
|
8
7
|
import { execa } from 'execa';
|
|
9
|
-
import ncp from 'ncp';
|
|
10
8
|
import { Listr } from 'listr2';
|
|
11
9
|
import gitignore from 'gitignore';
|
|
12
10
|
import inquirer from 'inquirer';
|
|
11
|
+
import { compileMustacheTemplate, isPascalCase, convertIntoPascalCase, sanitize } from '../../util.js';
|
|
12
|
+
import { getInitProjectQuestions } from './helper.js';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
compileMustacheTemplate,
|
|
16
|
-
isPascalCase,
|
|
17
|
-
convertIntoPascalCase,
|
|
18
|
-
sanitize
|
|
19
|
-
} from '../../util.js';
|
|
14
|
+
const writeGitignore = promisify(gitignore.writeFile);
|
|
20
15
|
|
|
21
|
-
import { getInitProjectQuestions } from './helper.js';
|
|
22
16
|
|
|
23
|
-
const
|
|
17
|
+
const copyProjectDir = async (src, dest) => {
|
|
18
|
+
if (typeof fs.cp === 'function') {
|
|
19
|
+
await fs.promises.cp(src, dest, { recursive: true, errorOnExist: false, force: false });
|
|
20
|
+
}
|
|
21
|
+
};
|
|
24
22
|
|
|
25
|
-
const copy = promisify(ncp);
|
|
26
|
-
const writeGitignore = promisify(gitignore.writeFile);
|
|
27
|
-
const writeFile = promisify(fs.writeFile);
|
|
28
23
|
|
|
29
24
|
const createGitignore = async options => {
|
|
30
25
|
const file = fs.createWriteStream(path.join(options.targetDirectory, '.gitignore'), {
|
|
@@ -37,51 +32,54 @@ const createGitignore = async options => {
|
|
|
37
32
|
};
|
|
38
33
|
|
|
39
34
|
const createLicense = async options => {
|
|
35
|
+
// Write LICENSE file directly
|
|
40
36
|
const targetPath = path.join(options.targetDirectory, 'LICENSE');
|
|
41
37
|
const licenseContent = 'Enter license text here';
|
|
42
|
-
|
|
38
|
+
await fs.promises.writeFile(targetPath, licenseContent, 'utf8');
|
|
43
39
|
};
|
|
44
40
|
|
|
41
|
+
|
|
45
42
|
const copyProjectTemplate = async options => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
43
|
+
// Use fast copy
|
|
44
|
+
await copyProjectDir(options.templateDirectory, options.targetDirectory);
|
|
49
45
|
const packageJsonPath = path.join(options.targetDirectory, 'package.json.mustache');
|
|
50
46
|
const templateNPMRCPath = path.join(options.targetDirectory, 'templateNPMRC.txt');
|
|
51
47
|
|
|
52
48
|
let { organization, projectName } = options;
|
|
53
|
-
|
|
54
49
|
projectName = sanitize(projectName).toLowerCase();
|
|
55
|
-
|
|
56
50
|
organization = sanitize(organization);
|
|
57
51
|
if (!isPascalCase(organization)) {
|
|
58
52
|
organization = convertIntoPascalCase(organization);
|
|
59
53
|
}
|
|
54
|
+
options = { ...options, organization, projectName };
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
...options,
|
|
63
|
-
organization,
|
|
64
|
-
projectName
|
|
65
|
-
};
|
|
56
|
+
// Compile and write package.json in one go
|
|
66
57
|
const output = compileMustacheTemplate(packageJsonPath, options);
|
|
67
|
-
fs.
|
|
68
|
-
fs.
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
|
|
58
|
+
await fs.promises.writeFile(packageJsonPath, output);
|
|
59
|
+
await fs.promises.rename(packageJsonPath, packageJsonPath.replace('.mustache', ''));
|
|
60
|
+
|
|
61
|
+
// Rename templateNPMRC.txt to .npmrc if exists
|
|
62
|
+
try {
|
|
63
|
+
await fs.promises.rename(templateNPMRCPath, templateNPMRCPath.replace('templateNPMRC.txt', '.npmrc'));
|
|
64
|
+
} catch (e) {
|
|
65
|
+
// ignore if not present
|
|
66
|
+
}
|
|
72
67
|
|
|
73
68
|
await createLicense(options);
|
|
74
69
|
};
|
|
75
70
|
|
|
71
|
+
|
|
76
72
|
const initGit = async options => {
|
|
73
|
+
// Use execa for async git init
|
|
77
74
|
const result = await execa('git', ['init'], {
|
|
78
75
|
cwd: options.targetDirectory
|
|
79
76
|
});
|
|
80
77
|
if (result.failed) {
|
|
81
|
-
|
|
78
|
+
throw new Error('Failed to initialize git');
|
|
82
79
|
}
|
|
83
80
|
};
|
|
84
81
|
|
|
82
|
+
|
|
85
83
|
export default async options => {
|
|
86
84
|
options.templateDirectory = path.resolve(
|
|
87
85
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
@@ -90,32 +88,28 @@ export default async options => {
|
|
|
90
88
|
let projectName = 'test';
|
|
91
89
|
|
|
92
90
|
const questions = getInitProjectQuestions();
|
|
91
|
+
const answers = await inquirer.prompt(questions);
|
|
92
|
+
projectName = sanitize(answers.projectName).toLowerCase();
|
|
93
|
+
options = { ...options, ...answers };
|
|
94
|
+
|
|
95
|
+
const projectDirectory = `./${projectName}`;
|
|
96
|
+
if (!fs.existsSync(projectDirectory)) {
|
|
97
|
+
fs.mkdirSync(projectDirectory);
|
|
98
|
+
} else {
|
|
99
|
+
console.log(chalk.bold.red(`A project with name ${projectName} already exists. Exiting...`));
|
|
100
|
+
process.exit();
|
|
101
|
+
}
|
|
93
102
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
options
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
console.log(chalk.bold.red(`A project with name ${projectName} already exists. Exiting...`));
|
|
105
|
-
process.exit();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const targetDirectory = options.targetDirectory || process.cwd();
|
|
109
|
-
options.targetDirectory = path.join(targetDirectory, projectName);
|
|
110
|
-
options.componentDirectory = path.join(
|
|
111
|
-
options.targetDirectory,
|
|
112
|
-
'node_modules/@pega/custom-dx-components'
|
|
113
|
-
);
|
|
114
|
-
options.componentLibraryUtilsDirectory = path.join(
|
|
115
|
-
options.targetDirectory,
|
|
116
|
-
'node_modules/@pega/constellation-dx-components-build-utils'
|
|
117
|
-
);
|
|
118
|
-
});
|
|
103
|
+
const targetDirectory = options.targetDirectory || process.cwd();
|
|
104
|
+
options.targetDirectory = path.join(targetDirectory, projectName);
|
|
105
|
+
options.componentDirectory = path.join(
|
|
106
|
+
options.targetDirectory,
|
|
107
|
+
'node_modules/@pega/custom-dx-components'
|
|
108
|
+
);
|
|
109
|
+
options.componentLibraryUtilsDirectory = path.join(
|
|
110
|
+
options.targetDirectory,
|
|
111
|
+
'node_modules/@pega/constellation-dx-components-build-utils'
|
|
112
|
+
);
|
|
119
113
|
|
|
120
114
|
const installDependenciesText = `Installing dependencies. This will take a couple of minutes.`;
|
|
121
115
|
|
|
@@ -138,35 +132,38 @@ export default async options => {
|
|
|
138
132
|
{
|
|
139
133
|
title: installDependenciesText,
|
|
140
134
|
task: () =>
|
|
141
|
-
|
|
135
|
+
execa('npm', ['i', '--force', '--production=false'], { cwd: options.targetDirectory })
|
|
142
136
|
},
|
|
143
137
|
*/
|
|
144
138
|
{
|
|
145
139
|
title: installDependenciesText,
|
|
146
140
|
task: () =>
|
|
147
|
-
|
|
141
|
+
execa('npm', ['ci', '--force', '--no-audit', '--no-fund', '--loglevel=error'], { cwd: options.targetDirectory })
|
|
148
142
|
},
|
|
149
143
|
/*
|
|
150
144
|
{
|
|
151
145
|
title: 'Installing tasks dependencies',
|
|
152
146
|
task: () =>
|
|
153
|
-
|
|
147
|
+
execa('npm', ['i', '--force', '--production=false'], { cwd: options.componentDirectory })
|
|
154
148
|
},
|
|
155
149
|
{
|
|
156
150
|
title: 'Installing tasks library dependencies',
|
|
157
151
|
task: () =>
|
|
158
|
-
|
|
152
|
+
execa('npm', ['i', '--force', '--production=false'], {
|
|
159
153
|
cwd: options.componentLibraryUtilsDirectory
|
|
160
154
|
})
|
|
161
155
|
},
|
|
162
156
|
*/
|
|
157
|
+
|
|
158
|
+
/*
|
|
163
159
|
{
|
|
164
160
|
title: 'Updating',
|
|
165
|
-
task: () =>
|
|
161
|
+
task: () => execa('npm', ['update', '--dev', '--no-audit', '--no-fund', '--loglevel=error'], { cwd: options.targetDirectory })
|
|
166
162
|
}
|
|
163
|
+
*/
|
|
167
164
|
/* {
|
|
168
165
|
title: 'Installing quick run',
|
|
169
|
-
task: () =>
|
|
166
|
+
task: () => execa('npm', ['i', '-g', 'npm-quick-run'], { cwd: options.targetDirectory })
|
|
170
167
|
} */
|
|
171
168
|
],
|
|
172
169
|
{
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
"react-is": "^18.3.1",
|
|
100
100
|
"react-redux": "^7.2.9",
|
|
101
101
|
"serve": "^14.2.4",
|
|
102
|
-
"shelljs": "^0.8.5",
|
|
103
102
|
"styled-components": "^5.3.11",
|
|
104
103
|
"ts-loader": "^9.5.2"
|
|
105
104
|
},
|
|
@@ -108,7 +107,7 @@
|
|
|
108
107
|
"@babel/preset-react": "^7.27.1",
|
|
109
108
|
"@babel/preset-typescript": "^7.27.1",
|
|
110
109
|
"@pega/configs": "^0.16.3",
|
|
111
|
-
"@pega/custom-dx-components": "~
|
|
110
|
+
"@pega/custom-dx-components": "~25.1.10",
|
|
112
111
|
"@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
|
|
113
112
|
"@storybook/addon-actions": "^8.6.14",
|
|
114
113
|
"@storybook/addon-essentials": "^8.6.14",
|
|
@@ -140,9 +140,6 @@ addDebugLog("getInfinityLibraries", '', "");
|
|
|
140
140
|
const rulesetVersion = defaultPegaServerConfig.rulesetVersion;
|
|
141
141
|
|
|
142
142
|
let urlParams = `/app-name/${ApplicationName}/app-version/${ApplicationVersion}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
|
|
143
|
-
//let urlParams = `&ApplicationName=${ApplicationName}&ApplicationVersion=${ApplicationVersion}&RulesetName=${rulesetName}&RulesetVersion=${rulesetVersion}`;
|
|
144
|
-
//urlParams = encodeURIComponent(urlParams);
|
|
145
|
-
|
|
146
143
|
|
|
147
144
|
url = url.concat(urlParams);
|
|
148
145
|
|
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
getConfigDefaults,
|
|
23
23
|
getInputConfigForCommand,
|
|
24
24
|
convertYNToBoolean,
|
|
25
|
-
checkForBranch
|
|
25
|
+
checkForBranch,
|
|
26
|
+
applyPegaData } from '../../util.js';
|
|
26
27
|
|
|
27
28
|
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
28
29
|
import { default as buildLibrary } from '../build-lib/index.js';
|
|
@@ -61,9 +62,12 @@ addDebugLog("publish", "", "+");
|
|
|
61
62
|
// const currentVersion = devBuild ? `${orgLib.version}-dev`: orgLib.version;
|
|
62
63
|
const currentVersion = orgLib.buildVersion;
|
|
63
64
|
const serverConfg = await getPegaServerConfig();
|
|
65
|
+
let configJson = {};
|
|
66
|
+
await applyPegaData(configJson);
|
|
64
67
|
|
|
65
68
|
console.log();
|
|
66
69
|
console.log(`Publishing to server: ${chalk.green.bold(`${serverConfg.server}`)}`);
|
|
70
|
+
console.log(`Cosmos version: ${chalk.green.bold(`${configJson.packageCosmosVersion}`)}`);
|
|
67
71
|
|
|
68
72
|
if (useInputConfig) {
|
|
69
73
|
const inputConfig = await getInputConfigForCommand("publish");
|