@pega/custom-dx-components 8.8.11 → 8.8.13
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/helper.js +22 -21
- package/src/tasks/build/helper.js +1 -0
- package/src/tasks/build/index.js +3 -1
- package/src/tasks/build-all/helper.js +1 -0
- package/src/tasks/build-all/index.js +16 -22
- package/src/tasks/bundle/builder/webpack.config.js +2 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/publish/helper.js +5 -4
- package/src/tasks/publish/index.js +2 -1
- package/src/tasks/publish-all/helper.js +77 -27
- package/src/tasks/publish-all/index.js +21 -27
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
import { getPegaServerConfig } from '../../util.js';
|
|
3
|
-
|
|
4
2
|
import { AUTHENTICATE_SCHEMA, AUTHENTICATE_DEFAULTS } from '../../constants.js';
|
|
5
3
|
|
|
6
4
|
export const getAuthQuestions = async (dxcbConfig) => {
|
|
7
5
|
const defaultPegaConfig = dxcbConfig;
|
|
8
|
-
const aAlwaysAsk = dxcbConfig
|
|
9
|
-
const aNeverAsk = dxcbConfig
|
|
10
|
-
const aAskOnce = dxcbConfig
|
|
11
|
-
const aAskedOnce = dxcbConfig
|
|
6
|
+
const aAlwaysAsk = dxcbConfig.questions_askAlways ? dxcbConfig.questions_askAlways.split(',') : [];
|
|
7
|
+
const aNeverAsk = dxcbConfig.questions_askNever ? dxcbConfig.questions_askNever.split(',') : [];
|
|
8
|
+
const aAskOnce = dxcbConfig.questions_askOnce ? dxcbConfig.questions_askOnce.split(',') : [];
|
|
9
|
+
const aAskedOnce = dxcbConfig.questions_askedOnce ? dxcbConfig.questions_askedOnce.split(',') : [];
|
|
12
10
|
|
|
13
11
|
// Ask if various must, never, once criteria are met
|
|
14
12
|
const askThisTime = (prop) => {
|
|
15
|
-
|
|
13
|
+
return aAlwaysAsk.includes(prop) ||
|
|
16
14
|
(!aNeverAsk.includes(prop) && (aAskOnce.includes(prop) && !aAskedOnce.includes(prop)));
|
|
17
|
-
return bAsk;
|
|
18
15
|
};
|
|
19
16
|
|
|
20
|
-
const initAnswer = (prop,
|
|
21
|
-
|
|
17
|
+
const initAnswer = (prop, defValue) => {
|
|
18
|
+
if (askThisTime(prop)) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return defaultPegaConfig[prop] ? defaultPegaConfig[prop] : defValue;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const initAnswers = (answers) => {
|
|
25
25
|
// Setup default answers (if they are present and non-empty)
|
|
26
|
-
answers.serverType = initAnswer('serverType',
|
|
27
|
-
answers.server = initAnswer('server',
|
|
28
|
-
answers.isolationId = initAnswer('isolationId'
|
|
29
|
-
answers.clientId = initAnswer('clientId',
|
|
30
|
-
answers.grantType = initAnswer('grantType',
|
|
31
|
-
answers.authService = initAnswer('authService',
|
|
26
|
+
answers.serverType = initAnswer('serverType', AUTHENTICATE_DEFAULTS.serverType);
|
|
27
|
+
answers.server = initAnswer('server', AUTHENTICATE_DEFAULTS.server);
|
|
28
|
+
answers.isolationId = initAnswer('isolationId');
|
|
29
|
+
answers.clientId = initAnswer('clientId', AUTHENTICATE_DEFAULTS.clientId);
|
|
30
|
+
answers.grantType = initAnswer('grantType', AUTHENTICATE_DEFAULTS.grantType);
|
|
31
|
+
answers.authService = initAnswer('authService', AUTHENTICATE_DEFAULTS.authService);
|
|
32
32
|
answers.redirectUri = initAnswer('redirectUri', AUTHENTICATE_DEFAULTS.redirectUri);
|
|
33
|
-
answers.clientSecret = initAnswer('clientSecret'
|
|
34
|
-
answers.user = initAnswer('user'
|
|
35
|
-
answers.password = initAnswer('password'
|
|
33
|
+
answers.clientSecret = initAnswer('clientSecret');
|
|
34
|
+
answers.user = initAnswer('user');
|
|
35
|
+
answers.password = initAnswer('password');
|
|
36
36
|
answers.aAsked = [];
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -192,14 +192,15 @@ export const getAuthQuestions = async (dxcbConfig) => {
|
|
|
192
192
|
type: 'password',
|
|
193
193
|
message: 'Enter clientSecret',
|
|
194
194
|
default: defaultPegaConfig.clientSecret,
|
|
195
|
-
validate:
|
|
195
|
+
validate: value => {
|
|
196
196
|
if (value.trim()) {
|
|
197
197
|
return true;
|
|
198
198
|
}
|
|
199
199
|
return 'clientSecret cannot be empty';
|
|
200
200
|
},
|
|
201
201
|
when: answers => {
|
|
202
|
-
return (answers.
|
|
202
|
+
return (((answers.serverType === "infinity" && answers.grantType !== "authCode") ||
|
|
203
|
+
answers.serverType === "launchpad") && fnStandardWhen('clientSecret', answers));
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
206
|
];
|
package/src/tasks/build/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export default async options => {
|
|
|
20
20
|
...answers
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
const sDevBuild = devBuild ? '(dev build)' : '';
|
|
23
24
|
const tasks = new Listr(
|
|
24
25
|
[
|
|
25
26
|
{
|
|
@@ -37,7 +38,8 @@ export default async options => {
|
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
|
-
title:
|
|
41
|
+
title: `Bundle Component ${sDevBuild}`,
|
|
42
|
+
type: 'confirm',
|
|
41
43
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild),
|
|
42
44
|
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
43
45
|
}
|
|
@@ -3,18 +3,17 @@ import Listr from 'listr';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
|
-
|
|
7
6
|
import bundleComponent from '../bundle/index.js';
|
|
8
|
-
import lintComponent from '../linter/index.js';
|
|
9
|
-
import {
|
|
10
|
-
import { getComponentDirectoryPath, showVersion, getComponentsObj } from '../../util.js';
|
|
7
|
+
import { lintComponent } from '../linter/index.js';
|
|
8
|
+
import { getComponentDirectoryPath, showVersion, getComponents } from '../../util.js';
|
|
11
9
|
|
|
12
|
-
import {
|
|
10
|
+
import { getBuildComponentQuestions, cleanUp } from './helper.js';
|
|
13
11
|
|
|
14
12
|
|
|
15
13
|
export function getCustomTasks(componentKey, sourceMap, devBuild) {
|
|
16
14
|
|
|
17
|
-
const
|
|
15
|
+
const sDevBuild = devBuild ? '(dev build)' : '';
|
|
16
|
+
return new Listr(
|
|
18
17
|
[
|
|
19
18
|
{
|
|
20
19
|
title: 'Validate config schema',
|
|
@@ -31,8 +30,8 @@ export function getCustomTasks(componentKey, sourceMap, devBuild) {
|
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
32
|
{
|
|
34
|
-
title:
|
|
35
|
-
task: async () =>
|
|
33
|
+
title: `Bundle component ${sDevBuild}`,
|
|
34
|
+
task: async () => bundleComponent(componentKey, sourceMap, devBuild),
|
|
36
35
|
}
|
|
37
36
|
],
|
|
38
37
|
{
|
|
@@ -40,40 +39,35 @@ export function getCustomTasks(componentKey, sourceMap, devBuild) {
|
|
|
40
39
|
}
|
|
41
40
|
);
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
|
|
49
|
-
export default async
|
|
48
|
+
export default async () => {
|
|
50
49
|
showVersion();
|
|
51
50
|
|
|
52
|
-
let category = CATEGORY_CONSTELLATION;
|
|
53
51
|
|
|
54
|
-
const components = await
|
|
52
|
+
const components = await getComponents();
|
|
55
53
|
const questions = await getBuildComponentQuestions();
|
|
56
54
|
const answers = await inquirer.prompt(questions);
|
|
57
55
|
const { sourceMap, devBuild } = answers;
|
|
58
56
|
|
|
59
57
|
|
|
58
|
+
for (const componentKey of components) {
|
|
59
|
+
console.log(chalk.bold.green(`Building ${componentKey}`));
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
for (var index in components) {
|
|
65
|
-
componentKey = components[index].value;
|
|
66
|
-
console.log(chalk.bold.green("Building: " + components[index].name));
|
|
67
|
-
|
|
68
|
-
let myCustomTasks = getCustomTasks(componentKey, sourceMap, devBuild );
|
|
61
|
+
const myCustomTasks = getCustomTasks(componentKey, sourceMap, devBuild );
|
|
69
62
|
|
|
63
|
+
// eslint-disable-next-line no-await-in-loop
|
|
70
64
|
await myCustomTasks.run().catch(err => {
|
|
71
65
|
console.log(chalk.bold.red(err.toString()));
|
|
72
66
|
});
|
|
73
67
|
}
|
|
74
68
|
|
|
75
|
-
|
|
76
|
-
cleanUp();
|
|
69
|
+
// once done, remove leftover directories
|
|
70
|
+
await cleanUp();
|
|
77
71
|
|
|
78
72
|
return true;
|
|
79
73
|
};
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@pega/configs": "^0.5.3",
|
|
59
|
-
"@pega/custom-dx-components": "^8.8.
|
|
59
|
+
"@pega/custom-dx-components": "^8.8.13",
|
|
60
60
|
"@pega/eslint-config": "^0.3.2",
|
|
61
61
|
"@storybook/addon-actions": "^6.5.12",
|
|
62
62
|
"@storybook/addon-essentials": "^6.5.12",
|
|
@@ -40,8 +40,8 @@ export const getPublishComponentQuestions = async () => {
|
|
|
40
40
|
}
|
|
41
41
|
return 'Ruleset name cannot be empty';
|
|
42
42
|
},
|
|
43
|
-
when:
|
|
44
|
-
return
|
|
43
|
+
when: () => {
|
|
44
|
+
return defaultPegaConfig.serverType === 'infinity';
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
{
|
|
@@ -54,8 +54,8 @@ export const getPublishComponentQuestions = async () => {
|
|
|
54
54
|
}
|
|
55
55
|
return 'Please provide compatible version e.g 01-01-01';
|
|
56
56
|
},
|
|
57
|
-
when:
|
|
58
|
-
return
|
|
57
|
+
when: () => {
|
|
58
|
+
return defaultPegaConfig.serverType === 'infinity';
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
{
|
|
@@ -67,6 +67,7 @@ export const getPublishComponentQuestions = async () => {
|
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
name: 'devBuild',
|
|
70
|
+
type: 'confirm',
|
|
70
71
|
message: 'Generate development build ?',
|
|
71
72
|
default: defaultPegaConfig.devBuild
|
|
72
73
|
}
|
|
@@ -21,6 +21,7 @@ export default async options => {
|
|
|
21
21
|
...answers
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
const sDevBuild = devBuild ? '(dev build)' : '';
|
|
24
25
|
const tasks = new Listr(
|
|
25
26
|
[
|
|
26
27
|
{
|
|
@@ -38,7 +39,7 @@ export default async options => {
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
|
-
title:
|
|
42
|
+
title: `Bundle Component ${sDevBuild}`,
|
|
42
43
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild),
|
|
43
44
|
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
44
45
|
},
|
|
@@ -9,14 +9,16 @@ import chalk from 'chalk';
|
|
|
9
9
|
import {
|
|
10
10
|
constructCompleteUrl,
|
|
11
11
|
getComponentDirectoryPath,
|
|
12
|
-
getComponents,
|
|
13
12
|
getPegaServerConfig,
|
|
14
13
|
validateRulesetVersion
|
|
15
14
|
} from '../../util.js';
|
|
16
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
17
|
+
LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
18
|
+
TOKEN_PATH
|
|
19
|
+
} from '../../constants.js';
|
|
17
20
|
|
|
18
21
|
export const getPublishComponentQuestions = async () => {
|
|
19
|
-
const components = await getComponents();
|
|
20
22
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
21
23
|
|
|
22
24
|
return [
|
|
@@ -29,6 +31,9 @@ export const getPublishComponentQuestions = async () => {
|
|
|
29
31
|
return true;
|
|
30
32
|
}
|
|
31
33
|
return 'Ruleset name cannot be empty';
|
|
34
|
+
},
|
|
35
|
+
when: () => {
|
|
36
|
+
return defaultPegaConfig.serverType === 'infinity';
|
|
32
37
|
}
|
|
33
38
|
},
|
|
34
39
|
{
|
|
@@ -40,16 +45,21 @@ export const getPublishComponentQuestions = async () => {
|
|
|
40
45
|
return true;
|
|
41
46
|
}
|
|
42
47
|
return 'Please provide compatible version e.g 01-01-01';
|
|
48
|
+
},
|
|
49
|
+
when: () => {
|
|
50
|
+
return defaultPegaConfig.serverType === 'infinity';
|
|
43
51
|
}
|
|
44
52
|
},
|
|
45
53
|
{
|
|
46
54
|
name: 'sourceMap',
|
|
47
55
|
message: 'Generate source map ?',
|
|
48
56
|
default: defaultPegaConfig.sourceMap,
|
|
57
|
+
// eslint-disable-next-line sonarjs/no-redundant-boolean
|
|
49
58
|
when: () => false && !process.env.SOURCE_MAP
|
|
50
59
|
},
|
|
51
60
|
{
|
|
52
61
|
name: 'devBuild',
|
|
62
|
+
type: 'confirm',
|
|
53
63
|
message: 'Generate development build ?',
|
|
54
64
|
default: defaultPegaConfig.devBuild
|
|
55
65
|
}
|
|
@@ -70,11 +80,11 @@ export const zipComponent = async componentKey => {
|
|
|
70
80
|
|
|
71
81
|
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
72
82
|
// clean up now happens in function cleanUp
|
|
73
|
-
//fs.rmdir('dist', { recursive: true }, err => {
|
|
83
|
+
// fs.rmdir('dist', { recursive: true }, err => {
|
|
74
84
|
// if (err) {
|
|
75
85
|
// throw err;
|
|
76
86
|
// }
|
|
77
|
-
//});
|
|
87
|
+
// });
|
|
78
88
|
return { zipContent, configContent };
|
|
79
89
|
};
|
|
80
90
|
|
|
@@ -90,40 +100,68 @@ export const cleanUp = async () => {
|
|
|
90
100
|
throw err;
|
|
91
101
|
}
|
|
92
102
|
});
|
|
93
|
-
}
|
|
103
|
+
};
|
|
94
104
|
|
|
95
105
|
export const publishComponentToServer = async data => {
|
|
96
|
-
const { configContent, zipContent,
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
const { configContent, zipContent, rulesetName, rulesetVersion } = data;
|
|
107
|
+
|
|
108
|
+
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
109
|
+
const { serverType, isolationId } = defaultPegaServerConfig;
|
|
110
|
+
const isLaunchpad = serverType === 'launchpad';
|
|
111
|
+
const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace(
|
|
112
|
+
'{isolationId}',
|
|
113
|
+
isolationId
|
|
114
|
+
);
|
|
115
|
+
let apiBody;
|
|
116
|
+
|
|
117
|
+
if (isLaunchpad) {
|
|
118
|
+
apiBody = {
|
|
119
|
+
type: 'CustomComponent',
|
|
120
|
+
zipContent,
|
|
121
|
+
componentName: JSON.parse(configContent).componentKey,
|
|
122
|
+
pxUpdateDateTime: '',
|
|
123
|
+
environmentID: defaultPegaServerConfig.isolationId
|
|
124
|
+
};
|
|
125
|
+
} else {
|
|
126
|
+
apiBody = {
|
|
127
|
+
configContent,
|
|
128
|
+
zipContent,
|
|
129
|
+
componentKey: JSON.parse(configContent).componentKey,
|
|
130
|
+
publishFor: 'constellation',
|
|
131
|
+
rulesetName,
|
|
132
|
+
rulesetVersion,
|
|
133
|
+
category: ''
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
107
137
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
108
138
|
const url = constructCompleteUrl(
|
|
109
139
|
defaultPegaConfig.server,
|
|
110
|
-
PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT
|
|
140
|
+
isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT
|
|
111
141
|
);
|
|
142
|
+
|
|
112
143
|
try {
|
|
113
144
|
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
114
145
|
if (OauthData) {
|
|
115
146
|
const {
|
|
116
147
|
access_token: accessToken,
|
|
117
|
-
token_type: tokenType
|
|
118
|
-
refresh_token: refreshToken
|
|
148
|
+
token_type: tokenType
|
|
149
|
+
// refresh_token: refreshToken
|
|
119
150
|
} = JSON.parse(OauthData);
|
|
120
151
|
let status = 500;
|
|
152
|
+
const headers = {};
|
|
153
|
+
|
|
154
|
+
if (isLaunchpad) {
|
|
155
|
+
headers.cookie = `Pega-AAT=${accessToken}`;
|
|
156
|
+
headers['Content-Type'] = 'application/json';
|
|
157
|
+
} else {
|
|
158
|
+
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
159
|
+
}
|
|
160
|
+
|
|
121
161
|
fetch(url, {
|
|
122
162
|
method: 'POST',
|
|
123
163
|
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
124
|
-
headers
|
|
125
|
-
Authorization: `${tokenType} ${accessToken}`
|
|
126
|
-
},
|
|
164
|
+
headers,
|
|
127
165
|
body: JSON.stringify(apiBody)
|
|
128
166
|
})
|
|
129
167
|
.then(response => {
|
|
@@ -131,20 +169,32 @@ export const publishComponentToServer = async data => {
|
|
|
131
169
|
return response.text();
|
|
132
170
|
})
|
|
133
171
|
.then(resp => {
|
|
134
|
-
const respData = JSON.parse(resp);
|
|
172
|
+
const respData = isLaunchpad ? resp : JSON.parse(resp);
|
|
135
173
|
if (status === 401) {
|
|
136
174
|
throw new Error(
|
|
137
175
|
'Error occurred in authentication. Please regenerate using authenticate'
|
|
138
176
|
);
|
|
139
177
|
// console.log(accessTokenUri, refreshToken);
|
|
140
178
|
/* TODO - Handle refresh_token */
|
|
141
|
-
} else if (status
|
|
142
|
-
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
179
|
+
} else if (status === 200 || status === 201) {
|
|
180
|
+
console.log(chalk.bold.green(`Success : ${isLaunchpad ? respData : respData.message}`));
|
|
143
181
|
} else {
|
|
144
182
|
throw new Error(`${respData.message}`);
|
|
145
183
|
}
|
|
146
184
|
})
|
|
147
|
-
.catch(e =>
|
|
185
|
+
.catch(e => {
|
|
186
|
+
if (e.code === 'ECONNREFUSED') {
|
|
187
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
188
|
+
Promise.reject(
|
|
189
|
+
`${chalk.bold.red(
|
|
190
|
+
'Error occurred in authentication. Please regenerate using authenticate'
|
|
191
|
+
)}`
|
|
192
|
+
);
|
|
193
|
+
} else {
|
|
194
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
195
|
+
Promise.reject(`${chalk.bold.red(e)}`);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
148
198
|
} else {
|
|
149
199
|
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
150
200
|
}
|
|
@@ -3,22 +3,20 @@ import Listr from 'listr';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
|
-
|
|
7
6
|
import bundleComponent from '../bundle/index.js';
|
|
8
7
|
import { lintComponent } from '../linter/index.js';
|
|
8
|
+
import { getComponents, getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
import { getPublishComponentQuestions, publishComponentToServer, zipComponent, cleanUp } from './helper.js';
|
|
12
10
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
getPublishComponentQuestions,
|
|
12
|
+
publishComponentToServer,
|
|
13
|
+
zipComponent,
|
|
14
|
+
cleanUp
|
|
15
|
+
} from './helper.js';
|
|
19
16
|
|
|
20
17
|
export function getCustomTasks(componentKey, sourceMap, devBuild, content, options) {
|
|
21
|
-
const
|
|
18
|
+
const sDevBuild = devBuild ? '(dev build)' : '';
|
|
19
|
+
return new Listr(
|
|
22
20
|
[
|
|
23
21
|
{
|
|
24
22
|
title: 'Validate config schema',
|
|
@@ -27,8 +25,10 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, content, optio
|
|
|
27
25
|
}
|
|
28
26
|
},
|
|
29
27
|
{
|
|
30
|
-
title:
|
|
31
|
-
task: async () =>
|
|
28
|
+
title: `Bundle Component ${sDevBuild}`,
|
|
29
|
+
task: async () => {
|
|
30
|
+
await bundleComponent(componentKey, sourceMap, devBuild);
|
|
31
|
+
},
|
|
32
32
|
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
33
33
|
},
|
|
34
34
|
{
|
|
@@ -57,8 +57,6 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, content, optio
|
|
|
57
57
|
exitOnError: true
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
|
-
|
|
61
|
-
return customTasks;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
export default async options => {
|
|
@@ -67,29 +65,25 @@ export default async options => {
|
|
|
67
65
|
const components = await getComponents();
|
|
68
66
|
const questions = await getPublishComponentQuestions();
|
|
69
67
|
const answers = await inquirer.prompt(questions);
|
|
70
|
-
const {sourceMap, devBuild } = answers;
|
|
68
|
+
const { sourceMap, devBuild } = answers;
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
const content = {
|
|
73
71
|
...answers
|
|
74
72
|
};
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
for (const componentKey of components) {
|
|
75
|
+
console.log(chalk.bold.green(`Publishing: ${componentKey}`));
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
componentKey = components[index];
|
|
81
|
-
console.log(chalk.bold.green("Publishing: " + componentKey));
|
|
82
|
-
|
|
83
|
-
let myCustomTasks = getCustomTasks(componentKey, sourceMap, devBuild, content, options);
|
|
77
|
+
const myCustomTasks = getCustomTasks(componentKey, sourceMap, devBuild, content, options);
|
|
84
78
|
|
|
79
|
+
// eslint-disable-next-line no-await-in-loop
|
|
85
80
|
await myCustomTasks.run().catch(err => {
|
|
86
|
-
|
|
81
|
+
console.log(chalk.bold.red(err.toString()));
|
|
87
82
|
});
|
|
88
83
|
}
|
|
89
84
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
// once done, remove leftover directories
|
|
86
|
+
await cleanUp();
|
|
93
87
|
|
|
94
88
|
return true;
|
|
95
89
|
};
|