@sap-ux/deploy-tooling 0.14.47 → 0.15.2
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/cli/config.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.mergeConfig = exports.getDeploymentConfig = exports.getVersion = void 0;
|
|
13
4
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
@@ -35,17 +26,14 @@ exports.getVersion = getVersion;
|
|
|
35
26
|
* @param path - path to the ui5*.yaml file
|
|
36
27
|
* @returns the configuration object or throws an error if it cannot be read.
|
|
37
28
|
*/
|
|
38
|
-
function getDeploymentConfig(path) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return config;
|
|
48
|
-
});
|
|
29
|
+
async function getDeploymentConfig(path) {
|
|
30
|
+
const content = (0, fs_1.readFileSync)(path, 'utf-8');
|
|
31
|
+
const ui5Config = await ui5_config_1.UI5Config.newInstance(content);
|
|
32
|
+
const config = ui5Config.findCustomTask(types_1.NAME)?.configuration;
|
|
33
|
+
if (!config) {
|
|
34
|
+
throw new Error('The deployment configuration is missing.');
|
|
35
|
+
}
|
|
36
|
+
return config;
|
|
49
37
|
}
|
|
50
38
|
exports.getDeploymentConfig = getDeploymentConfig;
|
|
51
39
|
/**
|
|
@@ -77,7 +65,7 @@ function getServiceFromEnv(targetUrl) {
|
|
|
77
65
|
username: process.env.SERVICE_USERNAME,
|
|
78
66
|
password: process.env.SERVICE_PASSWORD
|
|
79
67
|
},
|
|
80
|
-
url: targetUrl
|
|
68
|
+
url: targetUrl ?? process.env.SERVICE_URL,
|
|
81
69
|
systemid: process.env.SERVICE_SYSTEM_ID
|
|
82
70
|
};
|
|
83
71
|
}
|
|
@@ -133,17 +121,16 @@ function getServiceKey(options, targetUrl) {
|
|
|
133
121
|
* @returns merged target object
|
|
134
122
|
*/
|
|
135
123
|
function mergeTarget(baseTarget, options) {
|
|
136
|
-
|
|
137
|
-
const targetUrl = (_a = options.url) !== null && _a !== void 0 ? _a : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.url;
|
|
124
|
+
const targetUrl = options.url ?? baseTarget?.url;
|
|
138
125
|
return {
|
|
139
126
|
url: targetUrl,
|
|
140
|
-
client:
|
|
141
|
-
scp: options.cloud !== undefined ? options.cloud : baseTarget
|
|
142
|
-
authenticationType:
|
|
143
|
-
destination:
|
|
127
|
+
client: options.client ?? baseTarget?.client,
|
|
128
|
+
scp: options.cloud !== undefined ? options.cloud : baseTarget?.cloud,
|
|
129
|
+
authenticationType: options.authenticationType ?? baseTarget?.authenticationType,
|
|
130
|
+
destination: options.destination ?? baseTarget?.destination,
|
|
144
131
|
serviceKey: getServiceKey(options, targetUrl),
|
|
145
132
|
params: options.queryParams ? parseQueryParams(options.queryParams) : undefined,
|
|
146
|
-
service:
|
|
133
|
+
service: options.service ?? baseTarget?.service
|
|
147
134
|
};
|
|
148
135
|
}
|
|
149
136
|
/**
|
|
@@ -154,10 +141,13 @@ function mergeTarget(baseTarget, options) {
|
|
|
154
141
|
* @returns merged credentials
|
|
155
142
|
*/
|
|
156
143
|
function mergeCredentials(taskConfig, options) {
|
|
157
|
-
var _a, _b;
|
|
158
144
|
let credentials = taskConfig.credentials;
|
|
159
145
|
if (options.username || options.password) {
|
|
160
|
-
credentials =
|
|
146
|
+
credentials = {
|
|
147
|
+
...(credentials ?? {}),
|
|
148
|
+
username: options.username ?? '',
|
|
149
|
+
password: options.password ?? ''
|
|
150
|
+
};
|
|
161
151
|
}
|
|
162
152
|
return credentials;
|
|
163
153
|
}
|
|
@@ -168,36 +158,33 @@ function mergeCredentials(taskConfig, options) {
|
|
|
168
158
|
* @param options - CLI options
|
|
169
159
|
* @returns the merged config
|
|
170
160
|
*/
|
|
171
|
-
function mergeConfig(taskConfig, options) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
return config;
|
|
200
|
-
});
|
|
161
|
+
async function mergeConfig(taskConfig, options) {
|
|
162
|
+
const app = {
|
|
163
|
+
name: options.name ?? taskConfig.app?.name,
|
|
164
|
+
description: options.description ?? taskConfig.app?.description,
|
|
165
|
+
package: options.package ?? taskConfig.app?.package,
|
|
166
|
+
transport: options.transport ?? taskConfig.app?.transport
|
|
167
|
+
};
|
|
168
|
+
const target = mergeTarget(taskConfig.target, options);
|
|
169
|
+
const config = { app, target, credentials: mergeCredentials(taskConfig, options) };
|
|
170
|
+
config.test = mergeFlag(options.test, taskConfig.test);
|
|
171
|
+
config.safe = mergeFlag(options.safe, taskConfig.safe);
|
|
172
|
+
config.keep = mergeFlag(options.keep, taskConfig.keep);
|
|
173
|
+
config.strictSsl = mergeFlag(options.strictSsl, taskConfig.strictSsl);
|
|
174
|
+
config.yes = mergeFlag(options.yes, taskConfig.yes);
|
|
175
|
+
config.createTransport = mergeFlag(options.createTransport, taskConfig.createTransport);
|
|
176
|
+
config.retry = process.env.NO_RETRY ? !process.env.NO_RETRY : mergeFlag(options.retry, taskConfig.retry);
|
|
177
|
+
config.lrep = options.lrep;
|
|
178
|
+
if (!options.archiveUrl && !options.archivePath && !options.archiveFolder) {
|
|
179
|
+
options.archiveFolder = 'dist';
|
|
180
|
+
}
|
|
181
|
+
if (options.config && options.archiveFolder && !(0, path_1.isAbsolute)(options.archiveFolder)) {
|
|
182
|
+
options.archiveFolder = (0, path_1.join)((0, path_1.dirname)(options.config), options.archiveFolder);
|
|
183
|
+
}
|
|
184
|
+
if (options.config && options.archivePath && !(0, path_1.isAbsolute)(options.archivePath)) {
|
|
185
|
+
options.archivePath = (0, path_1.join)((0, path_1.dirname)(options.config), options.archivePath);
|
|
186
|
+
}
|
|
187
|
+
return config;
|
|
201
188
|
}
|
|
202
189
|
exports.mergeConfig = mergeConfig;
|
|
203
190
|
//# sourceMappingURL=config.js.map
|
package/dist/cli/index.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.runUndeploy = exports.runDeploy = exports.createCommand = void 0;
|
|
13
4
|
const commander_1 = require("commander");
|
|
@@ -86,61 +77,55 @@ exports.createCommand = createCommand;
|
|
|
86
77
|
* @param cmd - CLI command configuration to be executed
|
|
87
78
|
* @returns a set of objects required for the command execution
|
|
88
79
|
*/
|
|
89
|
-
function prepareRun(cmd) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
logPrefix: types_1.NAME
|
|
101
|
-
});
|
|
102
|
-
// Handle empty config when not passed in
|
|
103
|
-
const taskConfig = options.config ? yield (0, config_1.getDeploymentConfig)(options.config) : {};
|
|
104
|
-
const config = yield (0, config_1.mergeConfig)(taskConfig, options);
|
|
105
|
-
if (logLevel >= logger_1.LogLevel.Debug) {
|
|
106
|
-
logger.debug((0, base_1.getConfigForLogging)(config));
|
|
107
|
-
}
|
|
108
|
-
(0, base_1.validateConfig)(config);
|
|
109
|
-
(0, ui5_config_1.replaceEnvVariables)(config);
|
|
110
|
-
return { cmd, logger, config, options };
|
|
80
|
+
async function prepareRun(cmd) {
|
|
81
|
+
if (process.argv.length < 3) {
|
|
82
|
+
cmd.help();
|
|
83
|
+
}
|
|
84
|
+
(0, dotenv_1.config)();
|
|
85
|
+
const options = cmd.parse().opts();
|
|
86
|
+
const logLevel = options.verbose ? logger_1.LogLevel.Silly : logger_1.LogLevel.Info;
|
|
87
|
+
const logger = new logger_1.ToolsLogger({
|
|
88
|
+
transports: [new logger_1.ConsoleTransport()],
|
|
89
|
+
logLevel,
|
|
90
|
+
logPrefix: types_1.NAME
|
|
111
91
|
});
|
|
92
|
+
// Handle empty config when not passed in
|
|
93
|
+
const taskConfig = options.config ? await (0, config_1.getDeploymentConfig)(options.config) : {};
|
|
94
|
+
const config = await (0, config_1.mergeConfig)(taskConfig, options);
|
|
95
|
+
if (logLevel >= logger_1.LogLevel.Debug) {
|
|
96
|
+
logger.debug((0, base_1.getConfigForLogging)(config));
|
|
97
|
+
}
|
|
98
|
+
(0, base_1.validateConfig)(config);
|
|
99
|
+
(0, ui5_config_1.replaceEnvVariables)(config);
|
|
100
|
+
return { cmd, logger, config, options };
|
|
112
101
|
}
|
|
113
102
|
/**
|
|
114
103
|
* Function that is to be executed when the exposed deploy command is executed.
|
|
115
104
|
*/
|
|
116
|
-
function runDeploy() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
});
|
|
105
|
+
async function runDeploy() {
|
|
106
|
+
const cmd = createCommand('deploy');
|
|
107
|
+
try {
|
|
108
|
+
const { logger, options, config } = await prepareRun(cmd);
|
|
109
|
+
const archive = await (0, archive_1.getArchive)(logger, options);
|
|
110
|
+
await (0, base_1.deploy)(archive, config, logger);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
cmd.error(error.message);
|
|
114
|
+
}
|
|
128
115
|
}
|
|
129
116
|
exports.runDeploy = runDeploy;
|
|
130
117
|
/**
|
|
131
118
|
* Function that is to be executed when the exposed undeploy command is executed.
|
|
132
119
|
*/
|
|
133
|
-
function runUndeploy() {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
});
|
|
120
|
+
async function runUndeploy() {
|
|
121
|
+
const cmd = createCommand('undeploy');
|
|
122
|
+
try {
|
|
123
|
+
const { logger, config } = await prepareRun(cmd);
|
|
124
|
+
await (0, base_1.undeploy)(config, logger);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
cmd.error(error.message);
|
|
128
|
+
}
|
|
144
129
|
}
|
|
145
130
|
exports.runUndeploy = runUndeploy;
|
|
146
131
|
//# sourceMappingURL=index.js.map
|
package/dist/ui5/archive.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
|
};
|
|
@@ -23,23 +14,21 @@ const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
|
23
14
|
* @param exclude - array of regex patterns used to exclude folders from archive
|
|
24
15
|
* @returns {*} {Promise<Buffer>} - archive
|
|
25
16
|
*/
|
|
26
|
-
function createUi5Archive(logger, workspace, projectName, exclude = []) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
zip.addFile(path, buffer);
|
|
38
|
-
}
|
|
17
|
+
async function createUi5Archive(logger, workspace, projectName, exclude = []) {
|
|
18
|
+
logger.info('Creating archive with UI5 build result.');
|
|
19
|
+
const prefix = `/resources/${projectName}/`;
|
|
20
|
+
const zip = new adm_zip_1.default();
|
|
21
|
+
const resources = await workspace.byGlob(`${prefix}**/*`);
|
|
22
|
+
for (const resource of resources) {
|
|
23
|
+
if (!exclude.some((regex) => RegExp(regex, 'g').exec(resource.getPath()))) {
|
|
24
|
+
const path = resource.getPath().replace(prefix, '');
|
|
25
|
+
logger.debug(`Adding ${path}`);
|
|
26
|
+
const buffer = await resource.getBuffer();
|
|
27
|
+
zip.addFile(path, buffer);
|
|
39
28
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
}
|
|
30
|
+
logger.info('Archive created.');
|
|
31
|
+
return zip.toBuffer();
|
|
43
32
|
}
|
|
44
33
|
exports.createUi5Archive = createUi5Archive;
|
|
45
34
|
//# sourceMappingURL=archive.js.map
|
package/dist/ui5/index.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
|
const logger_1 = require("@sap-ux/logger");
|
|
12
3
|
const types_1 = require("../types");
|
|
13
4
|
const base_1 = require("../base");
|
|
@@ -21,24 +12,21 @@ const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
|
21
12
|
* @param params.workspace - reference to the UI5 tooling workspace object
|
|
22
13
|
* @param params.options - project properties and configuration
|
|
23
14
|
*/
|
|
24
|
-
function task({ workspace, options }) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
transports: [new logger_1.UI5ToolingTransport({ moduleName: `${types_1.NAME} ${options.projectName}` })],
|
|
31
|
-
logLevel: (_d = (_c = options.configuration) === null || _c === void 0 ? void 0 : _c.log) !== null && _d !== void 0 ? _d : logger_1.LogLevel.Info
|
|
32
|
-
});
|
|
33
|
-
if (logLevel >= logger_1.LogLevel.Debug) {
|
|
34
|
-
logger.debug(Object.assign(Object.assign({}, options.configuration), { credentials: undefined }));
|
|
35
|
-
}
|
|
36
|
-
const config = (0, base_1.validateConfig)(options.configuration);
|
|
37
|
-
(0, ui5_config_1.replaceEnvVariables)(config);
|
|
38
|
-
// The calling client can use either the projectNamespace or projectName when creating the workspace, needs to match when creating the archive.
|
|
39
|
-
const archive = yield (0, archive_1.createUi5Archive)(logger, workspace, (_e = options.projectNamespace) !== null && _e !== void 0 ? _e : options.projectName, config.exclude);
|
|
40
|
-
yield (0, base_1.deploy)(archive, config, logger);
|
|
15
|
+
async function task({ workspace, options }) {
|
|
16
|
+
(0, dotenv_1.config)();
|
|
17
|
+
const logLevel = options.configuration?.log ?? logger_1.LogLevel.Info;
|
|
18
|
+
const logger = new logger_1.ToolsLogger({
|
|
19
|
+
transports: [new logger_1.UI5ToolingTransport({ moduleName: `${types_1.NAME} ${options.projectName}` })],
|
|
20
|
+
logLevel: options.configuration?.log ?? logger_1.LogLevel.Info
|
|
41
21
|
});
|
|
22
|
+
if (logLevel >= logger_1.LogLevel.Debug) {
|
|
23
|
+
logger.debug({ ...options.configuration, credentials: undefined });
|
|
24
|
+
}
|
|
25
|
+
const config = (0, base_1.validateConfig)(options.configuration);
|
|
26
|
+
(0, ui5_config_1.replaceEnvVariables)(config);
|
|
27
|
+
// The calling client can use either the projectNamespace or projectName when creating the workspace, needs to match when creating the archive.
|
|
28
|
+
const archive = await (0, archive_1.createUi5Archive)(logger, workspace, options.projectNamespace ?? options.projectName, config.exclude);
|
|
29
|
+
await (0, base_1.deploy)(archive, config, logger);
|
|
42
30
|
}
|
|
43
31
|
module.exports = task;
|
|
44
32
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Adeploy-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.15.2",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"prompts": "2.4.2",
|
|
33
33
|
"adm-zip": "0.5.10",
|
|
34
34
|
"chalk": "4.1.2",
|
|
35
|
-
"@sap-ux/axios-extension": "1.
|
|
36
|
-
"@sap-ux/btp-utils": "0.
|
|
37
|
-
"@sap-ux/logger": "0.
|
|
38
|
-
"@sap-ux/system-access": "0.
|
|
39
|
-
"@sap-ux/ui5-config": "0.
|
|
40
|
-
"@sap-ux/project-input-validator": "0.
|
|
35
|
+
"@sap-ux/axios-extension": "1.15.1",
|
|
36
|
+
"@sap-ux/btp-utils": "0.15.0",
|
|
37
|
+
"@sap-ux/logger": "0.6.0",
|
|
38
|
+
"@sap-ux/system-access": "0.5.1",
|
|
39
|
+
"@sap-ux/ui5-config": "0.23.1",
|
|
40
|
+
"@sap-ux/project-input-validator": "0.3.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/prompts": "2.4.4",
|
|
44
44
|
"@types/adm-zip": "0.5.5",
|
|
45
|
-
"@sap-ux/store": "0.
|
|
45
|
+
"@sap-ux/store": "0.7.0"
|
|
46
46
|
},
|
|
47
47
|
"ui5": {
|
|
48
48
|
"dependencies": []
|