@sap-ux/ui5-application-writer 1.9.2 → 2.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.
@@ -1,4 +1,4 @@
1
- import type { App, AppOptions, UI5 } from '../types';
1
+ import type { App, AppOptions, UI5 } from '../types.js';
2
2
  import type { Package } from '@sap-ux/project-access';
3
3
  /**
4
4
  * Returns a package instance with default properties.
@@ -1,19 +1,9 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.defaultUI5Libs = void 0;
7
- exports.packageDefaults = packageDefaults;
8
- exports.mergeApp = mergeApp;
9
- exports.mergeUi5 = mergeUi5;
10
- exports.getManifestVersion = getManifestVersion;
11
- const ui5_config_1 = require("@sap-ux/ui5-config");
12
- const mapping_json_1 = __importDefault(require("@ui5/manifest/mapping.json")); // from https://github.com/SAP/ui5-manifest/blob/master/mapping.json
13
- const ui5Libs_1 = require("./ui5Libs");
14
- const semver_1 = __importDefault(require("semver"));
15
- const i18n_1 = require("../i18n");
16
- const mergeWith_1 = __importDefault(require("lodash/mergeWith"));
1
+ import { UI5_DEFAULT, getEsmTypesVersion, getTypesVersion, getTypesPackage } from '@sap-ux/ui5-config';
2
+ import versionToManifestDescMapping from '@ui5/manifest/mapping.json' with { type: 'json' }; // from https://github.com/SAP/ui5-manifest/blob/master/mapping.json
3
+ import { getUI5Libs } from './ui5Libs.js';
4
+ import semVer from 'semver';
5
+ import { t } from '../i18n.js';
6
+ import merge from 'lodash/mergeWith.js';
17
7
  /**
18
8
  * Returns a package instance with default properties.
19
9
  *
@@ -22,7 +12,7 @@ const mergeWith_1 = __importDefault(require("lodash/mergeWith"));
22
12
  * @param {boolean} [isEdmxProjectType] - whether the project type is Edmx or CAP
23
13
  * @returns {Partial<Package>} the package instance
24
14
  */
