@sap-ux/adp-tooling 0.16.13 → 0.16.14

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.
@@ -27,7 +27,7 @@ export declare function getFDCRequestArguments(cfConfig: CfConfig): RequestArgum
27
27
  * @param {string[]} appHostIds - The app host ids.
28
28
  * @param {CfConfig} cfConfig - The CF config.
29
29
  * @param {ToolsLogger} logger - The logger.
30
- * @returns {Promise<FDCResponse>} The FDC apps.
30
+ * @returns {Promise<CFApp[]>} The FDC apps.
31
31
  */
32
32
  export declare function getFDCApps(appHostIds: string[], cfConfig: CfConfig, logger: ToolsLogger): Promise<CFApp[]>;
33
33
  /**
@@ -119,7 +119,7 @@ function getFDCRequestArguments(cfConfig) {
119
119
  * @param {string[]} appHostIds - The app host ids.
120
120
  * @param {CfConfig} cfConfig - The CF config.
121
121
  * @param {ToolsLogger} logger - The logger.
122
- * @returns {Promise<FDCResponse>} The FDC apps.
122
+ * @returns {Promise<CFApp[]>} The FDC apps.
123
123
  */
124
124
  async function getFDCApps(appHostIds, cfConfig, logger) {
125
125
  const requestArguments = getFDCRequestArguments(cfConfig);
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "error": {
78
78
  "appDoesNotSupportFlexibility": "The selected application does not support flexibility because it has `flexEnabled=false`. SAPUI5 Adaptation Project only supports applications that support flexibility. Please select a different application.",
79
- "failedToParseXsAppJson": "Failed to parse `xs-app.json`. Error: {{error}}",
79
+ "failedToParseXsAppJson": "Failed to parse the `xs-app.json` file. Error: {{error}}",
80
80
  "failedToParseManifestJson": "Failed to parse the `manifest.json` file. Error: {{error}}",
81
81
  "oDataEndpointsValidationFailed": "Validation for the OData endpoints has failed. For more information, check the logs.",
82
82
  "adpDoesNotSupportSelectedApp": "Adaptation project doesn't support the selected application. Please select a different application.",
package/dist/writer/cf.js CHANGED
@@ -36,6 +36,8 @@ async function generateCf(basePath, config, logger, fs) {
36
36
  const variant = (0, project_utils_1.getCfVariant)(fullConfig);
37
37
  (0, manifest_1.fillDescriptorContent)(variant.content, app.appType, ui5.version, app.i18nModels);
38
38
  await (0, project_utils_1.writeCfTemplates)(basePath, variant, fullConfig, fs);
39
+ await (0, project_utils_1.writeCfUI5Yaml)(fullConfig.project.folder, fullConfig, fs);
40
+ await (0, project_utils_1.writeCfUI5BuildYaml)(fullConfig.project.folder, fullConfig, fs);
39
41
  return fs;
40
42
  }
41
43
  /**
@@ -1,5 +1,5 @@
1
1
  import type { UI5Config } from '@sap-ux/ui5-config';
2
- import type { AdpWriterConfig, Content, CloudApp, InternalInboundNavigation } from '../types';
2
+ import type { AdpWriterConfig, Content, CloudApp, InternalInboundNavigation, CfAdpWriterConfig } from '../types';
3
3
  /**
4
4
  * Generate the configuration for the middlewares required for the ui5.yaml.
5
5
  *
@@ -61,5 +61,18 @@ export declare function enhanceUI5DeployYaml(ui5Config: UI5Config, config: AdpWr
61
61
  * @param manifestChangeContent Application variant change content
62
62
  */
63
63
  export declare function enhanceManifestChangeContentWithFlpConfig(flpConfiguration: InternalInboundNavigation, appId: string, manifestChangeContent?: Content[]): void;
64
+ /**
65
+ * Generate custom configuration required for the ui5.yaml.
66
+ *
67
+ * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
68
+ * @param {CfAdpWriterConfig} config - Full project configuration.
69
+ */
70
+ export declare function enhanceUI5YamlWithCfCustomTask(ui5Config: UI5Config, config: CfAdpWriterConfig): void;
71
+ /**
72
+ * Generate custom configuration required for the ui5.yaml.
73
+ *
74
+ * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
75
+ */
76
+ export declare function enhanceUI5YamlWithCfCustomMiddleware(ui5Config: UI5Config): void;
64
77
  export {};
65
78
  //# sourceMappingURL=options.d.ts.map
@@ -7,6 +7,9 @@ exports.enhanceUI5YamlWithTranspileMiddleware = enhanceUI5YamlWithTranspileMiddl
7
7
  exports.hasDeployConfig = hasDeployConfig;
8
8
  exports.enhanceUI5DeployYaml = enhanceUI5DeployYaml;
9
9
  exports.enhanceManifestChangeContentWithFlpConfig = enhanceManifestChangeContentWithFlpConfig;
10
+ exports.enhanceUI5YamlWithCfCustomTask = enhanceUI5YamlWithCfCustomTask;
11
+ exports.enhanceUI5YamlWithCfCustomMiddleware = enhanceUI5YamlWithCfCustomMiddleware;
12
+ const constants_1 = require("../base/constants");
10
13
  const VSCODE_URL = 'https://REQUIRED_FOR_VSCODE.example';
11
14
  /**
12
15
  * Generate the configuration for the middlewares required for the ui5.yaml.
@@ -289,4 +292,55 @@ function enhanceManifestChangeContentWithFlpConfig(flpConfiguration, appId, mani
289
292
  manifestChangeContent.push(removeOtherInboundsChange);
290
293
  }
291
294
  }
295
+ /**
296
+ * Generate custom configuration required for the ui5.yaml.
297
+ *
298
+ * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
299
+ * @param {CfAdpWriterConfig} config - Full project configuration.
300
+ */
301
+ function enhanceUI5YamlWithCfCustomTask(ui5Config, config) {
302
+ const { baseApp, cf, project } = config;
303
+ ui5Config.addCustomTasks([
304
+ {
305
+ name: 'app-variant-bundler-build',
306
+ beforeTask: 'escapeNonAsciiCharacters',
307
+ configuration: {
308
+ module: project.name,
309
+ appHostId: baseApp.appHostId,
310
+ appName: baseApp.appName,
311
+ appVersion: baseApp.appVersion,
312
+ html5RepoRuntime: cf.html5RepoRuntimeGuid,
313
+ org: cf.org.GUID,
314
+ space: cf.space.GUID,
315
+ sapCloudService: cf.businessSolutionName ?? '',
316
+ serviceInstanceName: cf.businessService
317
+ }
318
+ }
319
+ ]);
320
+ }
321
+ /**
322
+ * Generate custom configuration required for the ui5.yaml.
323
+ *
324
+ * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
325
+ */
326
+ function enhanceUI5YamlWithCfCustomMiddleware(ui5Config) {
327
+ const ui5ConfigOptions = {
328
+ url: constants_1.UI5_CDN_URL
329
+ };
330
+ ui5Config.addFioriToolsProxyMiddleware({
331
+ ui5: ui5ConfigOptions,
332
+ backend: []
333
+ }, 'compression');
334
+ ui5Config.addCustomMiddleware([
335
+ {
336
+ name: 'fiori-tools-preview',
337
+ afterMiddleware: 'fiori-tools-proxy',
338
+ configuration: {
339
+ flp: {
340
+ theme: 'sap_horizon'
341
+ }
342
+ }
343
+ }
344
+ ]);
345
+ }
292
346
  //# sourceMappingURL=options.js.map
@@ -36,13 +36,6 @@ export declare function getCustomConfig(environment: OperationsType, { name: id,
36
36
  * @returns {DescriptorVariant} The variant for the CF project.
37
37
  */
38
38
  export declare function getCfVariant(config: CfAdpWriterConfig): DescriptorVariant;
39
- /**
40
- * Get the ADP config for the CF project.
41
- *
42
- * @param {CfAdpWriterConfig} config - The CF configuration.
43
- * @returns {Record<string, unknown>} The ADP config for the CF project.
44
- */
45
- export declare function getCfAdpConfig(config: CfAdpWriterConfig): Record<string, unknown>;
46
39
  /**
47
40
  * Writes a given project template files within a specified folder in the project directory.
48
41
  *
@@ -62,6 +55,24 @@ export declare function writeTemplateToFolder(baseTmplPath: string, projectPath:
62
55
  * @returns {void}
63
56
  */
64
57
  export declare function writeUI5Yaml(projectPath: string, data: AdpWriterConfig, fs: Editor): Promise<void>;
58
+ /**
59
+ * Writes a ui5.yaml file for CF project within a specified folder in the project directory.
60
+ *
61
+ * @param {string} projectPath - The root path of the project.
62
+ * @param {CfAdpWriterConfig} data - The data to be populated in the template file.
63
+ * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
64
+ * @returns {void}
65
+ */
66
+ export declare function writeCfUI5Yaml(projectPath: string, data: CfAdpWriterConfig, fs: Editor): Promise<void>;
67
+ /**
68
+ * Writes a ui5-build.yaml file for CF project within a specified folder in the project directory.
69
+ *
70
+ * @param {string} projectPath - The root path of the project.
71
+ * @param {CfAdpWriterConfig} data - The data to be populated in the template file.
72
+ * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
73
+ * @returns {void}
74
+ */
75
+ export declare function writeCfUI5BuildYaml(projectPath: string, data: CfAdpWriterConfig, fs: Editor): Promise<void>;
65
76
  /**
66
77
  * Writes a ui5-deploy.yaml file within a specified folder in the project directory.
67
78
  *
@@ -4,15 +4,15 @@ exports.getPackageJSONInfo = getPackageJSONInfo;
4
4
  exports.getTypes = getTypes;
5
5
  exports.getCustomConfig = getCustomConfig;
6
6
  exports.getCfVariant = getCfVariant;
7
- exports.getCfAdpConfig = getCfAdpConfig;
8
7
  exports.writeTemplateToFolder = writeTemplateToFolder;
9
8
  exports.writeUI5Yaml = writeUI5Yaml;
9
+ exports.writeCfUI5Yaml = writeCfUI5Yaml;
10
+ exports.writeCfUI5BuildYaml = writeCfUI5BuildYaml;
10
11
  exports.writeUI5DeployYaml = writeUI5DeployYaml;
11
12
  exports.writeCfTemplates = writeCfTemplates;
12
13
  const node_path_1 = require("node:path");
13
14
  const node_fs_1 = require("node:fs");
14
15
  const uuid_1 = require("uuid");
15
- const types_1 = require("../types");
16
16
  const options_1 = require("./options");
17
17
  const ui5_config_1 = require("@sap-ux/ui5-config");
18
18
  /**
@@ -109,28 +109,6 @@ function getCfVariant(config) {
109
109
  };
110
110
  return variant;
111
111
  }
112
- /**
113
- * Get the ADP config for the CF project.
114
- *
115
- * @param {CfAdpWriterConfig} config - The CF configuration.
116
- * @returns {Record<string, unknown>} The ADP config for the CF project.
117
- */
118
- function getCfAdpConfig(config) {
119
- const { app, project, ui5, cf } = config;
120
- const configJson = {
121
- componentname: app.namespace,
122
- appvariant: project.name,
123
- layer: app.layer,
124
- isOVPApp: app.appType === types_1.ApplicationType.FIORI_ELEMENTS_OVP,
125
- isFioriElement: app.appType === types_1.ApplicationType.FIORI_ELEMENTS,
126
- environment: 'CF',
127
- ui5Version: ui5.version,
128
- cfApiUrl: cf.url,
129
- cfSpace: cf.space.GUID,
130
- cfOrganization: cf.org.GUID
131
- };
132
- return configJson;
133
- }
134
112
  /**
135
113
  * Writes a given project template files within a specified folder in the project directory.
136
114
  *
@@ -185,6 +163,50 @@ async function writeUI5Yaml(projectPath, data, fs) {
185
163
  throw new Error(`Could not write ui5.yaml file. Reason: ${e.message}`);
186
164
  }
187
165
  }
166
+ /**
167
+ * Writes a ui5.yaml file for CF project within a specified folder in the project directory.
168
+ *
169
+ * @param {string} projectPath - The root path of the project.
170
+ * @param {CfAdpWriterConfig} data - The data to be populated in the template file.
171
+ * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
172
+ * @returns {void}
173
+ */
174
+ async function writeCfUI5Yaml(projectPath, data, fs) {
175
+ try {
176
+ const ui5ConfigPath = (0, node_path_1.join)(projectPath, 'ui5.yaml');
177
+ const baseUi5ConfigContent = fs.read(ui5ConfigPath);
178
+ const ui5Config = await ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
179
+ ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8', paths: { webapp: 'dist' } });
180
+ /** Middlewares */
181
+ (0, options_1.enhanceUI5YamlWithCfCustomMiddleware)(ui5Config);
182
+ fs.write(ui5ConfigPath, ui5Config.toString());
183
+ }
184
+ catch (e) {
185
+ throw new Error(`Could not write ui5.yaml file. Reason: ${e.message}`);
186
+ }
187
+ }
188
+ /**
189
+ * Writes a ui5-build.yaml file for CF project within a specified folder in the project directory.
190
+ *
191
+ * @param {string} projectPath - The root path of the project.
192
+ * @param {CfAdpWriterConfig} data - The data to be populated in the template file.
193
+ * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
194
+ * @returns {void}
195
+ */
196
+ async function writeCfUI5BuildYaml(projectPath, data, fs) {
197
+ try {
198
+ const ui5ConfigPath = (0, node_path_1.join)(projectPath, 'ui5-build.yaml');
199
+ const baseUi5ConfigContent = fs.read(ui5ConfigPath);
200
+ const ui5Config = await ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
201
+ ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8' });
202
+ /** Builder task */
203
+ (0, options_1.enhanceUI5YamlWithCfCustomTask)(ui5Config, data);
204
+ fs.write(ui5ConfigPath, ui5Config.toString());
205
+ }
206
+ catch (e) {
207
+ throw new Error(`Could not write ui5-build.yaml file. Reason: ${e.message}`);
208
+ }
209
+ }
188
210
  /**
189
211
  * Writes a ui5-deploy.yaml file within a specified folder in the project directory.
190
212
  *
@@ -218,23 +240,17 @@ async function writeUI5DeployYaml(projectPath, data, fs) {
218
240
  async function writeCfTemplates(basePath, variant, config, fs) {
219
241
  const baseTmplPath = (0, node_path_1.join)(__dirname, '../../templates');
220
242
  const templatePath = config.options?.templatePathOverwrite ?? baseTmplPath;
221
- const { app, baseApp, cf, project, options } = config;
243
+ const { app, project, options } = config;
222
244
  fs.copyTpl((0, node_path_1.join)(templatePath, 'project/webapp/manifest.appdescr_variant'), (0, node_path_1.join)(project.folder, 'webapp', 'manifest.appdescr_variant'), { app: variant });
223
245
  fs.copyTpl((0, node_path_1.join)(templatePath, 'cf/package.json'), (0, node_path_1.join)(project.folder, 'package.json'), {
224
246
  module: project.name
225
247
  });
226
248
  fs.copyTpl((0, node_path_1.join)(templatePath, 'cf/ui5.yaml'), (0, node_path_1.join)(project.folder, 'ui5.yaml'), {
227
- appHostId: baseApp.appHostId,
228
- appName: baseApp.appName,
229
- appVersion: baseApp.appVersion,
230
- module: project.name,
231
- html5RepoRuntime: cf.html5RepoRuntimeGuid,
232
- org: cf.org.GUID,
233
- space: cf.space.GUID,
234
- sapCloudService: cf.businessSolutionName ?? '',
235
- instanceName: cf.businessService
249
+ module: project.name
250
+ });
251
+ fs.copyTpl((0, node_path_1.join)(templatePath, 'cf/ui5-build.yaml'), (0, node_path_1.join)(project.folder, 'ui5-build.yaml'), {
252
+ module: project.name
236
253
  });
237
- fs.writeJSON((0, node_path_1.join)(project.folder, '.adp/config.json'), getCfAdpConfig(config));
238
254
  fs.copyTpl((0, node_path_1.join)(templatePath, 'cf/i18n/i18n.properties'), (0, node_path_1.join)(project.folder, 'webapp/i18n/i18n.properties'), {
239
255
  module: project.name,
240
256
  moduleTitle: app.title,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
11
11
  },
12
- "version": "0.16.13",
12
+ "version": "0.16.14",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -4,7 +4,9 @@
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "build": "npm run clean && ui5 build --include-task=generateCachebusterInfo && npm run zip",
7
+ "prestart": "npm run build",
8
+ "start": "fiori run --open /test/flp.html#app-preview",
9
+ "build": "npm run clean && ui5 build --config ui5-build.yaml --include-task=generateCachebusterInfo && npm run zip",
8
10
  "zip": "cd dist && npx bestzip ../<%= module %>.zip *",
9
11
  "clean": "npx rimraf <%= module %>.zip dist",
10
12
  "build-ui5": "npm explore @ui5/task-adaptation -- npm run rollup"
@@ -20,11 +22,12 @@
20
22
  ]
21
23
  },
22
24
  "devDependencies": {
23
- "@sap/ui5-builder-webide-extension": "1.0.x",
24
- "@sapui5/ts-types": "^1.85.1",
25
- "@ui5/cli": "^3.0.0",
26
- "@ui5/task-adaptation": "^1.0.x",
27
- "bestzip": "2.1.4",
28
- "rimraf": "3.0.2"
25
+ "@sap/ui5-builder-webide-extension": "^1.1.9",
26
+ "@sapui5/ts-types": "^1.141.2",
27
+ "@sap/ux-ui5-tooling": "1",
28
+ "@ui5/cli": "^4.0.16",
29
+ "@ui5/task-adaptation": "^1.5.3",
30
+ "bestzip": "^2.2.1",
31
+ "rimraf": "^5.0.5"
29
32
  }
30
33
  }
@@ -0,0 +1,5 @@
1
+ ---
2
+ specVersion: "2.2"
3
+ type: application
4
+ metadata:
5
+ name: <%= module %>
@@ -3,17 +3,3 @@ specVersion: "2.2"
3
3
  type: application
4
4
  metadata:
5
5
  name: <%= module %>
6
- builder:
7
- customTasks:
8
- - name: app-variant-bundler-build
9
- beforeTask: escapeNonAsciiCharacters
10
- configuration:
11
- appHostId: <%= appHostId %>
12
- appName: <%= appName %>
13
- appVersion: <%= appVersion %>
14
- moduleName: <%= module %>
15
- org: <%= org %>
16
- space: <%= space %>
17
- html5RepoRuntime: <%= html5RepoRuntime %>
18
- sapCloudService: <%= sapCloudService %>
19
- serviceInstanceName: <%= instanceName %>