@sap-ux/deploy-tooling 0.14.46 → 0.15.1
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/dist/base/config.js +5 -3
- package/dist/base/deploy.js +162 -196
- package/dist/base/prompt.js +13 -24
- package/dist/base/validate.js +165 -191
- package/dist/cli/archive.js +23 -37
- package/dist/cli/config.js +47 -60
- package/dist/cli/index.js +39 -54
- package/dist/ui5/archive.js +14 -25
- package/dist/ui5/index.js +14 -26
- package/package.json +8 -8
package/dist/base/config.js
CHANGED
|
@@ -10,9 +10,11 @@ const system_access_1 = require("@sap-ux/system-access");
|
|
|
10
10
|
* @returns config object that can be logged
|
|
11
11
|
*/
|
|
12
12
|
function getConfigForLogging(config) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (config.credentials?.password) {
|
|
14
|
+
return {
|
|
15
|
+
...config,
|
|
16
|
+
credentials: 'hidden'
|
|
17
|
+
};
|
|
16
18
|
}
|
|
17
19
|
else {
|
|
18
20
|
return config;
|
package/dist/base/deploy.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.undeploy = exports.deploy = exports.createTransportRequest = void 0;
|
|
13
4
|
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
@@ -27,22 +18,20 @@ const validate_1 = require("./validate");
|
|
|
27
18
|
* @param logger - reference to the logger instance
|
|
28
19
|
* @param archive - archive file that is to be deployed
|
|
29
20
|
*/
|
|
30
|
-
function handleError(command, error, provider, config, logger, archive) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
logger.error(`${command === tryDeploy ? 'Deployment' : 'Undeployment'} has failed.`);
|
|
40
|
-
logger.debug((0, config_1.getConfigForLogging)(config));
|
|
41
|
-
if (!config.verbose) {
|
|
42
|
-
logger.error('Change logging level to debug your issue\n\t(see examples https://github.com/SAP/open-ux-tools/tree/main/packages/deploy-tooling#configuration-with-logging-enabled)');
|
|
21
|
+
async function handleError(command, error, provider, config, logger, archive) {
|
|
22
|
+
const retry = config.retry === undefined ? true : config.retry;
|
|
23
|
+
if (retry && (0, axios_extension_1.isAxiosError)(error)) {
|
|
24
|
+
const success = await axiosErrorRetryHandler(command, error.response, provider, config, logger, archive);
|
|
25
|
+
if (success) {
|
|
26
|
+
return;
|
|
43
27
|
}
|
|
44
|
-
|
|
45
|
-
});
|
|
28
|
+
}
|
|
29
|
+
logger.error(`${command === tryDeploy ? 'Deployment' : 'Undeployment'} has failed.`);
|
|
30
|
+
logger.debug((0, config_1.getConfigForLogging)(config));
|
|
31
|
+
if (!config.verbose) {
|
|
32
|
+
logger.error('Change logging level to debug your issue\n\t(see examples https://github.com/SAP/open-ux-tools/tree/main/packages/deploy-tooling#configuration-with-logging-enabled)');
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
46
35
|
}
|
|
47
36
|
/**
|
|
48
37
|
* Handler for 412 error code.
|
|
@@ -54,17 +43,15 @@ function handleError(command, error, provider, config, logger, archive) {
|
|
|
54
43
|
* @param archive - archive file that is to be deployed
|
|
55
44
|
* @returns true if the error was handled otherwise false is returned
|
|
56
45
|
*/
|
|
57
|
-
function handle412Error(command, provider, config, logger, archive) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
});
|
|
46
|
+
async function handle412Error(command, provider, config, logger, archive) {
|
|
47
|
+
logger.warn('An app in the same repository with different sap app id found.');
|
|
48
|
+
if (config.yes || (await (0, prompt_1.promptConfirmation)('Do you want to overwrite (Y/n)?'))) {
|
|
49
|
+
await command(provider, { ...config, safe: false, retry: false }, logger, archive);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
68
55
|
}
|
|
69
56
|
/**
|
|
70
57
|
* Handler for 401 error code.
|
|
@@ -76,30 +63,27 @@ function handle412Error(command, provider, config, logger, archive) {
|
|
|
76
63
|
* @param archive - archive file that is to be deployed
|
|
77
64
|
* @returns true if the error was handled otherwise false is returned
|
|
78
65
|
*/
|
|
79
|
-
function handle401Error(command, provider, config, logger, archive) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
logger.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
config.target.serviceKey.uaa.username = credentials.username;
|
|
90
|
-
config.target.serviceKey.uaa.password = credentials.password;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
config.credentials = credentials;
|
|
94
|
-
}
|
|
95
|
-
// Need to re-init the provider with the updated credentials
|
|
96
|
-
provider = yield createProvider(config, logger);
|
|
97
|
-
yield command(provider, config, logger, archive);
|
|
98
|
-
return true;
|
|
66
|
+
async function handle401Error(command, provider, config, logger, archive) {
|
|
67
|
+
logger.warn(`${command === tryDeploy ? 'Deployment' : 'Undeployment'} failed with authentication error.`);
|
|
68
|
+
if (await (0, validate_1.checkForCredentials)(config.target.destination, logger)) {
|
|
69
|
+
logger.info('Please maintain correct credentials to avoid seeing this error\n\t(see help: https://www.npmjs.com/package/@sap/ux-ui5-tooling#setting-environment-variables-in-a-env-file)');
|
|
70
|
+
logger.info('Please enter your credentials.');
|
|
71
|
+
const credentials = await (0, system_access_1.getCredentialsWithPrompts)(provider.defaults?.auth?.username);
|
|
72
|
+
if (Object.keys(credentials).length) {
|
|
73
|
+
if (config.target.serviceKey) {
|
|
74
|
+
config.target.serviceKey.uaa.username = credentials.username;
|
|
75
|
+
config.target.serviceKey.uaa.password = credentials.password;
|
|
99
76
|
}
|
|
77
|
+
else {
|
|
78
|
+
config.credentials = credentials;
|
|
79
|
+
}
|
|
80
|
+
// Need to re-init the provider with the updated credentials
|
|
81
|
+
provider = await createProvider(config, logger);
|
|
82
|
+
await command(provider, config, logger, archive);
|
|
83
|
+
return true;
|
|
100
84
|
}
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
103
87
|
}
|
|
104
88
|
/**
|
|
105
89
|
* Main function for different deploy retry handling.
|
|
@@ -112,17 +96,15 @@ function handle401Error(command, provider, config, logger, archive) {
|
|
|
112
96
|
* @param archive - archive file that is to be deployed
|
|
113
97
|
* @returns true if the error was handled otherwise false is return or an error is raised
|
|
114
98
|
*/
|
|
115
|
-
function axiosErrorRetryHandler(command, response, provider, config, logger, archive) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
});
|
|
99
|
+
async function axiosErrorRetryHandler(command, response, provider, config, logger, archive) {
|
|
100
|
+
switch (response?.status) {
|
|
101
|
+
case 401:
|
|
102
|
+
return handle401Error(command, provider, config, logger, archive);
|
|
103
|
+
case 412:
|
|
104
|
+
return handle412Error(command, provider, config, logger, archive);
|
|
105
|
+
default:
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
126
108
|
}
|
|
127
109
|
/**
|
|
128
110
|
* Generate a service instance for deployment from the supplied deployment config.
|
|
@@ -133,8 +115,7 @@ function axiosErrorRetryHandler(command, response, provider, config, logger, arc
|
|
|
133
115
|
* @returns service returns the UI5 ABAP Repository service
|
|
134
116
|
*/
|
|
135
117
|
function getDeployService(factoryFn, config, logger) {
|
|
136
|
-
|
|
137
|
-
const service = factoryFn((_a = config.target) === null || _a === void 0 ? void 0 : _a.service);
|
|
118
|
+
const service = factoryFn(config.target?.service);
|
|
138
119
|
service.log = logger;
|
|
139
120
|
if (!config.strictSsl) {
|
|
140
121
|
logger.warn('You chose not to validate SSL certificate. Please verify the server certificate is trustful before proceeding. See documentation for recommended configuration (https://help.sap.com/viewer/17d50220bcd848aa854c9c182d65b699/Latest/en-US/4b318bede7eb4021a8be385c46c74045.html).');
|
|
@@ -150,26 +131,23 @@ function getDeployService(factoryFn, config, logger) {
|
|
|
150
131
|
* @throws error if transport request creation fails
|
|
151
132
|
* @returns transportRequest
|
|
152
133
|
*/
|
|
153
|
-
function createTransportRequest(config, logger, provider) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
ui5AppName,
|
|
165
|
-
description: description.length > 60 ? description.slice(0, 57) + '...' : description
|
|
166
|
-
}));
|
|
167
|
-
if (transportRequest) {
|
|
168
|
-
logger.info(`Transport request ${transportRequest} created for application ${ui5AppName}.`);
|
|
169
|
-
return transportRequest;
|
|
170
|
-
}
|
|
171
|
-
throw new Error(`Transport request could not be created for application ${ui5AppName}.`);
|
|
134
|
+
async function createTransportRequest(config, logger, provider) {
|
|
135
|
+
if (!provider) {
|
|
136
|
+
provider = await createProvider(config, logger);
|
|
137
|
+
}
|
|
138
|
+
const adtService = await provider.getAdtService(axios_extension_1.TransportRequestService);
|
|
139
|
+
const ui5AppName = (0, config_1.isBspConfig)(config.app) ? config.app.name : '';
|
|
140
|
+
const description = `For ABAP repository ${ui5AppName}, created by SAP Open UX Tools`;
|
|
141
|
+
const transportRequest = await adtService?.createTransportRequest({
|
|
142
|
+
packageName: config.app.package ?? '',
|
|
143
|
+
ui5AppName,
|
|
144
|
+
description: description.length > 60 ? description.slice(0, 57) + '...' : description
|
|
172
145
|
});
|
|
146
|
+
if (transportRequest) {
|
|
147
|
+
logger.info(`Transport request ${transportRequest} created for application ${ui5AppName}.`);
|
|
148
|
+
return transportRequest;
|
|
149
|
+
}
|
|
150
|
+
throw new Error(`Transport request could not be created for application ${ui5AppName}.`);
|
|
173
151
|
}
|
|
174
152
|
exports.createTransportRequest = createTransportRequest;
|
|
175
153
|
/**
|
|
@@ -179,13 +157,11 @@ exports.createTransportRequest = createTransportRequest;
|
|
|
179
157
|
* @param logger - reference to the logger instance
|
|
180
158
|
* @returns an instance of an ABAP service provider
|
|
181
159
|
*/
|
|
182
|
-
function createProvider(config, logger) {
|
|
183
|
-
return
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}, !!config.target.scp, logger);
|
|
188
|
-
});
|
|
160
|
+
async function createProvider(config, logger) {
|
|
161
|
+
return await (0, system_access_1.createAbapServiceProvider)(config.target, {
|
|
162
|
+
auth: config.credentials,
|
|
163
|
+
ignoreCertErrors: !config.strictSsl
|
|
164
|
+
}, !!config.target.scp, logger);
|
|
189
165
|
}
|
|
190
166
|
/**
|
|
191
167
|
* Check if the archive is an adapation project and if yes, try to deploy it to the layered repository.
|
|
@@ -195,29 +171,27 @@ function createProvider(config, logger) {
|
|
|
195
171
|
* @param logger - reference to the logger instance
|
|
196
172
|
* @param archive - archive file that is to be deployed
|
|
197
173
|
*/
|
|
198
|
-
function tryDeployToLrep(provider, config, logger, archive) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
throw new Error('Deployment in test mode not supported for deployments to the layered repository.');
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
logger.debug('Deploying an adaptation project to LREP');
|
|
208
|
-
const service = getDeployService(provider.getLayeredRepository.bind(provider), config, logger);
|
|
209
|
-
yield service.deploy(archive, {
|
|
210
|
-
namespace: descriptor.namespace,
|
|
211
|
-
layer: descriptor.layer,
|
|
212
|
-
package: config.app.package,
|
|
213
|
-
transport: config.app.transport
|
|
214
|
-
});
|
|
215
|
-
}
|
|
174
|
+
async function tryDeployToLrep(provider, config, logger, archive) {
|
|
175
|
+
logger.debug('No BSP name provided, checking if it is an adaptation project');
|
|
176
|
+
const descriptor = (0, archive_1.getAppDescriptorVariant)(archive);
|
|
177
|
+
if (descriptor) {
|
|
178
|
+
if (config.test) {
|
|
179
|
+
throw new Error('Deployment in test mode not supported for deployments to the layered repository.');
|
|
216
180
|
}
|
|
217
181
|
else {
|
|
218
|
-
|
|
182
|
+
logger.debug('Deploying an adaptation project to LREP');
|
|
183
|
+
const service = getDeployService(provider.getLayeredRepository.bind(provider), config, logger);
|
|
184
|
+
await service.deploy(archive, {
|
|
185
|
+
namespace: descriptor.namespace,
|
|
186
|
+
layer: descriptor.layer,
|
|
187
|
+
package: config.app.package,
|
|
188
|
+
transport: config.app.transport
|
|
189
|
+
});
|
|
219
190
|
}
|
|
220
|
-
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
(0, config_1.throwConfigMissingError)('app-name');
|
|
194
|
+
}
|
|
221
195
|
}
|
|
222
196
|
/**
|
|
223
197
|
* Try executing the deployment command and handle known errors.
|
|
@@ -227,45 +201,43 @@ function tryDeployToLrep(provider, config, logger, archive) {
|
|
|
227
201
|
* @param logger - reference to the logger instance
|
|
228
202
|
* @param archive - archive file that is to be deployed
|
|
229
203
|
*/
|
|
230
|
-
function tryDeploy(provider, config, logger, archive) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if ((0, config_1.isBspConfig)(config.app)) {
|
|
240
|
-
if (config.test === true) {
|
|
241
|
-
const validateOutput = yield (0, validate_1.validateBeforeDeploy)(config, provider, logger);
|
|
242
|
-
logger.info(`Results of validating the deployment configuration settings:${(0, validate_1.formatSummary)(validateOutput.summary)}`);
|
|
243
|
-
}
|
|
244
|
-
const service = getDeployService(provider.getUi5AbapRepository.bind(provider), config, logger);
|
|
245
|
-
yield service.deploy({
|
|
246
|
-
archive,
|
|
247
|
-
bsp: config.app,
|
|
248
|
-
testMode: config.test,
|
|
249
|
-
safeMode: config.safe
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
yield tryDeployToLrep(provider, config, logger, archive);
|
|
254
|
-
}
|
|
204
|
+
async function tryDeploy(provider, config, logger, archive) {
|
|
205
|
+
try {
|
|
206
|
+
if (config.createTransport) {
|
|
207
|
+
config.app.transport = await createTransportRequest(config, logger, provider);
|
|
208
|
+
// Reset as we don't want other flows kicking it off again!
|
|
209
|
+
config.createTransport = false;
|
|
210
|
+
}
|
|
211
|
+
// check if deployment of BSP is requested
|
|
212
|
+
if ((0, config_1.isBspConfig)(config.app)) {
|
|
255
213
|
if (config.test === true) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
else {
|
|
259
|
-
logger.info('Deployment Successful.');
|
|
260
|
-
if (yield (0, validate_1.showAdditionalInfoForOnPrem)(`${config.target.destination}`)) {
|
|
261
|
-
logger.info('(Note: As the destination is configured using an On-Premise SAP Cloud Connector, you will need to replace the host in the URL above with the internal host)');
|
|
262
|
-
}
|
|
214
|
+
const validateOutput = await (0, validate_1.validateBeforeDeploy)(config, provider, logger);
|
|
215
|
+
logger.info(`Results of validating the deployment configuration settings:${(0, validate_1.formatSummary)(validateOutput.summary)}`);
|
|
263
216
|
}
|
|
217
|
+
const service = getDeployService(provider.getUi5AbapRepository.bind(provider), config, logger);
|
|
218
|
+
await service.deploy({
|
|
219
|
+
archive,
|
|
220
|
+
bsp: config.app,
|
|
221
|
+
testMode: config.test,
|
|
222
|
+
safeMode: config.safe
|
|
223
|
+
});
|
|
264
224
|
}
|
|
265
|
-
|
|
266
|
-
|
|
225
|
+
else {
|
|
226
|
+
await tryDeployToLrep(provider, config, logger, archive);
|
|
267
227
|
}
|
|
268
|
-
|
|
228
|
+
if (config.test === true) {
|
|
229
|
+
logger.info('Deployment in TestMode completed. A successful TestMode execution does not necessarily mean that your upload will be successful.');
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
logger.info('Deployment Successful.');
|
|
233
|
+
if (await (0, validate_1.showAdditionalInfoForOnPrem)(`${config.target.destination}`)) {
|
|
234
|
+
logger.info('(Note: As the destination is configured using an On-Premise SAP Cloud Connector, you will need to replace the host in the URL above with the internal host)');
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
await handleError(tryDeploy, error, provider, config, logger, archive);
|
|
240
|
+
}
|
|
269
241
|
}
|
|
270
242
|
/**
|
|
271
243
|
* Deploy the given archive to the given target using the given app description.
|
|
@@ -274,15 +246,13 @@ function tryDeploy(provider, config, logger, archive) {
|
|
|
274
246
|
* @param config - deployment configuration
|
|
275
247
|
* @param logger - reference to the logger instance
|
|
276
248
|
*/
|
|
277
|
-
function deploy(archive, config, logger) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
yield tryDeploy(provider, config, logger, archive);
|
|
285
|
-
});
|
|
249
|
+
async function deploy(archive, config, logger) {
|
|
250
|
+
if (config.keep) {
|
|
251
|
+
(0, fs_1.writeFileSync)(`archive.zip`, archive);
|
|
252
|
+
}
|
|
253
|
+
const provider = await createProvider(config, logger);
|
|
254
|
+
logger.info(`Starting to deploy${config.test === true ? ' in test mode' : ''}.`);
|
|
255
|
+
await tryDeploy(provider, config, logger, archive);
|
|
286
256
|
}
|
|
287
257
|
exports.deploy = deploy;
|
|
288
258
|
/**
|
|
@@ -292,38 +262,36 @@ exports.deploy = deploy;
|
|
|
292
262
|
* @param config - deployment configuration
|
|
293
263
|
* @param logger - reference to the logger instance
|
|
294
264
|
*/
|
|
295
|
-
function tryUndeploy(provider, config, logger) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
config.createTransport = false;
|
|
301
|
-
}
|
|
302
|
-
if (config.lrep) {
|
|
303
|
-
const service = getDeployService(provider.getLayeredRepository.bind(provider), config, logger);
|
|
304
|
-
yield service.undeploy({
|
|
305
|
-
namespace: config.lrep,
|
|
306
|
-
transport: config.app.transport
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
else if ((0, config_1.isBspConfig)(config.app)) {
|
|
310
|
-
const service = getDeployService(provider.getUi5AbapRepository.bind(provider), config, logger);
|
|
311
|
-
yield service.undeploy({ bsp: config.app, testMode: config.test });
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
(0, config_1.throwConfigMissingError)('app-name');
|
|
315
|
-
}
|
|
316
|
-
if (config.test === true) {
|
|
317
|
-
logger.info('Undeployment in TestMode completed. A successful TestMode execution does not necessarily mean that your undeploy will be successful.');
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
logger.info('Undeployment Successful.');
|
|
321
|
-
}
|
|
265
|
+
async function tryUndeploy(provider, config, logger) {
|
|
266
|
+
try {
|
|
267
|
+
if (config.createTransport) {
|
|
268
|
+
config.app.transport = await createTransportRequest(config, logger, provider);
|
|
269
|
+
config.createTransport = false;
|
|
322
270
|
}
|
|
323
|
-
|
|
324
|
-
|
|
271
|
+
if (config.lrep) {
|
|
272
|
+
const service = getDeployService(provider.getLayeredRepository.bind(provider), config, logger);
|
|
273
|
+
await service.undeploy({
|
|
274
|
+
namespace: config.lrep,
|
|
275
|
+
transport: config.app.transport
|
|
276
|
+
});
|
|
325
277
|
}
|
|
326
|
-
|
|
278
|
+
else if ((0, config_1.isBspConfig)(config.app)) {
|
|
279
|
+
const service = getDeployService(provider.getUi5AbapRepository.bind(provider), config, logger);
|
|
280
|
+
await service.undeploy({ bsp: config.app, testMode: config.test });
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
(0, config_1.throwConfigMissingError)('app-name');
|
|
284
|
+
}
|
|
285
|
+
if (config.test === true) {
|
|
286
|
+
logger.info('Undeployment in TestMode completed. A successful TestMode execution does not necessarily mean that your undeploy will be successful.');
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
logger.info('Undeployment Successful.');
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
await handleError(tryUndeploy, error, provider, config, logger, Buffer.from(''));
|
|
294
|
+
}
|
|
327
295
|
}
|
|
328
296
|
/**
|
|
329
297
|
* Undeploy the given project from the given target using the given app name.
|
|
@@ -331,12 +299,10 @@ function tryUndeploy(provider, config, logger) {
|
|
|
331
299
|
* @param config - deployment configuration
|
|
332
300
|
* @param logger - reference to the logger instance
|
|
333
301
|
*/
|
|
334
|
-
function undeploy(config, logger) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
yield tryUndeploy(provider, config, logger);
|
|
339
|
-
});
|
|
302
|
+
async function undeploy(config, logger) {
|
|
303
|
+
const provider = await createProvider(config, logger);
|
|
304
|
+
logger.info(`Starting to undeploy ${config.test === true ? ' in test mode' : ''}.`);
|
|
305
|
+
await tryUndeploy(provider, config, logger);
|
|
340
306
|
}
|
|
341
307
|
exports.undeploy = undeploy;
|
|
342
308
|
//# sourceMappingURL=deploy.js.map
|
package/dist/base/prompt.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -20,22 +11,20 @@ const prompts_1 = __importDefault(require("prompts"));
|
|
|
20
11
|
* @param message - the message to be shown for confirmation.
|
|
21
12
|
* @returns true if confirmed, otherwise false
|
|
22
13
|
*/
|
|
23
|
-
function promptConfirmation(message) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return confirm && !abort;
|
|
14
|
+
async function promptConfirmation(message) {
|
|
15
|
+
let abort = false;
|
|
16
|
+
const { confirm } = await (0, prompts_1.default)({
|
|
17
|
+
type: 'confirm',
|
|
18
|
+
name: 'confirm',
|
|
19
|
+
initial: true,
|
|
20
|
+
message
|
|
21
|
+
}, {
|
|
22
|
+
onCancel() {
|
|
23
|
+
abort = true;
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
38
26
|
});
|
|
27
|
+
return confirm && !abort;
|
|
39
28
|
}
|
|
40
29
|
exports.promptConfirmation = promptConfirmation;
|
|
41
30
|
//# sourceMappingURL=prompt.js.map
|