@pega/custom-dx-components 0.242.50 → 0.242.52
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/delete-lib/index.js +20 -0
- package/src/tasks/import-archive/index.js +4 -3
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/switch-lib/index.js +2 -2
- package/src/tasks/switch-version/index.js +3 -32
- package/src/util.js +29 -55
- package/tests/functional/localCreateBuildDelete.test.js +1 -1
- package/tests/functional/localLibCreateLibExportImportLib.test.js +1 -1
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
deleteLocalArchiveLibrary,
|
|
12
12
|
deleteLocalArchiveLibraryVersion,
|
|
13
13
|
deleteLocalComponent,
|
|
14
|
+
getHaveDependencyDifference,
|
|
14
15
|
getComponents,
|
|
15
16
|
getLibraryArchiveDirectories,
|
|
16
17
|
deleteArchives,
|
|
@@ -174,6 +175,15 @@ addDebugLog("deleteLibraryVersion", "END", "-");
|
|
|
174
175
|
console.log(`\nSwitched to ${chalk.green(`${configDef.displayLibVersion}`)}`);
|
|
175
176
|
await showCurrentStatus();
|
|
176
177
|
|
|
178
|
+
if (getHaveDependencyDifference()) {
|
|
179
|
+
|
|
180
|
+
console.log('\n***************************************************************');
|
|
181
|
+
console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
|
|
182
|
+
console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
|
|
183
|
+
console.log('***************************************************************\n');
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
177
187
|
}
|
|
178
188
|
}
|
|
179
189
|
else {
|
|
@@ -182,6 +192,16 @@ addDebugLog("deleteLibraryVersion", "END", "-");
|
|
|
182
192
|
}
|
|
183
193
|
|
|
184
194
|
}
|
|
195
|
+
else {
|
|
196
|
+
// switch to another version, if no versions to switch to then delete /store so will be back to state of nothing
|
|
197
|
+
const archiveLibraries = await getLibraryArchiveDirectories("");
|
|
198
|
+
if (!archiveLibraries || archiveLibraries.length === 0) {
|
|
199
|
+
// no libraries, so remove "/store"
|
|
200
|
+
await deleteArchives();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
}
|
|
204
|
+
|
|
185
205
|
|
|
186
206
|
addDebugLog("deleteLibraryVersion", "END", "-");
|
|
187
207
|
|
|
@@ -247,7 +247,8 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
247
247
|
let organization = await getPackgeOrg(tempPackage);
|
|
248
248
|
let localConfig = await getLocalConfigData(tempTasksConfig);
|
|
249
249
|
|
|
250
|
-
let
|
|
250
|
+
let libName = localConfig.library;
|
|
251
|
+
let orgLibName = `${organization}_${libName}`;
|
|
251
252
|
const version = localConfig.buildVersion;
|
|
252
253
|
const devBuild = localConfig.devBuild;
|
|
253
254
|
|
|
@@ -365,8 +366,8 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
365
366
|
|
|
366
367
|
console.log('\n***************************************************************');
|
|
367
368
|
console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
|
|
368
|
-
console.log(
|
|
369
|
-
console.log('
|
|
369
|
+
console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
|
|
370
|
+
console.log('***************************************************************\n');
|
|
370
371
|
}
|
|
371
372
|
|
|
372
373
|
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@pega/configs": "^0.15.1",
|
|
103
|
-
"@pega/custom-dx-components": "~0.242.
|
|
103
|
+
"@pega/custom-dx-components": "~0.242.52",
|
|
104
104
|
"@pega/pcore-pconnect-typedefs": "~3.2.0-alpha.1",
|
|
105
105
|
"@storybook/addon-actions": "^7.6.19",
|
|
106
106
|
"@storybook/addon-essentials": "^7.6.19",
|
|
@@ -139,8 +139,8 @@ addDebugLog("switchLibrary", "", "+");
|
|
|
139
139
|
|
|
140
140
|
console.log('\n***************************************************************');
|
|
141
141
|
console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
|
|
142
|
-
console.log(
|
|
143
|
-
console.log('
|
|
142
|
+
console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
|
|
143
|
+
console.log('***************************************************************\n');
|
|
144
144
|
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -103,25 +103,6 @@ addDebugLog("switchVersion", "", "+");
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
// const anotherTask = new Listr(
|
|
107
|
-
// [
|
|
108
|
-
// {
|
|
109
|
-
// title: `npm update (may take a few minutes)`,
|
|
110
|
-
// task: async () => {
|
|
111
|
-
// await runNpmUpdate();
|
|
112
|
-
// }
|
|
113
|
-
// }
|
|
114
|
-
// ],
|
|
115
|
-
// { concurrent: false, exitOnError: true }
|
|
116
|
-
// );
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// archive existing
|
|
120
|
-
// await zipVersionAndArchive(existingOrgLib, oldVersion);
|
|
121
|
-
|
|
122
|
-
// restore from archive
|
|
123
|
-
//
|
|
124
|
-
|
|
125
106
|
console.log(`${chalk.bold.green(`\nSwitched to ${orgLib.currentOrgLib}/${newVersion}!\n`)}`);
|
|
126
107
|
|
|
127
108
|
await forceDefaultsUpdate();
|
|
@@ -131,19 +112,9 @@ addDebugLog("switchVersion", "", "+");
|
|
|
131
112
|
|
|
132
113
|
console.log('\n***************************************************************');
|
|
133
114
|
console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
|
|
134
|
-
console.log(
|
|
135
|
-
console.log('
|
|
136
|
-
|
|
137
|
-
// const upateQuestions = await getRunNpmQuestions();
|
|
138
|
-
// const answers = await inquirer.prompt(upateQuestions);
|
|
139
|
-
// const { updateNpm } = answers;
|
|
140
|
-
|
|
141
|
-
// if (updateNpm) {
|
|
142
|
-
// await anotherTask.run().catch(err => {
|
|
143
|
-
// console.log(chalk.bold.red(err.toString()));
|
|
144
|
-
// process.exit(1);
|
|
145
|
-
// });
|
|
146
|
-
// }
|
|
115
|
+
console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
|
|
116
|
+
console.log('***************************************************************\n');
|
|
117
|
+
|
|
147
118
|
}
|
|
148
119
|
|
|
149
120
|
|
package/src/util.js
CHANGED
|
@@ -285,12 +285,19 @@ export const checkJWTExpiration = async () => {
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
const jwt = jwtDecode(tokenAndStaticServer.C11NB2S);
|
|
288
|
-
const { exp } = jwt;
|
|
288
|
+
const { exp, customer_org } = jwt;
|
|
289
289
|
if (exp < (new Date().getTime() + 1) / 1000) {
|
|
290
290
|
console.log(chalk.redBright("JWT token has expired, please reauthenticate."));
|
|
291
291
|
process.exit(1);
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
// check that there is customer_org
|
|
295
|
+
if (!customer_org || customer_org === "") {
|
|
296
|
+
console.log(chalk.red(`PegaInfinity server DSS setting ${chalk.redBright.bold(`C11nCCv2CustomerOrg`)} is NOT set.`));
|
|
297
|
+
console.log(chalk.red("Please update DSS setting, save and then reauthenticate."));
|
|
298
|
+
process.exit(1);
|
|
299
|
+
}
|
|
300
|
+
|
|
294
301
|
}
|
|
295
302
|
|
|
296
303
|
export const getLibraryBased = () => {
|
|
@@ -1258,17 +1265,18 @@ if (showDebug) addDebugLog("getLocalLibraryVersions", `libraryName: ${libraryNam
|
|
|
1258
1265
|
};
|
|
1259
1266
|
|
|
1260
1267
|
export const getLocalArchivedLibraryVersions = async (libraryName, currentVersion = "0.0.0") => {
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1268
|
+
if (showDebug) addDebugLog("getLocalArchivedLibraryVersions", `libraryName: ${libraryName}` , "");
|
|
1269
|
+
const currentDirectory = process.cwd();
|
|
1270
|
+
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${libraryName}`);
|
|
1264
1271
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1272
|
+
return fs
|
|
1273
|
+
.readdirSync(archiveDirectory, { withFileTypes: true })
|
|
1274
|
+
.filter(dirent => dirent.isDirectory() && dirent.name != currentVersion)
|
|
1275
|
+
.map(dirent => dirent.name);
|
|
1276
|
+
};
|
|
1270
1277
|
|
|
1271
1278
|
export const getLocalArchivedLibrraryVersionData = async(libraryName, libraryVersion) => {
|
|
1279
|
+
if (showDebug) addDebugLog("getLocalArchivedLibrraryVersionData", `libraryName: ${libraryName}, libraryVersion: ${libraryVersion}`, "");
|
|
1272
1280
|
const currentDirectory = process.cwd();
|
|
1273
1281
|
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${libraryName}`, `${libraryVersion}`);
|
|
1274
1282
|
|
|
@@ -1504,11 +1512,13 @@ if (showDebug) addDebugLog("zipVersionAndArchive", `orgLibName: ${orgLibName}, v
|
|
|
1504
1512
|
};
|
|
1505
1513
|
|
|
1506
1514
|
export const unZipFromArchive = async (fileName) => {
|
|
1515
|
+
if (showDebug) addDebugLog("unZipFromArchive", `fileName: ${fileName}`, "");
|
|
1507
1516
|
await unarchive(fileName, TEMP_PATH);
|
|
1508
1517
|
};
|
|
1509
1518
|
|
|
1510
1519
|
|
|
1511
1520
|
export const updateComponentTaskConfig = async () => {
|
|
1521
|
+
if (showDebug) addDebugLog("updateComponentTaskConfig", "", "");
|
|
1512
1522
|
const currentDirectory = process.cwd();
|
|
1513
1523
|
const tempDirectory = join(currentDirectory, TEMP_PATH);
|
|
1514
1524
|
|
|
@@ -1531,6 +1541,7 @@ export const updateComponentTaskConfig = async () => {
|
|
|
1531
1541
|
}
|
|
1532
1542
|
|
|
1533
1543
|
export const restoreDependenciesFromPackage = async () => {
|
|
1544
|
+
if (showDebug) addDebugLog("restoreDependenciesFromPackage", "", "");
|
|
1534
1545
|
const currentDirectory = process.cwd();
|
|
1535
1546
|
const tempDirectory = join(currentDirectory, TEMP_PATH);
|
|
1536
1547
|
const tempPackagePath = join (tempDirectory, PACKAGE_JSON_FILENAME);
|
|
@@ -1609,10 +1620,12 @@ export const restoreDependenciesFromPackage = async () => {
|
|
|
1609
1620
|
}
|
|
1610
1621
|
|
|
1611
1622
|
export const getHaveDependencyDifference = () => {
|
|
1623
|
+
if (showDebug) addDebugLog("getHaveDependencyDifference", ``, "");
|
|
1612
1624
|
return haveDependencyDifference;
|
|
1613
1625
|
}
|
|
1614
1626
|
|
|
1615
1627
|
export const restoreFromArchive = async (fileName, orgLibName, version) => {
|
|
1628
|
+
if (showDebug) addDebugLog("restoreFromArchive", `fileName: ${fileName}, orgLibName: ${orgLibName}, version: ${version}`, "");
|
|
1616
1629
|
const currentDirectory = process.cwd();
|
|
1617
1630
|
const tempDirectory = join(currentDirectory, TEMP_PATH);
|
|
1618
1631
|
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${version}`);
|
|
@@ -1668,6 +1681,7 @@ export const restoreFromArchive = async (fileName, orgLibName, version) => {
|
|
|
1668
1681
|
};
|
|
1669
1682
|
|
|
1670
1683
|
export const clearSrcComponentsDirectory = async () => {
|
|
1684
|
+
if (showDebug) addDebugLog("clearSrcComponentsDirectory", ``, "");
|
|
1671
1685
|
const currentDirectory = process.cwd();
|
|
1672
1686
|
const currentComponentsPath = join(currentDirectory, "src", "components");
|
|
1673
1687
|
|
|
@@ -1700,6 +1714,7 @@ if (showDebug) addDebugLog("hasArchives", `${hasArc}`, "");
|
|
|
1700
1714
|
};
|
|
1701
1715
|
|
|
1702
1716
|
export const deleteArchives = async () => {
|
|
1717
|
+
if (showDebug) addDebugLog("deleteArchives", ``, "");
|
|
1703
1718
|
const currentDirectory = process.cwd();
|
|
1704
1719
|
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH);
|
|
1705
1720
|
const hasArc = fs.existsSync(archiveDirectory);
|
|
@@ -1713,7 +1728,7 @@ export const deleteArchives = async () => {
|
|
|
1713
1728
|
}
|
|
1714
1729
|
|
|
1715
1730
|
export const checkLibraryAndArchives = async () => {
|
|
1716
|
-
|
|
1731
|
+
if (showDebug) addDebugLog("checkLibraryAndArchives", ``, "");
|
|
1717
1732
|
const isLibraryBased = getLibraryBased();
|
|
1718
1733
|
const hasArch = await hasArchives();
|
|
1719
1734
|
|
|
@@ -1774,59 +1789,14 @@ if (showDebug) addDebugLog("getLibraryArchiveDirectories", "", "");
|
|
|
1774
1789
|
.map(dirent => dirent.name);
|
|
1775
1790
|
};
|
|
1776
1791
|
|
|
1777
|
-
// export const getLibraryArchivesFiles = async (orgLibName, version) => {
|
|
1778
|
-
// if (showDebug) addDebugLog("getLibraryArchives", `orgLibName: ${orgLibName}`, "");
|
|
1779
|
-
// const currentDirectory = process.cwd();
|
|
1780
|
-
// const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${version}`);
|
|
1781
1792
|
|
|
1782
|
-
// if (!fs.existsSync(archiveDirectory)) {
|
|
1783
|
-
// return [];
|
|
1784
|
-
// }
|
|
1785
|
-
|
|
1786
|
-
// return fs
|
|
1787
|
-
// .readdirSync(archiveDirectory, { withFileTypes: true })
|
|
1788
|
-
// .filter(dirent => !dirent.isDirectory() && !isHiddenFile(dirent.name) )
|
|
1789
|
-
// .map(dirent => dirent.name);
|
|
1790
|
-
|
|
1791
|
-
// };
|
|
1792
1793
|
|
|
1793
1794
|
export const getLibraryArchivesVersions = async (orgLibName, currentVersion) => {
|
|
1794
1795
|
if (showDebug) addDebugLog("getLibraryArchivesVersions", `orgLibName: ${orgLibName}`, "");
|
|
1795
|
-
// const archFileList = await getLibraryArchivesFiles(orgLibName, currentVersion);
|
|
1796
|
-
// let archiveVersionList = [];
|
|
1797
|
-
|
|
1798
|
-
// if (archFileList && archFileList.length > 0) {
|
|
1799
|
-
// for (let index in archFileList) {
|
|
1800
|
-
// let fileName = archFileList[index];
|
|
1801
|
-
// let fVersion = fileName.replace(orgLibName.concat("_"), "");
|
|
1802
|
-
// fVersion = fVersion.replace(".zip", "");
|
|
1803
|
-
// if (currentVersion != fVersion) {
|
|
1804
|
-
// archiveVersionList.push(fVersion);
|
|
1805
|
-
// }
|
|
1806
|
-
|
|
1807
|
-
// }
|
|
1808
|
-
// }
|
|
1809
|
-
// else {
|
|
1810
|
-
// console.error(
|
|
1811
|
-
// `${chalk.red.bold(`No archives found for ${orgLibName}.`)}`
|
|
1812
|
-
// );
|
|
1813
|
-
// process.exit(1);
|
|
1814
|
-
// }
|
|
1815
|
-
|
|
1816
|
-
// if (archiveVersionList.length == 0) {
|
|
1817
|
-
// console.error(
|
|
1818
|
-
// `${chalk.red.bold(`No archives found for ${orgLibName} beyond current version.`)}`
|
|
1819
|
-
// );
|
|
1820
|
-
// process.exit(1);
|
|
1821
|
-
// }
|
|
1822
|
-
|
|
1823
|
-
// return archiveVersionList;
|
|
1824
1796
|
|
|
1825
1797
|
const currentDirectory = process.cwd();
|
|
1826
1798
|
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`);
|
|
1827
1799
|
|
|
1828
|
-
// const currentVersion = getConfigDefaults().buildVersion;
|
|
1829
|
-
|
|
1830
1800
|
if (!fs.existsSync(archiveDirectory)) {
|
|
1831
1801
|
return [];
|
|
1832
1802
|
}
|
|
@@ -1841,6 +1811,7 @@ if (showDebug) addDebugLog("getLibraryArchivesVersions", `orgLibName: ${orgLibNa
|
|
|
1841
1811
|
};
|
|
1842
1812
|
|
|
1843
1813
|
export const deleteLocalArchiveLibrary = async(libraryName) => {
|
|
1814
|
+
if (showDebug) addDebugLog("deleteLocalArchiveLibrary", `libraryName: ${libraryName}`, "");
|
|
1844
1815
|
const currentDirectory = process.cwd();
|
|
1845
1816
|
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, libraryName);
|
|
1846
1817
|
|
|
@@ -1863,6 +1834,7 @@ export const deleteLocalArchiveLibrary = async(libraryName) => {
|
|
|
1863
1834
|
}
|
|
1864
1835
|
|
|
1865
1836
|
export const deleteLocalArchiveLibraryVersion = async(libraryName, version) => {
|
|
1837
|
+
if (showDebug) addDebugLog("deleteLocalArchiveLibraryVersion", `libraryName: ${libraryName}, version: ${version}`, "");
|
|
1866
1838
|
const currentDirectory = process.cwd();
|
|
1867
1839
|
const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, libraryName, version);
|
|
1868
1840
|
|
|
@@ -1880,6 +1852,7 @@ export const deleteLocalArchiveLibraryVersion = async(libraryName, version) => {
|
|
|
1880
1852
|
}
|
|
1881
1853
|
|
|
1882
1854
|
export const cleanUpTemp = async() => {
|
|
1855
|
+
if (showDebug) addDebugLog("cleanUpTemp", ``, "");
|
|
1883
1856
|
const currentDirectory = process.cwd();
|
|
1884
1857
|
const tempDirectory = join (currentDirectory, TEMP_PATH);
|
|
1885
1858
|
|
|
@@ -1891,6 +1864,7 @@ export const cleanUpTemp = async() => {
|
|
|
1891
1864
|
|
|
1892
1865
|
|
|
1893
1866
|
export const getJestFunctionalTestList = async(whichTests) => {
|
|
1867
|
+
if (showDebug) addDebugLog("getJestFunctionalTestList", ``, "");
|
|
1894
1868
|
const functionalDir = path.join(path.resolve(), JEST_TESTS_FUNCTIONAL_PATH);
|
|
1895
1869
|
const libFilter = "localLib";
|
|
1896
1870
|
|
|
@@ -111,7 +111,7 @@ describe(`create library delete Library: ${serverDir} - ${compType}`, () => {
|
|
|
111
111
|
expect(stdout).toContain(`${newFileName} schema is valid`);
|
|
112
112
|
// expect(stdout).toContain('Compiled successfully.');
|
|
113
113
|
// done();
|
|
114
|
-
},
|
|
114
|
+
}, 50000);
|
|
115
115
|
|
|
116
116
|
it('npm run delete Local', async () => {
|
|
117
117
|
const fileName = 'MyTestText';
|
|
@@ -125,7 +125,7 @@ describe(`createLib createAll exportStore importStore deleteLib: ${serverDir} -
|
|
|
125
125
|
// // remove it
|
|
126
126
|
// fs.rmdirSync(fileDir, { recursive: true });
|
|
127
127
|
// }
|
|
128
|
-
},
|
|
128
|
+
}, 30000);
|
|
129
129
|
|
|
130
130
|
it('npm run list', async () => {
|
|
131
131
|
const script = 'npm run list --prefix ../../..';
|