25
- function packageDefaults(version, description, isEdmxProjectType) {
15
+ export function packageDefaults(version, description, isEdmxProjectType) {
26
16
  const defaults = {
27
17
  version: version || '0.0.1',
28
18
  description: description || '',
@@ -53,12 +43,12 @@ function packageDefaults(version, description, isEdmxProjectType) {
53
43
  * @param {App} app - specifies the application properties
54
44
  * @returns {Partial<App>} the App instance
55
45
  */
56
- function mergeApp(app) {
57
- return (0, mergeWith_1.default)({
46
+ export function mergeApp(app) {
47
+ return merge({
58
48
  version: '0.0.1',
59
- title: (0, i18n_1.t)('text.defaultAppTitle', { id: app.id }),
60
- description: (0, i18n_1.t)('text.defaultAppDescription', { id: app.id }),
61
- baseComponent: "sap/ui/core/UIComponent" /* UI5_DEFAULT.BASE_COMPONENT */,
49
+ title: t('text.defaultAppTitle', { id: app.id }),
50
+ description: t('text.defaultAppDescription', { id: app.id }),
51
+ baseComponent: UI5_DEFAULT.BASE_COMPONENT,
62
52
  sourceTemplate: {
63
53
  id: app.sourceTemplate?.id ?? '',
64
54
  version: app.sourceTemplate?.version ?? '',
@@ -67,7 +57,7 @@ function mergeApp(app) {
67
57
  }, app);
68
58
  }
69
59
  // Required default libs
70
- exports.defaultUI5Libs = ['sap.m', 'sap.ui.core'];
60
+ export const defaultUI5Libs = ['sap.m', 'sap.ui.core'];
71
61
  /**
72
62
  * Merges version properties with the provided UI5 instance.
73
63
  * Coerces provided UI5 versions to valid semantic versions.
@@ -76,10 +66,10 @@ exports.defaultUI5Libs = ['sap.m', 'sap.ui.core'];
76
66
  * @param options - application options
77
67
  * @returns {UI5} the updated copy of UI5 instance (does not change `ui5`)
78
68
  */
79
- function mergeUi5(ui5, options) {
80
- const version = ui5.version ?? "" /* UI5_DEFAULT.DEFAULT_UI5_VERSION */; // Undefined or null indicates the latest available should be used
69
+ export function mergeUi5(ui5, options) {
70
+ const version = ui5.version ?? UI5_DEFAULT.DEFAULT_UI5_VERSION; // Undefined or null indicates the latest available should be used
81
71
  const framework = ui5.framework ?? 'SAPUI5';
82
- const defaultFrameworkUrl = framework === 'SAPUI5' ? "https://ui5.sap.com" /* UI5_DEFAULT.SAPUI5_CDN */ : "https://sdk.openui5.org" /* UI5_DEFAULT.OPENUI5_CDN */;
72
+ const defaultFrameworkUrl = framework === 'SAPUI5' ? UI5_DEFAULT.SAPUI5_CDN : UI5_DEFAULT.OPENUI5_CDN;
83
73
  const merged = {
84
74
  minUI5Version: getMinUI5Version(version, ui5.minUI5Version),
85
75
  localVersion: getLocalVersion({ framework, version, localVersion: ui5.localVersion }),
@@ -89,13 +79,13 @@ function mergeUi5(ui5, options) {
89
79
  };
90
80
  merged.descriptorVersion = getManifestVersion(merged.minUI5Version, ui5.descriptorVersion);
91
81
  merged.typesVersion =
92
- ui5.typesVersion ?? (options?.typescript ? ui5_config_1.getEsmTypesVersion : ui5_config_1.getTypesVersion)(merged.minUI5Version);
93
- merged.typesPackage = (0, ui5_config_1.getTypesPackage)(merged.typesVersion);
82
+ ui5.typesVersion ?? (options?.typescript ? getEsmTypesVersion : getTypesVersion)(merged.minUI5Version);
83
+ merged.typesPackage = getTypesPackage(merged.typesVersion);
94
84
  merged.ui5Theme = ui5.ui5Theme ?? 'sap_fiori_3';
95
85
  if (ui5.manifestLibs && ui5.manifestLibs.length > 0) {
96
- merged.manifestLibs = (0, ui5Libs_1.getUI5Libs)(ui5.manifestLibs);
86
+ merged.manifestLibs = getUI5Libs(ui5.manifestLibs);
97
87
  }
98
- merged.ui5Libs = (0, ui5Libs_1.getUI5Libs)(ui5.ui5Libs);
88
+ merged.ui5Libs = getUI5Libs(ui5.ui5Libs);
99
89
  return { ...ui5, ...merged };
100
90
  }
101
91
  /**
@@ -106,7 +96,7 @@ function mergeUi5(ui5, options) {
106
96
  * @returns minimum UI5 version for manifest
107
97
  */
108
98
  function getMinUI5Version(ui5Version, minUI5Version) {
109
- return minUI5Version ?? (ui5Version ? ui5Version : "1.60.0" /* UI5_DEFAULT.MIN_UI5_VERSION */);
99
+ return minUI5Version ?? (ui5Version ? ui5Version : UI5_DEFAULT.MIN_UI5_VERSION);
110
100
  }
111
101
  /**
112
102
  * Get the manifest descriptor version from the specified UI5 version.
@@ -117,8 +107,8 @@ function getMinUI5Version(ui5Version, minUI5Version) {
117
107
  * @param manifestVersion - optional manifest descriptor version to be used if provided
118
108
  * @returns - the manifest descriptor version
119
109
  */
120
- function getManifestVersion(ui5Version, manifestVersion) {
121
- const ui5SemVer = semver_1.default.coerce(ui5Version);
110
+ export function getManifestVersion(ui5Version, manifestVersion) {
111
+ const ui5SemVer = semVer.coerce(ui5Version);
122
112
  /**
123
113
  * Finds the closest manifest version for the specified ui5 version. This is determined
124
114
  * by finding the closest lower ui5 version and returning its corresponding manifest version.
@@ -135,22 +125,22 @@ function getManifestVersion(ui5Version, manifestVersion) {
135
125
  * @returns closest matching manifest version or undefined, if none found (below lowest value)
136
126
  */
137
127
  const getClosestManifestVersion = (version) => {
138
- const verToManifestVer = mapping_json_1.default;
139
- let matchVersion = verToManifestVer[`${semver_1.default.major(version)}.${semver_1.default.minor(version)}`];
128
+ const verToManifestVer = versionToManifestDescMapping;
129
+ let matchVersion = verToManifestVer[`${semVer.major(version)}.${semVer.minor(version)}`];
140
130
  if (!matchVersion) {
141
131
  const sortedSemVers = Object.keys(verToManifestVer)
142
132
  .filter((ver) => ver !== 'latest')
143
- .map((verStr) => semver_1.default.coerce(verStr))
144
- .sort((a, b) => semver_1.default.rcompare(a, b));
133
+ .map((verStr) => semVer.coerce(verStr))
134
+ .sort((a, b) => semVer.rcompare(a, b));
145
135
  const latestUI5SemVer = sortedSemVers[0];
146
136
  // ui5 version is greater than the latest use the latest
147
- if (semver_1.default.gt(version, latestUI5SemVer)) {
137
+ if (semVer.gt(version, latestUI5SemVer)) {
148
138
  matchVersion = verToManifestVer[`${latestUI5SemVer.major}.${latestUI5SemVer.minor}`];
149
139
  }
150
140
  else {
151
141
  // Find the nearest lower
152
142
  const nearest = sortedSemVers.find((mapVer) => {
153
- return semver_1.default.gt(version, mapVer);
143
+ return semVer.gt(version, mapVer);
154
144
  });
155
145
  if (nearest) {
156
146
  matchVersion = verToManifestVer[`${nearest.major}.${nearest.minor}`];
@@ -159,7 +149,7 @@ function getManifestVersion(ui5Version, manifestVersion) {
159
149
  }
160
150
  return matchVersion;
161
151
  };
162
- return manifestVersion ?? (ui5SemVer && getClosestManifestVersion(ui5SemVer)) ?? "1.12.0" /* UI5_DEFAULT.MANIFEST_VERSION */;
152
+ return manifestVersion ?? (ui5SemVer && getClosestManifestVersion(ui5SemVer)) ?? UI5_DEFAULT.MANIFEST_VERSION;
163
153
  }
164
154
  /**
165
155
  * If a specific local version is provided, use it, otherwise, sync with version but keep minimum versions in mind.
@@ -175,17 +165,17 @@ function getLocalVersion({ framework, version, localVersion }) {
175
165
  if (localVersion) {
176
166
  return localVersion;
177
167
  }
178
- else if (version === "" /* UI5_DEFAULT.DEFAULT_UI5_VERSION */) {
179
- return "1.95.0" /* UI5_DEFAULT.DEFAULT_LOCAL_UI5_VERSION */;
168
+ else if (version === UI5_DEFAULT.DEFAULT_UI5_VERSION) {
169
+ return UI5_DEFAULT.DEFAULT_LOCAL_UI5_VERSION;
180
170
  }
181
171
  // minimum version available as local libs
182
- const minVersion = framework === 'SAPUI5' ? "1.84.54" /* UI5_DEFAULT.MIN_LOCAL_SAPUI5_VERSION */ : "1.52.5" /* UI5_DEFAULT.MIN_LOCAL_OPENUI5_VERSION */;
172
+ const minVersion = framework === 'SAPUI5' ? UI5_DEFAULT.MIN_LOCAL_SAPUI5_VERSION : UI5_DEFAULT.MIN_LOCAL_OPENUI5_VERSION;
183
173
  // If the ui5 `version` is higher than the min framework version 'result' then use that as the local version instead
184
174
  // Update to a valid coerced version string e.g. snapshot-1.80 -> 1.80.0. Cannot be null as previously validated.
185
- const versionSemVer = semver_1.default.coerce(version);
186
- const minSemVer = semver_1.default.coerce(minVersion);
187
- if (versionSemVer && minSemVer && semver_1.default.gt(versionSemVer, minSemVer)) {
188
- return semver_1.default.valid(versionSemVer);
175
+ const versionSemVer = semVer.coerce(version);
176
+ const minSemVer = semVer.coerce(minVersion);
177
+ if (versionSemVer && minSemVer && semVer.gt(versionSemVer, minSemVer)) {
178
+ return semVer.valid(versionSemVer);
189
179
  }
190
180
  else {
191
181
  return minVersion;
@@ -1,4 +1,4 @@
1
- import type { App, UI5, AppOptions, Ui5App } from '../types';
1
+ import type { App, UI5, AppOptions, Ui5App } from '../types.js';
2
2
  import type { Package } from '@sap-ux/project-access';
3
3
  /**
4
4
  * Merges Ui5App instance with default properties.
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeWithDefaults = mergeWithDefaults;
4
- const ui5_config_1 = require("@sap-ux/ui5-config");
5
- const defaults_1 = require("./defaults");
6
- const validators_1 = require("./validators");
1
+ import { mergeObjects } from '@sap-ux/ui5-config';
2
+ import { mergeApp, packageDefaults, mergeUi5 } from './defaults.js';
3
+ import { validate } from './validators.js';
7
4
  /**
8
5
  * Merges Ui5App instance with default properties.
9
6
  * Replaces undefined mandatory properties with default values.
@@ -11,18 +8,18 @@ const validators_1 = require("./validators");
11
8
  * @param {Ui5App} ui5App - the Ui5App instance
12
9
  * @returns {Ui5App} - a new Ui5App instance with all required defaults set
13
10
  */
14
- function mergeWithDefaults(ui5App) {
15
- (0, validators_1.validate)(ui5App);
16
- ui5App.app = (0, defaults_1.mergeApp)(ui5App.app);
11
+ export function mergeWithDefaults(ui5App) {
12
+ validate(ui5App);
13
+ ui5App.app = mergeApp(ui5App.app);
17
14
  ui5App.appOptions = ui5App.appOptions || {};
18
15
  // if typescript is enabled then enable eslint too
19
16
  if (ui5App.appOptions.typescript) {
20
17
  ui5App.appOptions.eslint = true;
21
18
  }
22
- ui5App.ui5 = (0, defaults_1.mergeUi5)(ui5App.ui5 || {}, ui5App.appOptions);
19
+ ui5App.ui5 = mergeUi5(ui5App.ui5 || {}, ui5App.appOptions);
23
20
  // Determine if the project type is 'EDMXBackend'.
24
21
  const isEdmxProjectType = ui5App.app.projectType === 'EDMXBackend';
25
- ui5App.package = (0, ui5_config_1.mergeObjects)((0, defaults_1.packageDefaults)(ui5App.package.version, ui5App.app.description, isEdmxProjectType), ui5App.package);
22
+ ui5App.package = mergeObjects(packageDefaults(ui5App.package.version, ui5App.app.description, isEdmxProjectType), ui5App.package);
26
23
  if (!isEdmxProjectType) {
27
24
  // sapuxLayer is not defined for cap projects
28
25
  ui5App.package.sapuxLayer = undefined;
@@ -1,24 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ui5NPMSupport = exports.ui5TSSupport = exports.getUI5Libs = void 0;
4
- const defaults_1 = require("./defaults");
1
+ import { defaultUI5Libs } from './defaults.js';
5
2
  /**
6
3
  * Merges the specified ui5 libs with the defaults.
7
4
  *
8
5
  * @param ui5Libs - The ui5 libraries to be merged with the defaults
9
6
  * @returns UI5 libs with defaults
10
7
  */
11
- const getUI5Libs = (ui5Libs) => {
8
+ export const getUI5Libs = (ui5Libs) => {
12
9
  const libs = Array.isArray(ui5Libs) ? ui5Libs : ui5Libs?.split(',') || [];
13
- return defaults_1.defaultUI5Libs.concat(libs).filter((value, index, self) => {
10
+ return defaultUI5Libs.concat(libs).filter((value, index, self) => {
14
11
  return self.indexOf(value) === index;
15
12
  });
16
13
  };
17
- exports.getUI5Libs = getUI5Libs;
18
14
  /**
19
15
  * UI5 task and middleware configurations required for TypeScript projects
20
16
  */
21
- exports.ui5TSSupport = {
17
+ export const ui5TSSupport = {
22
18
  task: {
23
19
  name: 'ui5-tooling-transpile-task',
24
20
  afterTask: 'replaceVersion',
@@ -44,7 +40,7 @@ exports.ui5TSSupport = {
44
40
  /**
45
41
  * UI5 tasks and middleware configurations required for including npm modules
46
42
  */
47
- exports.ui5NPMSupport = {
43
+ export const ui5NPMSupport = {
48
44
  task: {
49
45
  name: 'ui5-tooling-modules-task',
50
46
  afterTask: 'replaceVersion',
@@ -1,4 +1,4 @@
1
- import type { Ui5App } from '../types';
1
+ import type { Ui5App } from '../types.js';
2
2
  /**
3
3
  * Validates the specified app id to ensure we do not create malformed documents.
4
4
  *
@@ -1,13 +1,5 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateAppId = validateAppId;
7
- exports.validateUI5Version = validateUI5Version;
8
- exports.validate = validate;
9
- const semver_1 = __importDefault(require("semver"));
10
- const i18n_1 = require("../i18n");
1
+ import semVer from 'semver';
2
+ import { t } from '../i18n.js';
11
3
  /**
12
4
  * Validates the specified app id to ensure we do not create malformed documents.
13
5
  *
@@ -15,13 +7,13 @@ const i18n_1 = require("../i18n");
15
7
  * @throws Error with validation message, if the app id is not valid
16
8
  * @returns true, if app id is validated
17
9
  */
18
- function validateAppId(appId) {
10
+ export function validateAppId(appId) {
19
11
  if (!appId) {
20
- throw new Error((0, i18n_1.t)('error.missingRequiredProperty', { propertyName: 'app.id' }));
12
+ throw new Error(t('error.missingRequiredProperty', { propertyName: 'app.id' }));
21
13
  }
22
14
  const match = appId.match(/"/);
23
15
  if (match) {
24
- throw new Error((0, i18n_1.t)('error.disallowedCharacters', { propertyName: 'app.id', disallowedChars: `${match?.join()}` }));
16
+ throw new Error(t('error.disallowedCharacters', { propertyName: 'app.id', disallowedChars: `${match?.join()}` }));
25
17
  }
26
18
  return true;
27
19
  }
@@ -33,9 +25,9 @@ function validateAppId(appId) {
33
25
  * @param version - the UI5 version string to validate
34
26
  * @returns - true if the specified UI5 version is considered valid
35
27
  */
36
- function validateUI5Version(version) {
37
- if (version && semver_1.default.coerce(version) === null) {
38
- throw new Error((0, i18n_1.t)('error.invalidUI5Version', { version }));
28
+ export function validateUI5Version(version) {
29
+ if (version && semVer.coerce(version) === null) {
30
+ throw new Error(t('error.invalidUI5Version', { version }));
39
31
  }
40
32
  return true;
41
33
  }
@@ -46,7 +38,7 @@ function validateUI5Version(version) {
46
38
  * @returns true, if the ui5App is valid
47
39
  * @throws Error with validation message, if the ui5App is not valid
48
40
  */
49
- function validate(ui5App) {
41
+ export function validate(ui5App) {
50
42
  return (validateAppId(ui5App.app.id) &&
51
43
  validateUI5Version(ui5App.ui5?.version) &&
52
44
  validateUI5Version(ui5App.ui5?.localVersion) &&
package/dist/i18n.js CHANGED
@@ -1,23 +1,15 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.i18n = void 0;
7
- exports.initI18n = initI18n;
8
- exports.t = t;
9
- const i18next_1 = __importDefault(require("i18next"));
10
- const ui5_application_writer_i18n_json_1 = __importDefault(require("./translations/ui5-application-writer.i18n.json"));
1
+ import i18next from 'i18next';
2
+ import translations from './translations/ui5-application-writer.i18n.json' with { type: 'json' };
11
3
  const NS = 'ui5-application-writer';
12
- exports.i18n = i18next_1.default.createInstance();
4
+ export const i18n = i18next.createInstance();
13
5
  /**
14
6
  * Initialize i18next with the translations for this module.
15
7
  */
16
- async function initI18n() {
17
- await exports.i18n.init({
8
+ export async function initI18n() {
9
+ await i18n.init({
18
10
  resources: {
19
11
  en: {
20
- [NS]: ui5_application_writer_i18n_json_1.default
12
+ [NS]: translations
21
13
  }
22
14
  },
23
15
  lng: 'en',
@@ -34,8 +26,8 @@ async function initI18n() {
34
26
  * @param options additional options
35
27
  * @returns {string} localized string stored for the given key
36
28
  */
37
- function t(key, options) {
38
- return exports.i18n.t(key, options);
29
+ export function t(key, options) {
30
+ return i18n.t(key, options);
39
31
  }
40
32
  initI18n().catch(() => {
41
33
  // Ignore any errors since the write will still work
package/dist/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import { type Package } from '@sap-ux/project-access';
2
- import { Ui5App } from './types';
1
+ import type { Ui5App } from './types.js';
3
2
  import type { Editor } from 'mem-fs-editor';
4
- import type { App, AppOptions, UI5 } from './types';
5
3
  /**
6
4
  * Writes the template to the memfs editor instance.
7
5
  *
@@ -27,9 +25,10 @@ declare function isTypescriptEnabled(basePath: string, fs?: Editor): Promise<boo
27
25
  * @returns the updated memfs editor instance
28
26
  */
29
27
  declare function enableTypescript(basePath: string, fs?: Editor): Promise<Editor>;
30
- export { Ui5App, generate, enableTypescript, isTypescriptEnabled };
31
- export { App, Package, UI5, AppOptions };
32
- export { addEslintFeature } from './options';
33
- export { compareUI5VersionGte, ui5LtsVersion_1_120, ui5LtsVersion_1_71, processDestinationPath, getTemplateVersionPath } from './utils';
34
- export { getManifestVersion } from './data/defaults';
28
+ export type { Package } from '@sap-ux/project-access';
29
+ export { generate, enableTypescript, isTypescriptEnabled };
30
+ export type { App, Ui5App, UI5, AppOptions } from './types.js';
31
+ export { addEslintFeature } from './options.js';
32
+ export { compareUI5VersionGte, ui5LtsVersion_1_120, ui5LtsVersion_1_71, processDestinationPath, getTemplateVersionPath } from './utils.js';
33
+ export { getManifestVersion } from './data/defaults.js';
35
34
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,18 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getManifestVersion = exports.getTemplateVersionPath = exports.processDestinationPath = exports.ui5LtsVersion_1_71 = exports.ui5LtsVersion_1_120 = exports.compareUI5VersionGte = exports.addEslintFeature = void 0;
4
- exports.generate = generate;
5
- exports.enableTypescript = enableTypescript;
6
- exports.isTypescriptEnabled = isTypescriptEnabled;
7
- const node_path_1 = require("node:path");
8
- const mem_fs_1 = require("mem-fs");
9
- const mem_fs_editor_1 = require("mem-fs-editor");
10
- const ui5_config_1 = require("@sap-ux/ui5-config");
11
- const project_access_1 = require("@sap-ux/project-access");
12
- const data_1 = require("./data");
13
- const ui5Libs_1 = require("./data/ui5Libs");
14
- const options_1 = require("./options");
15
- const utils_1 = require("./utils");
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 { UI5Config, getEsmTypesVersion, getPreviewMiddlewareConfig, getTypesPackage } from '@sap-ux/ui5-config';
6
+ import { getMinimumUI5Version } from '@sap-ux/project-access';
7
+ import { mergeWithDefaults } from './data/index.js';
8
+ import { ui5TSSupport } from './data/ui5Libs.js';
9
+ import { applyOptionalFeatures, enableTypescript as enableTypescriptOption, getTemplateOptions } from './options.js';
10
+ import { copyTemplates } from './utils.js';
11
+ const __dirname = dirname(fileURLToPath(import.meta.url));
16
12
  /**
17
13
  * Writes the template to the memfs editor instance.
18
14
  *
@@ -23,10 +19,10 @@ const utils_1 = require("./utils");
23
19
  */
24
20
  async function generate(basePath, ui5AppConfig, fs) {
25
21
  if (!fs) {
26
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
22
+ fs = create(createStorage());
27
23
  }
28
- const ui5App = (0, data_1.mergeWithDefaults)(ui5AppConfig);
29
- const tmplPath = (0, node_path_1.join)(__dirname, '..', 'templates');
24
+ const ui5App = mergeWithDefaults(ui5AppConfig);
25
+ const tmplPath = join(__dirname, '..', 'templates');
30
26
  const ignore = [ui5AppConfig.appOptions?.typescript ? '**/*.js' : '**/*.ts'];
31
27
  if (ui5AppConfig.appOptions?.generateIndex === false) {
32
28
  ignore.push('**/webapp/index.html');
@@ -39,12 +35,12 @@ async function generate(basePath, ui5AppConfig, fs) {
39
35
  ignore.push('**/gitignore.tmpl');
40
36
  }
41
37
  // Determine the UI5 resource URL based on project type and UI5 framework details
42
- const ui5ResourceUrl = (0, options_1.getTemplateOptions)(isEdmxProjectType, ui5App.ui5?.frameworkUrl, ui5App.ui5?.version);
38
+ const ui5ResourceUrl = getTemplateOptions(isEdmxProjectType, ui5App.ui5?.frameworkUrl, ui5App.ui5?.version);
43
39
  const templateOptions = {
44
40
  ...ui5App,
45
41
  ui5ResourceUrl
46
42
  };
47
- (0, utils_1.copyTemplates)({
43
+ copyTemplates({
48
44
  fs,
49
45
  basePath,
50
46
  tmplPath,
@@ -53,8 +49,8 @@ async function generate(basePath, ui5AppConfig, fs) {
53
49
  ui5Version: ui5App.ui5?.version
54
50
  });
55
51
  // ui5.yaml
56
- const ui5ConfigPath = (0, node_path_1.join)(basePath, 'ui5.yaml');
57
- const ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(ui5ConfigPath));
52
+ const ui5ConfigPath = join(basePath, 'ui5.yaml');
53
+ const ui5Config = await UI5Config.newInstance(fs.read(ui5ConfigPath));
58
54
  ui5Config.addFioriToolsProxyMiddleware({
59
55
  ui5: {
60
56
  url: ui5App.ui5?.frameworkUrl
@@ -62,19 +58,19 @@ async function generate(basePath, ui5AppConfig, fs) {
62
58
  });
63
59
  ui5Config.addFioriToolsAppReloadMiddleware();
64
60
  const previewMiddleWareOpts = getPreviewMiddlewareOpts(ui5App.app, ui5App.ui5?.ui5Theme, ui5AppConfig.appOptions?.useVirtualPreviewEndpoints);
65
- const fioriToolsPreviewConfigMiddlware = (0, ui5_config_1.getPreviewMiddlewareConfig)(previewMiddleWareOpts);
61
+ const fioriToolsPreviewConfigMiddlware = getPreviewMiddlewareConfig(previewMiddleWareOpts);
66
62
  // add preview middleware to ui5Config for edmx projects and cap apps using virtual endpoints
67
63
  if (isEdmxProjectType || ui5AppConfig.appOptions?.useVirtualPreviewEndpoints) {
68
64
  ui5Config.updateCustomMiddleware(fioriToolsPreviewConfigMiddlware);
69
65
  }
70
66
  if (isEdmxProjectType) {
71
- const ui5LocalConfigPath = (0, node_path_1.join)(basePath, 'ui5-local.yaml');
67
+ const ui5LocalConfigPath = join(basePath, 'ui5-local.yaml');
72
68
  // write ui5-local.yaml only for non-CAP applications
73
- const ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(ui5LocalConfigPath));
69
+ const ui5LocalConfig = await UI5Config.newInstance(fs.read(ui5LocalConfigPath));
74
70
  ui5LocalConfig.addUI5Framework(ui5App.ui5.framework, ui5App.ui5.localVersion, ui5App.ui5.ui5Libs, ui5App.ui5.ui5Theme);
75
71
  ui5LocalConfig.addFioriToolsAppReloadMiddleware();
76
72
  // Add optional features
77
- await (0, options_1.applyOptionalFeatures)(ui5App, fs, basePath, tmplPath, [ui5Config, ui5LocalConfig]);
73
+ await applyOptionalFeatures(ui5App, fs, basePath, tmplPath, [ui5Config, ui5LocalConfig]);
78
74
  // add preview middleware to ui5LocalConfig
79
75
  ui5LocalConfig.updateCustomMiddleware(fioriToolsPreviewConfigMiddlware);
80
76
  // write ui5 local yaml
@@ -82,7 +78,7 @@ async function generate(basePath, ui5AppConfig, fs) {
82
78
  }
83
79
  else {
84
80
  // Add optional features
85
- await (0, options_1.applyOptionalFeatures)(ui5App, fs, basePath, tmplPath, [ui5Config]);
81
+ await applyOptionalFeatures(ui5App, fs, basePath, tmplPath, [ui5Config]);
86
82
  }
87
83
  // write ui5 yaml
88
84
  fs.write(ui5ConfigPath, ui5Config.toString());
@@ -119,14 +115,14 @@ function getPreviewMiddlewareOpts(app, ui5Theme, useVirtualPreviewEndpoints = fa
119
115
  */
120
116
  async function isTypescriptEnabled(basePath, fs) {
121
117
  if (!fs) {
122
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
118
+ fs = create(createStorage());
123
119
  }
124
120
  // check middlewares and tasks
125
- const ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read((0, node_path_1.join)(basePath, 'ui5.yaml')));
126
- if (!ui5Config.findCustomMiddleware(ui5Libs_1.ui5TSSupport.middleware.name)) {
121
+ const ui5Config = await UI5Config.newInstance(fs.read(join(basePath, 'ui5.yaml')));
122
+ if (!ui5Config.findCustomMiddleware(ui5TSSupport.middleware.name)) {
127
123
  return false;
128
124
  }
129
- if (!ui5Config.findCustomTask(ui5Libs_1.ui5TSSupport.task.name)) {
125
+ if (!ui5Config.findCustomTask(ui5TSSupport.task.name)) {
130
126
  return false;
131
127
  }
132
128
  return true;
@@ -140,10 +136,10 @@ async function isTypescriptEnabled(basePath, fs) {
140
136
  */
141
137
  async function enableTypescript(basePath, fs) {
142
138
  if (!fs) {
143
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
139
+ fs = create(createStorage());
144
140
  }
145
- const manifestPath = (0, node_path_1.join)(basePath, 'webapp/manifest.json');
146
- const ui5ConfigPath = (0, node_path_1.join)(basePath, 'ui5.yaml');
141
+ const manifestPath = join(basePath, 'webapp/manifest.json');
142
+ const ui5ConfigPath = join(basePath, 'ui5.yaml');
147
143
  if (!fs.exists(manifestPath)) {
148
144
  throw new Error(`Invalid project folder. Cannot find required file ${manifestPath}`);
149
145
  }
@@ -151,11 +147,11 @@ async function enableTypescript(basePath, fs) {
151
147
  throw new Error(`Invalid project folder. Cannot find required file ${ui5ConfigPath}`);
152
148
  }
153
149
  const manifest = fs.readJSON(manifestPath);
154
- const ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(ui5ConfigPath));
155
- const tmplPath = (0, node_path_1.join)(__dirname, '..', 'templates');
150
+ const ui5Config = await UI5Config.newInstance(fs.read(ui5ConfigPath));
151
+ const tmplPath = join(__dirname, '..', 'templates');
156
152
  //By chosing getMinimumUI5Version we assume that the esm type is compatible if there are multiple versions.
157
- const typesVersion = (0, ui5_config_1.getEsmTypesVersion)((0, project_access_1.getMinimumUI5Version)(manifest));
158
- const typesPackage = (0, ui5_config_1.getTypesPackage)(typesVersion);
153
+ const typesVersion = getEsmTypesVersion(getMinimumUI5Version(manifest));
154
+ const typesPackage = getTypesPackage(typesVersion);
159
155
  const ui5App = {
160
156
  app: manifest['sap.app'],
161
157
  ui5: {
@@ -163,18 +159,12 @@ async function enableTypescript(basePath, fs) {
163
159
  typesVersion
164
160
  }
165
161
  };
166
- await (0, options_1.enableTypescript)({ basePath, fs, ui5Configs: [ui5Config], tmplPath, ui5App }, true);
162
+ await enableTypescriptOption({ basePath, fs, ui5Configs: [ui5Config], tmplPath, ui5App }, true);
167
163
  fs.write(ui5ConfigPath, ui5Config.toString());
168
164
  return fs;
169
165
  }
170
- var options_2 = require("./options");
171
- Object.defineProperty(exports, "addEslintFeature", { enumerable: true, get: function () { return options_2.addEslintFeature; } });
172
- var utils_2 = require("./utils");
173
- Object.defineProperty(exports, "compareUI5VersionGte", { enumerable: true, get: function () { return utils_2.compareUI5VersionGte; } });
174
- Object.defineProperty(exports, "ui5LtsVersion_1_120", { enumerable: true, get: function () { return utils_2.ui5LtsVersion_1_120; } });
175
- Object.defineProperty(exports, "ui5LtsVersion_1_71", { enumerable: true, get: function () { return utils_2.ui5LtsVersion_1_71; } });
176
- Object.defineProperty(exports, "processDestinationPath", { enumerable: true, get: function () { return utils_2.processDestinationPath; } });
177
- Object.defineProperty(exports, "getTemplateVersionPath", { enumerable: true, get: function () { return utils_2.getTemplateVersionPath; } });
178
- var defaults_1 = require("./data/defaults");
179
- Object.defineProperty(exports, "getManifestVersion", { enumerable: true, get: function () { return defaults_1.getManifestVersion; } });
166
+ export { generate, enableTypescript, isTypescriptEnabled };
167
+ export { addEslintFeature } from './options.js';
168
+ export { compareUI5VersionGte, ui5LtsVersion_1_120, ui5LtsVersion_1_71, processDestinationPath, getTemplateVersionPath } from './utils.js';
169
+ export { getManifestVersion } from './data/defaults.js';
180
170
  //# sourceMappingURL=index.js.map
package/dist/options.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { UI5, Ui5App } from './types';
2
+ import type { UI5, Ui5App } from './types.js';
3
3
  import type { UI5Config } from '@sap-ux/ui5-config';
4
4
  import type { ProjectType } from '@sap-ux/project-access';
5
5
  /**
package/dist/options.js CHANGED
@@ -1,16 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enableTypescript = enableTypescript;
4
- exports.enableNpmPackageConsumption = enableNpmPackageConsumption;
5
- exports.applyOptionalFeatures = applyOptionalFeatures;
6
- exports.addEslintFeature = addEslintFeature;
7
- exports.getTemplateOptions = getTemplateOptions;
8
- const node_path_1 = require("node:path");
9
- const ejs_1 = require("ejs");
10
- const project_access_1 = require("@sap-ux/project-access");
11
- const ui5Libs_1 = require("./data/ui5Libs");
12
- const ui5_config_1 = require("@sap-ux/ui5-config");
13
- const utils_1 = require("./utils");
1
+ import { dirname, join } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { render } from 'ejs';
4
+ import { getFilePaths } from '@sap-ux/project-access';
5
+ import { ui5NPMSupport, ui5TSSupport } from './data/ui5Libs.js';
6
+ import { mergeObjects, UI5_DEFAULT } from '@sap-ux/ui5-config';
7
+ import { getTemplateVersionPath, processDestinationPath } from './utils.js';
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
9
  /**
15
10
  * Copy all template files into the target project.
16
11
  *
@@ -22,27 +17,27 @@ const utils_1 = require("./utils");
22
17
  * @param input.tmplPath template basepath
23
18
  */
24
19
  async function copyTemplates(name, { ui5App, fs, basePath, tmplPath }) {
25
- let optTmplDirPath = (0, node_path_1.join)(tmplPath, 'optional', `${name}`);
26
- const optionPath = (0, utils_1.getTemplateVersionPath)(ui5App.ui5);
20
+ let optTmplDirPath = join(tmplPath, 'optional', `${name}`);
21
+ const optionPath = getTemplateVersionPath(ui5App.ui5);
27
22
  if (name === 'loadReuseLibs') {
28
- optTmplDirPath = (0, node_path_1.join)(optTmplDirPath, optionPath);
23
+ optTmplDirPath = join(optTmplDirPath, optionPath);
29
24
  }
30
- const optTmplFilePaths = await (0, project_access_1.getFilePaths)(optTmplDirPath);
25
+ const optTmplFilePaths = await getFilePaths(optTmplDirPath);
31
26
  optTmplFilePaths.forEach((optTmplFilePath) => {
32
27
  const relPath = optTmplFilePath.replace(optTmplDirPath, '');
33
- const outPath = (0, node_path_1.join)(basePath, relPath);
28
+ const outPath = join(basePath, relPath);
34
29
  // Extend or add
35
30
  if (!fs.exists(outPath)) {
36
31
  fs.copyTpl(optTmplFilePath, outPath, ui5App, undefined, {
37
32
  globOptions: { dot: true },
38
- processDestinationPath: utils_1.processDestinationPath
33
+ processDestinationPath: processDestinationPath
39
34
  });
40
35
  }
41
36
  else if (outPath.endsWith('.json')) {
42
37
  // Only merge JSON files (e.g., package.json)
43
- const add = JSON.parse((0, ejs_1.render)(fs.read(optTmplFilePath), ui5App, {}));
38
+ const add = JSON.parse(render(fs.read(optTmplFilePath), ui5App, {}));
44
39
  const existingFile = JSON.parse(fs.read(outPath));
45
- const merged = (0, ui5_config_1.mergeObjects)(existingFile, add);
40
+ const merged = mergeObjects(existingFile, add);
46
41
  fs.writeJSON(outPath, merged);
47
42
  }
48
43
  // For non-JSON files (like .mjs), skip if file already exists
@@ -68,14 +63,14 @@ const factories = {
68
63
  * @param input Input required to enable the optional typescript features
69
64
  * @param keepOldComponent if set to true then the old Component.js will be renamed but kept.
70
65
  */
71
- async function enableTypescript(input, keepOldComponent = false) {
72
- input.ui5App.app.baseComponent = input.ui5App.app.baseComponent ?? "sap/ui/core/UIComponent" /* UI5_DEFAULT.BASE_COMPONENT */;
66
+ export async function enableTypescript(input, keepOldComponent = false) {
67
+ input.ui5App.app.baseComponent = input.ui5App.app.baseComponent ?? UI5_DEFAULT.BASE_COMPONENT;
73
68
  await copyTemplates('typescript', input);
74
69
  input.ui5Configs.forEach((ui5Config) => {
75
- ui5Config.addCustomMiddleware([ui5Libs_1.ui5TSSupport.middleware]);
76
- ui5Config.addCustomTasks([ui5Libs_1.ui5TSSupport.task]);
70
+ ui5Config.addCustomMiddleware([ui5TSSupport.middleware]);
71
+ ui5Config.addCustomTasks([ui5TSSupport.task]);
77
72
  });
78
- const compPath = (0, node_path_1.join)(input.basePath, 'webapp/Component.js');
73
+ const compPath = join(input.basePath, 'webapp/Component.js');
79
74
  if (keepOldComponent) {
80
75
  input.fs.move(compPath, `${compPath}.old`);
81
76
  }
@@ -88,11 +83,11 @@ async function enableTypescript(input, keepOldComponent = false) {
88
83
  *
89
84
  * @param input Input required to enable the optional npm modules import
90
85
  */
91
- async function enableNpmPackageConsumption(input) {
86
+ export async function enableNpmPackageConsumption(input) {
92
87
  await copyTemplates('npmPackageConsumption', input);
93
88
  input.ui5Configs.forEach((ui5Config) => {
94
- ui5Config.addCustomMiddleware([ui5Libs_1.ui5NPMSupport.middleware]);
95
- ui5Config.addCustomTasks([ui5Libs_1.ui5NPMSupport.task]);
89
+ ui5Config.addCustomMiddleware([ui5NPMSupport.middleware]);
90
+ ui5Config.addCustomTasks([ui5NPMSupport.task]);
96
91
  });
97
92
  }
98
93
  /**
@@ -104,7 +99,7 @@ async function enableNpmPackageConsumption(input) {
104
99
  * @param tmplPath template basepath
105
100
  * @param ui5Configs available UI5 configs
106
101
  */
107
- async function applyOptionalFeatures(ui5App, fs, basePath, tmplPath, ui5Configs) {
102
+ export async function applyOptionalFeatures(ui5App, fs, basePath, tmplPath, ui5Configs) {
108
103
  if (ui5App.appOptions) {
109
104
  for (const [key, value] of Object.entries(ui5App.appOptions)) {
110
105
  if (value === true) {
@@ -119,9 +114,9 @@ async function applyOptionalFeatures(ui5App, fs, basePath, tmplPath, ui5Configs)
119
114
  * @param basePath - base path to be used for adding the config
120
115
  * @param fs - file system reference
121
116
  */
122
- async function addEslintFeature(basePath, fs) {
117
+ export async function addEslintFeature(basePath, fs) {
123
118
  const input = {
124
- tmplPath: (0, node_path_1.join)(__dirname, '../templates'),
119
+ tmplPath: join(__dirname, '../templates'),
125
120
  basePath: basePath,
126
121
  fs: fs,
127
122
  ui5Configs: [], // the ui5Configs is not used for eslint configuration
@@ -141,7 +136,7 @@ async function addEslintFeature(basePath, fs) {
141
136
  * @param {string} [version] version of the ui5 framework.
142
137
  * @returns {string} - The constructed resource URL based on project type.
143
138
  */
144
- function getTemplateOptions(isEdmxProjectType, frameworkUrl, version) {
139
+ export function getTemplateOptions(isEdmxProjectType, frameworkUrl, version) {
145
140
  const resourcePath = 'resources/sap-ui-core.js';
146
141
  if (isEdmxProjectType || !frameworkUrl) {
147
142
  // Use relative path for Edmx projects or if frameworkUrl is not available
package/dist/types.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type UI5, type TemplateOptions } from './types';
1
+ import { type UI5, type TemplateOptions } from './types.js';
2
2
  import type { Editor } from 'mem-fs-editor';
3
3
  export declare const ui5LtsVersion_1_71 = "1.71.0";
4
4
  export declare const ui5LtsVersion_1_120 = "1.120.0";
package/dist/utils.js CHANGED
@@ -1,15 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ui5LtsVersion_1_120 = exports.ui5LtsVersion_1_71 = void 0;
4
- exports.compareUI5VersionGte = compareUI5VersionGte;
5
- exports.getTemplateVersionPath = getTemplateVersionPath;
6
- exports.processDestinationPath = processDestinationPath;
7
- exports.copyTemplates = copyTemplates;
8
- const semver_1 = require("semver");
9
- const node_path_1 = require("node:path");
10
- const project_access_1 = require("@sap-ux/project-access");
11
- exports.ui5LtsVersion_1_71 = '1.71.0';
12
- exports.ui5LtsVersion_1_120 = '1.120.0';
1
+ import { gte } from 'semver';
2
+ import { join } from 'node:path';
3
+ import { FileName } from '@sap-ux/project-access';
4
+ export const ui5LtsVersion_1_71 = '1.71.0';
5
+ export const ui5LtsVersion_1_120 = '1.120.0';
13
6
  /**
14
7
  * Compares two UI5 versions to determine if the first is greater than or equal to the second.
15
8
  *
@@ -17,13 +10,13 @@ exports.ui5LtsVersion_1_120 = '1.120.0';
17
10
  * @param {string} ui5VersionB - The second UI5 version to compare.
18
11
  * @returns {boolean} - True if the first version is greater than or equal to the second, false otherwise.
19
12
  */
20
- function compareUI5VersionGte(ui5VersionA, ui5VersionB) {
13
+ export function compareUI5VersionGte(ui5VersionA, ui5VersionB) {
21
14
  if (ui5VersionA === '') {
22
15
  // latest version
23
16
  return true;
24
17
  }
25
18
  else {
26
- return (0, semver_1.gte)(ui5VersionA, ui5VersionB, { loose: true });
19
+ return gte(ui5VersionA, ui5VersionB, { loose: true });
27
20
  }
28
21
  }
29
22
  /**
@@ -32,14 +25,14 @@ function compareUI5VersionGte(ui5VersionA, ui5VersionB) {
32
25
  * @param {UI5} ui5 - The UI5 configuration.
33
26
  * @returns {string} - The template version path.
34
27
  */
35
- function getTemplateVersionPath(ui5) {
28
+ export function getTemplateVersionPath(ui5) {
36
29
  let templateVersionPath = '';
37
30
  const ui5Version = ui5?.minUI5Version ?? ui5?.version ?? '';
38
- if (ui5Version && compareUI5VersionGte(ui5Version, exports.ui5LtsVersion_1_120)) {
39
- templateVersionPath = exports.ui5LtsVersion_1_120;
31
+ if (ui5Version && compareUI5VersionGte(ui5Version, ui5LtsVersion_1_120)) {
32
+ templateVersionPath = ui5LtsVersion_1_120;
40
33
  }
41
34
  else {
42
- templateVersionPath = exports.ui5LtsVersion_1_71;
35
+ templateVersionPath = ui5LtsVersion_1_71;
43
36
  }
44
37
  return templateVersionPath;
45
38
  }
@@ -49,7 +42,7 @@ function getTemplateVersionPath(ui5) {
49
42
  * @param {string} filePath - The file path to process.
50
43
  * @returns {string} - The processed file path.
51
44
  */
52
- function processDestinationPath(filePath) {
45
+ export function processDestinationPath(filePath) {
53
46
  return filePath.replace('/1.120.0', '').replace('/1.71.0', '');
54
47
  }
55
48
  /**
@@ -63,19 +56,19 @@ function processDestinationPath(filePath) {
63
56
  * @param options.ignore - Glob patterns to ignore during copy
64
57
  * @param options.ui5Version - Optional UI5 version to determine template version
65
58
  */
66
- function copyTemplates(options) {
59
+ export function copyTemplates(options) {
67
60
  const { fs, basePath, tmplPath, templateOptions, ignore, ui5Version } = options;
68
- const remainingCoreFiles = ['gitignore.tmpl', project_access_1.FileName.Package, project_access_1.FileName.Ui5LocalYaml, project_access_1.FileName.Ui5Yaml];
69
- const resolvedUi5Version = ui5Version ?? exports.ui5LtsVersion_1_120;
70
- const templateUi5Version = compareUI5VersionGte(resolvedUi5Version, exports.ui5LtsVersion_1_120)
71
- ? exports.ui5LtsVersion_1_120
72
- : exports.ui5LtsVersion_1_71;
61
+ const remainingCoreFiles = ['gitignore.tmpl', FileName.Package, FileName.Ui5LocalYaml, FileName.Ui5Yaml];
62
+ const resolvedUi5Version = ui5Version ?? ui5LtsVersion_1_120;
63
+ const templateUi5Version = compareUI5VersionGte(resolvedUi5Version, ui5LtsVersion_1_120)
64
+ ? ui5LtsVersion_1_120
65
+ : ui5LtsVersion_1_71;
73
66
  // Copy version-specific template files
74
- fs.copyTpl((0, node_path_1.join)(tmplPath, 'core', templateUi5Version, '**/*.*'), (0, node_path_1.join)(basePath), templateOptions, undefined, {
67
+ fs.copyTpl(join(tmplPath, 'core', templateUi5Version, '**/*.*'), join(basePath), templateOptions, undefined, {
75
68
  globOptions: { dot: true, ignore }
76
69
  });
77
70
  // Copy remaining common files
78
- fs.copyTpl(remainingCoreFiles.map((fileName) => (0, node_path_1.join)(tmplPath, 'core', fileName)), (0, node_path_1.join)(basePath), templateOptions, undefined, {
71
+ fs.copyTpl(remainingCoreFiles.map((fileName) => join(tmplPath, 'core', fileName)), join(basePath), templateOptions, undefined, {
79
72
  globOptions: { dot: true, ignore },
80
73
  processDestinationPath: (filePath) => filePath.replace(/gitignore.tmpl/g, '.gitignore')
81
74
  });
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/ui5-application-writer",
3
3
  "description": "Writer module allowing to create a the base UI5 project structure.",
4
+ "type": "module",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -9,7 +10,7 @@
9
10
  "bugs": {
10
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aui5-application-writer"
11
12
  },
12
- "version": "1.9.2",
13
+ "version": "2.0.0",
13
14
  "license": "Apache-2.0",
14
15
  "main": "dist/index.js",
15
16
  "files": [
@@ -27,7 +28,7 @@
27
28
  "mem-fs": "2.1.0",
28
29
  "mem-fs-editor": "9.4.0",
29
30
  "semver": "7.7.4",
30
- "@sap-ux/ui5-config": "0.31.1"
31
+ "@sap-ux/ui5-config": "1.0.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@types/ejs": "3.1.5",
@@ -37,8 +38,8 @@
37
38
  "@types/mem-fs-editor": "7.0.1",
38
39
  "@types/semver": "7.7.1",
39
40
  "fs-extra": "11.3.4",
40
- "@sap-ux/eslint-plugin-fiori-tools": "10.2.2",
41
- "@sap-ux/project-access": "1.38.1"
41
+ "@sap-ux/eslint-plugin-fiori-tools": "10.4.0",
42
+ "@sap-ux/project-access": "2.0.0"
42
43
  },
43
44
  "engines": {
44
45
  "node": ">=22.x"
@@ -50,8 +51,8 @@
50
51
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
51
52
  "lint": "eslint",
52
53
  "lint:fix": "eslint --fix",
53
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
54
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
54
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
55
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
55
56
  "link": "pnpm link --global",
56
57
  "unlink": "pnpm unlink --global"
57
58
  }