@sap-ux/ui5-application-writer 1.1.6 → 1.2.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.
@@ -1,4 +1,5 @@
1
- import type { App, AppOptions, Package, UI5 } from '../types';
1
+ import type { App, AppOptions, UI5 } from '../types';
2
+ import type { Package } from '@sap-ux/project-access';
2
3
  /**
3
4
  * Returns a package instance with default properties.
4
5
  *
@@ -1,4 +1,5 @@
1
- import type { App, UI5, AppOptions, Package, Ui5App } from '../types';
1
+ import type { App, UI5, AppOptions, Ui5App } from '../types';
2
+ import type { Package } from '@sap-ux/project-access';
2
3
  /**
3
4
  * Merges Ui5App instance with default properties.
4
5
  * Replaces undefined mandatory properties with default values.
@@ -23,6 +23,10 @@ function mergeWithDefaults(ui5App) {
23
23
  // Determine if the project type is 'EDMXBackend'.
24
24
  const isEdmxProjectType = ui5App.app.projectType === 'EDMXBackend';
25
25
  ui5App.package = (0, ui5_config_1.mergeObjects)((0, defaults_1.packageDefaults)(ui5App.package.version, ui5App.app.description, isEdmxProjectType), ui5App.package);
26
+ if (!isEdmxProjectType) {
27
+ // sapuxLayer is not defined for cap projects
28
+ ui5App.package.sapuxLayer = undefined;
29
+ }
26
30
  if (ui5App.appOptions.sapux && isEdmxProjectType) {
27
31
  // Add @sap/ux-specification to devDependencies only for non-CAP projects
28
32
  ui5App.package.devDependencies = ui5App.package.devDependencies || {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { App, AppOptions, Package, UI5 } from './types';
2
+ import type { App, AppOptions, UI5 } from './types';
3
+ import { type Package } from '@sap-ux/project-access';
3
4
  import { Ui5App } from './types';
4
5
  /**
5
6
  * Writes the template to the memfs editor instance.
package/dist/index.js CHANGED
@@ -54,6 +54,8 @@ async function generate(basePath, ui5AppConfig, fs) {
54
54
  });
55
55
  ui5Config.addFioriToolsAppReloadMiddleware();
56
56
  if (isEdmxProjectType) {
57
+ // add preview middleware to ui5Config
58
+ ui5Config.addFioriToolsPreviewMiddleware(ui5App.app.id, ui5App.ui5?.ui5Theme);
57
59
  const ui5LocalConfigPath = (0, path_1.join)(basePath, 'ui5-local.yaml');
58
60
  // write ui5-local.yaml only for non-CAP applications
59
61
  const ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(ui5LocalConfigPath));
@@ -61,6 +63,8 @@ async function generate(basePath, ui5AppConfig, fs) {
61
63
  ui5LocalConfig.addFioriToolsAppReloadMiddleware();
62
64
  // Add optional features
63
65
  await (0, options_1.applyOptionalFeatures)(ui5App, fs, basePath, tmplPath, [ui5Config, ui5LocalConfig]);
66
+ // add preview middleware to ui5LocalConfig
67
+ ui5LocalConfig.addFioriToolsPreviewMiddleware(ui5App.app.id, ui5App.ui5?.ui5Theme);
64
68
  // write ui5 local yaml
65
69
  fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
66
70
  }
package/dist/types.d.ts CHANGED
@@ -1,15 +1,4 @@
1
- import type { ProjectType } from '@sap-ux/project-access';
2
- export interface Package {
3
- name: string;
4
- version?: string;
5
- description?: string;
6
- scripts?: Record<string, string>;
7
- dependencies?: Record<string, string>;
8
- devDependencies?: Record<string, string>;
9
- ui5?: {
10
- dependencies?: string[];
11
- };
12
- }
1
+ import type { ProjectType, Package } from '@sap-ux/project-access';
13
2
  export interface App {
14
3
  id: string;
15
4
  /**
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%3Aui5-application-writer"
11
11
  },
12
- "version": "1.1.6",
12
+ "version": "1.2.0",
13
13
  "license": "Apache-2.0",
14
14
  "main": "dist/index.js",
15
15
  "files": [
@@ -27,7 +27,7 @@
27
27
  "mem-fs": "2.1.0",
28
28
  "mem-fs-editor": "9.4.0",
29
29
  "semver": "7.5.4",
30
- "@sap-ux/ui5-config": "0.24.1"
30
+ "@sap-ux/ui5-config": "0.25.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/ejs": "3.1.2",
@@ -38,7 +38,7 @@
38
38
  "@types/semver": "7.5.2",
39
39
  "fs-extra": "10.0.0",
40
40
  "@sap-ux/eslint-plugin-fiori-tools": "0.5.0",
41
- "@sap-ux/project-access": "1.26.9"
41
+ "@sap-ux/project-access": "1.27.4"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=18.x"
@@ -9,6 +9,9 @@
9
9
  ],
10
10
  "main": "webapp/index.html",
11
11
  "dependencies": {},
12
- "devDependencies": <%- JSON.stringify(package.devDependencies, null, 8) -%>,
13
- "scripts": <%- JSON.stringify(package.scripts, null, 4) -%>
14
- }
12
+ "devDependencies": <%- JSON.stringify(package.devDependencies, null, 8).trim() -%>,
13
+ "scripts": <%- JSON.stringify(package.scripts, null, 4).trim() -%>
14
+ <% if (package.sapuxLayer) { %>
15
+ ,"sapuxLayer": "<%= package.sapuxLayer %>"
16
+ <% } %>
17
+ }