@pega/dx-component-builder-sdk 0.1.37 → 0.1.39
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/tasks/authenticate/index.js +3 -2
- package/src/tasks/build/index.js +2 -2
- package/src/tasks/build-all/index.js +2 -2
- package/src/tasks/create/index.js +4 -4
- package/src/tasks/map/map.js +10 -3
- package/src/tasks/publish/index.js +6 -6
- package/src/tasks/rename/index.js +12 -0
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ let server = null;
|
|
|
17
17
|
const generateAccessToken = async config => {
|
|
18
18
|
|
|
19
19
|
let authSuccess = false;
|
|
20
|
-
const { serverType, isolationId, grantType, clientId, clientSecret, user, password } = config;
|
|
20
|
+
const { serverType, authService, isolationId, grantType, clientId, clientSecret, user, password } = config;
|
|
21
21
|
// Try to gracefully deal with missing trailing slashes for server (and later conditionally for redirectUri)
|
|
22
22
|
const server = config.server.endsWith('/') ? config.server : `${config.server}/`;
|
|
23
23
|
|
|
@@ -38,6 +38,7 @@ const generateAccessToken = async config => {
|
|
|
38
38
|
// Build auth config structure
|
|
39
39
|
const authConfig = {
|
|
40
40
|
serverType: serverType,
|
|
41
|
+
authService: authService,
|
|
41
42
|
grantType: grantType,
|
|
42
43
|
tokenUri: sTokenUri,
|
|
43
44
|
clientId: clientId,
|
|
@@ -46,7 +47,6 @@ const generateAccessToken = async config => {
|
|
|
46
47
|
...authCodeConfig
|
|
47
48
|
};
|
|
48
49
|
if (serverType === 'infinity') {
|
|
49
|
-
authConfig.authService = 'pega';
|
|
50
50
|
if (grantType !== 'clientCreds' && user && password) {
|
|
51
51
|
authConfig.userIdentifier = user;
|
|
52
52
|
authConfig.password = Buffer.from(password).toString('base64');
|
|
@@ -114,6 +114,7 @@ export default async options => {
|
|
|
114
114
|
const serverConfig = data[DXCB_CONFIG][DXCB_PUBLISH_ACCESS];
|
|
115
115
|
serverConfig.serverType = data[SERVER_CONFIG][SERVER_TYPE] || "infinity";
|
|
116
116
|
serverConfig.server = data[SERVER_CONFIG][serverConfig.serverType === "infinity" ? SERVER_REST_URL : LP_SERVER_REST_URL];
|
|
117
|
+
serverConfig.authService = data.authConfig?.authService || 'pega';
|
|
117
118
|
const isPwdNonEmpty = serverConfig['password'] ? true : false;
|
|
118
119
|
|
|
119
120
|
const questions = await getAuthQuestions(serverConfig);
|
package/src/tasks/build/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export default async options => {
|
|
|
51
51
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, category),
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
title: 'Lint
|
|
54
|
+
title: 'Lint associated component',
|
|
55
55
|
task: async () => {
|
|
56
56
|
const targetDirectory = await getComponentDirectoryPath(componentKey, "constellation");
|
|
57
57
|
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
@@ -59,7 +59,7 @@ export default async options => {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
|
-
title: 'Bundle
|
|
62
|
+
title: 'Bundle associated component',
|
|
63
63
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, "constellation")
|
|
64
64
|
}
|
|
65
65
|
],
|
|
@@ -34,7 +34,7 @@ export function getCustomTasks(componentKey, category, sourceMap, devBuild, cont
|
|
|
34
34
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, category),
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
title: 'Lint
|
|
37
|
+
title: 'Lint associated component',
|
|
38
38
|
task: async () => {
|
|
39
39
|
const targetDirectory = await getComponentDirectoryPath(componentKey, "constellation");
|
|
40
40
|
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
@@ -42,7 +42,7 @@ export function getCustomTasks(componentKey, category, sourceMap, devBuild, cont
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
title: 'Bundle
|
|
45
|
+
title: 'Bundle associated component',
|
|
46
46
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, "constellation")
|
|
47
47
|
}
|
|
48
48
|
],
|
|
@@ -200,7 +200,7 @@ export const validateCompile = async (
|
|
|
200
200
|
|
|
201
201
|
let componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
202
202
|
if (components.includes(componentKey)) {
|
|
203
|
-
console.log(chalk.red(`${componentKey}
|
|
203
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
return;
|
|
@@ -208,7 +208,7 @@ export const validateCompile = async (
|
|
|
208
208
|
// test for constellation
|
|
209
209
|
const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
210
210
|
if (componentsConstellation.includes(componentKey)) {
|
|
211
|
-
console.log(chalk.red(`${componentKey}
|
|
211
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -216,7 +216,7 @@ export const validateCompile = async (
|
|
|
216
216
|
// test for constellation
|
|
217
217
|
const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
218
218
|
if (componentsConstellation.includes(componentKey)) {
|
|
219
|
-
console.log(chalk.red(`${componentKey}
|
|
219
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
@@ -266,7 +266,7 @@ export const validateCompile = async (
|
|
|
266
266
|
console.log(chalk.green(`created ${componentKey} component in ${targetDirectory}`));
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
console.log(chalk.green(`created ${componentKey}
|
|
269
|
+
console.log(chalk.green(`created ${componentKey} associated component in ${targetDirectoryConstellation}`));
|
|
270
270
|
|
|
271
271
|
};
|
|
272
272
|
|
package/src/tasks/map/map.js
CHANGED
|
@@ -39,7 +39,7 @@ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTO
|
|
|
39
39
|
let importFull = "import ".concat(componentName).concat(" from '").concat(importComponent).concat("/';");
|
|
40
40
|
let mapFull = "\"".concat(componentNameNoPrefix).concat("\" : " ).concat(componentName).concat(",");
|
|
41
41
|
|
|
42
|
-
if (mapData.indexOf(importComponent) < 0) {
|
|
42
|
+
if (mapData.indexOf(importComponent.concat("/")) < 0) {
|
|
43
43
|
// not present so we can add
|
|
44
44
|
|
|
45
45
|
// add import
|
|
@@ -108,8 +108,15 @@ export const renameComponentInMap = async (oldComponentKey, newComponentKey) =>
|
|
|
108
108
|
let mapData = fs.readFileSync(pegaLocalComponentMapPath, { encoding: 'utf8' });
|
|
109
109
|
|
|
110
110
|
if (mapData.indexOf(oldComponentName) >= 0) {
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
mapData = mapData.replaceAll(oldComponentName + " ", newComponentName + " ");
|
|
115
|
+
mapData = mapData.replaceAll(oldComponentName + ",", newComponentName + ",");
|
|
116
|
+
|
|
117
|
+
mapData = mapData.replaceAll(oldComponentNameNoPrefix + "/", newComponentNameNoPrefix + "/");
|
|
118
|
+
mapData = mapData.replaceAll( '"' + oldComponentNameNoPrefix + '"' , '"' + newComponentNameNoPrefix + '"');
|
|
119
|
+
|
|
113
120
|
fs.writeFileSync(pegaLocalComponentMapPath, mapData, { encoding: 'utf8' });
|
|
114
121
|
|
|
115
122
|
}
|
|
@@ -66,7 +66,7 @@ export default async options => {
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
title: 'Lint
|
|
69
|
+
title: 'Lint associated component',
|
|
70
70
|
task: async () => {
|
|
71
71
|
const targetDirectory = await getComponentDirectoryPath(componentKey, CATEGORY_CONSTELLATION);
|
|
72
72
|
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
@@ -74,31 +74,31 @@ export default async options => {
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
|
-
title: 'Map config to
|
|
77
|
+
title: 'Map config to associated component',
|
|
78
78
|
task: async () => {
|
|
79
79
|
mapConfigJsonToCompanion(componentKey);
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
title: 'Bundle
|
|
83
|
+
title: 'Bundle associated component',
|
|
84
84
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, CATEGORY_CONSTELLATION),
|
|
85
85
|
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
title: 'Zip
|
|
88
|
+
title: 'Zip associated component',
|
|
89
89
|
task: async () => {
|
|
90
90
|
const output = await zipComponent(componentKey, CATEGORY_CONSTELLATION);
|
|
91
91
|
content = { ...content, ...output };
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
title: 'Publish
|
|
95
|
+
title: 'Publish associated component',
|
|
96
96
|
task: async () => {
|
|
97
97
|
await publishComponentToServer(content);
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
|
-
title: 'Clean up
|
|
101
|
+
title: 'Clean up associated',
|
|
102
102
|
task: async () => {
|
|
103
103
|
await removeCompanionConfigJson(componentKey);
|
|
104
104
|
}
|
|
@@ -63,6 +63,18 @@ export const updateConfig = async (
|
|
|
63
63
|
configData.library = library;
|
|
64
64
|
configData.version = version;
|
|
65
65
|
configData.description = (description != '') ? description : componentLabel;
|
|
66
|
+
|
|
67
|
+
if (allowedApplications.trim() === '') {
|
|
68
|
+
allowedApplications = [];
|
|
69
|
+
} else {
|
|
70
|
+
if (allowedApplications.indexOf(',') !== -1) {
|
|
71
|
+
allowedApplications = allowedApplications.split(',');
|
|
72
|
+
}
|
|
73
|
+
allowedApplications = [].concat(allowedApplications);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
allowedApplications = allowedApplications.filter(el => !!el.trim()).map(el => el.trim());
|
|
77
|
+
|
|
66
78
|
configData.allowedApplications = allowedApplications;
|
|
67
79
|
|
|
68
80
|
// stringify "4", makes the json string look like JSON in the file, formated instead of a single line
|