@sap-ux/deploy-tooling 0.1.0
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/LICENSE +201 -0
- package/README.md +78 -0
- package/bin/deploy +3 -0
- package/bin/undeploy +3 -0
- package/dist/base/archive.d.ts +18 -0
- package/dist/base/archive.js +82 -0
- package/dist/base/config.d.ts +31 -0
- package/dist/base/config.js +103 -0
- package/dist/base/deploy.d.ts +32 -0
- package/dist/base/deploy.js +256 -0
- package/dist/base/index.d.ts +5 -0
- package/dist/base/index.js +21 -0
- package/dist/base/prompt.d.ts +23 -0
- package/dist/base/prompt.js +86 -0
- package/dist/cli/archive.d.ts +13 -0
- package/dist/cli/archive.js +110 -0
- package/dist/cli/config.d.ts +23 -0
- package/dist/cli/config.js +145 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.js +128 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -0
- package/dist/types/index.d.ts +66 -0
- package/dist/types/index.js +5 -0
- package/dist/ui5/archive.d.ts +13 -0
- package/dist/ui5/archive.js +39 -0
- package/dist/ui5/index.d.ts +12 -0
- package/dist/ui5/index.js +40 -0
- package/package.json +63 -0
- package/ui5.yaml +7 -0
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.mergeConfig = exports.getDeploymentConfig = exports.getVersion = void 0;
|
|
13
|
+
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
const types_1 = require("../types");
|
|
17
|
+
/**
|
|
18
|
+
* Tries to read the version of the modules package.json but in case of an error, it returns the manually maintained version matching major.minor of the module.
|
|
19
|
+
*
|
|
20
|
+
* @returns the version of the deploy tooling.
|
|
21
|
+
*/
|
|
22
|
+
function getVersion() {
|
|
23
|
+
try {
|
|
24
|
+
const packageInfo = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../package.json'), 'utf-8');
|
|
25
|
+
return JSON.parse(packageInfo).version;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return '0.1';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.getVersion = getVersion;
|
|
32
|
+
/**
|
|
33
|
+
* Read the deployment configuration from a ui5*.yaml file.
|
|
34
|
+
*
|
|
35
|
+
* @param path - path to the ui5*.yaml file
|
|
36
|
+
* @returns the configuration object or throws an error if it cannot be read.
|
|
37
|
+
*/
|
|
38
|
+
function getDeploymentConfig(path) {
|
|
39
|
+
var _a;
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const content = (0, fs_1.readFileSync)(path, 'utf-8');
|
|
42
|
+
const ui5Config = yield ui5_config_1.UI5Config.newInstance(content);
|
|
43
|
+
const config = (_a = ui5Config.findCustomTask(types_1.NAME)) === null || _a === void 0 ? void 0 : _a.configuration;
|
|
44
|
+
if (!config) {
|
|
45
|
+
throw new Error('The deployment configuration is missing.');
|
|
46
|
+
}
|
|
47
|
+
return config;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exports.getDeploymentConfig = getDeploymentConfig;
|
|
51
|
+
/**
|
|
52
|
+
* Try reading a service key object from the given path an parse it as js object.
|
|
53
|
+
*
|
|
54
|
+
* @param path path to the service key json file
|
|
55
|
+
* @returns service key as js object.
|
|
56
|
+
*/
|
|
57
|
+
function readServiceKeyFromFile(path) {
|
|
58
|
+
try {
|
|
59
|
+
return JSON.parse((0, fs_1.readFileSync)(path, 'utf-8'));
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
throw new Error(`Unable to read service key from from ${path}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Boolean merger.
|
|
67
|
+
*
|
|
68
|
+
* @param cli - optional flag from CLI
|
|
69
|
+
* @param file - optional flag from file
|
|
70
|
+
* @returns merged flag
|
|
71
|
+
*/
|
|
72
|
+
function mergeFlag(cli, file) {
|
|
73
|
+
return cli !== undefined ? cli : file;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse a query string and return an object.
|
|
77
|
+
*
|
|
78
|
+
* @param query query string
|
|
79
|
+
* @returns params object ready for axios requests
|
|
80
|
+
*/
|
|
81
|
+
function parseQueryParams(query) {
|
|
82
|
+
const paramsList = query.split('&');
|
|
83
|
+
const params = {};
|
|
84
|
+
paramsList.forEach((param) => {
|
|
85
|
+
const [key, value] = param.split('=');
|
|
86
|
+
if (value !== undefined) {
|
|
87
|
+
params[key] = value;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return params;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Merge CLI options into a base target configuration.
|
|
94
|
+
*
|
|
95
|
+
* @param baseTarget base target config
|
|
96
|
+
* @param options additional options
|
|
97
|
+
* @returns merged target object
|
|
98
|
+
*/
|
|
99
|
+
function mergeTarget(baseTarget, options) {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
return {
|
|
102
|
+
url: (_a = options.url) !== null && _a !== void 0 ? _a : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.url,
|
|
103
|
+
client: (_b = options.client) !== null && _b !== void 0 ? _b : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.client,
|
|
104
|
+
cloud: options.cloud !== undefined ? options.cloud : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.cloud,
|
|
105
|
+
destination: (_c = options.destination) !== null && _c !== void 0 ? _c : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.destination,
|
|
106
|
+
serviceKey: options.cloudServiceKey ? readServiceKeyFromFile(options.cloudServiceKey) : undefined,
|
|
107
|
+
params: options.queryParams ? parseQueryParams(options.queryParams) : undefined
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Merge the configuration from the ui5*.yaml with CLI options.
|
|
112
|
+
*
|
|
113
|
+
* @param taskConfig - base configuration from the file
|
|
114
|
+
* @param options - CLI options
|
|
115
|
+
* @returns the merged config
|
|
116
|
+
*/
|
|
117
|
+
function mergeConfig(taskConfig, options) {
|
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const app = {
|
|
121
|
+
name: (_a = options.name) !== null && _a !== void 0 ? _a : (_b = taskConfig.app) === null || _b === void 0 ? void 0 : _b.name,
|
|
122
|
+
description: (_c = options.description) !== null && _c !== void 0 ? _c : (_d = taskConfig.app) === null || _d === void 0 ? void 0 : _d.description,
|
|
123
|
+
package: (_e = options.package) !== null && _e !== void 0 ? _e : (_f = taskConfig.app) === null || _f === void 0 ? void 0 : _f.package,
|
|
124
|
+
transport: (_g = options.transport) !== null && _g !== void 0 ? _g : (_h = taskConfig.app) === null || _h === void 0 ? void 0 : _h.transport
|
|
125
|
+
};
|
|
126
|
+
const target = mergeTarget(taskConfig.target, options);
|
|
127
|
+
const config = { app, target, credentials: taskConfig.credentials };
|
|
128
|
+
config.test = mergeFlag(options.test, taskConfig.test);
|
|
129
|
+
config.keep = mergeFlag(options.keep, taskConfig.keep);
|
|
130
|
+
config.strictSsl = mergeFlag(options.strictSsl, taskConfig.strictSsl);
|
|
131
|
+
config.yes = mergeFlag(options.yes, taskConfig.yes);
|
|
132
|
+
if (!options.archiveUrl && !options.archivePath && !options.archiveFolder) {
|
|
133
|
+
options.archiveFolder = 'dist';
|
|
134
|
+
}
|
|
135
|
+
if (options.config && options.archiveFolder && !(0, path_1.isAbsolute)(options.archiveFolder)) {
|
|
136
|
+
options.archiveFolder = (0, path_1.join)((0, path_1.dirname)(options.config), options.archiveFolder);
|
|
137
|
+
}
|
|
138
|
+
if (options.config && options.archivePath && !(0, path_1.isAbsolute)(options.archivePath)) {
|
|
139
|
+
options.archivePath = (0, path_1.join)((0, path_1.dirname)(options.config), options.archivePath);
|
|
140
|
+
}
|
|
141
|
+
return config;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
exports.mergeConfig = mergeConfig;
|
|
145
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Create an instance of a command runner for deployment.
|
|
4
|
+
*
|
|
5
|
+
* @param name - command name
|
|
6
|
+
* @returns instance of the command
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCommand(name: 'deploy' | 'undeploy'): Command;
|
|
9
|
+
/**
|
|
10
|
+
* Function that is to be execute when the exposed deploy command is executed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runDeploy(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Function that is to be execute when the exposed undeploy command is executed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function runUndeploy(): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.runUndeploy = exports.runDeploy = exports.createCommand = void 0;
|
|
13
|
+
const commander_1 = require("commander");
|
|
14
|
+
const logger_1 = require("@sap-ux/logger");
|
|
15
|
+
const base_1 = require("../base");
|
|
16
|
+
const types_1 = require("../types");
|
|
17
|
+
const archive_1 = require("./archive");
|
|
18
|
+
const config_1 = require("./config");
|
|
19
|
+
/**
|
|
20
|
+
* Create an instance of a command runner for deployment.
|
|
21
|
+
*
|
|
22
|
+
* @param name - command name
|
|
23
|
+
* @returns instance of the command
|
|
24
|
+
*/
|
|
25
|
+
function createCommand(name) {
|
|
26
|
+
const command = new commander_1.Command(name)
|
|
27
|
+
.option('-c, --config <path-to-yaml>', 'Path to config yaml file')
|
|
28
|
+
.option('-y, --yes', 'yes to all questions', false)
|
|
29
|
+
.option('-n, --no-retry', `do not retry if ${name} fails for any reason`, false)
|
|
30
|
+
.option('--verbose', 'verbose log output', false);
|
|
31
|
+
// options to set (or overwrite) values that are otherwise read from the `ui5*.yaml`
|
|
32
|
+
command
|
|
33
|
+
.addOption(new commander_1.Option('--destination <destination>', 'Destination in SAP BTP pointing to an ABAP system').conflicts('url'))
|
|
34
|
+
.addOption(new commander_1.Option('--url <target-url>', 'URL of target ABAP system').conflicts('destination'))
|
|
35
|
+
.addOption(new commander_1.Option('--client <sap-client>', 'Client number of target ABAP system').conflicts('destination'))
|
|
36
|
+
.addOption(new commander_1.Option('--cloud', 'target is an ABAP Cloud system').conflicts('destination'))
|
|
37
|
+
.addOption(new commander_1.Option('--cloud-service-key <file-location>', 'JSON file location with the ABAP cloud service key.').conflicts('destination'))
|
|
38
|
+
.option('--transport <transport-request>', 'Transport number to record the change in the ABAP system')
|
|
39
|
+
.option('--name <bsp-name>', 'Project name of the app')
|
|
40
|
+
.option('--strict-ssl', 'Perform certificate validation (use --no-strict-ssl to deactivate it)')
|
|
41
|
+
.option('--query-params <param1=value¶m2=value>', 'Additional parameters that are to be added to calls to the target.')
|
|
42
|
+
.option('--test', `Run in test mode. ABAP backend reports ${name}ment errors without actually ${name}ing (use --no-test to deactivate it).`);
|
|
43
|
+
if (name === 'deploy') {
|
|
44
|
+
// additional parameters for deployment
|
|
45
|
+
command
|
|
46
|
+
.option('--package <abap-package>', 'Package name for deploy target ABAP system')
|
|
47
|
+
.option('--description <description>', 'Project description of the app')
|
|
48
|
+
// SafeMode: Example: If the deployment would overwrite a repository that contains an app with a different sap.app/id and SafeMode is true, HTTP status code 412 (Precondition Failed) with further information would be returned.
|
|
49
|
+
.option('--safe', 'Prevents accidentally breaking deployments.')
|
|
50
|
+
.option('--keep', 'Keep a copy of the deployed archive in the project folder.');
|
|
51
|
+
// alternatives to provide the archive
|
|
52
|
+
command
|
|
53
|
+
.addOption(new commander_1.Option('--archive-url <url>', 'Download app bundle from this url and upload this bundle for deployment').conflicts(['archivePath', 'archiveFolder']))
|
|
54
|
+
.addOption(new commander_1.Option('--archive-path <path>', 'Provide path of the app bundle for deployment').conflicts([
|
|
55
|
+
'archiveUrl',
|
|
56
|
+
'archiveFolder'
|
|
57
|
+
]))
|
|
58
|
+
.addOption(new commander_1.Option('--archive-folder <path>', 'Provide path to a folder for deployment').conflicts([
|
|
59
|
+
'archiveUrl',
|
|
60
|
+
'archivePath'
|
|
61
|
+
]));
|
|
62
|
+
}
|
|
63
|
+
return command.version((0, config_1.getVersion)(), '-v, --version', 'version of the deploy tooling');
|
|
64
|
+
}
|
|
65
|
+
exports.createCommand = createCommand;
|
|
66
|
+
/**
|
|
67
|
+
* Prepare the run of the task based on on the configured command i.e. read and validate configuration and create logger.
|
|
68
|
+
*
|
|
69
|
+
* @param cmd - CLI command configuration to be executed
|
|
70
|
+
* @returns a set of objects required for the command execution
|
|
71
|
+
*/
|
|
72
|
+
function prepareRun(cmd) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if (process.argv.length < 3) {
|
|
75
|
+
cmd.help();
|
|
76
|
+
}
|
|
77
|
+
const options = cmd.parse().opts();
|
|
78
|
+
const logLevel = options.verbose ? logger_1.LogLevel.Silly : logger_1.LogLevel.Info;
|
|
79
|
+
const logger = new logger_1.ToolsLogger({
|
|
80
|
+
transports: [new logger_1.ConsoleTransport()],
|
|
81
|
+
logLevel,
|
|
82
|
+
logPrefix: types_1.NAME
|
|
83
|
+
});
|
|
84
|
+
// Handle empty config when not passed in
|
|
85
|
+
const taskConfig = options.config ? yield (0, config_1.getDeploymentConfig)(options.config) : {};
|
|
86
|
+
const config = yield (0, config_1.mergeConfig)(taskConfig, options);
|
|
87
|
+
if (logLevel >= logger_1.LogLevel.Debug) {
|
|
88
|
+
logger.debug((0, base_1.getConfigForLogging)(config));
|
|
89
|
+
}
|
|
90
|
+
(0, base_1.validateConfig)(config);
|
|
91
|
+
(0, base_1.replaceEnvVariables)(config);
|
|
92
|
+
return { cmd, logger, config, options };
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Function that is to be execute when the exposed deploy command is executed.
|
|
97
|
+
*/
|
|
98
|
+
function runDeploy() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const cmd = createCommand('deploy');
|
|
101
|
+
try {
|
|
102
|
+
const { logger, options, config } = yield prepareRun(cmd);
|
|
103
|
+
const archive = yield (0, archive_1.getArchive)(logger, options);
|
|
104
|
+
yield (0, base_1.deploy)(archive, config, logger);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
cmd.error(error.message);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
exports.runDeploy = runDeploy;
|
|
112
|
+
/**
|
|
113
|
+
* Function that is to be execute when the exposed undeploy command is executed.
|
|
114
|
+
*/
|
|
115
|
+
function runUndeploy() {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
const cmd = createCommand('undeploy');
|
|
118
|
+
try {
|
|
119
|
+
const { logger, config } = yield prepareRun(cmd);
|
|
120
|
+
yield (0, base_1.undeploy)(config, logger);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
cmd.error(error.message);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
exports.runUndeploy = runUndeploy;
|
|
128
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.task = void 0;
|
|
21
|
+
const ui5_1 = __importDefault(require("./ui5"));
|
|
22
|
+
exports.task = ui5_1.default;
|
|
23
|
+
__exportStar(require("./cli"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { AxiosRequestConfig, BspConfig, ServiceInfo } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { LogLevel } from '@sap-ux/logger';
|
|
3
|
+
export declare const NAME = "abap-deploy-task";
|
|
4
|
+
export interface UrlAbapTarget {
|
|
5
|
+
url: string;
|
|
6
|
+
client?: string;
|
|
7
|
+
cloud?: boolean;
|
|
8
|
+
serviceKey?: ServiceInfo;
|
|
9
|
+
params?: AxiosRequestConfig['params'];
|
|
10
|
+
}
|
|
11
|
+
export interface DestinationAbapTarget {
|
|
12
|
+
destination: string;
|
|
13
|
+
}
|
|
14
|
+
export type AbapTarget = (UrlAbapTarget & Partial<DestinationAbapTarget>) | (DestinationAbapTarget & Partial<UrlAbapTarget>);
|
|
15
|
+
export interface CommonOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Deploy with test mode true i.e. everything is sent to the backend but the backend only checks the inputs without a real deployment
|
|
18
|
+
*/
|
|
19
|
+
test?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Deploy the app with safe mode deactivated if set to false i.e. issues like duplicate app id are ignored
|
|
22
|
+
*/
|
|
23
|
+
safe?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If set to true only only servers with validated identities are accepted
|
|
26
|
+
*/
|
|
27
|
+
strictSsl?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Additional project files that are to be added to the zip
|
|
30
|
+
*/
|
|
31
|
+
add?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional: if set to true then the generated zip archive will be written to the filesystem
|
|
34
|
+
*/
|
|
35
|
+
keep?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional: set a specific log level, default is info
|
|
38
|
+
*/
|
|
39
|
+
log?: LogLevel;
|
|
40
|
+
/**
|
|
41
|
+
* If set to true, skip confirmation prompts and assume yes as answer.
|
|
42
|
+
*/
|
|
43
|
+
yes?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Enable verbose logging.
|
|
46
|
+
*/
|
|
47
|
+
verbose?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If set to try then do not retry if a deployment fails.
|
|
50
|
+
*/
|
|
51
|
+
noRetry?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface AbapDeployConfig extends CommonOptions {
|
|
54
|
+
target: AbapTarget;
|
|
55
|
+
app: BspConfig;
|
|
56
|
+
credentials?: AxiosRequestConfig['auth'];
|
|
57
|
+
}
|
|
58
|
+
export interface CliOptions extends Partial<BspConfig>, Partial<DestinationAbapTarget>, Pick<Partial<UrlAbapTarget>, Exclude<keyof UrlAbapTarget, 'serviceKey'>>, Partial<CommonOptions> {
|
|
59
|
+
config?: string;
|
|
60
|
+
archiveFolder?: string;
|
|
61
|
+
archivePath?: string;
|
|
62
|
+
archiveUrl?: string;
|
|
63
|
+
cloudServiceKey?: string;
|
|
64
|
+
queryParams?: string;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
4
|
+
import type { DuplexCollection } from '@ui5/fs';
|
|
5
|
+
/**
|
|
6
|
+
* Create an archive of files in the workspace.
|
|
7
|
+
*
|
|
8
|
+
* @param logger - reference to the logger instance
|
|
9
|
+
* @param workspace - reference to the UI5 tooling workspace object
|
|
10
|
+
* @param projectName - project properties and configuration
|
|
11
|
+
*/
|
|
12
|
+
export declare function createUi5Archive(logger: ToolsLogger, workspace: DuplexCollection, projectName: string): Promise<Buffer>;
|
|
13
|
+
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createUi5Archive = void 0;
|
|
13
|
+
const yazl_1 = require("yazl");
|
|
14
|
+
const base_1 = require("../base");
|
|
15
|
+
/**
|
|
16
|
+
* Create an archive of files in the workspace.
|
|
17
|
+
*
|
|
18
|
+
* @param logger - reference to the logger instance
|
|
19
|
+
* @param workspace - reference to the UI5 tooling workspace object
|
|
20
|
+
* @param projectName - project properties and configuration
|
|
21
|
+
*/
|
|
22
|
+
function createUi5Archive(logger, workspace, projectName) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
logger.info('Creating archive with UI5 build result.');
|
|
25
|
+
const prefix = `/resources/${projectName}/`;
|
|
26
|
+
const zip = new yazl_1.ZipFile();
|
|
27
|
+
const resources = yield workspace.byGlob(`${prefix}**/*`);
|
|
28
|
+
for (const resource of resources) {
|
|
29
|
+
const path = resource.getPath().replace(prefix, '');
|
|
30
|
+
logger.debug(path);
|
|
31
|
+
const buffer = yield resource.getBuffer();
|
|
32
|
+
zip.addBuffer(buffer, path);
|
|
33
|
+
}
|
|
34
|
+
logger.info('Archive created.');
|
|
35
|
+
return (0, base_1.createBuffer)(zip);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.createUi5Archive = createUi5Archive;
|
|
39
|
+
//# sourceMappingURL=archive.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TaskParameters } from '@ui5/builder';
|
|
2
|
+
import type { AbapDeployConfig } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Custom task to upload the build result to the UI5 ABAP Repository.
|
|
5
|
+
*
|
|
6
|
+
* @param params - destructured input parameters
|
|
7
|
+
* @param params.workspace - reference to the UI5 tooling workspace object
|
|
8
|
+
* @param params.options - project properties and configuration
|
|
9
|
+
*/
|
|
10
|
+
declare function task({ workspace, options }: TaskParameters<AbapDeployConfig>): Promise<void>;
|
|
11
|
+
export = task;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
const logger_1 = require("@sap-ux/logger");
|
|
12
|
+
const types_1 = require("../types");
|
|
13
|
+
const base_1 = require("../base");
|
|
14
|
+
const archive_1 = require("./archive");
|
|
15
|
+
/**
|
|
16
|
+
* Custom task to upload the build result to the UI5 ABAP Repository.
|
|
17
|
+
*
|
|
18
|
+
* @param params - destructured input parameters
|
|
19
|
+
* @param params.workspace - reference to the UI5 tooling workspace object
|
|
20
|
+
* @param params.options - project properties and configuration
|
|
21
|
+
*/
|
|
22
|
+
function task({ workspace, options }) {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const logLevel = (_b = (_a = options.configuration) === null || _a === void 0 ? void 0 : _a.log) !== null && _b !== void 0 ? _b : logger_1.LogLevel.Info;
|
|
26
|
+
const logger = new logger_1.ToolsLogger({
|
|
27
|
+
transports: [new logger_1.UI5ToolingTransport({ moduleName: `${types_1.NAME} ${options.projectName}` })],
|
|
28
|
+
logLevel: (_d = (_c = options.configuration) === null || _c === void 0 ? void 0 : _c.log) !== null && _d !== void 0 ? _d : logger_1.LogLevel.Info
|
|
29
|
+
});
|
|
30
|
+
if (logLevel >= logger_1.LogLevel.Debug) {
|
|
31
|
+
logger.debug(Object.assign(Object.assign({}, options.configuration), { credentials: undefined }));
|
|
32
|
+
}
|
|
33
|
+
const config = (0, base_1.validateConfig)(options.configuration);
|
|
34
|
+
(0, base_1.replaceEnvVariables)(config);
|
|
35
|
+
const archive = yield (0, archive_1.createUi5Archive)(logger, workspace, options.projectName);
|
|
36
|
+
yield (0, base_1.deploy)(archive, config, logger);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
module.exports = task;
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sap-ux/deploy-tooling",
|
|
3
|
+
"description": "UI5 CLI tasks to deploy to ABAP systems",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
7
|
+
"directory": "packages/deploy-tooling"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Adeploy-tooling"
|
|
11
|
+
},
|
|
12
|
+
"version": "0.1.0",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"author": "@SAP/ux-tools-team",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"bin": {
|
|
17
|
+
"deploy": "bin/deploy",
|
|
18
|
+
"undeploy": "bin/undeploy"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"dist",
|
|
23
|
+
"ui5.yaml",
|
|
24
|
+
"bin",
|
|
25
|
+
"!dist/*.map",
|
|
26
|
+
"!dist/**/*.map"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@sap-ux/axios-extension": "1.0.3",
|
|
30
|
+
"@sap-ux/btp-utils": "0.11.5",
|
|
31
|
+
"@sap-ux/logger": "0.3.5",
|
|
32
|
+
"@sap-ux/store": "0.3.10",
|
|
33
|
+
"@sap-ux/ui5-config": "0.16.4",
|
|
34
|
+
"axios": "0.24.0",
|
|
35
|
+
"commander": "9.4.0",
|
|
36
|
+
"dotenv": "16.0.0",
|
|
37
|
+
"prompts": "2.4.2",
|
|
38
|
+
"yazl": "2.5.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/prompts": "2.0.14",
|
|
42
|
+
"@types/yazl": "2.4.2"
|
|
43
|
+
},
|
|
44
|
+
"ui5": {
|
|
45
|
+
"dependencies": []
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
|
|
49
|
+
"node": ">= 14.16.0 < 15.0.0 || >=16.1.0 < 17.0.0 || >=18.0.0 < 19.0.0"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc --build",
|
|
53
|
+
"watch": "tsc --watch",
|
|
54
|
+
"clean": "rimraf dist test/test-output coverage *.tsbuildinfo",
|
|
55
|
+
"format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
|
|
56
|
+
"lint": "eslint . --ext .ts",
|
|
57
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
58
|
+
"test": "jest --ci --forceExit --detectOpenHandles --colors",
|
|
59
|
+
"test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
|
|
60
|
+
"link": "pnpm link --global",
|
|
61
|
+
"unlink": "pnpm unlink --global"
|
|
62
|
+
}
|
|
63
|
+
}
|