@pega/custom-dx-components 0.242.35 → 0.242.36
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/cli.js +6 -0
- package/src/constants.js +1 -0
- package/src/tasks/build-lib/helper.js +0 -1
- package/src/tasks/create-lib/index.js +5 -3
- package/src/tasks/create-version/index.js +3 -1
- package/src/tasks/delete-lib/index.js +4 -1
- package/src/tasks/delete-version/index.js +3 -1
- package/src/tasks/export-archive/index.js +58 -41
- package/src/tasks/import-archive/index.js +5 -1
- package/src/tasks/import-comp/helper.js +2 -4
- package/src/tasks/import-comp/index.js +1 -2
- package/src/tasks/index.js +1 -0
- package/src/tasks/init/template/package.json.mustache +3 -2
- package/src/tasks/list-lib/index.js +3 -1
- package/src/tasks/list-pub/index.js +18 -14
- package/src/tasks/move/helper.js +6 -3
- package/src/tasks/move/index.js +86 -17
- package/src/tasks/publish/helper.js +8 -5
- package/src/tasks/publish/index.js +4 -4
- package/src/tasks/publish-all/helper.js +16 -10
- package/src/tasks/quarantine/index.js +84 -0
- package/src/tasks/rename-lib/index.js +0 -1
- package/src/tasks/revert-webpack/index.js +0 -2
- package/src/tasks/set-perm/index.js +18 -2
- package/src/tasks/store/index.js +4 -1
- package/src/tasks/switch-lib/index.js +3 -1
- package/src/tasks/switch-version/index.js +3 -1
- package/src/util.js +50 -6
- package/tests/functional/localCreateAllListDeleteAll.test.js +56 -10
- package/tests/functional/localCreateBuildAllDeleteAll.test.js +56 -48
- package/tests/functional/localCreateBuildDelete.test.js +57 -10
- package/tests/functional/localCreateListDelete.test.js +55 -102
- package/tests/functional/localCreatePublishAllDeleteAll.test.js +68 -61
- package/tests/functional/localCreatePublishDelete.test.js +62 -21
- package/tests/functional/localCreateRenameDelete.test.js +55 -140
- package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +118 -0
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +241 -0
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +246 -0
- package/tests/functional/localLibCreateLibDeleteLib.test.js +109 -0
- package/tests/functional/localLibCreateLibExportImportLib.test.js +242 -0
- package/tests/functional/localLibCreateLibExportLib.test.js +219 -0
- package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +131 -0
- package/tests/functional/localLibCreateLibListDeleteLib.test.js +261 -0
- package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +236 -0
- package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +237 -0
- package/tests/functional/localLibCreateLibPermDeleteLib.test.js +144 -0
- package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +194 -0
- package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +453 -0
- package/tests/functional/localPromoteRevertWP.test.js +83 -38
package/src/tasks/move/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import ncp from 'ncp';
|
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
+
sanitize,
|
|
10
11
|
checkPathAccess,
|
|
11
12
|
showVersion,
|
|
12
13
|
getComponentsObj,
|
|
@@ -18,7 +19,8 @@ import {
|
|
|
18
19
|
unZipFromArchive,
|
|
19
20
|
zipVersionAndArchive,
|
|
20
21
|
getLibraryArchivesVersions,
|
|
21
|
-
getLibraryArchiveDirectories
|
|
22
|
+
getLibraryArchiveDirectories,
|
|
23
|
+
cleanUpTemp
|
|
22
24
|
} from '../../util.js';
|
|
23
25
|
import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, ARCHIVES_PATH, TEMP_PATH } from '../../constants.js';
|
|
24
26
|
import { getComponentKeyQuestion, getLibraryQuestions, getLibraryVersionQuestion } from './helper.js';
|
|
@@ -32,7 +34,6 @@ import {
|
|
|
32
34
|
convertIntoPascalCase,
|
|
33
35
|
getComponentDirectoryPath
|
|
34
36
|
} from '../../util.js';
|
|
35
|
-
import { or } from 'ajv/dist/compile/codegen/index.js';
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
const copy = promisify(ncp);
|
|
@@ -42,8 +43,10 @@ export const updateConfig = async (
|
|
|
42
43
|
{
|
|
43
44
|
oldComponentKey,
|
|
44
45
|
newComponentKey,
|
|
46
|
+
compName,
|
|
45
47
|
library,
|
|
46
48
|
version,
|
|
49
|
+
compLabel,
|
|
47
50
|
targetDirectory,
|
|
48
51
|
},
|
|
49
52
|
options,
|
|
@@ -60,6 +63,11 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
|
|
|
60
63
|
configData.library = library;
|
|
61
64
|
configData.version = version;
|
|
62
65
|
|
|
66
|
+
if (compLabel != "") {
|
|
67
|
+
configData.label = compLabel;
|
|
68
|
+
configData.description = compLabel;
|
|
69
|
+
}
|
|
70
|
+
|
|
63
71
|
// stringify "4", makes the json string look like JSON in the file, formated instead of a single line
|
|
64
72
|
fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8' });
|
|
65
73
|
|
|
@@ -91,13 +99,15 @@ export const renameComponent = async (
|
|
|
91
99
|
library,
|
|
92
100
|
version,
|
|
93
101
|
copyMove,
|
|
102
|
+
compName = "",
|
|
103
|
+
compLabel = "",
|
|
94
104
|
options
|
|
95
105
|
) => {
|
|
96
106
|
|
|
97
107
|
addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKey}`, "");
|
|
98
108
|
|
|
99
|
-
const componentName = componentKey.split("_")[2];
|
|
100
|
-
const newComponentKey = `${library}_${
|
|
109
|
+
// const componentName = componentKey.split("_")[2];
|
|
110
|
+
const newComponentKey = `${library}_${compName}`;
|
|
101
111
|
const oldComponentKey = componentKey;
|
|
102
112
|
const newComponentKeyPC = convertIntoPascalCase(newComponentKey);
|
|
103
113
|
const oldComponentKeyPC = convertIntoPascalCase(oldComponentKey);
|
|
@@ -135,9 +145,10 @@ addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKe
|
|
|
135
145
|
{
|
|
136
146
|
oldComponentKey,
|
|
137
147
|
newComponentKey,
|
|
138
|
-
|
|
148
|
+
compName,
|
|
139
149
|
library,
|
|
140
150
|
version,
|
|
151
|
+
compLabel,
|
|
141
152
|
targetDirectory,
|
|
142
153
|
},
|
|
143
154
|
options
|
|
@@ -169,6 +180,7 @@ export const moveComp = async(componentKey, copyMove, orgLibName, version, copyS
|
|
|
169
180
|
const archFileName = join(archiveDirectory, fileName);
|
|
170
181
|
const currentCompPath = join(currentDirectory, "src", "components");
|
|
171
182
|
const tempCompPath = join(tempDirectory, "src", "components");
|
|
183
|
+
const configDef = getConfigDefaults();
|
|
172
184
|
|
|
173
185
|
await unZipFromArchive(archFileName);
|
|
174
186
|
|
|
@@ -224,6 +236,12 @@ export const moveComp = async(componentKey, copyMove, orgLibName, version, copyS
|
|
|
224
236
|
|
|
225
237
|
// rearchive temp directory
|
|
226
238
|
await zipVersionAndArchive(orgLibName, version, tempDirectory);
|
|
239
|
+
|
|
240
|
+
// update current /src/components because we copied to it (as well as the archive)
|
|
241
|
+
if (orgLibName === configDef.currentOrgLib && version === configDef.buildVersion && copyMove === "Copy") {
|
|
242
|
+
fs.cpSync(join(tempCompPath, newComponentKey), join(currentCompPath, newComponentKey), { recursive: true, force: true });
|
|
243
|
+
}
|
|
244
|
+
|
|
227
245
|
}
|
|
228
246
|
else {
|
|
229
247
|
console.log(chalk.yellow(`No components were ${copiedOrMoved}`));
|
|
@@ -232,20 +250,57 @@ export const moveComp = async(componentKey, copyMove, orgLibName, version, copyS
|
|
|
232
250
|
// delete temp directory
|
|
233
251
|
fs.rmSync(tempDirectory, { recursive: true, force: true, maxRetries: 5 });
|
|
234
252
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
253
|
}
|
|
239
254
|
|
|
240
255
|
export const localMoveCopyComp = async(componentKey, orgLibName, version, copyMove, currentDirectory, tempDirectory ) => {
|
|
241
256
|
const currentCompPath = join(currentDirectory, "src", "components");
|
|
242
257
|
const tempCompPath = join(tempDirectory, "src", "components");
|
|
258
|
+
const configDef = getConfigDefaults();
|
|
243
259
|
|
|
244
260
|
const tempCompName = componentKey.split("_")[2];
|
|
245
|
-
|
|
261
|
+
let newTempComponentKey = `${orgLibName}_${tempCompName}`;
|
|
246
262
|
const tempDirComp = join(tempCompPath, `${newTempComponentKey}`);
|
|
247
263
|
|
|
248
|
-
|
|
264
|
+
let compLabel = "";
|
|
265
|
+
let compName = tempCompName;
|
|
266
|
+
|
|
267
|
+
if (fs.existsSync(join(currentCompPath, componentKey)) && version === configDef.buildVersion && copyMove === "Copy") {
|
|
268
|
+
// need to rename
|
|
269
|
+
console.log(`\n${chalk.yellow(`${tempCompName}`)} exists, select new name and label for copied component.`);
|
|
270
|
+
const nameAnswers = await inquirer.prompt([
|
|
271
|
+
{
|
|
272
|
+
name: 'componentName',
|
|
273
|
+
message: 'Enter component name (required)',
|
|
274
|
+
validate: value => {
|
|
275
|
+
/* value should not be empty
|
|
276
|
+
It should not have spaces
|
|
277
|
+
It should not start with a number
|
|
278
|
+
Only case-insensitive alphanumeric values are allowed
|
|
279
|
+
*/
|
|
280
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
return 'Only alphanumeric values are allowed, starting with alphabets, no spaces.';
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: 'componentLabel',
|
|
288
|
+
message: 'Enter component label for display (required)',
|
|
289
|
+
validate: value => {
|
|
290
|
+
if (value) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
return 'Please provide value for label';
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
]);
|
|
297
|
+
|
|
298
|
+
//
|
|
299
|
+
compName = nameAnswers.componentName;
|
|
300
|
+
compLabel = nameAnswers.componentLabel;
|
|
301
|
+
|
|
302
|
+
}
|
|
303
|
+
else if (fs.existsSync(tempDirComp)) {
|
|
249
304
|
const answers = await inquirer.prompt([
|
|
250
305
|
{
|
|
251
306
|
name: 'confirmOverride',
|
|
@@ -264,7 +319,7 @@ export const localMoveCopyComp = async(componentKey, orgLibName, version, copyMo
|
|
|
264
319
|
}
|
|
265
320
|
|
|
266
321
|
// rename the component
|
|
267
|
-
const newComponentKey = await renameComponent(componentKey, orgLibName, version, copyMove);
|
|
322
|
+
const newComponentKey = await renameComponent(componentKey, orgLibName, version, copyMove, compName, compLabel);
|
|
268
323
|
|
|
269
324
|
return newComponentKey;
|
|
270
325
|
}
|
|
@@ -284,6 +339,8 @@ addDebugLog("move", "", "+");
|
|
|
284
339
|
process.exit();
|
|
285
340
|
}
|
|
286
341
|
|
|
342
|
+
await cleanUpTemp();
|
|
343
|
+
|
|
287
344
|
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
288
345
|
data = data && JSON.parse(data);
|
|
289
346
|
|
|
@@ -303,6 +360,8 @@ addDebugLog("move", "", "+");
|
|
|
303
360
|
|
|
304
361
|
let localComponents = await getComponentsObj();
|
|
305
362
|
|
|
363
|
+
const configDef = getConfigDefaults();
|
|
364
|
+
|
|
306
365
|
if (!localComponents || localComponents.length === 0 ) {
|
|
307
366
|
console.log(chalk.red.bold("No components to move/copy."));
|
|
308
367
|
process.exit();
|
|
@@ -343,7 +402,8 @@ addDebugLog("move", "", "+");
|
|
|
343
402
|
let removeOrgLib = "";
|
|
344
403
|
let libVersions;
|
|
345
404
|
try {
|
|
346
|
-
libVersions = await getLibraryArchivesVersions(configDef.currentOrgLib, configDef.buildVersion);
|
|
405
|
+
// libVersions = await getLibraryArchivesVersions(configDef.currentOrgLib, configDef.buildVersion);
|
|
406
|
+
libVersions = await getLibraryArchivesVersions(configDef.currentOrgLib, "0.0.0");
|
|
347
407
|
}
|
|
348
408
|
catch (ex) {}
|
|
349
409
|
if (!libVersions || libVersions.length === 0) {
|
|
@@ -371,10 +431,11 @@ addDebugLog("move", "", "+");
|
|
|
371
431
|
({copyMove} = copyMoveAnswer);
|
|
372
432
|
copyMoveLC = copyMove.toLowerCase();
|
|
373
433
|
|
|
374
|
-
if (localComponents && localComponents.length > 1) {
|
|
434
|
+
if (localComponents && localComponents.length > 1 ) {
|
|
375
435
|
localComponents.unshift({name: 'ALL', value: 'ALL'});
|
|
376
436
|
}
|
|
377
437
|
|
|
438
|
+
|
|
378
439
|
const keyQuestions = await getComponentKeyQuestion(localComponents, copyMoveLC, paramComponentKey);
|
|
379
440
|
|
|
380
441
|
const answers = await inquirer.prompt(keyQuestions);
|
|
@@ -387,12 +448,20 @@ addDebugLog("move", "", "+");
|
|
|
387
448
|
orgLibName = libAnswers.libraryName;
|
|
388
449
|
const buildVersion = configDef.currentOrgLib === orgLibName ? configDef.buildVersion : "";
|
|
389
450
|
|
|
390
|
-
|
|
391
|
-
|
|
451
|
+
// can copy (will rename) to same version, but can't move
|
|
452
|
+
if (copyMove === "Move") {
|
|
453
|
+
try {
|
|
454
|
+
libVersions = await getLibraryArchivesVersions(orgLibName, buildVersion);
|
|
455
|
+
}
|
|
456
|
+
catch (ex) {}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (libVersions.length == 0) {
|
|
460
|
+
console.log(`Current library: ${chalk.green(`${orgLibName}`)} has NO available versions to move to.`);
|
|
461
|
+
process.exit();
|
|
392
462
|
}
|
|
393
|
-
catch (ex) {}
|
|
394
463
|
|
|
395
|
-
const versionQuestions = await getLibraryVersionQuestion(orgLibName, libVersions);
|
|
464
|
+
const versionQuestions = await getLibraryVersionQuestion(orgLibName, libVersions, copyMoveLC);
|
|
396
465
|
const versionAnswers = await inquirer.prompt(versionQuestions);
|
|
397
466
|
({version, copyShared} = versionAnswers);
|
|
398
467
|
|
|
@@ -119,11 +119,14 @@ addDebugLog("zipComponent", `componentKey: ${componentKey}`, "");
|
|
|
119
119
|
|
|
120
120
|
const configContent = Buffer.from(fs.readFileSync(configJson)).toString();
|
|
121
121
|
|
|
122
|
-
fs.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
if (fs.existsSync('dist')) {
|
|
123
|
+
fs.rm('dist', { recursive: true }, err => {
|
|
124
|
+
if (err) {
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
127
130
|
|
|
128
131
|
return { zipContent, configContent };
|
|
129
132
|
};
|
|
@@ -17,6 +17,8 @@ export default async options => {
|
|
|
17
17
|
await checkLibraryAndArchives();
|
|
18
18
|
const isLibraryBased = getLibraryBased();
|
|
19
19
|
|
|
20
|
+
addDebugLog("publish", "", "+");
|
|
21
|
+
|
|
20
22
|
if (isLibraryBased) {
|
|
21
23
|
|
|
22
24
|
await checkJWTExpiration();
|
|
@@ -61,7 +63,7 @@ export default async options => {
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
if (okToPublish) {
|
|
64
|
-
// marking as
|
|
66
|
+
// marking as internal, so no questions will be ask
|
|
65
67
|
options.params.push("internal");
|
|
66
68
|
|
|
67
69
|
await buildLibrary(options);
|
|
@@ -72,9 +74,7 @@ export default async options => {
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
addDebugLog("publish", "", "+");
|
|
77
|
-
|
|
77
|
+
// non library based publish
|
|
78
78
|
let componentKey;
|
|
79
79
|
let sourceMap;
|
|
80
80
|
let devBuild;
|
|
@@ -109,17 +109,23 @@ addDebugLog("zipComponent", `componentKey: ${componentKey}`, "");
|
|
|
109
109
|
|
|
110
110
|
export const cleanUp = async () => {
|
|
111
111
|
addDebugLog("cleanUp", "", "");
|
|
112
|
-
fs.rm('dist/components', { recursive: true }, err => {
|
|
113
|
-
if (err) {
|
|
114
|
-
throw err;
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
112
|
|
|
118
|
-
fs.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
if (fs.existsSync('dist/components')) {
|
|
114
|
+
fs.rm('dist/components', { recursive: true }, err => {
|
|
115
|
+
if (err) {
|
|
116
|
+
throw err;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (fs.existsSync('lib')) {
|
|
122
|
+
fs.rm('lib', { recursive: true }, err => {
|
|
123
|
+
if (err) {
|
|
124
|
+
throw err;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
123
129
|
};
|
|
124
130
|
|
|
125
131
|
export const publishComponentToServer = async (data, doFetch) => {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path, {join} from 'path';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
showVersion,
|
|
9
|
+
addDebugLog,
|
|
10
|
+
getJestFunctionalTestList } from '../../util.js';
|
|
11
|
+
|
|
12
|
+
import { JEST_TESTS_FUNCTIONAL_PATH } from '../../constants.js';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export const quarnUnquarnTests = async(answers) => {
|
|
16
|
+
switch (answers.QuarUnQuar) {
|
|
17
|
+
case "Quarantine" :
|
|
18
|
+
await quarantineTests(answers);
|
|
19
|
+
break;
|
|
20
|
+
case "Unquarantine" :
|
|
21
|
+
await unquarantineTests(answers);
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export const quarantineTests = async(answers) => {
|
|
29
|
+
const testList = await getJestFunctionalTestList(answers.whichTests);
|
|
30
|
+
const functionalPath = join(path.resolve(), JEST_TESTS_FUNCTIONAL_PATH);
|
|
31
|
+
|
|
32
|
+
// rename .test to .notest
|
|
33
|
+
for (const testName of testList) {
|
|
34
|
+
const quarantineName = testName.replace(".test", ".notest");
|
|
35
|
+
fs.renameSync(join(functionalPath, testName), join(functionalPath, quarantineName));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const unquarantineTests = async(answers) => {
|
|
41
|
+
const testList = await getJestFunctionalTestList(answers.whichTests);
|
|
42
|
+
const functionalPath = join(path.resolve(), JEST_TESTS_FUNCTIONAL_PATH);
|
|
43
|
+
|
|
44
|
+
// rename .test to .notest
|
|
45
|
+
for (const testName of testList) {
|
|
46
|
+
const restoreName = testName.replace(".notest", ".test");
|
|
47
|
+
fs.renameSync(join(functionalPath, testName), join(functionalPath, restoreName));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export default async options => {
|
|
54
|
+
|
|
55
|
+
addDebugLog("quarantine", "", "+");
|
|
56
|
+
|
|
57
|
+
await showVersion();
|
|
58
|
+
|
|
59
|
+
const quaranAnswers = await inquirer.prompt([
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
name: 'QuarUnQuar',
|
|
63
|
+
type: 'rawlist',
|
|
64
|
+
message: `Quarantine or UnQuarantine tests`,
|
|
65
|
+
choices: ["Quarantine", "Unquarantine"],
|
|
66
|
+
default: 'Quarantine'
|
|
67
|
+
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'whichTests',
|
|
71
|
+
type: 'rawlist',
|
|
72
|
+
message: (answers) => `Which tests to ${answers.QuarUnQuar}`,
|
|
73
|
+
default: 'ALL',
|
|
74
|
+
choices: ["ALL", "Original", "Library"]
|
|
75
|
+
}
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
// await showCurrentStatus();
|
|
79
|
+
await quarnUnquarnTests(quaranAnswers);
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
addDebugLog("quarantine", "END", "-");
|
|
83
|
+
|
|
84
|
+
}
|
|
@@ -8,8 +8,6 @@ import { WEBPACK_CONFIG_JS_FILENAME } from '../../constants.js';
|
|
|
8
8
|
|
|
9
9
|
export const renamePromotedWebPack = async () => {
|
|
10
10
|
addDebugLog("renamePromotedWebPack","", "");
|
|
11
|
-
// call this function from top level
|
|
12
|
-
// fs.copyFileSync("./webpack.config.js", "webpack.config.js")
|
|
13
11
|
|
|
14
12
|
const promoteWebPackDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
|
|
15
13
|
const renamedPromoteWebPackDir = path.resolve(`${WEBPACK_CONFIG_JS_FILENAME}.notused`);
|
|
@@ -49,11 +49,20 @@ addDebugLog("setPermVersion", `isPerm: ${isPerm}`, "");
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
export const setPermanent = async () => {
|
|
52
|
+
export const setPermanent = async ( inputYN = "" ) => {
|
|
53
53
|
addDebugLog("setPermanent", "", "");
|
|
54
54
|
|
|
55
55
|
const configDefaults = await getConfigDefaults();
|
|
56
56
|
|
|
57
|
+
if (inputYN != "") {
|
|
58
|
+
const makePerm = (inputYN === 'Y' || inputYN === 'y' || inputYN === true || inputYN === 'true');
|
|
59
|
+
await setPermVersion(makePerm);
|
|
60
|
+
|
|
61
|
+
await forceDefaultsUpdate();
|
|
62
|
+
await showCurrentStatus();
|
|
63
|
+
process.exit();
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
const isOrNot = configDefaults.devBuild ? "NOT PERMANENT" : "PERMANENT";
|
|
58
67
|
|
|
59
68
|
console.log(`Currently ${chalk.green(`${configDefaults.displayLibVersion}`)} is ${chalk.yellow(`${isOrNot}`)}.`);
|
|
@@ -125,8 +134,15 @@ addDebugLog("setPerm", "", "+");
|
|
|
125
134
|
|
|
126
135
|
await showVersion();
|
|
127
136
|
await checkLibraryAndArchives();
|
|
137
|
+
|
|
138
|
+
let inputYN = "";
|
|
139
|
+
|
|
140
|
+
if (options.params.length >= 4) {
|
|
141
|
+
inputYN = options.params[3];
|
|
142
|
+
}
|
|
143
|
+
|
|
128
144
|
// await showCurrentStatus();
|
|
129
|
-
await setPermanent();
|
|
145
|
+
await setPermanent(inputYN);
|
|
130
146
|
|
|
131
147
|
|
|
132
148
|
addDebugLog("setPerm", "END", "-");
|
package/src/tasks/store/index.js
CHANGED
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
checkLibraryAndArchives,
|
|
10
10
|
getConfigDefaults,
|
|
11
11
|
getLibraryBased,
|
|
12
|
-
zipVersionAndArchive
|
|
12
|
+
zipVersionAndArchive,
|
|
13
|
+
cleanUpTemp
|
|
13
14
|
} from '../../util.js';
|
|
14
15
|
|
|
15
16
|
export default async options => {
|
|
@@ -18,6 +19,8 @@ export default async options => {
|
|
|
18
19
|
|
|
19
20
|
addDebugLog("storeComponents", "", "+");
|
|
20
21
|
|
|
22
|
+
await cleanUpTemp();
|
|
23
|
+
|
|
21
24
|
const isLibraryBased = getLibraryBased();
|
|
22
25
|
if (!isLibraryBased) {
|
|
23
26
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
checkLibraryAndArchives,
|
|
16
16
|
getConfigDefaults,
|
|
17
17
|
forceDefaultsUpdate,
|
|
18
|
-
getHaveDependencyDifference
|
|
18
|
+
getHaveDependencyDifference,
|
|
19
|
+
cleanUpTemp
|
|
19
20
|
} from '../../util.js';
|
|
20
21
|
|
|
21
22
|
import { getSwitchLibraryComponentQuestions, getSwitchVersionComponentQuestions } from './helper.js';
|
|
@@ -31,6 +32,7 @@ export default async options => {
|
|
|
31
32
|
|
|
32
33
|
await showVersion();
|
|
33
34
|
await checkLibraryAndArchives();
|
|
35
|
+
await cleanUpTemp();
|
|
34
36
|
|
|
35
37
|
addDebugLog("switchLibrary", "", "+");
|
|
36
38
|
let libraryName;
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
getConfigDefaults,
|
|
18
18
|
getHaveDependencyDifference,
|
|
19
19
|
forceDefaultsUpdate,
|
|
20
|
-
modAddAboutData
|
|
20
|
+
modAddAboutData,
|
|
21
|
+
cleanUpTemp
|
|
21
22
|
} from '../../util.js';
|
|
22
23
|
|
|
23
24
|
import { getSwitchVersionComponentQuestions } from './helper.js';
|
|
@@ -33,6 +34,7 @@ export default async options => {
|
|
|
33
34
|
|
|
34
35
|
await showVersion();
|
|
35
36
|
await checkLibraryAndArchives();
|
|
37
|
+
await cleanUpTemp();
|
|
36
38
|
|
|
37
39
|
addDebugLog("switchVersion", "", "+");
|
|
38
40
|
let libraryName;
|
package/src/util.js
CHANGED
|
@@ -33,7 +33,8 @@ import {
|
|
|
33
33
|
SHOW_DEBUG,
|
|
34
34
|
COMPONENTS_PATH,
|
|
35
35
|
ARCHIVES_PATH,
|
|
36
|
-
TEMP_PATH
|
|
36
|
+
TEMP_PATH,
|
|
37
|
+
JEST_TESTS_FUNCTIONAL_PATH
|
|
37
38
|
} from './constants.js';
|
|
38
39
|
|
|
39
40
|
|
|
@@ -44,6 +45,7 @@ let debugLevel = 1;
|
|
|
44
45
|
let haveDependencyDifference = false;
|
|
45
46
|
let addAboutData = true;
|
|
46
47
|
|
|
48
|
+
|
|
47
49
|
// updated upon start
|
|
48
50
|
let defaultConfigs = {
|
|
49
51
|
serverType: "",
|
|
@@ -1311,17 +1313,22 @@ if (showDebug) addDebugLog("deletePublishExtras", `libraryName: ${libraryName},
|
|
|
1311
1313
|
|
|
1312
1314
|
export const cleanUp = async () => {
|
|
1313
1315
|
if (showDebug) addDebugLog("cleanUp", "", "");
|
|
1316
|
+
if (fs.existsSync('dist/components')) {
|
|
1314
1317
|
fs.rm('dist/components', { recursive: true }, err => {
|
|
1315
1318
|
if (err) {
|
|
1316
1319
|
throw err;
|
|
1317
1320
|
}
|
|
1318
1321
|
});
|
|
1322
|
+
}
|
|
1319
1323
|
|
|
1324
|
+
if (fs.existsSync('lib')) {
|
|
1320
1325
|
fs.rm('lib', { recursive: true }, err => {
|
|
1321
1326
|
if (err) {
|
|
1322
1327
|
throw err;
|
|
1323
1328
|
}
|
|
1324
1329
|
});
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1325
1332
|
};
|
|
1326
1333
|
|
|
1327
1334
|
export const getComponentsConfigs = async (compDir = null) => {
|
|
@@ -1413,6 +1420,7 @@ if (showDebug) addDebugLog("zipVersionAndArchive", `orgLibName: ${orgLibName}, v
|
|
|
1413
1420
|
console.log('Data has been drained');
|
|
1414
1421
|
});
|
|
1415
1422
|
|
|
1423
|
+
|
|
1416
1424
|
// good practice to catch warnings (ie stat failures and other non-blocking errors)
|
|
1417
1425
|
archive.on('warning', function(err) {
|
|
1418
1426
|
if (err.code === 'ENOENT') {
|
|
@@ -1436,7 +1444,7 @@ if (showDebug) addDebugLog("zipVersionAndArchive", `orgLibName: ${orgLibName}, v
|
|
|
1436
1444
|
// console.log(chalk.green(`component zipped with size: ${Math.ceil(zipBuffer.length / 1024)} KB`));
|
|
1437
1445
|
// const zipContent = zipBuffer.toString('base64');
|
|
1438
1446
|
|
|
1439
|
-
|
|
1447
|
+
return output;
|
|
1440
1448
|
|
|
1441
1449
|
};
|
|
1442
1450
|
|
|
@@ -1680,6 +1688,7 @@ if (showDebug) addDebugLog("getLibraryArchiveDirectories", "", "");
|
|
|
1680
1688
|
const currentDirectory = process.cwd();
|
|
1681
1689
|
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH);
|
|
1682
1690
|
|
|
1691
|
+
|
|
1683
1692
|
if (!fs.existsSync(archiveDirectory)) {
|
|
1684
1693
|
return [];
|
|
1685
1694
|
}
|
|
@@ -1764,11 +1773,10 @@ export const deleteLocalArchiveLibrary = async(libraryName) => {
|
|
|
1764
1773
|
fs.rmSync(archiveDirectory, { recursive: true });
|
|
1765
1774
|
console.log(`${chalk.green.bold(libraryName)} is deleted from Local.`);
|
|
1766
1775
|
} catch (err) {
|
|
1767
|
-
console.log(`${chalk.green.red(`No such file ${libraryName}
|
|
1768
|
-
throw new Error(`No such file ${libraryName}`);
|
|
1776
|
+
console.log(`${chalk.green.red(`No such file ${libraryName}`)}`);
|
|
1777
|
+
// throw new Error(`No such file ${libraryName}`);
|
|
1769
1778
|
}
|
|
1770
1779
|
|
|
1771
|
-
|
|
1772
1780
|
}
|
|
1773
1781
|
|
|
1774
1782
|
export const deleteLocalArchiveLibraryVersion = async(libraryName, version) => {
|
|
@@ -1783,11 +1791,47 @@ export const deleteLocalArchiveLibraryVersion = async(libraryName, version) => {
|
|
|
1783
1791
|
|
|
1784
1792
|
} catch (err) {
|
|
1785
1793
|
console.log(`${chalk.green.red(`No such file ${libraryName}/${version}`)}`);
|
|
1786
|
-
throw new Error(`No such file ${libraryName}/${version}`);
|
|
1794
|
+
// throw new Error(`No such file ${libraryName}/${version}`);
|
|
1787
1795
|
}
|
|
1788
1796
|
|
|
1789
1797
|
}
|
|
1790
1798
|
|
|
1799
|
+
export const cleanUpTemp = async() => {
|
|
1800
|
+
const currentDirectory = process.cwd();
|
|
1801
|
+
const tempDirectory = join (currentDirectory, TEMP_PATH);
|
|
1802
|
+
|
|
1803
|
+
if (fs.existsSync(tempDirectory)) {
|
|
1804
|
+
fs.rmSync(tempDirectory, { recursive: true });
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
|
|
1810
|
+
export const getJestFunctionalTestList = async(whichTests) => {
|
|
1811
|
+
const functionalDir = path.join(path.resolve(), JEST_TESTS_FUNCTIONAL_PATH);
|
|
1812
|
+
const libFilter = "localLib";
|
|
1813
|
+
|
|
1814
|
+
switch (whichTests) {
|
|
1815
|
+
case "ALL" :
|
|
1816
|
+
return fs
|
|
1817
|
+
.readdirSync(functionalDir, { withFileTypes: true })
|
|
1818
|
+
.filter(dirent => !dirent.isDirectory() )
|
|
1819
|
+
.map(dirent => dirent.name);
|
|
1820
|
+
case "Original":
|
|
1821
|
+
return fs
|
|
1822
|
+
.readdirSync(functionalDir, { withFileTypes: true })
|
|
1823
|
+
.filter(dirent => !dirent.isDirectory() && !dirent.name.startsWith(libFilter))
|
|
1824
|
+
.map(dirent => dirent.name);
|
|
1825
|
+
case "Library" :
|
|
1826
|
+
return fs
|
|
1827
|
+
.readdirSync(functionalDir, { withFileTypes: true })
|
|
1828
|
+
.filter(dirent => !dirent.isDirectory() && dirent.name.startsWith(libFilter))
|
|
1829
|
+
.map(dirent => dirent.name);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1791
1835
|
|
|
1792
1836
|
// init
|
|
1793
1837
|
await forceDefaultsUpdate();
|