@pega/dx-component-builder-sdk 0.1.32 → 0.1.34
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/build/helper.js +19 -5
- package/src/tasks/build/index.js +4 -1
- package/src/tasks/build-all/helper.js +18 -5
- package/src/tasks/build-all/index.js +43 -24
- package/src/tasks/publish/helper.js +12 -2
- package/src/tasks/publish-all/helper.js +8 -2
- package/src/tasks/publish-all/index.js +3 -3
package/package.json
CHANGED
|
@@ -18,6 +18,20 @@ import {
|
|
|
18
18
|
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
export const cleanUp = async () => {
|
|
22
|
+
fs.rm('dist/components', { recursive: true }, err => {
|
|
23
|
+
if (err) {
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
fs.rm('lib', { recursive: true }, err => {
|
|
29
|
+
if (err) {
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
export const getBuildCategory = async (options) => {
|
|
22
36
|
const categoryType = getOptionsCategory(options);
|
|
23
37
|
|
|
@@ -78,10 +92,10 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
78
92
|
const zipContent = zip.toBuffer().toString('base64');
|
|
79
93
|
|
|
80
94
|
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
81
|
-
fs.rmd('dist', { recursive: true }, err => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
95
|
+
// fs.rmd('dist/components', { recursive: true }, err => {
|
|
96
|
+
// if (err) {
|
|
97
|
+
// throw err;
|
|
98
|
+
// }
|
|
99
|
+
// });
|
|
86
100
|
return { zipContent, configContent };
|
|
87
101
|
};
|
package/src/tasks/build/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import validate from '../validator/index.js';
|
|
|
6
6
|
|
|
7
7
|
import bundleComponent from '../bundle/index.js';
|
|
8
8
|
import lintComponent from '../linter/index.js';
|
|
9
|
-
import { getBuildComponentQuestions, getBuildCategory } from './helper.js';
|
|
9
|
+
import { getBuildComponentQuestions, getBuildCategory, cleanUp } from './helper.js';
|
|
10
10
|
import { getComponentDirectoryPath, showVersion, getOptionsCategory } from '../../util.js';
|
|
11
11
|
|
|
12
12
|
import { CATEGORY_CUSTOM } from '../../constants.js';
|
|
@@ -105,5 +105,8 @@ export default async options => {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
|
|
109
|
+
cleanUp();
|
|
110
|
+
|
|
108
111
|
return true;
|
|
109
112
|
};
|
|
@@ -12,6 +12,19 @@ import {
|
|
|
12
12
|
} from '../../util.js';
|
|
13
13
|
import { COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
|
|
14
14
|
|
|
15
|
+
export const cleanUp = async () => {
|
|
16
|
+
fs.rm('dist/components', { recursive: true }, err => {
|
|
17
|
+
if (err) {
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
fs.rm('lib', { recursive: true }, err => {
|
|
23
|
+
if (err) {
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
15
28
|
|
|
16
29
|
export const getBuildCategory = async (options) => {
|
|
17
30
|
const categoryType = getOptionsCategory(options);
|
|
@@ -62,10 +75,10 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
62
75
|
const zipContent = zip.toBuffer().toString('base64');
|
|
63
76
|
|
|
64
77
|
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
65
|
-
fs.rmd('dist', { recursive: true }, err => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
78
|
+
// fs.rmd('dist/components', { recursive: true }, err => {
|
|
79
|
+
// if (err) {
|
|
80
|
+
// throw err;
|
|
81
|
+
// }
|
|
82
|
+
// });
|
|
70
83
|
return { zipContent, configContent };
|
|
71
84
|
};
|
|
@@ -6,32 +6,12 @@ import validate from '../validator/index.js';
|
|
|
6
6
|
|
|
7
7
|
import bundleComponent from '../bundle/index.js';
|
|
8
8
|
import lintComponent from '../linter/index.js';
|
|
9
|
-
import { getBuildComponentQuestions, getBuildCategory } from './helper.js';
|
|
9
|
+
import { getBuildComponentQuestions, getBuildCategory, cleanUp } from './helper.js';
|
|
10
10
|
import { getComponentDirectoryPath, showVersion, getOptionsCategory, getComponentsObj } from '../../util.js';
|
|
11
11
|
|
|
12
12
|
import { CATEGORY_CUSTOM } from '../../constants.js';
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
showVersion();
|
|
16
|
-
|
|
17
|
-
const catQuestion = await getBuildCategory(options);
|
|
18
|
-
const catAnwers = await inquirer.prompt(catQuestion);
|
|
19
|
-
|
|
20
|
-
let category = catAnwers.category;
|
|
21
|
-
if (category == null) {
|
|
22
|
-
category = getOptionsCategory(options);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const components = await getComponentsObj(false, category);
|
|
26
|
-
const questions = await getBuildComponentQuestions(category);
|
|
27
|
-
const answers = await inquirer.prompt(questions);
|
|
28
|
-
const { sourceMap, devBuild } = answers;
|
|
29
|
-
|
|
30
|
-
let content = {
|
|
31
|
-
...answers
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
var componentKey;
|
|
14
|
+
export function getCustomTasks(componentKey, category, sourceMap, devBuild, content, options) {
|
|
35
15
|
|
|
36
16
|
const customTasks = new Listr(
|
|
37
17
|
[
|
|
@@ -71,6 +51,12 @@ export default async options => {
|
|
|
71
51
|
}
|
|
72
52
|
);
|
|
73
53
|
|
|
54
|
+
return customTasks;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export function getOverrideTasks(componentKey, category, sourceMap, devBuild, content, options) {
|
|
59
|
+
|
|
74
60
|
const overrideTasks = new Listr(
|
|
75
61
|
[
|
|
76
62
|
{
|
|
@@ -97,12 +83,40 @@ export default async options => {
|
|
|
97
83
|
}
|
|
98
84
|
);
|
|
99
85
|
|
|
86
|
+
return overrideTasks;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default async options => {
|
|
90
|
+
showVersion();
|
|
91
|
+
|
|
92
|
+
const catQuestion = await getBuildCategory(options);
|
|
93
|
+
const catAnwers = await inquirer.prompt(catQuestion);
|
|
94
|
+
|
|
95
|
+
let category = catAnwers.category;
|
|
96
|
+
if (category == null) {
|
|
97
|
+
category = getOptionsCategory(options);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const components = await getComponentsObj(false, category);
|
|
101
|
+
const questions = await getBuildComponentQuestions(category);
|
|
102
|
+
const answers = await inquirer.prompt(questions);
|
|
103
|
+
const { sourceMap, devBuild } = answers;
|
|
104
|
+
|
|
105
|
+
let content = {
|
|
106
|
+
...answers
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var componentKey;
|
|
110
|
+
|
|
100
111
|
|
|
101
112
|
if (category === CATEGORY_CUSTOM) {
|
|
102
113
|
for (var index in components) {
|
|
103
114
|
componentKey = components[index].value;
|
|
104
115
|
console.log(chalk.bold.green("Building: " + components[index].name));
|
|
105
|
-
|
|
116
|
+
|
|
117
|
+
let myCustomTasks = getCustomTasks(componentKey, category, sourceMap, devBuild, content, options);
|
|
118
|
+
|
|
119
|
+
await myCustomTasks.run().catch(err => {
|
|
106
120
|
console.log(chalk.bold.red(err.toString()));
|
|
107
121
|
});
|
|
108
122
|
}
|
|
@@ -111,11 +125,16 @@ export default async options => {
|
|
|
111
125
|
for (var index in components) {
|
|
112
126
|
componentKey = components[index].value;
|
|
113
127
|
console.log(chalk.bold.green("Building: " + components[index].name));
|
|
114
|
-
|
|
128
|
+
|
|
129
|
+
let myOverrideTasks = getOverrideTasks(componentKey, category, sourceMap, devBuild, content, options);
|
|
130
|
+
|
|
131
|
+
await mOverrideTasks.run().catch(err => {
|
|
115
132
|
console.log(chalk.bold.red(err.toString()));
|
|
116
133
|
});
|
|
117
134
|
}
|
|
118
135
|
}
|
|
119
136
|
|
|
137
|
+
cleanUp();
|
|
138
|
+
|
|
120
139
|
return true;
|
|
121
140
|
};
|
|
@@ -138,7 +138,12 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
138
138
|
let configContent = "{ }";
|
|
139
139
|
if (category === CATEGORY_CUSTOM || category === CATEGORY_CONSTELLATION) {
|
|
140
140
|
configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
141
|
-
fs.rmdir('dist', { recursive: true }, err => {
|
|
141
|
+
fs.rmdir('dist/components', { recursive: true }, err => {
|
|
142
|
+
if (err) {
|
|
143
|
+
throw err;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
fs.rmdir('lib', { recursive: true }, err => {
|
|
142
147
|
if (err) {
|
|
143
148
|
throw err;
|
|
144
149
|
}
|
|
@@ -147,7 +152,12 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
147
152
|
else {
|
|
148
153
|
if (fs.existsSync(configExtJson)) {
|
|
149
154
|
configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config-ext.json`)).toString();
|
|
150
|
-
fs.rmdir('dist', { recursive: true }, err => {
|
|
155
|
+
fs.rmdir('dist/components', { recursive: true }, err => {
|
|
156
|
+
if (err) {
|
|
157
|
+
throw err;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
fs.rmdir('lib', { recursive: true }, err => {
|
|
151
161
|
if (err) {
|
|
152
162
|
throw err;
|
|
153
163
|
}
|
|
@@ -161,8 +161,14 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
161
161
|
return { zipContent, configContent };
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
export const
|
|
165
|
-
fs.rm('dist', { recursive: true }, err => {
|
|
164
|
+
export const cleanUp = async () => {
|
|
165
|
+
fs.rm('dist/components', { recursive: true }, err => {
|
|
166
|
+
if (err) {
|
|
167
|
+
throw err;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
fs.rm('lib', { recursive: true }, err => {
|
|
166
172
|
if (err) {
|
|
167
173
|
throw err;
|
|
168
174
|
}
|
|
@@ -16,7 +16,7 @@ import { getPublishComponentQuestions,
|
|
|
16
16
|
getBuildCategory,
|
|
17
17
|
mapConfigJsonToCompanion,
|
|
18
18
|
removeCompanionConfigJson,
|
|
19
|
-
|
|
19
|
+
cleanUp
|
|
20
20
|
} from './helper.js';
|
|
21
21
|
|
|
22
22
|
|
|
@@ -195,8 +195,8 @@ export default async options => {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
|
|
198
|
-
// once done, remove leftover
|
|
199
|
-
|
|
198
|
+
// once done, remove leftover directories
|
|
199
|
+
cleanUp();
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
return true;
|