@sap-ux/adp-tooling 0.19.10 → 1.0.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/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
package/dist/writer/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const baseTmplPath = (0, node_path_1.join)(__dirname, '../../templates');
|
|
1
|
+
import { dirname, join } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { create as createStorage } from 'mem-fs';
|
|
4
|
+
import { create } from 'mem-fs-editor';
|
|
5
|
+
import { getManifestContent } from './manifest/index.js';
|
|
6
|
+
import { getI18nDescription, getI18nModels, writeI18nModels } from './i18n/index.js';
|
|
7
|
+
import { writeTemplateToFolder, writeUI5Yaml, writeUI5DeployYaml } from './project-utils.js';
|
|
8
|
+
import { FlexLayer } from '../types.js';
|
|
9
|
+
import { getApplicationType } from '../source/index.js';
|
|
10
|
+
import { writeKeyUserChanges } from '../base/change-utils.js';
|
|
11
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const baseTmplPath = join(__dirname, '../../templates');
|
|
14
13
|
/**
|
|
15
14
|
* Set default values for optional properties.
|
|
16
15
|
*
|
|
@@ -28,14 +27,14 @@ function setDefaults(config) {
|
|
|
28
27
|
keyUserChanges: config.keyUserChanges
|
|
29
28
|
};
|
|
30
29
|
configWithDefaults.app.title ??= `Adaptation of ${config.app.reference}`;
|
|
31
|
-
configWithDefaults.app.layer ??=
|
|
30
|
+
configWithDefaults.app.layer ??= FlexLayer.CUSTOMER_BASE;
|
|
32
31
|
configWithDefaults.package ??= config.package ? { ...config.package } : {};
|
|
33
32
|
configWithDefaults.package.name ??= config.app.id.toLowerCase().replace(/\./g, '-');
|
|
34
33
|
configWithDefaults.package.description ??= configWithDefaults.app.title;
|
|
35
|
-
configWithDefaults.app.i18nModels ??=
|
|
36
|
-
configWithDefaults.app.i18nDescription ??=
|
|
37
|
-
configWithDefaults.app.appType ??=
|
|
38
|
-
configWithDefaults.app.content ??=
|
|
34
|
+
configWithDefaults.app.i18nModels ??= getI18nModels(configWithDefaults.app.manifest, configWithDefaults.app.layer, configWithDefaults.app.reference, configWithDefaults.app.title);
|
|
35
|
+
configWithDefaults.app.i18nDescription ??= getI18nDescription(configWithDefaults.app.layer, configWithDefaults.app.title);
|
|
36
|
+
configWithDefaults.app.appType ??= getApplicationType(configWithDefaults.app.manifest);
|
|
37
|
+
configWithDefaults.app.content ??= getManifestContent(configWithDefaults);
|
|
39
38
|
return configWithDefaults;
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
@@ -46,17 +45,17 @@ function setDefaults(config) {
|
|
|
46
45
|
* @param fs - the memfs editor instance
|
|
47
46
|
* @returns the updated memfs editor instance
|
|
48
47
|
*/
|
|
49
|
-
async function generate(basePath, config, fs) {
|
|
48
|
+
export async function generate(basePath, config, fs) {
|
|
50
49
|
if (!fs) {
|
|
51
|
-
fs =
|
|
50
|
+
fs = create(createStorage());
|
|
52
51
|
}
|
|
53
52
|
const fullConfig = setDefaults(config);
|
|
54
53
|
const templatePath = config.options?.templatePathOverwrite ?? baseTmplPath;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
await
|
|
58
|
-
await
|
|
59
|
-
await
|
|
54
|
+
writeI18nModels(basePath, fullConfig.app.i18nModels, fs);
|
|
55
|
+
writeTemplateToFolder(templatePath, join(basePath), fullConfig, fs);
|
|
56
|
+
await writeUI5DeployYaml(basePath, fullConfig, fs);
|
|
57
|
+
await writeUI5Yaml(basePath, fullConfig, fs);
|
|
58
|
+
await writeKeyUserChanges(basePath, fullConfig, fs);
|
|
60
59
|
return fs;
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
@@ -67,33 +66,33 @@ async function generate(basePath, config, fs) {
|
|
|
67
66
|
* @param fs - the memfs editor instance
|
|
68
67
|
* @returns the updated memfs editor instance
|
|
69
68
|
*/
|
|
70
|
-
async function migrate(basePath, config, fs) {
|
|
69
|
+
export async function migrate(basePath, config, fs) {
|
|
71
70
|
if (!fs) {
|
|
72
|
-
fs =
|
|
71
|
+
fs = create(createStorage());
|
|
73
72
|
}
|
|
74
73
|
const fullConfig = setDefaults(config);
|
|
75
|
-
const tmplPath =
|
|
74
|
+
const tmplPath = join(baseTmplPath, 'project');
|
|
76
75
|
// Copy the specified files to target project
|
|
77
|
-
fs.copyTpl(
|
|
76
|
+
fs.copyTpl(join(tmplPath, '**/ui5.yaml'), join(basePath), fullConfig, undefined, {
|
|
78
77
|
globOptions: { dot: true }
|
|
79
78
|
});
|
|
80
|
-
fs.copyTpl(
|
|
79
|
+
fs.copyTpl(join(tmplPath, '**/package.json'), join(basePath), fullConfig, undefined, {
|
|
81
80
|
globOptions: { dot: true }
|
|
82
81
|
});
|
|
83
|
-
fs.copyTpl(
|
|
82
|
+
fs.copyTpl(join(tmplPath, '**/gitignore.tmpl'), join(basePath), fullConfig, undefined, {
|
|
84
83
|
globOptions: { dot: true },
|
|
85
84
|
processDestinationPath: (filePath) => filePath.replace(/gitignore.tmpl/g, '.gitignore')
|
|
86
85
|
});
|
|
87
86
|
// delete .che folder
|
|
88
|
-
if (fs.exists(
|
|
89
|
-
fs.delete(
|
|
87
|
+
if (fs.exists(join(basePath, '.che/project.json'))) {
|
|
88
|
+
fs.delete(join(basePath, '.che/*'));
|
|
90
89
|
}
|
|
91
90
|
// delete neo-app.json
|
|
92
|
-
if (fs.exists(
|
|
93
|
-
fs.delete(
|
|
91
|
+
if (fs.exists(join(basePath, 'neo-app.json'))) {
|
|
92
|
+
fs.delete(join(basePath, 'neo-app.json'));
|
|
94
93
|
}
|
|
95
|
-
await
|
|
96
|
-
await
|
|
94
|
+
await writeUI5Yaml(basePath, fullConfig, fs);
|
|
95
|
+
await writeUI5DeployYaml(basePath, fullConfig, fs);
|
|
97
96
|
return fs;
|
|
98
97
|
}
|
|
99
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApplicationType } from '../../types';
|
|
2
|
-
import type { Content, AdpWriterConfig, ResourceModel } from '../../types';
|
|
1
|
+
import { ApplicationType } from '../../types.js';
|
|
2
|
+
import type { Content, AdpWriterConfig, ResourceModel } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a descriptor change object for a resource model.
|
|
5
5
|
*
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.createDescriptorChangeForResourceModel = createDescriptorChangeForResourceModel;
|
|
4
|
-
exports.fillDescriptorContent = fillDescriptorContent;
|
|
5
|
-
exports.fillSupportData = fillSupportData;
|
|
6
|
-
exports.getManifestContent = getManifestContent;
|
|
7
|
-
const ui5_1 = require("../../ui5");
|
|
8
|
-
const types_1 = require("../../types");
|
|
1
|
+
import { isFeatureSupportedVersion } from '../../ui5/index.js';
|
|
2
|
+
import { FlexLayer, ApplicationType } from '../../types.js';
|
|
9
3
|
/**
|
|
10
4
|
* Creates a descriptor change object for a resource model.
|
|
11
5
|
*
|
|
@@ -19,9 +13,9 @@ const types_1 = require("../../types");
|
|
|
19
13
|
* If supported and the application type is FREE_STYLE, it includes specific properties for localization.
|
|
20
14
|
* Otherwise, it prepares a standard model enhancement structure.
|
|
21
15
|
*/
|
|
22
|
-
function createDescriptorChangeForResourceModel(modelId, path, type, ui5Version) {
|
|
23
|
-
const fallbackLocaleSupported =
|
|
24
|
-
if (type ===
|
|
16
|
+
export function createDescriptorChangeForResourceModel(modelId, path, type, ui5Version) {
|
|
17
|
+
const fallbackLocaleSupported = isFeatureSupportedVersion('1.84.0', ui5Version);
|
|
18
|
+
if (type === ApplicationType.FREE_STYLE && fallbackLocaleSupported) {
|
|
25
19
|
return {
|
|
26
20
|
changeType: 'appdescr_ui5_addNewModelEnhanceWith',
|
|
27
21
|
content: {
|
|
@@ -53,7 +47,7 @@ function createDescriptorChangeForResourceModel(modelId, path, type, ui5Version)
|
|
|
53
47
|
* Each descriptor change is generated based on the provided system version and application type,
|
|
54
48
|
* taking into account whether certain UI5 features are supported.
|
|
55
49
|
*/
|
|
56
|
-
function fillDescriptorContent(content, type, systemVersion, i18nModels) {
|
|
50
|
+
export function fillDescriptorContent(content, type, systemVersion, i18nModels) {
|
|
57
51
|
if (i18nModels) {
|
|
58
52
|
i18nModels.forEach((i18nModel) => {
|
|
59
53
|
content.push(createDescriptorChangeForResourceModel(i18nModel.key, i18nModel.path, type, systemVersion));
|
|
@@ -67,7 +61,7 @@ function fillDescriptorContent(content, type, systemVersion, i18nModels) {
|
|
|
67
61
|
* @param {string} [fioriId] - The Fiori ID to set in the registration.
|
|
68
62
|
* @param {string} [ach] - The application component hierarchy code, which will be converted to uppercase.
|
|
69
63
|
*/
|
|
70
|
-
function fillSupportData(content, fioriId, ach) {
|
|
64
|
+
export function fillSupportData(content, fioriId, ach) {
|
|
71
65
|
if (fioriId) {
|
|
72
66
|
content.push({
|
|
73
67
|
changeType: 'appdescr_fiori_setRegistrationIds',
|
|
@@ -97,10 +91,10 @@ function fillSupportData(content, fioriId, ach) {
|
|
|
97
91
|
* change or setting necessary for the application configuration, such as setting minimum UI5 version,
|
|
98
92
|
* updating title, or adding support data.
|
|
99
93
|
*/
|
|
100
|
-
function getManifestContent(config) {
|
|
94
|
+
export function getManifestContent(config) {
|
|
101
95
|
const { app, ui5 } = config;
|
|
102
96
|
const { ach, fioriId, appType, layer, i18nModels } = app;
|
|
103
|
-
const isCustomerBase = layer ===
|
|
97
|
+
const isCustomerBase = layer === FlexLayer.CUSTOMER_BASE;
|
|
104
98
|
const content = [];
|
|
105
99
|
fillDescriptorContent(content, appType, ui5?.version, i18nModels);
|
|
106
100
|
if (!isCustomerBase) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './descriptor-content';
|
|
1
|
+
export * from './descriptor-content.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./descriptor-content"), exports);
|
|
1
|
+
export * from './descriptor-content.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/writer/options.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UI5Config } from '@sap-ux/ui5-config';
|
|
2
|
-
import type { AdpWriterConfig, Content, CloudApp, InternalInboundNavigation, CfAdpWriterConfig, CustomConfig } from '../types';
|
|
2
|
+
import type { AdpWriterConfig, Content, CloudApp, InternalInboundNavigation, CfAdpWriterConfig, CustomConfig } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generate the configuration for the middlewares required for the ui5.yaml.
|
|
5
5
|
*
|
package/dist/writer/options.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.enhanceUI5YamlWithCustomTask = enhanceUI5YamlWithCustomTask;
|
|
5
|
-
exports.enhanceUI5YamlWithCustomConfig = enhanceUI5YamlWithCustomConfig;
|
|
6
|
-
exports.enhanceUI5YamlWithTranspileMiddleware = enhanceUI5YamlWithTranspileMiddleware;
|
|
7
|
-
exports.hasDeployConfig = hasDeployConfig;
|
|
8
|
-
exports.enhanceUI5DeployYaml = enhanceUI5DeployYaml;
|
|
9
|
-
exports.enhanceManifestChangeContentWithFlpConfig = enhanceManifestChangeContentWithFlpConfig;
|
|
10
|
-
exports.enhanceUI5YamlWithCfCustomTask = enhanceUI5YamlWithCfCustomTask;
|
|
11
|
-
exports.enhanceUI5YamlWithFioriToolsMiddleware = enhanceUI5YamlWithFioriToolsMiddleware;
|
|
12
|
-
const constants_1 = require("../base/constants");
|
|
13
|
-
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
14
|
-
const source_1 = require("../source");
|
|
1
|
+
import { UI5_CDN_URL } from '../base/constants/index.js';
|
|
2
|
+
import { AdaptationProjectType } from '@sap-ux/axios-extension';
|
|
3
|
+
import { SupportedProject } from '../source/index.js';
|
|
15
4
|
const VSCODE_URL = 'https://REQUIRED_FOR_VSCODE.example';
|
|
16
5
|
/**
|
|
17
6
|
* Generate the configuration for the middlewares required for the ui5.yaml.
|
|
@@ -19,7 +8,7 @@ const VSCODE_URL = 'https://REQUIRED_FOR_VSCODE.example';
|
|
|
19
8
|
* @param ui5Config configuration representing the ui5.yaml
|
|
20
9
|
* @param config full project configuration
|
|
21
10
|
*/
|
|
22
|
-
function enhanceUI5Yaml(ui5Config, config) {
|
|
11
|
+
export function enhanceUI5Yaml(ui5Config, config) {
|
|
23
12
|
if (config.options?.fioriTools) {
|
|
24
13
|
addFioriToolsMiddlewares(ui5Config, config);
|
|
25
14
|
}
|
|
@@ -35,7 +24,7 @@ function enhanceUI5Yaml(ui5Config, config) {
|
|
|
35
24
|
* @param {UI5Config} ui5Config - The UI5 configuration object representing the ui5.yaml.
|
|
36
25
|
* @param {AdpWriterConfig} config - The configuration object containing options for the adaptation project.
|
|
37
26
|
*/
|
|
38
|
-
function enhanceUI5YamlWithCustomTask(ui5Config, config) {
|
|
27
|
+
export function enhanceUI5YamlWithCustomTask(ui5Config, config) {
|
|
39
28
|
if (config.options?.enableTypeScript) {
|
|
40
29
|
ui5Config.addCustomTasks([
|
|
41
30
|
{
|
|
@@ -52,7 +41,7 @@ function enhanceUI5YamlWithCustomTask(ui5Config, config) {
|
|
|
52
41
|
}
|
|
53
42
|
]);
|
|
54
43
|
}
|
|
55
|
-
if (config.customConfig?.adp?.projectType ===
|
|
44
|
+
if (config.customConfig?.adp?.projectType === AdaptationProjectType.CLOUD_READY) {
|
|
56
45
|
const tasks = getAdpCloudCustomTasks(config);
|
|
57
46
|
ui5Config.addCustomTasks(tasks);
|
|
58
47
|
}
|
|
@@ -63,7 +52,7 @@ function enhanceUI5YamlWithCustomTask(ui5Config, config) {
|
|
|
63
52
|
* @param ui5Config configuration representing the ui5.yaml
|
|
64
53
|
* @param customConfig custom configuration
|
|
65
54
|
*/
|
|
66
|
-
function enhanceUI5YamlWithCustomConfig(ui5Config, customConfig) {
|
|
55
|
+
export function enhanceUI5YamlWithCustomConfig(ui5Config, customConfig) {
|
|
67
56
|
const adp = customConfig?.adp;
|
|
68
57
|
if (adp) {
|
|
69
58
|
const { support } = adp;
|
|
@@ -77,7 +66,7 @@ function enhanceUI5YamlWithCustomConfig(ui5Config, customConfig) {
|
|
|
77
66
|
* @param {AdpWriterConfig} config - The configuration object containing options for the adaptation project.
|
|
78
67
|
* @param {boolean} [config.options.enableTypeScript] - Flag indicating if TypeScript support is enabled.
|
|
79
68
|
*/
|
|
80
|
-
function enhanceUI5YamlWithTranspileMiddleware(ui5Config, config) {
|
|
69
|
+
export function enhanceUI5YamlWithTranspileMiddleware(ui5Config, config) {
|
|
81
70
|
if (config.options?.enableTypeScript) {
|
|
82
71
|
ui5Config.updateCustomMiddleware({
|
|
83
72
|
name: 'ui5-tooling-transpile-middleware',
|
|
@@ -97,7 +86,7 @@ function enhanceUI5YamlWithTranspileMiddleware(ui5Config, config) {
|
|
|
97
86
|
* @param config a writer configuration
|
|
98
87
|
* @returns typecasted config if it contains a deploy config
|
|
99
88
|
*/
|
|
100
|
-
function hasDeployConfig(config) {
|
|
89
|
+
export function hasDeployConfig(config) {
|
|
101
90
|
return !!config.deploy;
|
|
102
91
|
}
|
|
103
92
|
/**
|
|
@@ -106,7 +95,7 @@ function hasDeployConfig(config) {
|
|
|
106
95
|
* @param ui5Config configuration representing the ui5.yaml
|
|
107
96
|
* @param config full project configuration
|
|
108
97
|
*/
|
|
109
|
-
function enhanceUI5DeployYaml(ui5Config, config) {
|
|
98
|
+
export function enhanceUI5DeployYaml(ui5Config, config) {
|
|
110
99
|
ui5Config.addAbapDeployTask(config.target, config.deploy, config.options?.fioriTools === true);
|
|
111
100
|
}
|
|
112
101
|
/**
|
|
@@ -214,8 +203,8 @@ function getAdpCloudCustomTasks(config) {
|
|
|
214
203
|
}
|
|
215
204
|
else {
|
|
216
205
|
const customConfig = config.customConfig?.adp;
|
|
217
|
-
const isCloudProjectInPrivateCloudSystem = customConfig?.projectType ===
|
|
218
|
-
customConfig.supportedProject ===
|
|
206
|
+
const isCloudProjectInPrivateCloudSystem = customConfig?.projectType === AdaptationProjectType.CLOUD_READY &&
|
|
207
|
+
customConfig.supportedProject === SupportedProject.CLOUD_READY_AND_ON_PREM;
|
|
219
208
|
const client = isCloudProjectInPrivateCloudSystem ? config.target.client : undefined;
|
|
220
209
|
target = {
|
|
221
210
|
url: config.target.url ?? VSCODE_URL,
|
|
@@ -279,7 +268,7 @@ function getInboundChangeContentWithNewInboundID(flpConfiguration, appId) {
|
|
|
279
268
|
* @param appId Application variant id
|
|
280
269
|
* @param manifestChangeContent Application variant change content
|
|
281
270
|
*/
|
|
282
|
-
function enhanceManifestChangeContentWithFlpConfig(flpConfigurations, appId, manifestChangeContent = []) {
|
|
271
|
+
export function enhanceManifestChangeContentWithFlpConfig(flpConfigurations, appId, manifestChangeContent = []) {
|
|
283
272
|
flpConfigurations.forEach((flpConfig) => {
|
|
284
273
|
const inboundChangeContent = getInboundChangeContentWithNewInboundID(flpConfig, appId);
|
|
285
274
|
const addInboundChange = {
|
|
@@ -298,7 +287,7 @@ function enhanceManifestChangeContentWithFlpConfig(flpConfigurations, appId, man
|
|
|
298
287
|
* @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
|
|
299
288
|
* @param {CfAdpWriterConfig} config - Full project configuration.
|
|
300
289
|
*/
|
|
301
|
-
function enhanceUI5YamlWithCfCustomTask(ui5Config, config) {
|
|
290
|
+
export function enhanceUI5YamlWithCfCustomTask(ui5Config, config) {
|
|
302
291
|
const { baseApp, cf, project } = config;
|
|
303
292
|
ui5Config.addCustomTasks([
|
|
304
293
|
{
|
|
@@ -324,9 +313,9 @@ function enhanceUI5YamlWithCfCustomTask(ui5Config, config) {
|
|
|
324
313
|
*
|
|
325
314
|
* @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
|
|
326
315
|
*/
|
|
327
|
-
function enhanceUI5YamlWithFioriToolsMiddleware(ui5Config) {
|
|
316
|
+
export function enhanceUI5YamlWithFioriToolsMiddleware(ui5Config) {
|
|
328
317
|
const ui5ConfigOptions = {
|
|
329
|
-
url:
|
|
318
|
+
url: UI5_CDN_URL
|
|
330
319
|
};
|
|
331
320
|
// Add backend-proxy-middleware-cf as the first middleware (after compression)
|
|
332
321
|
ui5Config.addCustomMiddleware([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { AdpWriterConfig, TypesConfig, CfAdpWriterConfig, DescriptorVariant } from '../types';
|
|
2
|
+
import type { AdpWriterConfig, TypesConfig, CfAdpWriterConfig, DescriptorVariant } from '../types.js';
|
|
3
3
|
import type { Package } from '@sap-ux/project-access';
|
|
4
4
|
/**
|
|
5
5
|
* Retrieves the package name and version from the package.json file located two levels up the directory tree.
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.writeUI5Yaml = writeUI5Yaml;
|
|
8
|
-
exports.writeCfUI5Yaml = writeCfUI5Yaml;
|
|
9
|
-
exports.writeUI5DeployYaml = writeUI5DeployYaml;
|
|
10
|
-
exports.writeCfTemplates = writeCfTemplates;
|
|
11
|
-
const node_path_1 = require("node:path");
|
|
12
|
-
const node_fs_1 = require("node:fs");
|
|
13
|
-
const options_1 = require("./options");
|
|
14
|
-
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
1
|
+
import { dirname, join } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
import { enhanceUI5DeployYaml, enhanceUI5Yaml, hasDeployConfig, enhanceUI5YamlWithCustomConfig, enhanceUI5YamlWithCustomTask, enhanceUI5YamlWithTranspileMiddleware, enhanceUI5YamlWithCfCustomTask, enhanceUI5YamlWithFioriToolsMiddleware } from './options.js';
|
|
6
|
+
import { UI5Config, UI5_DEFAULT, getEsmTypesVersion, getTypesPackage, getTypesVersion } from '@sap-ux/ui5-config';
|
|
15
7
|
/**
|
|
16
8
|
* Retrieves the package name and version from the package.json file located two levels up the directory tree.
|
|
17
9
|
*
|
|
18
10
|
* @returns {Package} An object containing the `name` and `version` of the package.
|
|
19
11
|
*/
|
|
20
|
-
function getPackageJSONInfo() {
|
|
12
|
+
export function getPackageJSONInfo() {
|
|
21
13
|
const defaultPackage = {
|
|
22
14
|
name: '@sap-ux/adp-tooling',
|
|
23
15
|
version: 'NO_VERSION_FOUND'
|
|
24
16
|
};
|
|
25
17
|
try {
|
|
26
|
-
return JSON.parse(
|
|
18
|
+
return JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf-8'));
|
|
27
19
|
}
|
|
28
20
|
catch (e) {
|
|
29
21
|
return defaultPackage;
|
|
@@ -39,16 +31,16 @@ function getPackageJSONInfo() {
|
|
|
39
31
|
* @param {string} [ui5Version] - The version of UI5 (e.g., `"1.108.0"` or `"snapshot"`).
|
|
40
32
|
* @returns {TypesConfig} - The package name and version string for the UI5 types.
|
|
41
33
|
*/
|
|
42
|
-
function getTypes(ui5Version) {
|
|
34
|
+
export function getTypes(ui5Version) {
|
|
43
35
|
if (ui5Version?.includes('snapshot')) {
|
|
44
36
|
return {
|
|
45
|
-
typesPackage:
|
|
46
|
-
typesVersion: `~${
|
|
37
|
+
typesPackage: UI5_DEFAULT.TYPES_PACKAGE_NAME,
|
|
38
|
+
typesVersion: `~${UI5_DEFAULT.TYPES_VERSION_BEST}`
|
|
47
39
|
};
|
|
48
40
|
}
|
|
49
|
-
const typesPackage =
|
|
50
|
-
const isTypesPackage = typesPackage ===
|
|
51
|
-
const typesVersion = isTypesPackage ?
|
|
41
|
+
const typesPackage = getTypesPackage(ui5Version);
|
|
42
|
+
const isTypesPackage = typesPackage === UI5_DEFAULT.TYPES_PACKAGE_NAME;
|
|
43
|
+
const typesVersion = isTypesPackage ? getTypesVersion(ui5Version) : getEsmTypesVersion(ui5Version);
|
|
52
44
|
return {
|
|
53
45
|
typesPackage,
|
|
54
46
|
typesVersion
|
|
@@ -60,7 +52,7 @@ function getTypes(ui5Version) {
|
|
|
60
52
|
* @param {CfAdpWriterConfig} config - The CF configuration.
|
|
61
53
|
* @returns {DescriptorVariant} The variant for the CF project.
|
|
62
54
|
*/
|
|
63
|
-
function getCfVariant(config) {
|
|
55
|
+
export function getCfVariant(config) {
|
|
64
56
|
const { app, ui5 } = config;
|
|
65
57
|
const variant = {
|
|
66
58
|
layer: app.layer,
|
|
@@ -94,10 +86,10 @@ function getCfVariant(config) {
|
|
|
94
86
|
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
95
87
|
* @returns {void}
|
|
96
88
|
*/
|
|
97
|
-
function writeTemplateToFolder(baseTmplPath, projectPath, data, fs) {
|
|
89
|
+
export function writeTemplateToFolder(baseTmplPath, projectPath, data, fs) {
|
|
98
90
|
const ui5Version = data.ui5?.version;
|
|
99
|
-
const tmplPath =
|
|
100
|
-
const tsConfigPath =
|
|
91
|
+
const tmplPath = join(baseTmplPath, 'project', '**/*.*');
|
|
92
|
+
const tsConfigPath = join(baseTmplPath, 'typescript', 'tsconfig.json');
|
|
101
93
|
const { typesPackage, typesVersion } = getTypes(ui5Version);
|
|
102
94
|
try {
|
|
103
95
|
fs.copyTpl(tmplPath, projectPath, { ...data, typesPackage, typesVersion }, undefined, {
|
|
@@ -106,7 +98,7 @@ function writeTemplateToFolder(baseTmplPath, projectPath, data, fs) {
|
|
|
106
98
|
});
|
|
107
99
|
if (data.options?.enableTypeScript) {
|
|
108
100
|
const id = data.app?.id?.split('.').join('/');
|
|
109
|
-
fs.copyTpl(tsConfigPath,
|
|
101
|
+
fs.copyTpl(tsConfigPath, join(projectPath, 'tsconfig.json'), { id, typesPackage }, undefined, {
|
|
110
102
|
globOptions: { dot: true }
|
|
111
103
|
});
|
|
112
104
|
}
|
|
@@ -123,16 +115,16 @@ function writeTemplateToFolder(baseTmplPath, projectPath, data, fs) {
|
|
|
123
115
|
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
124
116
|
* @returns {void}
|
|
125
117
|
*/
|
|
126
|
-
async function writeUI5Yaml(projectPath, data, fs) {
|
|
118
|
+
export async function writeUI5Yaml(projectPath, data, fs) {
|
|
127
119
|
try {
|
|
128
|
-
const ui5ConfigPath =
|
|
120
|
+
const ui5ConfigPath = join(projectPath, 'ui5.yaml');
|
|
129
121
|
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
130
|
-
const ui5Config = await
|
|
122
|
+
const ui5Config = await UI5Config.newInstance(baseUi5ConfigContent);
|
|
131
123
|
ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8' });
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
124
|
+
enhanceUI5YamlWithCustomConfig(ui5Config, data.customConfig);
|
|
125
|
+
enhanceUI5YamlWithTranspileMiddleware(ui5Config, data);
|
|
126
|
+
enhanceUI5Yaml(ui5Config, data);
|
|
127
|
+
enhanceUI5YamlWithCustomTask(ui5Config, data);
|
|
136
128
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
137
129
|
}
|
|
138
130
|
catch (e) {
|
|
@@ -147,17 +139,17 @@ async function writeUI5Yaml(projectPath, data, fs) {
|
|
|
147
139
|
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
148
140
|
* @returns {void}
|
|
149
141
|
*/
|
|
150
|
-
async function writeCfUI5Yaml(projectPath, data, fs) {
|
|
142
|
+
export async function writeCfUI5Yaml(projectPath, data, fs) {
|
|
151
143
|
try {
|
|
152
|
-
const ui5ConfigPath =
|
|
144
|
+
const ui5ConfigPath = join(projectPath, 'ui5.yaml');
|
|
153
145
|
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
154
|
-
const ui5Config = await
|
|
146
|
+
const ui5Config = await UI5Config.newInstance(baseUi5ConfigContent);
|
|
155
147
|
ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8' });
|
|
156
|
-
|
|
148
|
+
enhanceUI5YamlWithCustomConfig(ui5Config, data.customConfig);
|
|
157
149
|
/** Builder task */
|
|
158
|
-
|
|
150
|
+
enhanceUI5YamlWithCfCustomTask(ui5Config, data);
|
|
159
151
|
/** Middlewares */
|
|
160
|
-
|
|
152
|
+
enhanceUI5YamlWithFioriToolsMiddleware(ui5Config);
|
|
161
153
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
162
154
|
}
|
|
163
155
|
catch (e) {
|
|
@@ -172,14 +164,14 @@ async function writeCfUI5Yaml(projectPath, data, fs) {
|
|
|
172
164
|
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
173
165
|
* @returns {void}
|
|
174
166
|
*/
|
|
175
|
-
async function writeUI5DeployYaml(projectPath, data, fs) {
|
|
167
|
+
export async function writeUI5DeployYaml(projectPath, data, fs) {
|
|
176
168
|
try {
|
|
177
|
-
if (
|
|
178
|
-
const ui5ConfigPath =
|
|
169
|
+
if (hasDeployConfig(data)) {
|
|
170
|
+
const ui5ConfigPath = join(projectPath, 'ui5.yaml');
|
|
179
171
|
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
180
|
-
const ui5DeployConfig = await
|
|
181
|
-
|
|
182
|
-
fs.write(
|
|
172
|
+
const ui5DeployConfig = await UI5Config.newInstance(baseUi5ConfigContent);
|
|
173
|
+
enhanceUI5DeployYaml(ui5DeployConfig, data);
|
|
174
|
+
fs.write(join(projectPath, 'ui5-deploy.yaml'), ui5DeployConfig.toString());
|
|
183
175
|
}
|
|
184
176
|
}
|
|
185
177
|
catch (e) {
|
|
@@ -194,32 +186,32 @@ async function writeUI5DeployYaml(projectPath, data, fs) {
|
|
|
194
186
|
* @param {CfAdpWriterConfig} config - The CF configuration.
|
|
195
187
|
* @param {Editor} fs - The memfs editor instance.
|
|
196
188
|
*/
|
|
197
|
-
async function writeCfTemplates(basePath, variant, config, fs) {
|
|
198
|
-
const baseTmplPath =
|
|
189
|
+
export async function writeCfTemplates(basePath, variant, config, fs) {
|
|
190
|
+
const baseTmplPath = join(__dirname, '../../templates');
|
|
199
191
|
const templatePath = config.options?.templatePathOverwrite ?? baseTmplPath;
|
|
200
192
|
const { app, project, options } = config;
|
|
201
|
-
fs.copyTpl(
|
|
202
|
-
fs.copyTpl(
|
|
193
|
+
fs.copyTpl(join(templatePath, 'project/webapp/manifest.appdescr_variant'), join(project.folder, 'webapp', 'manifest.appdescr_variant'), { app: variant });
|
|
194
|
+
fs.copyTpl(join(templatePath, 'cf/package.json'), join(project.folder, 'package.json'), {
|
|
203
195
|
module: project.name
|
|
204
196
|
});
|
|
205
|
-
fs.copyTpl(
|
|
197
|
+
fs.copyTpl(join(templatePath, 'cf/ui5.yaml'), join(project.folder, 'ui5.yaml'), {
|
|
206
198
|
module: project.name
|
|
207
199
|
});
|
|
208
|
-
fs.copyTpl(
|
|
200
|
+
fs.copyTpl(join(templatePath, 'cf/i18n/i18n.properties'), join(project.folder, 'webapp/i18n/i18n.properties'), {
|
|
209
201
|
module: project.name,
|
|
210
202
|
moduleTitle: app.title,
|
|
211
203
|
appVariantId: app.namespace,
|
|
212
204
|
i18nGuid: config.app.i18nDescription
|
|
213
205
|
});
|
|
214
|
-
fs.copy(
|
|
206
|
+
fs.copy(join(templatePath, 'cf/_gitignore'), join(project.folder, '.gitignore'));
|
|
215
207
|
if (options?.addStandaloneApprouter) {
|
|
216
|
-
fs.copyTpl(
|
|
208
|
+
fs.copyTpl(join(templatePath, 'cf/approuter/package.json'), join(basePath, `${project.name}-approuter/package.json`), {
|
|
217
209
|
projectName: project.name
|
|
218
210
|
});
|
|
219
|
-
fs.copyTpl(
|
|
211
|
+
fs.copyTpl(join(templatePath, 'cf/approuter/xs-app.json'), join(basePath, `${project.name}-approuter/xs-app.json`), {});
|
|
220
212
|
}
|
|
221
|
-
if (!fs.exists(
|
|
222
|
-
fs.copyTpl(
|
|
213
|
+
if (!fs.exists(join(basePath, 'xs-security.json'))) {
|
|
214
|
+
fs.copyTpl(join(templatePath, 'cf/xs-security.json'), join(basePath, 'xs-security.json'), {
|
|
223
215
|
projectName: project.xsSecurityAppName
|
|
224
216
|
});
|
|
225
217
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
2
|
import type { Manifest, Package } from '@sap-ux/project-access';
|
|
3
3
|
import { type AbapServiceProvider, AdaptationProjectType, type KeyUserChangeContent } from '@sap-ux/axios-extension';
|
|
4
|
-
import type { AdpWriterConfig, AttributesAnswers, CfAdpWriterConfig, ConfigAnswers, CreateCfConfigParams, UI5Version } from '../types';
|
|
5
|
-
import { FlexLayer } from '../types';
|
|
4
|
+
import type { AdpWriterConfig, AttributesAnswers, CfAdpWriterConfig, ConfigAnswers, CreateCfConfigParams, UI5Version } from '../types.js';
|
|
5
|
+
import { FlexLayer } from '../types.js';
|
|
6
6
|
export interface ConfigOptions {
|
|
7
7
|
/**
|
|
8
8
|
* The ABAP service provider instance used to retrieve system-specific information.
|