@pega/custom-dx-components 25.1.10-alpha-0.5 → 25.1.10-alpha-0.7
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 +2 -2
- package/src/tasks/create/index.js +4 -1
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +1 -0
- 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/template/README.md +1 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
- 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 +3 -2
- package/src/tasks/validator/index.js +8 -0
- package/src/util.js +19 -10
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +1 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/custom-dx-components",
|
|
3
|
-
"version": "25.1.10-alpha-0.
|
|
3
|
+
"version": "25.1.10-alpha-0.7",
|
|
4
4
|
"description": "Utility for building custom UI components",
|
|
5
5
|
"bin": "./bin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
20
20
|
"@babel/preset-react": "^7.27.1",
|
|
21
21
|
"@pega/auth": "^0.2.24",
|
|
22
|
-
"@pega/constellation-dx-components-build-utils": "^2.0.
|
|
22
|
+
"@pega/constellation-dx-components-build-utils": "^2.0.7",
|
|
23
23
|
"@pega/inquirer-fuzzy-path": "^3.0.0",
|
|
24
24
|
"ajv": "^8.17.1",
|
|
25
25
|
"ajv-keywords": "^5.1.0",
|
|
@@ -119,7 +119,7 @@ const compileMustacheTemplates = async (
|
|
|
119
119
|
TYPE: type,
|
|
120
120
|
SUB_TYPE: JSON.stringify(mustacheSubType),
|
|
121
121
|
SUB_TYPE_LABEL: subTypeLabel,
|
|
122
|
-
DESCRIPTION: description,
|
|
122
|
+
DESCRIPTION: description || componentLabel,
|
|
123
123
|
IS_TEMPLATE: isTemplate,
|
|
124
124
|
IS_PICKLIST: isPicklist,
|
|
125
125
|
IS_BOOLEAN: isBool,
|
|
@@ -190,6 +190,8 @@ const validateCompile = async (
|
|
|
190
190
|
framework = "Constellation";
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
|
|
194
|
+
|
|
193
195
|
const orgLib = getConfigDefaults();
|
|
194
196
|
if (isLibraryBased) {
|
|
195
197
|
// library comes from config
|
|
@@ -440,6 +442,7 @@ addDebugLog("create", "", "+");
|
|
|
440
442
|
description,
|
|
441
443
|
allowedApplications
|
|
442
444
|
} = answers;
|
|
445
|
+
|
|
443
446
|
await validateCompile(
|
|
444
447
|
{
|
|
445
448
|
componentName,
|
|
@@ -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", "-");
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@babel/preset-react": "^7.27.1",
|
|
109
109
|
"@babel/preset-typescript": "^7.27.1",
|
|
110
110
|
"@pega/configs": "^0.16.3",
|
|
111
|
-
"@pega/custom-dx-components": "~25.1.10-alpha-0.
|
|
111
|
+
"@pega/custom-dx-components": "~25.1.10-alpha-0.7",
|
|
112
112
|
"@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
|
|
113
113
|
"@storybook/addon-actions": "^8.6.14",
|
|
114
114
|
"@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");
|
|
@@ -110,13 +110,6 @@ addDebugLog("zipLibraryComponent", `libraryName: ${libraryName}, libraryVersion:
|
|
|
110
110
|
localizationsContent = Buffer.from(fs.readFileSync(localizationsJson)).toString();
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
// if (fs.existsSync(libraryDirectory)) {
|
|
114
|
-
// fs.rm(libraryDirectory, { recursive: true }, err => {
|
|
115
|
-
// if (err) {
|
|
116
|
-
// throw err;
|
|
117
|
-
// }
|
|
118
|
-
// });
|
|
119
|
-
// }
|
|
120
113
|
|
|
121
114
|
return { zipContent, configContent, localizationsContent};
|
|
122
115
|
};
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
getComponents,
|
|
8
8
|
checkLibraryAndArchives,
|
|
9
9
|
getPegaServerConfig,
|
|
10
|
-
getLibraryBasedCL
|
|
10
|
+
getLibraryBasedCL,
|
|
11
|
+
applyPegaData } from '../../util.js';
|
|
11
12
|
|
|
12
13
|
export const showCurrentStatus = async () => {
|
|
13
14
|
|
|
@@ -15,7 +16,7 @@ export const showCurrentStatus = async () => {
|
|
|
15
16
|
const componentList = await getComponents();
|
|
16
17
|
const isLibraryBased = getLibraryBased();
|
|
17
18
|
const isLibraryBasedCL = getLibraryBasedCL();
|
|
18
|
-
const pegaServer = await getPegaServerConfig();
|
|
19
|
+
const pegaServer = await getPegaServerConfig(true);
|
|
19
20
|
|
|
20
21
|
console.log("");
|
|
21
22
|
console.log("\tCurrent status");
|
|
@@ -370,10 +370,18 @@ export default async (option) => {
|
|
|
370
370
|
throw new Error(`Invalid schema json in config.json: ${er}`);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
373
376
|
const valid = validateSchema(data);
|
|
374
377
|
|
|
375
378
|
if (valid) {
|
|
376
379
|
|
|
380
|
+
if (data.description === "") {
|
|
381
|
+
throw new Error(`Invalid schema json in config.json: 'description' cannot be blank.`);
|
|
382
|
+
process.exit(1);
|
|
383
|
+
}
|
|
384
|
+
|
|
377
385
|
if (
|
|
378
386
|
componentToValidate &&
|
|
379
387
|
!/^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$/.test(componentToValidate)
|
package/src/util.js
CHANGED
|
@@ -760,6 +760,11 @@ if (showDebug) addDebugLog("restoreTopLevelConfigFiles", `directory: ${directory
|
|
|
760
760
|
const tempDirectory = join(currentDirectory, TEMP_PATH);
|
|
761
761
|
const configFiles = await getTopLevelConfigFiles(tempDirectory);
|
|
762
762
|
|
|
763
|
+
// we force to get the tasks.config.json and store it locally
|
|
764
|
+
// when we call updateComponentTaskConfig we will use this stored version to bring back server-config (except ruleset/version)
|
|
765
|
+
// and component objects
|
|
766
|
+
await getPegaConfig(true);
|
|
767
|
+
|
|
763
768
|
if (configFiles && configFiles.length > 0) {
|
|
764
769
|
for (const configF of configFiles) {
|
|
765
770
|
if (configF !== "package-lock.json" && configF !== "package.json") {
|
|
@@ -936,9 +941,9 @@ if (showDebug) { addDebugLog("getPegaConfig", "END", "-"); }
|
|
|
936
941
|
return pegaData;
|
|
937
942
|
};
|
|
938
943
|
|
|
939
|
-
export const getPegaServerConfig = async () => {
|
|
944
|
+
export const getPegaServerConfig = async (force = false) => {
|
|
940
945
|
if (showDebug) addDebugLog("getPegaServerConfig", "", "+");
|
|
941
|
-
if (!pegaConfig) {
|
|
946
|
+
if (!pegaConfig || force) {
|
|
942
947
|
pegaConfig = await getPegaConfig();
|
|
943
948
|
|
|
944
949
|
if (getServerType() === "launchpad") {
|
|
@@ -2218,19 +2223,23 @@ if (showDebug) addDebugLog("updateComponentTaskConfig", "", "");
|
|
|
2218
2223
|
const currentDirectory = process.cwd();
|
|
2219
2224
|
const tempDirectory = join(currentDirectory, TEMP_PATH);
|
|
2220
2225
|
|
|
2221
|
-
const tempConfigPath = join(tempDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
2222
2226
|
const currentConfigPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
2223
|
-
|
|
2224
|
-
const contents = fs.readFileSync(tempConfigPath);
|
|
2225
2227
|
const originalContents = fs.readFileSync(currentConfigPath);
|
|
2226
2228
|
|
|
2227
|
-
|
|
2229
|
+
// was previously stored in
|
|
2230
|
+
let contentsData = await getPegaConfig();
|
|
2231
|
+
|
|
2228
2232
|
let originalContentsData = JSON.parse(originalContents);
|
|
2233
|
+
const orgRuleset = originalContentsData["server-config"].rulesetName;
|
|
2234
|
+
const orgRulesetVersion = originalContentsData["server-config"].rulesetVersion;
|
|
2235
|
+
|
|
2236
|
+
// we keep server-config but we will restore from archive the
|
|
2237
|
+
// rulset/version. Other stuff in task.config will come from archive
|
|
2238
|
+
originalContentsData["server-config"] = contentsData["server-config"];
|
|
2239
|
+
// restore ruleset and verion
|
|
2240
|
+
originalContentsData["server-config"].rulesetName = orgRuleset;
|
|
2241
|
+
originalContentsData["server-config"].rulesetVersion = orgRulesetVersion;
|
|
2229
2242
|
|
|
2230
|
-
// only copy "components" from archived task.config and "devBuild"
|
|
2231
|
-
// that way, your current tasks.config isn't messed up
|
|
2232
|
-
originalContentsData["server-config"].devBuild = contentsData["server-config"].devBuild;
|
|
2233
|
-
originalContentsData["component"] = contentsData["component"];
|
|
2234
2243
|
|
|
2235
2244
|
// if we don't have a devServerPort, add the default
|
|
2236
2245
|
if (originalContentsData["server-config"].devServerPort === undefined) {
|