@pega/custom-dx-components 0.25.21 → 0.25.23
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 +2 -2
- package/src/tasks/build-jest-assets/index.js +0 -1
- package/src/tasks/build-lib/helper.js +0 -2
- package/src/tasks/build-lib/index.js +3 -3
- package/src/tasks/delete/helper.js +0 -1
- package/src/tasks/delete/index.js +5 -1
- package/src/tasks/delete-lib/helper.js +0 -1
- package/src/tasks/delete-pub/helper.js +7 -2
- package/src/tasks/delete-version/index.js +0 -1
- package/src/tasks/export-archive/helper.js +7 -1
- package/src/tasks/export-archive/index.js +10 -34
- package/src/tasks/import-archive/helper.js +19 -5
- package/src/tasks/import-archive/index.js +247 -35
- package/src/tasks/import-comp/helper.js +0 -2
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/init/template/tasks.config.json +1 -1
- package/src/tasks/list/helper.js +17 -2
- package/src/tasks/list-lib/index.js +10 -1
- package/src/tasks/list-pub/helper.js +2 -4
- package/src/tasks/list-pub/index.js +15 -2
- package/src/tasks/publish/helper.js +0 -1
- package/src/tasks/publish/index.js +13 -1
- package/src/tasks/publish-all/index.js +10 -1
- package/src/tasks/publish-archive/index.js +51 -83
- package/src/tasks/publish-lib/index.js +0 -23
- package/src/tasks/rename/index.js +9 -1
- package/src/tasks/restore/index.js +19 -13
- package/src/tasks/set-perm/index.js +0 -2
- package/src/tasks/show-help/index.js +1 -5
- package/src/tasks/show-status/index.js +19 -6
- package/src/tasks/store/index.js +39 -18
- package/src/tasks/switch-lib/helper.js +0 -1
- package/src/util.js +6 -77
- package/tests/assets/library/components/create/shared/create-nonce.ts +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/date.ts +0 -24
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/repeat-utils.ts +0 -4
- package/tests/assets/library/components/createAll/Constellation/shared/create-nonce.ts +1 -0
- package/tests/functional/localCreateBuildAllDeleteAll.test.js +8 -8
- package/tests/functional/localCreateBuildDelete.test.js +8 -8
- package/tests/functional/localCreateListDelete.test.js +8 -8
- package/tests/functional/localCreatePublishAllDeleteAll.test.js +8 -8
- package/tests/functional/localCreatePublishDelete.test.js +8 -8
- package/tests/functional/localCreateRenameDelete.test.js +8 -8
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibStoreRestoreDeleteLib.test.js +376 -0
package/src/tasks/list/helper.js
CHANGED
|
@@ -4,8 +4,23 @@ import chalk from 'chalk';
|
|
|
4
4
|
import fetch from 'node-fetch';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
LIST_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
9
|
+
LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
10
|
+
TOKEN_PATH, COMPONENT_SCHEMA,
|
|
11
|
+
TASKS_CONFIG_JSON_FILENAME,
|
|
12
|
+
COMPONENTS_DIRECTORY_PATH,
|
|
13
|
+
COMPONENTS_PATH } from '../../constants.js';
|
|
14
|
+
import {
|
|
15
|
+
constructCompleteUrl,
|
|
16
|
+
getComponents,
|
|
17
|
+
getPegaServerConfig,
|
|
18
|
+
getHttpsAgent,
|
|
19
|
+
addDebugLog,
|
|
20
|
+
getLibraryBased,
|
|
21
|
+
getComponentsConfigs,
|
|
22
|
+
getConfigDefaults,
|
|
23
|
+
checkAccessTokenExpiration } from '../../util.js';
|
|
9
24
|
|
|
10
25
|
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
11
26
|
SERVER: 'Server',
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
showVersion,
|
|
6
|
+
getLibraryBased,
|
|
7
|
+
addDebugLog,
|
|
8
|
+
checkLibraryAndArchives,
|
|
9
|
+
getLibraryArchivesVersions,
|
|
10
|
+
getConfigDefaults,
|
|
11
|
+
getLocalArchivedLibrraryVersionData,
|
|
12
|
+
getComponentsConfigs,
|
|
13
|
+
cleanUpTemp } from '../../util.js';
|
|
5
14
|
import { getArchiveLibraryQuestions } from './helper.js';
|
|
6
15
|
|
|
7
16
|
export default async (options) => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import chalk from 'chalk';
|
|
5
4
|
import fetch from 'node-fetch';
|
|
6
|
-
|
|
5
|
+
|
|
7
6
|
|
|
8
7
|
import {
|
|
9
8
|
getPegaServerConfig,
|
|
@@ -11,8 +10,7 @@ import {
|
|
|
11
10
|
getC11NB2STokenAndStaticServer,
|
|
12
11
|
getApplicationAndVersionFromToken,
|
|
13
12
|
constructCompleteUrl,
|
|
14
|
-
getHttpsAgent
|
|
15
|
-
getConfigDefaults
|
|
13
|
+
getHttpsAgent
|
|
16
14
|
} from '../../util.js';
|
|
17
15
|
|
|
18
16
|
import { listLibJSONResponse } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
showVersion,
|
|
6
|
+
getC11NB2STokenAndStaticServer,
|
|
7
|
+
getLocalLibraries,
|
|
8
|
+
getLocalLibraryVersions,
|
|
9
|
+
getLocalLibraryVersionData,
|
|
10
|
+
getLibraryBased,
|
|
11
|
+
addDebugLog,
|
|
12
|
+
checkLibraryAndArchives,
|
|
13
|
+
getConfigDefaults,
|
|
14
|
+
cleanUpTemp,
|
|
15
|
+
getPegaServerConfig,
|
|
16
|
+
getLibraryBasedCL,
|
|
17
|
+
getApplicationAndVersionFromToken } from '../../util.js';
|
|
5
18
|
|
|
6
19
|
import { listLibJSONResponse } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
7
20
|
|
|
8
|
-
import {
|
|
21
|
+
import { SOURCE_OF_COMPONENT_TYPES, getServerLibraries, getInfinityLibraries, getServerLocalQuestion } from './helper.js';
|
|
9
22
|
|
|
10
23
|
|
|
11
24
|
|
|
@@ -6,7 +6,19 @@ import fs from 'fs';
|
|
|
6
6
|
import validate from '../validator/index.js';
|
|
7
7
|
import bundleComponent from '../bundle/index.js';
|
|
8
8
|
import { lintComponent } from '../linter/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getComponentDirectoryPath,
|
|
11
|
+
getPegaServerConfig,
|
|
12
|
+
showVersion,
|
|
13
|
+
getLibraryBased,
|
|
14
|
+
addDebugLog,
|
|
15
|
+
updateServerConfigRuleSetAndVersion,
|
|
16
|
+
checkLibraryAndArchives,
|
|
17
|
+
getConfigDevBuild,
|
|
18
|
+
checkAccessTokenExpiration,
|
|
19
|
+
checkJWTExpiration,
|
|
20
|
+
getConfigDefaults,
|
|
21
|
+
getLibraryBasedCL } from '../../util.js';
|
|
10
22
|
|
|
11
23
|
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
12
24
|
import { default as buildLibrary } from '../build-lib/index.js';
|
|
@@ -5,7 +5,16 @@ import chalk from 'chalk';
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
6
|
import bundleComponent from '../bundle/index.js';
|
|
7
7
|
import { lintComponent } from '../linter/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
getComponents,
|
|
10
|
+
getComponentDirectoryPath,
|
|
11
|
+
checkAccessTokenExpiration,
|
|
12
|
+
showVersion,
|
|
13
|
+
getLibraryBased,
|
|
14
|
+
addDebugLog,
|
|
15
|
+
getPegaServerConfig,
|
|
16
|
+
updateServerConfigRuleSetAndVersion,
|
|
17
|
+
checkLibraryAndArchives } from '../../util.js';
|
|
9
18
|
|
|
10
19
|
import {
|
|
11
20
|
getPublishComponentQuestions,
|
|
@@ -4,8 +4,7 @@ import fetch from 'node-fetch';
|
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { zipUnArchiveToTempAndReturnBuffer, constructCompleteUrl, getHttpsAgent, getPegaServerConfig, addDebugLog, getConfigDefaults, zipVersionAndArchiveAndReturnBuffer } from '../../util.js';
|
|
7
|
+
import { zipUnArchiveToTempAndReturnBuffer, constructCompleteUrl, getHttpsAgent, getPegaServerConfig, addDebugLog, getConfigDefaults } from '../../util.js';
|
|
9
8
|
|
|
10
9
|
import { getPublishComponentQuestions } from './helper.js';
|
|
11
10
|
|
|
@@ -18,9 +17,9 @@ import {
|
|
|
18
17
|
} from '../../constants.js';
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
20
|
+
export const publishComponentLibraryArchiveToServer = async (data, zipContent, doFetch) => {
|
|
22
21
|
addDebugLog("publishComponentToServer", `data: ${data}`, "");
|
|
23
|
-
const {
|
|
22
|
+
const { rulesetName, rulesetVersion, libraryName, version } = data;
|
|
24
23
|
|
|
25
24
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
26
25
|
const { serverType, isolationId } = defaultPegaServerConfig;
|
|
@@ -30,35 +29,24 @@ export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
|
30
29
|
isolationId || 'undefined'
|
|
31
30
|
);
|
|
32
31
|
let apiBody;
|
|
32
|
+
let urlParams;
|
|
33
33
|
|
|
34
34
|
if (isLaunchpad) {
|
|
35
35
|
// currently no launchpad records to rule resolve a library
|
|
36
36
|
|
|
37
|
-
// apiBody = {
|
|
38
|
-
// type: 'CustomComponent',
|
|
39
|
-
// zipContent,
|
|
40
|
-
// componentName: JSON.parse(configContent).componentKey,
|
|
41
|
-
// pxUpdateDateTime: '',
|
|
42
|
-
// environmentID: defaultPegaServerConfig.isolationId
|
|
43
|
-
// };
|
|
44
37
|
} else {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
publishFor: 'constellation',
|
|
48
|
-
rulesetName,
|
|
49
|
-
rulesetVersion,
|
|
50
|
-
libraryName,
|
|
51
|
-
version,
|
|
52
|
-
category: ''
|
|
53
|
-
};
|
|
38
|
+
urlParams = `/library-name/${libraryName}/library-version/${version}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
|
|
39
|
+
|
|
54
40
|
}
|
|
55
41
|
|
|
56
42
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
57
|
-
|
|
43
|
+
let url = constructCompleteUrl(
|
|
58
44
|
defaultPegaConfig.server,
|
|
59
45
|
isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_LIBRARY_ARCHIVE_SERVICE_REST_ENDPOINT
|
|
60
46
|
);
|
|
61
47
|
|
|
48
|
+
url = url.concat(urlParams);
|
|
49
|
+
|
|
62
50
|
if (doFetch) {
|
|
63
51
|
try {
|
|
64
52
|
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
@@ -76,13 +64,15 @@ export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
|
76
64
|
headers['Content-Type'] = 'application/json';
|
|
77
65
|
} else {
|
|
78
66
|
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
67
|
+
headers['Content-Type'] = 'application/json';
|
|
79
68
|
}
|
|
80
69
|
|
|
70
|
+
|
|
81
71
|
const response = await fetch(url, {
|
|
82
72
|
method: 'POST',
|
|
83
73
|
agent: getHttpsAgent(defaultPegaConfig),
|
|
84
74
|
headers,
|
|
85
|
-
body: JSON.stringify(
|
|
75
|
+
body: JSON.stringify(zipContent)
|
|
86
76
|
});
|
|
87
77
|
|
|
88
78
|
status = response.status;
|
|
@@ -114,6 +104,7 @@ export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
|
114
104
|
}
|
|
115
105
|
} catch (err) {
|
|
116
106
|
if (status === 500) {
|
|
107
|
+
const respData = isLaunchpad ? await response.text() : await response.json();
|
|
117
108
|
throw new Error(
|
|
118
109
|
`Error occurred in authentication. Please regenerate using authenticate`
|
|
119
110
|
);
|
|
@@ -157,38 +148,24 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
157
148
|
|
|
158
149
|
if (orgLibName === configDef.currentOrgLib && selectedVersion === configDef.buildVersion) {
|
|
159
150
|
|
|
160
|
-
/*
|
|
161
|
-
console.log("\nYou've selected the current working library/version.");
|
|
162
|
-
console.log("Export store or the current.");
|
|
163
|
-
const archAnswers = await inquirer.prompt([
|
|
164
|
-
{
|
|
165
|
-
name: 'currentOrStore',
|
|
166
|
-
type: 'rawlist',
|
|
167
|
-
message: 'Select current or store',
|
|
168
|
-
default: "Current",
|
|
169
|
-
choices: ["Current", "Store"]
|
|
170
|
-
},
|
|
171
|
-
]);
|
|
172
|
-
|
|
173
|
-
const currentOrStore = archAnswers.currentOrStore;
|
|
174
|
-
|
|
175
|
-
if (currentOrStore === "Current") {
|
|
176
|
-
archiveBeforeStore = true;
|
|
177
|
-
}
|
|
178
|
-
*/
|
|
179
151
|
archiveBeforeStore = true;
|
|
180
152
|
|
|
181
153
|
if (archiveBeforeStore) {
|
|
182
154
|
|
|
183
|
-
|
|
184
|
-
|
|
155
|
+
const mainDirectory = process.cwd();
|
|
156
|
+
const archiveFileName = `${orgLibName}_${selectedVersion}.arch.zip`;
|
|
157
|
+
const archiveDirectory = join (mainDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
|
|
158
|
+
if (fs.existsSync(archiveDirectory)) {
|
|
159
|
+
const archiveFile = join(archiveDirectory, archiveFileName);
|
|
160
|
+
|
|
161
|
+
let zipContent = fs.readFileSync(archiveFile).toString("base64");
|
|
185
162
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
163
|
+
if (zipContent != null) {
|
|
164
|
+
|
|
165
|
+
zipContent = zipContent.replaceAll('"', "");
|
|
189
166
|
|
|
190
167
|
try {
|
|
191
|
-
publishComponentLibraryArchiveToServer(content, true )
|
|
168
|
+
publishComponentLibraryArchiveToServer(content, zipContent, true )
|
|
192
169
|
.then( () => {
|
|
193
170
|
console.log(chalk.green.bold(`Success: Published Archive ${content.libraryName}/${content.version} to server.`));
|
|
194
171
|
})
|
|
@@ -200,9 +177,10 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
200
177
|
console.log(chalk.bold.red(err.toString()));
|
|
201
178
|
}
|
|
202
179
|
|
|
203
|
-
}
|
|
204
180
|
|
|
205
|
-
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
}
|
|
206
184
|
|
|
207
185
|
return;
|
|
208
186
|
|
|
@@ -213,48 +191,38 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
213
191
|
// for now, to get a "buffer" from a zip file, need to unzip it in a /temp directory
|
|
214
192
|
// then re-zip. During the re-zip, create a buffer that can be passed to PegaInfinity
|
|
215
193
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const archiveDirectory = join (mainDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
|
|
219
|
-
if (fs.existsSync(archiveDirectory)) {
|
|
220
|
-
const archiveFile = join(archiveDirectory, archiveFileName);
|
|
221
|
-
|
|
222
|
-
// unzip to /temp, then re-zip and retrieve the buffer (remove /temp later)
|
|
223
|
-
let zipBuffer = await zipUnArchiveToTempAndReturnBuffer(orgLibName, selectedVersion);
|
|
224
|
-
|
|
225
|
-
zipBuffer.output.on('close', function() {
|
|
226
|
-
|
|
227
|
-
// get rid of temp directory, regardless
|
|
228
|
-
const tempDirectory = join (mainDirectory, TEMP_PATH);
|
|
229
|
-
if (fs.existsSync(tempDirectory)) {
|
|
230
|
-
fs.rmSync(tempDirectory, { recursive: true });
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (zipBuffer.zipContent != null) {
|
|
194
|
+
// unzip to /temp, then re-zip and retrieve the buffer (remove /temp later)
|
|
195
|
+
let zipBuffer = await zipUnArchiveToTempAndReturnBuffer(orgLibName, selectedVersion);
|
|
234
196
|
|
|
235
|
-
|
|
197
|
+
zipBuffer.output.on('close', function() {
|
|
236
198
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
.catch( (err) => {
|
|
243
|
-
console.log(chalk.red.bold(err));
|
|
244
|
-
})
|
|
245
|
-
}
|
|
246
|
-
catch (err) {
|
|
247
|
-
console.log(chalk.bold.red(err.toString()));
|
|
248
|
-
}
|
|
199
|
+
// get rid of temp directory, regardless
|
|
200
|
+
const tempDirectory = join (mainDirectory, TEMP_PATH);
|
|
201
|
+
if (fs.existsSync(tempDirectory)) {
|
|
202
|
+
fs.rmSync(tempDirectory, { recursive: true });
|
|
203
|
+
}
|
|
249
204
|
|
|
205
|
+
if (zipBuffer.zipContent != null) {
|
|
250
206
|
|
|
207
|
+
content = { ...content, zipContent: zipBuffer.zipContent};
|
|
251
208
|
|
|
209
|
+
try {
|
|
210
|
+
publishComponentLibraryArchiveToServer(content, true )
|
|
211
|
+
.then( () => {
|
|
212
|
+
console.log(chalk.green.bold(`Success: Published Archive ${content.libraryName}/${content.version} to server.`));
|
|
213
|
+
})
|
|
214
|
+
.catch( (err) => {
|
|
215
|
+
console.log(chalk.red.bold(err));
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
catch (err) {
|
|
219
|
+
console.log(chalk.bold.red(err.toString()));
|
|
252
220
|
}
|
|
253
221
|
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
}
|
|
222
|
+
}
|
|
257
223
|
|
|
224
|
+
});
|
|
258
225
|
|
|
259
226
|
}
|
|
227
|
+
|
|
260
228
|
};
|
|
@@ -12,7 +12,6 @@ import { lintComponent } from '../linter/index.js';
|
|
|
12
12
|
import { constructCompleteUrl, getComponentDirectoryPath, getHttpsAgent, getPegaServerConfig, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, getLibraryBasedCL, deletePublishExtras, addDebugLog, checkLibraryAndArchives, checkJWTExpiration, getConfigDefaults } from '../../util.js';
|
|
13
13
|
|
|
14
14
|
import { publishLib, listLibJSONResponse, deleteLibVersion } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
15
|
-
import { default as buildLibrary } from '../build-lib/index.js';
|
|
16
15
|
|
|
17
16
|
import { getLibraryVersionQuestion } from './helper.js';
|
|
18
17
|
|
|
@@ -99,7 +98,6 @@ addDebugLog("zipLibraryComponent", `libraryName: ${libraryName}, libraryVersion:
|
|
|
99
98
|
archive.file(localizationsJson, { name: path.basename(localizationsJson) });
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
|
|
103
101
|
await archive.finalize();
|
|
104
102
|
|
|
105
103
|
const zipBuffer = Buffer.concat(zipChunks);
|
|
@@ -140,13 +138,6 @@ addDebugLog("publishComponentToServer", `data: ${data}`, "");
|
|
|
140
138
|
if (isLaunchpad) {
|
|
141
139
|
// currently no launchpad records to rule resolve a library
|
|
142
140
|
|
|
143
|
-
// apiBody = {
|
|
144
|
-
// type: 'CustomComponent',
|
|
145
|
-
// zipContent,
|
|
146
|
-
// componentName: JSON.parse(configContent).componentKey,
|
|
147
|
-
// pxUpdateDateTime: '',
|
|
148
|
-
// environmentID: defaultPegaServerConfig.isolationId
|
|
149
|
-
// };
|
|
150
141
|
} else {
|
|
151
142
|
apiBody = {
|
|
152
143
|
configContent,
|
|
@@ -257,20 +248,12 @@ addDebugLog("publishComponentToServer", `data: ${data}`, "");
|
|
|
257
248
|
export const publishUILibraryComponentToInfinity = async (content) => {
|
|
258
249
|
addDebugLog("publishUILibraryComponentToInfinity", `content: ${content}`, "");
|
|
259
250
|
|
|
260
|
-
// const compDef = getConfigDefaults();
|
|
261
|
-
// const organization = compDef.organization;
|
|
262
|
-
// const library = compDef.library;
|
|
263
|
-
// const version = compDef.buildVersion;
|
|
264
|
-
// // const currentOrgLib = organization.concat('_').concat(library);
|
|
265
|
-
// const currentOrgLib = compDef.currentOrgLib;
|
|
266
|
-
|
|
267
251
|
console.log(chalk.green(`Publishing ${content.libraryName}/${content.version} to server...`));
|
|
268
252
|
|
|
269
253
|
const fromZip = await zipLibraryComponent(content.libraryName, content.version);
|
|
270
254
|
|
|
271
255
|
content = { ...fromZip, ...content };
|
|
272
256
|
|
|
273
|
-
// console.log(content);
|
|
274
257
|
try {
|
|
275
258
|
await publishComponentLibraryToServer(content, true );
|
|
276
259
|
// console.log(chalk.green.bold(`Success: Published ${content.libraryName}/${content.version} to server as a CL.`));
|
|
@@ -318,9 +301,6 @@ addDebugLog("publishLib", "services call", "");
|
|
|
318
301
|
await publishLib(libraryName, version, tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
|
|
319
302
|
addDebugLog("deleteLib", "services end", "");
|
|
320
303
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
304
|
}
|
|
325
305
|
|
|
326
306
|
|
|
@@ -375,7 +355,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
375
355
|
const orgLib = getConfigDefaults();
|
|
376
356
|
library = orgLib.library;
|
|
377
357
|
organization = orgLib.organization;
|
|
378
|
-
// libraryName = `${organization}_${library}`;
|
|
379
358
|
libraryName = orgLib.currentOrgLib;
|
|
380
359
|
|
|
381
360
|
version = orgLib.buildVersion;
|
|
@@ -394,8 +373,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
394
373
|
const compDef = getConfigDefaults();
|
|
395
374
|
organization = compDef.organization;
|
|
396
375
|
library = compDef.library;
|
|
397
|
-
|
|
398
|
-
// libraryName = `${organization}_${library}`;
|
|
399
376
|
libraryName = compDef.currentOrgLib;
|
|
400
377
|
|
|
401
378
|
try {
|
|
@@ -7,7 +7,15 @@ import inquirer from 'inquirer';
|
|
|
7
7
|
import ncp from 'ncp';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
checkPathAccess,
|
|
12
|
+
showVersion,
|
|
13
|
+
getComponentsObj,
|
|
14
|
+
getDirectoryFiles,
|
|
15
|
+
addDebugLog,
|
|
16
|
+
checkLibraryAndArchives,
|
|
17
|
+
getConfigDefaults,
|
|
18
|
+
getLibraryBased } from '../../util.js';
|
|
11
19
|
import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH } from '../../constants.js';
|
|
12
20
|
|
|
13
21
|
|
|
@@ -34,14 +34,25 @@ addDebugLog("restoreComponent", "", "+");
|
|
|
34
34
|
console.log(chalk.bold.yellow('\nChanges not saved to local storage will be LOST, code will be restored from local storage.'));
|
|
35
35
|
console.log("");
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
let restoreFromStore = {};
|
|
38
|
+
|
|
39
|
+
if (options.params.length === 4) {
|
|
40
|
+
const optConfirm = options.params[3];
|
|
41
|
+
restoreFromStore["confirmRestore"] = optConfirm === 'Y' || optConfirm === 'y' || optConfirm === true || optConfirm === 'true' ? true : false;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
restoreFromStore = await inquirer.prompt([
|
|
45
|
+
{
|
|
46
|
+
name: 'confirmRestore',
|
|
47
|
+
type: 'confirm',
|
|
48
|
+
message: `Restoring ${chalk.bold.green(`${confDef.displayLibVersion}`)} from local storage, proceed ?`,
|
|
49
|
+
default: true
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
45
56
|
|
|
46
57
|
if (restoreFromStore.confirmRestore) {
|
|
47
58
|
const switchToFileName = `${confDef.currentOrgLib}_${confDef.version}.arch.zip`;
|
|
@@ -50,7 +61,6 @@ addDebugLog("restoreComponent", "", "+");
|
|
|
50
61
|
{
|
|
51
62
|
title: `Restoring ${confDef.displayLibVersion}`,
|
|
52
63
|
task: async () => {
|
|
53
|
-
// await zipVersionAndArchive(confDef.currentOrgLib, confDef.buildVersion);
|
|
54
64
|
await restoreFromArchive(switchToFileName, confDef.currentOrgLib, confDef.version);
|
|
55
65
|
}
|
|
56
66
|
}
|
|
@@ -69,10 +79,6 @@ addDebugLog("restoreComponent", "", "+");
|
|
|
69
79
|
await showCurrentStatus();
|
|
70
80
|
}
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
82
|
addDebugLog("restoreComponent", "", "-");
|
|
77
83
|
|
|
78
84
|
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
1
|
import chalk from 'chalk';
|
|
5
|
-
|
|
6
2
|
import { showVersion, getLibraryBased, getLibraryBasedCL } from '../../util.js';
|
|
7
3
|
|
|
8
4
|
export const showCurrentStatus = async () => {
|
|
@@ -116,7 +112,7 @@ export const showHelpV2 = (isCL) => {
|
|
|
116
112
|
|
|
117
113
|
console.log(`\n${chalk.underline(`Notes`)}`);
|
|
118
114
|
console.log(`The following commands will store existing version in storage before executing the command:`);
|
|
119
|
-
console.log(`${chalk.cyan(`createLib, switchLib, createLibVersion, switchLibVersion, publishLibVersion, exportLibVersion`)}`);
|
|
115
|
+
console.log(`${chalk.cyan(`createLib, switchLib, createLibVersion, switchLibVersion, publishLibVersion, exportLibVersion, storeLibVersion`)}`);
|
|
120
116
|
console.log(`\nWhen editing in an IDE, always ${chalk.yellow("SAVE")} changes to components before doing a library/version context switch`);
|
|
121
117
|
console.log(`or changes will be lost!`);
|
|
122
118
|
console.log(`\nStoring is to LOCAL storage and is not backed up. You should export your library/versions archives to ${chalk.yellow("git")}`);
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
1
|
import chalk from 'chalk';
|
|
5
2
|
|
|
6
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
showVersion,
|
|
5
|
+
getLibraryBased,
|
|
6
|
+
getConfigDefaults,
|
|
7
|
+
getComponents,
|
|
8
|
+
checkLibraryAndArchives,
|
|
9
|
+
getPegaServerConfig,
|
|
10
|
+
getLibraryBasedCL } from '../../util.js';
|
|
7
11
|
|
|
8
12
|
export const showCurrentStatus = async () => {
|
|
9
13
|
|
|
10
14
|
const configDefaults = getConfigDefaults();
|
|
11
15
|
const componentList = await getComponents();
|
|
12
16
|
const isLibraryBasedCL = getLibraryBasedCL();
|
|
17
|
+
const pegaServer = await getPegaServerConfig();
|
|
13
18
|
|
|
14
19
|
console.log("");
|
|
15
20
|
console.log("\tCurrent status");
|
|
@@ -30,7 +35,15 @@ export const showCurrentStatus = async () => {
|
|
|
30
35
|
|
|
31
36
|
console.log("");
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
if (isLibraryBasedCL) {
|
|
39
|
+
|
|
40
|
+
console.log(`\tRuleSet:\t ${chalk.bold.green(`${pegaServer.rulesetName}`)}`);
|
|
41
|
+
console.log(`\tRuleSet Version: ${chalk.bold.green(`${pegaServer.rulesetVersion}`)}`);
|
|
42
|
+
console.log("");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
};
|
|
34
47
|
|
|
35
48
|
|
|
36
49
|
export default async options => {
|
|
@@ -46,4 +59,4 @@ export default async options => {
|
|
|
46
59
|
|
|
47
60
|
|
|
48
61
|
|
|
49
|
-
}
|
|
62
|
+
};
|
package/src/tasks/store/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { Listr } from 'listr2';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
|
-
|
|
7
7
|
showVersion,
|
|
8
8
|
addDebugLog,
|
|
9
9
|
checkLibraryAndArchives,
|
|
@@ -26,30 +26,51 @@ addDebugLog("storeComponents", "", "+");
|
|
|
26
26
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
|
|
27
27
|
process.exit();
|
|
28
28
|
}
|
|
29
|
+
const confDef = getConfigDefaults();
|
|
30
|
+
|
|
29
31
|
|
|
30
32
|
console.log(chalk.bold.yellow('\nBe sure to SAVE all changes before storing, or changes will NOT be stored.'));
|
|
31
33
|
|
|
34
|
+
let answers = {};
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
if (options.params.length === 4) {
|
|
37
|
+
const optConfirm = options.params[3];
|
|
38
|
+
answers["confirmStore"] = optConfirm === 'Y' || optConfirm === 'y' || optConfirm === true || optConfirm === 'true' ? true : false;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
|
|
42
|
+
answers = await inquirer.prompt([
|
|
37
43
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
name: 'confirmStore',
|
|
45
|
+
type: 'confirm',
|
|
46
|
+
message: `Storing ${chalk.green(`${confDef.currentOrgLib}/${confDef.buildVersion}`)} to local storage, proceed ?`,
|
|
47
|
+
default: true
|
|
42
48
|
}
|
|
43
|
-
]
|
|
44
|
-
|
|
45
|
-
);
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
console.log(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
if (answers.confirmStore) {
|
|
53
|
+
console.log("");
|
|
54
|
+
|
|
55
|
+
const tasks = new Listr(
|
|
56
|
+
[
|
|
57
|
+
{
|
|
58
|
+
title: `Store ${confDef.displayLibVersion}`,
|
|
59
|
+
task: async () => {
|
|
60
|
+
await zipVersionAndArchive(confDef.currentOrgLib, confDef.buildVersion);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
{ concurrent: false, exitOnError: true }
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
await tasks.run().catch(err => {
|
|
68
|
+
console.log(chalk.bold.red(err.toString()));
|
|
69
|
+
addDebugLog("storeComponents", "", "-");
|
|
70
|
+
process.exit(1);
|
|
71
|
+
});
|
|
72
|
+
console.log(chalk.greenBright('\nComponents Stored'));
|
|
73
|
+
}
|
|
53
74
|
|
|
54
75
|
addDebugLog("storeComponents", "", "-");
|
|
55
76
|
|