@sap-ux/adp-tooling 0.19.11 → 1.0.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/abap/client.d.ts +1 -1
- package/dist/abap/client.js +8 -13
- package/dist/abap/config.js +5 -8
- package/dist/abap/index.d.ts +3 -3
- package/dist/abap/index.js +3 -19
- package/dist/abap/provider.js +5 -8
- package/dist/base/abap/manifest-service.d.ts +1 -1
- package/dist/base/abap/manifest-service.js +9 -18
- package/dist/base/cf.js +8 -11
- package/dist/base/change-utils.d.ts +1 -1
- package/dist/base/change-utils.js +49 -62
- package/dist/base/constants/index.js +12 -15
- package/dist/base/credentials.d.ts +2 -2
- package/dist/base/credentials.js +6 -9
- package/dist/base/helper.d.ts +1 -1
- package/dist/base/helper.js +40 -57
- package/dist/base/project-builder.js +3 -6
- package/dist/base/prompt.d.ts +1 -1
- package/dist/base/prompt.js +19 -25
- package/dist/btp/api.d.ts +1 -1
- package/dist/btp/api.js +10 -18
- package/dist/btp/index.d.ts +1 -1
- package/dist/btp/index.js +1 -17
- package/dist/cf/app/discovery.d.ts +1 -1
- package/dist/cf/app/discovery.js +11 -18
- package/dist/cf/app/html5-repo.d.ts +1 -1
- package/dist/cf/app/html5-repo.js +24 -32
- package/dist/cf/app/index.d.ts +2 -2
- package/dist/cf/app/index.js +2 -18
- package/dist/cf/core/auth.d.ts +1 -1
- package/dist/cf/core/auth.js +4 -8
- package/dist/cf/core/config.d.ts +1 -1
- package/dist/cf/core/config.js +9 -15
- package/dist/cf/core/index.d.ts +2 -2
- package/dist/cf/core/index.js +2 -18
- package/dist/cf/deploy.d.ts +1 -1
- package/dist/cf/deploy.js +33 -44
- package/dist/cf/index.d.ts +6 -6
- package/dist/cf/index.js +6 -22
- package/dist/cf/project/index.d.ts +3 -3
- package/dist/cf/project/index.js +3 -19
- package/dist/cf/project/mta.d.ts +1 -1
- package/dist/cf/project/mta.js +23 -66
- package/dist/cf/project/yaml-loader.d.ts +1 -1
- package/dist/cf/project/yaml-loader.js +8 -16
- package/dist/cf/project/yaml.d.ts +2 -2
- package/dist/cf/project/yaml.js +28 -72
- package/dist/cf/services/api.d.ts +1 -1
- package/dist/cf/services/api.js +46 -93
- package/dist/cf/services/cli.d.ts +1 -1
- package/dist/cf/services/cli.js +31 -42
- package/dist/cf/services/destinations.js +12 -48
- package/dist/cf/services/index.d.ts +5 -5
- package/dist/cf/services/index.js +5 -21
- package/dist/cf/services/manifest.d.ts +1 -1
- package/dist/cf/services/manifest.js +9 -13
- package/dist/cf/services/ssh.js +14 -22
- package/dist/cf/utils/index.d.ts +1 -1
- package/dist/cf/utils/index.js +1 -17
- package/dist/cf/utils/validation.d.ts +1 -1
- package/dist/cf/utils/validation.js +12 -18
- package/dist/common/flp-parameters.d.ts +1 -1
- package/dist/common/flp-parameters.js +1 -4
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -17
- package/dist/i18n.js +8 -16
- package/dist/index.d.ts +23 -23
- package/dist/index.js +23 -46
- package/dist/preview/adp-preview.d.ts +1 -1
- package/dist/preview/adp-preview.js +41 -39
- package/dist/preview/change-handler.d.ts +1 -1
- package/dist/preview/change-handler.js +51 -59
- package/dist/preview/descriptor-change-handler.d.ts +1 -1
- package/dist/preview/descriptor-change-handler.js +18 -21
- package/dist/preview/ovp-routes-handler.js +11 -13
- package/dist/preview/routes-handler.js +36 -71
- package/dist/preview/utils.d.ts +1 -1
- package/dist/preview/utils.js +5 -8
- package/dist/prompts/add-annotations-to-odata/index.d.ts +1 -1
- package/dist/prompts/add-annotations-to-odata/index.js +24 -26
- package/dist/prompts/add-component-usages/index.d.ts +1 -1
- package/dist/prompts/add-component-usages/index.js +41 -43
- package/dist/prompts/add-new-model/index.d.ts +1 -1
- package/dist/prompts/add-new-model/index.js +75 -80
- package/dist/prompts/change-data-source/index.d.ts +1 -1
- package/dist/prompts/change-data-source/index.js +19 -22
- package/dist/prompts/change-inbound/index.d.ts +1 -1
- package/dist/prompts/change-inbound/index.js +11 -14
- package/dist/prompts/index.d.ts +5 -5
- package/dist/prompts/index.js +5 -15
- package/dist/source/applications.d.ts +2 -2
- package/dist/source/applications.js +7 -11
- package/dist/source/index.d.ts +3 -3
- package/dist/source/index.js +3 -19
- package/dist/source/manifest.d.ts +1 -1
- package/dist/source/manifest.js +15 -25
- package/dist/source/systems.d.ts +1 -1
- package/dist/source/systems.js +20 -27
- package/dist/types.d.ts +1 -1
- package/dist/types.js +64 -17
- package/dist/ui5/fetch.d.ts +1 -1
- package/dist/ui5/fetch.js +8 -12
- package/dist/ui5/format.d.ts +1 -1
- package/dist/ui5/format.js +17 -29
- package/dist/ui5/index.d.ts +4 -4
- package/dist/ui5/index.js +4 -20
- package/dist/ui5/network.d.ts +1 -1
- package/dist/ui5/network.js +1 -4
- package/dist/ui5/validator.js +14 -20
- package/dist/ui5/version-info.d.ts +1 -1
- package/dist/ui5/version-info.js +25 -36
- package/dist/writer/cf.d.ts +1 -1
- package/dist/writer/cf.js +35 -43
- package/dist/writer/changes/writer-factory.d.ts +2 -2
- package/dist/writer/changes/writer-factory.js +10 -13
- package/dist/writer/changes/writers/annotations-writer.d.ts +1 -1
- package/dist/writer/changes/writers/annotations-writer.js +11 -46
- package/dist/writer/changes/writers/component-usages-writer.d.ts +1 -1
- package/dist/writer/changes/writers/component-usages-writer.js +9 -12
- package/dist/writer/changes/writers/data-source-writer.d.ts +1 -1
- package/dist/writer/changes/writers/data-source-writer.js +7 -10
- package/dist/writer/changes/writers/inbound-writer.d.ts +1 -1
- package/dist/writer/changes/writers/inbound-writer.js +10 -13
- package/dist/writer/changes/writers/index.d.ts +5 -5
- package/dist/writer/changes/writers/index.js +5 -21
- package/dist/writer/changes/writers/new-model-writer.d.ts +1 -1
- package/dist/writer/changes/writers/new-model-writer.js +16 -20
- package/dist/writer/editors.d.ts +1 -1
- package/dist/writer/editors.js +6 -9
- package/dist/writer/i18n/index.d.ts +1 -1
- package/dist/writer/i18n/index.js +13 -17
- package/dist/writer/i18n/key-user-translations.js +9 -14
- package/dist/writer/inbound-navigation.d.ts +1 -1
- package/dist/writer/inbound-navigation.js +18 -27
- package/dist/writer/index.d.ts +1 -1
- package/dist/writer/index.js +36 -37
- package/dist/writer/manifest/descriptor-content.d.ts +2 -2
- package/dist/writer/manifest/descriptor-content.js +9 -15
- package/dist/writer/manifest/index.d.ts +1 -1
- package/dist/writer/manifest/index.js +1 -17
- package/dist/writer/options.d.ts +1 -1
- package/dist/writer/options.js +16 -27
- package/dist/writer/project-utils.d.ts +1 -1
- package/dist/writer/project-utils.js +49 -57
- package/dist/writer/writer-config.d.ts +2 -2
- package/dist/writer/writer-config.js +25 -30
- package/package.json +19 -17
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.downloadZip = downloadZip;
|
|
7
|
-
exports.getHtml5RepoCredentials = getHtml5RepoCredentials;
|
|
8
|
-
exports.downloadAppContent = downloadAppContent;
|
|
9
|
-
const axios_1 = __importDefault(require("axios"));
|
|
10
|
-
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
11
|
-
const i18n_1 = require("../../i18n");
|
|
12
|
-
const api_1 = require("../../btp/api");
|
|
13
|
-
const api_2 = require("../services/api");
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import AdmZip from 'adm-zip';
|
|
3
|
+
import { t } from '../../i18n.js';
|
|
4
|
+
import { getToken } from '../../btp/api.js';
|
|
5
|
+
import { getServiceNameByTags, getOrCreateServiceInstanceKeys, createServiceInstance } from '../services/api.js';
|
|
14
6
|
const HTML5_APPS_REPO_RUNTIME = 'html5-apps-repo-runtime';
|
|
15
7
|
/**
|
|
16
8
|
* Download zip from HTML5 repository.
|
|
@@ -20,9 +12,9 @@ const HTML5_APPS_REPO_RUNTIME = 'html5-apps-repo-runtime';
|
|
|
20
12
|
* @param {string} uri - URL with parameters.
|
|
21
13
|
* @returns {Promise<Buffer>} File buffer content.
|
|
22
14
|
*/
|
|
23
|
-
async function downloadZip(token, appHostId, uri) {
|
|
15
|
+
export async function downloadZip(token, appHostId, uri) {
|
|
24
16
|
try {
|
|
25
|
-
const response = await
|
|
17
|
+
const response = await axios.get(uri, {
|
|
26
18
|
responseType: 'arraybuffer',
|
|
27
19
|
headers: {
|
|
28
20
|
'Content-Type': 'application/json',
|
|
@@ -33,7 +25,7 @@ async function downloadZip(token, appHostId, uri) {
|
|
|
33
25
|
return response.data;
|
|
34
26
|
}
|
|
35
27
|
catch (e) {
|
|
36
|
-
throw new Error(
|
|
28
|
+
throw new Error(t('error.failedToDownloadZipFromHtml5Repo', { error: e.message }));
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
31
|
/**
|
|
@@ -43,28 +35,28 @@ async function downloadZip(token, appHostId, uri) {
|
|
|
43
35
|
* @param {ToolsLogger} logger logger to log messages
|
|
44
36
|
* @returns {Promise<ServiceInfo>} credentials json object
|
|
45
37
|
*/
|
|
46
|
-
async function getHtml5RepoCredentials(spaceGuid, logger) {
|
|
38
|
+
export async function getHtml5RepoCredentials(spaceGuid, logger) {
|
|
47
39
|
try {
|
|
48
|
-
let serviceInfo = await
|
|
40
|
+
let serviceInfo = await getOrCreateServiceInstanceKeys({
|
|
49
41
|
spaceGuids: [spaceGuid],
|
|
50
42
|
planNames: ['app-runtime'],
|
|
51
43
|
names: [HTML5_APPS_REPO_RUNTIME]
|
|
52
44
|
}, logger);
|
|
53
45
|
if (!serviceInfo?.serviceKeys?.length) {
|
|
54
|
-
const serviceName = await
|
|
55
|
-
await
|
|
46
|
+
const serviceName = await getServiceNameByTags(spaceGuid, ['html5-apps-repo-rt']);
|
|
47
|
+
await createServiceInstance('app-runtime', HTML5_APPS_REPO_RUNTIME, serviceName, {
|
|
56
48
|
logger
|
|
57
49
|
});
|
|
58
|
-
serviceInfo = await
|
|
50
|
+
serviceInfo = await getOrCreateServiceInstanceKeys({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
|
|
59
51
|
if (!serviceInfo?.serviceKeys?.length) {
|
|
60
|
-
logger.debug(
|
|
61
|
-
throw new Error(
|
|
52
|
+
logger.debug(t('error.noUaaCredentialsFoundForHtml5Repo'));
|
|
53
|
+
throw new Error(t('error.cannotFindHtml5RepoRuntime'));
|
|
62
54
|
}
|
|
63
55
|
}
|
|
64
56
|
return serviceInfo;
|
|
65
57
|
}
|
|
66
58
|
catch (e) {
|
|
67
|
-
throw new Error(
|
|
59
|
+
throw new Error(t('error.failedToGetCredentialsFromHtml5Repo', { error: e.message }));
|
|
68
60
|
}
|
|
69
61
|
}
|
|
70
62
|
/**
|
|
@@ -75,27 +67,27 @@ async function getHtml5RepoCredentials(spaceGuid, logger) {
|
|
|
75
67
|
* @param {ToolsLogger} logger logger to log messages
|
|
76
68
|
* @returns {Promise<AdmZip.IZipEntry[]>} manifest.json and xs-app.json
|
|
77
69
|
*/
|
|
78
|
-
async function downloadAppContent(spaceGuid, parameters, logger) {
|
|
70
|
+
export async function downloadAppContent(spaceGuid, parameters, logger) {
|
|
79
71
|
const { appHostId, appName, appVersion } = parameters;
|
|
80
72
|
const appNameVersion = `${appName}-${appVersion}`;
|
|
81
73
|
try {
|
|
82
74
|
const { serviceKeys, serviceInstance } = await getHtml5RepoCredentials(spaceGuid, logger);
|
|
83
|
-
const token = await
|
|
75
|
+
const token = await getToken(serviceKeys[0]?.credentials.uaa, logger);
|
|
84
76
|
const uri = `${serviceKeys[0]?.credentials.uri}/applications/content/${appNameVersion}?pathSuffixFilter=manifest.json,xs-app.json`;
|
|
85
77
|
const zip = await downloadZip(token, appHostId, uri);
|
|
86
78
|
let admZip;
|
|
87
79
|
try {
|
|
88
|
-
admZip = new
|
|
80
|
+
admZip = new AdmZip(zip);
|
|
89
81
|
}
|
|
90
82
|
catch (e) {
|
|
91
|
-
throw new Error(
|
|
83
|
+
throw new Error(t('error.failedToParseZipContent', { error: e.message }));
|
|
92
84
|
}
|
|
93
85
|
if (!admZip?.getEntries?.().length) {
|
|
94
|
-
throw new Error(
|
|
86
|
+
throw new Error(t('error.noZipContentParsed'));
|
|
95
87
|
}
|
|
96
88
|
const zipEntry = admZip.getEntries().find((zipEntry) => zipEntry.entryName === 'manifest.json');
|
|
97
89
|
if (!zipEntry) {
|
|
98
|
-
throw new Error(
|
|
90
|
+
throw new Error(t('error.failedToFindManifestJsonInHtml5Repo'));
|
|
99
91
|
}
|
|
100
92
|
try {
|
|
101
93
|
const manifest = JSON.parse(zipEntry.getData().toString('utf8'));
|
|
@@ -106,12 +98,12 @@ async function downloadAppContent(spaceGuid, parameters, logger) {
|
|
|
106
98
|
};
|
|
107
99
|
}
|
|
108
100
|
catch (e) {
|
|
109
|
-
throw new Error(
|
|
101
|
+
throw new Error(t('error.failedToParseManifestJson', { error: e.message }));
|
|
110
102
|
}
|
|
111
103
|
}
|
|
112
104
|
catch (e) {
|
|
113
105
|
logger.error(e);
|
|
114
|
-
throw new Error(
|
|
106
|
+
throw new Error(t('error.failedToDownloadAppContent', { spaceGuid, appName, appHostId, error: e.message }));
|
|
115
107
|
}
|
|
116
108
|
}
|
|
117
109
|
//# sourceMappingURL=html5-repo.js.map
|
package/dist/cf/app/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './discovery';
|
|
2
|
-
export * from './html5-repo';
|
|
1
|
+
export * from './discovery.js';
|
|
2
|
+
export * from './html5-repo.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cf/app/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./discovery"), exports);
|
|
18
|
-
__exportStar(require("./html5-repo"), exports);
|
|
1
|
+
export * from './discovery.js';
|
|
2
|
+
export * from './html5-repo.js';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/dist/cf/core/auth.d.ts
CHANGED
package/dist/cf/core/auth.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isExternalLoginEnabled = isExternalLoginEnabled;
|
|
4
|
-
exports.isLoggedInCf = isLoggedInCf;
|
|
5
|
-
const cf_tools_1 = require("@sap/cf-tools");
|
|
1
|
+
import { cfGetAuthToken } from '@sap/cf-tools';
|
|
6
2
|
/**
|
|
7
3
|
* Check if the external login is enabled.
|
|
8
4
|
*
|
|
9
5
|
* @param {any} vscode - The vscode instance.
|
|
10
6
|
* @returns {Promise<boolean>} Whether the external login is enabled.
|
|
11
7
|
*/
|
|
12
|
-
async function isExternalLoginEnabled(vscode) {
|
|
8
|
+
export async function isExternalLoginEnabled(vscode) {
|
|
13
9
|
const commands = await vscode.commands.getCommands();
|
|
14
10
|
return commands?.includes('cf.login');
|
|
15
11
|
}
|
|
@@ -20,13 +16,13 @@ async function isExternalLoginEnabled(vscode) {
|
|
|
20
16
|
* @param {ToolsLogger} logger - The logger.
|
|
21
17
|
* @returns {Promise<boolean>} Whether the user is logged in.
|
|
22
18
|
*/
|
|
23
|
-
async function isLoggedInCf(cfConfig, logger) {
|
|
19
|
+
export async function isLoggedInCf(cfConfig, logger) {
|
|
24
20
|
if (!cfConfig) {
|
|
25
21
|
logger?.error('CF config is not provided');
|
|
26
22
|
return false;
|
|
27
23
|
}
|
|
28
24
|
try {
|
|
29
|
-
await
|
|
25
|
+
await cfGetAuthToken();
|
|
30
26
|
return true;
|
|
31
27
|
}
|
|
32
28
|
catch (e) {
|
package/dist/cf/core/config.d.ts
CHANGED
package/dist/cf/core/config.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.loadCfConfig = loadCfConfig;
|
|
7
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
10
4
|
/**
|
|
11
5
|
* Get the home directory.
|
|
12
6
|
*
|
|
13
7
|
* @returns {string} The home directory.
|
|
14
8
|
*/
|
|
15
9
|
function getHomedir() {
|
|
16
|
-
let homedir =
|
|
10
|
+
let homedir = os.homedir();
|
|
17
11
|
const homeDrive = process.env?.['HOMEDRIVE'];
|
|
18
12
|
const homePath = process.env?.['HOMEPATH'];
|
|
19
13
|
if (process.platform === 'win32' && typeof homeDrive === 'string' && typeof homePath === 'string') {
|
|
20
|
-
homedir =
|
|
14
|
+
homedir = path.join(homeDrive, homePath);
|
|
21
15
|
}
|
|
22
16
|
return homedir;
|
|
23
17
|
}
|
|
@@ -27,15 +21,15 @@ function getHomedir() {
|
|
|
27
21
|
* @param {ToolsLogger} logger - The logger.
|
|
28
22
|
* @returns {CfConfig} The CF configuration.
|
|
29
23
|
*/
|
|
30
|
-
function loadCfConfig(logger) {
|
|
24
|
+
export function loadCfConfig(logger) {
|
|
31
25
|
let cfHome = process.env['CF_HOME'];
|
|
32
26
|
if (!cfHome) {
|
|
33
|
-
cfHome =
|
|
27
|
+
cfHome = path.join(getHomedir(), '.cf');
|
|
34
28
|
}
|
|
35
|
-
const configFileLocation =
|
|
29
|
+
const configFileLocation = path.join(cfHome, 'config.json');
|
|
36
30
|
let config = {};
|
|
37
31
|
try {
|
|
38
|
-
const configAsString =
|
|
32
|
+
const configAsString = fs.readFileSync(configFileLocation, 'utf-8');
|
|
39
33
|
config = JSON.parse(configAsString);
|
|
40
34
|
}
|
|
41
35
|
catch (e) {
|
package/dist/cf/core/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './auth';
|
|
2
|
-
export * from './config';
|
|
1
|
+
export * from './auth.js';
|
|
2
|
+
export * from './config.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cf/core/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./auth"), exports);
|
|
18
|
-
__exportStar(require("./config"), exports);
|
|
1
|
+
export * from './auth.js';
|
|
2
|
+
export * from './config.js';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/dist/cf/deploy.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CfConfig, CfDeploymentInfo, DeployCfOptions } from '../types';
|
|
1
|
+
import type { CfConfig, CfDeploymentInfo, DeployCfOptions } from '../types.js';
|
|
2
2
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
3
|
/**
|
|
4
4
|
* Gathers MTA project and CF environment information needed for deployment.
|
package/dist/cf/deploy.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.buildMtaArchive = buildMtaArchive;
|
|
10
|
-
exports.deployMtaArchive = deployMtaArchive;
|
|
11
|
-
exports.deployCf = deployCf;
|
|
12
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
-
const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
|
|
14
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
15
|
-
const cli_1 = require("./services/cli");
|
|
16
|
-
const auth_1 = require("./core/auth");
|
|
17
|
-
const config_1 = require("./core/config");
|
|
18
|
-
const yaml_loader_1 = require("./project/yaml-loader");
|
|
19
|
-
const i18n_1 = require("../i18n");
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { CommandRunner } from '@sap-ux/nodejs-utils';
|
|
3
|
+
import { getMtaPath } from '@sap-ux/project-access';
|
|
4
|
+
import { isCfInstalled } from './services/cli.js';
|
|
5
|
+
import { isLoggedInCf } from './core/auth.js';
|
|
6
|
+
import { loadCfConfig } from './core/config.js';
|
|
7
|
+
import { getYamlContent } from './project/yaml-loader.js';
|
|
8
|
+
import { t } from '../i18n.js';
|
|
20
9
|
const SEPARATOR = '------------------------------------';
|
|
21
10
|
/**
|
|
22
11
|
* Gathers MTA project and CF environment information needed for deployment.
|
|
@@ -25,9 +14,9 @@ const SEPARATOR = '------------------------------------';
|
|
|
25
14
|
* @param {CfConfig} cfConfig - The CF configuration.
|
|
26
15
|
* @returns {CfDeploymentInfo} Deployment information for the MTA project.
|
|
27
16
|
*/
|
|
28
|
-
function getCfDeploymentInfo(projectPath, cfConfig) {
|
|
29
|
-
const mtaYamlPath =
|
|
30
|
-
const mtaYaml =
|
|
17
|
+
export function getCfDeploymentInfo(projectPath, cfConfig) {
|
|
18
|
+
const mtaYamlPath = path.join(projectPath, 'mta.yaml');
|
|
19
|
+
const mtaYaml = getYamlContent(mtaYamlPath);
|
|
31
20
|
return {
|
|
32
21
|
mtaProjectName: mtaYaml.ID ?? '',
|
|
33
22
|
mtaVersion: mtaYaml.version ?? '',
|
|
@@ -48,7 +37,7 @@ function getCfDeploymentInfo(projectPath, cfConfig) {
|
|
|
48
37
|
* @param {CfDeploymentInfo} info - The deployment information to format.
|
|
49
38
|
* @returns {string} Formatted summary string ready for display.
|
|
50
39
|
*/
|
|
51
|
-
function formatDeploymentSummary(info) {
|
|
40
|
+
export function formatDeploymentSummary(info) {
|
|
52
41
|
const lines = [];
|
|
53
42
|
lines.push(`mta-project-name: ${info.mtaProjectName}`, `mta-version: ${info.mtaVersion}`, `space: ${info.space}`, `org: ${info.org}`, `api-url: ${info.apiUrl}`);
|
|
54
43
|
for (const mod of info.modules) {
|
|
@@ -57,7 +46,7 @@ function formatDeploymentSummary(info) {
|
|
|
57
46
|
lines.push(`path: ${mod.path}`);
|
|
58
47
|
}
|
|
59
48
|
}
|
|
60
|
-
lines.push('',
|
|
49
|
+
lines.push('', t('deploy.confirmPrompt'));
|
|
61
50
|
return lines.join('\n');
|
|
62
51
|
}
|
|
63
52
|
/**
|
|
@@ -66,9 +55,9 @@ function formatDeploymentSummary(info) {
|
|
|
66
55
|
* @param {string} projectPath - The starting project path.
|
|
67
56
|
* @returns {Promise<string | undefined>} The MTA root path, or undefined if not found.
|
|
68
57
|
*/
|
|
69
|
-
async function findMtaRoot(projectPath) {
|
|
70
|
-
const result = await
|
|
71
|
-
return result ?
|
|
58
|
+
export async function findMtaRoot(projectPath) {
|
|
59
|
+
const result = await getMtaPath(projectPath);
|
|
60
|
+
return result ? path.dirname(result.mtaPath) : undefined;
|
|
72
61
|
}
|
|
73
62
|
/**
|
|
74
63
|
* Validates the CF environment: checks CF CLI is installed, user is logged in, and locates the MTA root.
|
|
@@ -78,18 +67,18 @@ async function findMtaRoot(projectPath) {
|
|
|
78
67
|
* @returns {Promise<{ cfConfig: CfConfig; mtaRoot: string }>} The validated CF config and MTA root path.
|
|
79
68
|
*/
|
|
80
69
|
async function validateCfEnvironment(projectPath, logger) {
|
|
81
|
-
const cfInstalled = await
|
|
70
|
+
const cfInstalled = await isCfInstalled(logger);
|
|
82
71
|
if (!cfInstalled) {
|
|
83
|
-
throw new Error(
|
|
72
|
+
throw new Error(t('deploy.cfNotInstalled'));
|
|
84
73
|
}
|
|
85
|
-
const cfConfig =
|
|
86
|
-
const loggedIn = await
|
|
74
|
+
const cfConfig = loadCfConfig(logger);
|
|
75
|
+
const loggedIn = await isLoggedInCf(cfConfig, logger);
|
|
87
76
|
if (!loggedIn) {
|
|
88
|
-
throw new Error(
|
|
77
|
+
throw new Error(t('deploy.notLoggedIn'));
|
|
89
78
|
}
|
|
90
79
|
const mtaRoot = await findMtaRoot(projectPath);
|
|
91
80
|
if (!mtaRoot) {
|
|
92
|
-
throw new Error(
|
|
81
|
+
throw new Error(t('deploy.mtaNotFound', { projectPath }));
|
|
93
82
|
}
|
|
94
83
|
return { cfConfig, mtaRoot };
|
|
95
84
|
}
|
|
@@ -99,13 +88,13 @@ async function validateCfEnvironment(projectPath, logger) {
|
|
|
99
88
|
* @param {string} projectPath - Path to the ADP project root.
|
|
100
89
|
* @param {ToolsLogger} logger - Logger instance.
|
|
101
90
|
*/
|
|
102
|
-
async function buildMtaArchive(projectPath, logger) {
|
|
103
|
-
const commandRunner = new
|
|
91
|
+
export async function buildMtaArchive(projectPath, logger) {
|
|
92
|
+
const commandRunner = new CommandRunner();
|
|
104
93
|
try {
|
|
105
94
|
await commandRunner.run('npm', ['run', 'build-mta'], { cwd: projectPath }, logger);
|
|
106
95
|
}
|
|
107
96
|
catch (e) {
|
|
108
|
-
throw new Error(
|
|
97
|
+
throw new Error(t('deploy.buildFailed', { error: String(e) }));
|
|
109
98
|
}
|
|
110
99
|
}
|
|
111
100
|
/**
|
|
@@ -114,13 +103,13 @@ async function buildMtaArchive(projectPath, logger) {
|
|
|
114
103
|
* @param {string} projectPath - Path to the ADP project root.
|
|
115
104
|
* @param {ToolsLogger} logger - Logger instance.
|
|
116
105
|
*/
|
|
117
|
-
async function deployMtaArchive(projectPath, logger) {
|
|
118
|
-
const commandRunner = new
|
|
106
|
+
export async function deployMtaArchive(projectPath, logger) {
|
|
107
|
+
const commandRunner = new CommandRunner();
|
|
119
108
|
try {
|
|
120
109
|
await commandRunner.run('npm', ['run', 'deploy'], { cwd: projectPath }, logger);
|
|
121
110
|
}
|
|
122
111
|
catch (e) {
|
|
123
|
-
throw new Error(
|
|
112
|
+
throw new Error(t('deploy.deployFailed', { error: String(e) }));
|
|
124
113
|
}
|
|
125
114
|
}
|
|
126
115
|
/**
|
|
@@ -131,7 +120,7 @@ async function deployMtaArchive(projectPath, logger) {
|
|
|
131
120
|
* @param {DeployCfOptions} [options] - Deployment options (confirmation callback, output callback).
|
|
132
121
|
* @returns {Promise<void>} Resolves when deployment completes.
|
|
133
122
|
*/
|
|
134
|
-
async function deployCf(projectPath, logger, options = {}) {
|
|
123
|
+
export async function deployCf(projectPath, logger, options = {}) {
|
|
135
124
|
const { cfConfig, mtaRoot } = await validateCfEnvironment(projectPath, logger);
|
|
136
125
|
const info = getCfDeploymentInfo(mtaRoot, cfConfig);
|
|
137
126
|
const summary = formatDeploymentSummary(info);
|
|
@@ -140,14 +129,14 @@ async function deployCf(projectPath, logger, options = {}) {
|
|
|
140
129
|
if (options.confirmDeployment) {
|
|
141
130
|
const confirmed = await options.confirmDeployment(summary);
|
|
142
131
|
if (!confirmed) {
|
|
143
|
-
logger.info(
|
|
132
|
+
logger.info(t('deploy.cancelled'));
|
|
144
133
|
return;
|
|
145
134
|
}
|
|
146
135
|
}
|
|
147
|
-
logger.info(
|
|
136
|
+
logger.info(t('deploy.buildStarted'));
|
|
148
137
|
await buildMtaArchive(projectPath, logger);
|
|
149
|
-
logger.info(
|
|
138
|
+
logger.info(t('deploy.deployStarted'));
|
|
150
139
|
await deployMtaArchive(projectPath, logger);
|
|
151
|
-
logger.info(
|
|
140
|
+
logger.info(t('deploy.success'));
|
|
152
141
|
}
|
|
153
142
|
//# sourceMappingURL=deploy.js.map
|
package/dist/cf/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './deploy';
|
|
2
|
-
export * from './project';
|
|
3
|
-
export * from './app';
|
|
4
|
-
export * from './core';
|
|
5
|
-
export * from './services';
|
|
6
|
-
export * from './utils';
|
|
1
|
+
export * from './deploy.js';
|
|
2
|
+
export * from './project/index.js';
|
|
3
|
+
export * from './app/index.js';
|
|
4
|
+
export * from './core/index.js';
|
|
5
|
+
export * from './services/index.js';
|
|
6
|
+
export * from './utils/index.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cf/index.js
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./deploy"), exports);
|
|
18
|
-
__exportStar(require("./project"), exports);
|
|
19
|
-
__exportStar(require("./app"), exports);
|
|
20
|
-
__exportStar(require("./core"), exports);
|
|
21
|
-
__exportStar(require("./services"), exports);
|
|
22
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
export * from './deploy.js';
|
|
2
|
+
export * from './project/index.js';
|
|
3
|
+
export * from './app/index.js';
|
|
4
|
+
export * from './core/index.js';
|
|
5
|
+
export * from './services/index.js';
|
|
6
|
+
export * from './utils/index.js';
|
|
23
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './mta';
|
|
2
|
-
export * from './yaml';
|
|
3
|
-
export * from './yaml-loader';
|
|
1
|
+
export * from './mta.js';
|
|
2
|
+
export * from './yaml.js';
|
|
3
|
+
export * from './yaml-loader.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cf/project/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./mta"), exports);
|
|
18
|
-
__exportStar(require("./yaml"), exports);
|
|
19
|
-
__exportStar(require("./yaml-loader"), exports);
|
|
1
|
+
export * from './mta.js';
|
|
2
|
+
export * from './yaml.js';
|
|
3
|
+
export * from './yaml-loader.js';
|
|
20
4
|
//# sourceMappingURL=index.js.map
|
package/dist/cf/project/mta.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
-
import type { BusinessServiceResource, AppRouterType, MtaYaml } from '../../types';
|
|
2
|
+
import type { BusinessServiceResource, AppRouterType, MtaYaml } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Builds VCAP_SERVICES by resolving MTA resources to service key credentials.
|
|
5
5
|
*
|