@sap-ux/fiori-freestyle-writer 2.7.15 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { FreestyleApp } from './types';
1
+ import type { FreestyleApp } from './types.js';
2
2
  /**
3
3
  * Sets defaults for relevant parameters (`flpAppId`, `startFile`, `localStartFile`, ) when virtual endpoints are used.
4
4
  *
package/dist/defaults.js CHANGED
@@ -1,15 +1,10 @@
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.escapeFLPText = void 0;
7
- exports.setVirtualEndpointDefaults = setVirtualEndpointDefaults;
8
- exports.setDefaults = setDefaults;
9
- const read_pkg_up_1 = __importDefault(require("read-pkg-up"));
10
- const types_1 = require("./types");
11
- const utils_1 = require("./utils");
12
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
1
+ import readPkgUp from 'read-pkg-up';
2
+ import { TemplateType } from './types.js';
3
+ import { compareUI5VersionGte, ui5LtsVersion_1_120 } from './utils.js';
4
+ import { getFlpId } from '@sap-ux/fiori-generator-shared';
5
+ import { dirname } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
8
  const defaultVirtualPreviewFile = 'test/flp.html'; // Default virtual preview file name
14
9
  const defaultIntent = 'app-preview';
15
10
  const defaultNavActionDisplay = 'display';
@@ -21,7 +16,7 @@ const defaultNavActionDisplay = 'display';
21
16
  function setAppDefaults(app) {
22
17
  app.baseComponent = app.baseComponent || 'sap/ui/core/UIComponent';
23
18
  app.flpAction = app.flpAction || defaultNavActionDisplay;
24
- app.flpAppId = app.flpAppId || (0, fiori_generator_shared_1.getFlpId)(app.id, app.flpAction);
19
+ app.flpAppId = app.flpAppId || getFlpId(app.id, app.flpAction);
25
20
  }
26
21
  /**
27
22
  * Set defaults for the basic template on the given instance.
@@ -36,7 +31,7 @@ function setBasicTemplateDefaults(settings) {
36
31
  *
37
32
  * @param ffApp - Fiori freestyle application config
38
33
  */
39
- function setVirtualEndpointDefaults(ffApp) {
34
+ export function setVirtualEndpointDefaults(ffApp) {
40
35
  ffApp.app.flpAppId = defaultIntent;
41
36
  ffApp.app.localStartFile = defaultVirtualPreviewFile;
42
37
  ffApp.app.startFile = defaultVirtualPreviewFile;
@@ -47,24 +42,24 @@ function setVirtualEndpointDefaults(ffApp) {
47
42
  *
48
43
  * @param ffApp full config object used by the generate method
49
44
  */
50
- function setDefaults(ffApp) {
45
+ export function setDefaults(ffApp) {
51
46
  setAppDefaults(ffApp.app);
52
47
  // Add template information
53
48
  if (!ffApp.app.sourceTemplate?.version || !ffApp.app.sourceTemplate?.id) {
54
- const packageInfo = read_pkg_up_1.default.sync({ cwd: __dirname });
49
+ const packageInfo = readPkgUp.sync({ cwd: __dirname });
55
50
  ffApp.app.sourceTemplate = {
56
51
  id: `${packageInfo?.packageJson.name}:${ffApp.template.type}`,
57
52
  version: packageInfo?.packageJson.version,
58
53
  toolsId: ffApp.app.sourceTemplate?.toolsId
59
54
  };
60
55
  }
61
- if (ffApp.template.type === types_1.TemplateType.Basic) {
56
+ if (ffApp.template.type === TemplateType.Basic) {
62
57
  setBasicTemplateDefaults(ffApp.template.settings);
63
58
  }
64
59
  // All fiori-freestyle apps should use load reuse libs for ui5 below 1.120.0 , unless explicitly overridden
65
60
  let loadReuseLibs = true;
66
- if ((0, utils_1.compareUI5VersionGte)(ffApp.ui5?.minUI5Version ?? ffApp.ui5?.version ?? '', utils_1.ui5LtsVersion_1_120) &&
67
- ffApp.template.type === types_1.TemplateType.Basic) {
61
+ if (compareUI5VersionGte(ffApp.ui5?.minUI5Version ?? ffApp.ui5?.version ?? '', ui5LtsVersion_1_120) &&
62
+ ffApp.template.type === TemplateType.Basic) {
68
63
  loadReuseLibs = false;
69
64
  }
70
65
  ffApp.appOptions = Object.assign({
@@ -85,6 +80,5 @@ function setDefaults(ffApp) {
85
80
  }
86
81
  // Specific escaping is required for FLP texts in flpSandbox.html template file
87
82
  // Escapes '\' with '\\\\' and '"' with '\"' to correctly render inputs in a secure way
88
- const escapeFLPText = (s) => s.replace(/\\/g, '\\\\').replace(/(")/g, '\\$&');
89
- exports.escapeFLPText = escapeFLPText;
83
+ export const escapeFLPText = (s) => s.replace(/\\/g, '\\\\').replace(/(")/g, '\\$&');
90
84
  //# sourceMappingURL=defaults.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Package } from '@sap-ux/ui5-application-writer';
2
- import type { FreestyleApp } from './types';
2
+ import type { FreestyleApp } from './types.js';
3
3
  import type { Logger } from '@sap-ux/logger';
4
4
  import type { Editor } from 'mem-fs-editor';
5
5
  /**
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateOPATests = generateOPATests;
4
- const ui5_test_writer_1 = require("@sap-ux/ui5-test-writer");
5
- const types_1 = require("./types");
6
- const i18n_1 = require("./i18n");
1
+ import { generateFreestyleOPAFiles } from '@sap-ux/ui5-test-writer';
2
+ import { TemplateType } from './types.js';
3
+ import { t } from './i18n.js';
7
4
  /**
8
5
  * Adds test scripts to the package.json object.
9
6
  *
@@ -30,8 +27,8 @@ function addTestScripts(packageJson, addMock) {
30
27
  * @param {Logger} [log] - Optional logger instance.
31
28
  * @returns {Promise<Editor>} - The modified file system editor.
32
29
  */
33
- async function generateOPATests(basePath, ffApp, addMock, packageJson, fs, log) {
34
- if (ffApp.template.type === types_1.TemplateType.Basic) {
30
+ export async function generateOPATests(basePath, ffApp, addMock, packageJson, fs, log) {
31
+ if (ffApp.template.type === TemplateType.Basic) {
35
32
  addTestScripts(packageJson, addMock);
36
33
  const config = {
37
34
  appId: ffApp.app.id,
@@ -43,10 +40,10 @@ async function generateOPATests(basePath, ffApp, addMock, packageJson, fs, log)
43
40
  enableTypeScript: ffApp.appOptions?.typescript,
44
41
  useVirtualPreviewEndpoints: ffApp.appOptions?.useVirtualPreviewEndpoints
45
42
  };
46
- await (0, ui5_test_writer_1.generateFreestyleOPAFiles)(basePath, config, fs, log);
43
+ await generateFreestyleOPAFiles(basePath, config, fs, log);
47
44
  }
48
45
  else {
49
- log?.info((0, i18n_1.t)('info.unsupportedTestTemplateMessage', { templateType: ffApp.template.type }));
46
+ log?.info(t('info.unsupportedTestTemplateMessage', { templateType: ffApp.template.type }));
50
47
  }
51
48
  }
52
49
  //# sourceMappingURL=generateOPATests.js.map
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 fiori_freestyle_writer_i18n_json_1 = __importDefault(require("./translations/fiori-freestyle-writer.i18n.json"));
1
+ import i18next from 'i18next';
2
+ import translations from './translations/fiori-freestyle-writer.i18n.json' with { type: 'json' };
11
3
  const NS = 'fiori-freestyle-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]: fiori_freestyle_writer_i18n_json_1.default
12
+ [NS]: translations
21
13
  }
22
14
  },
23
15
  lng: 'en',
@@ -34,10 +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
- initI18n().catch(() => {
41
- // Ignore any errors since the write will still work
42
- });
32
+ void initI18n().catch(() => undefined);
43
33
  //# sourceMappingURL=i18n.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { FreestyleApp } from './types';
2
1
  import type { Logger } from '@sap-ux/logger';
3
2
  import type { Editor } from 'mem-fs-editor';
3
+ import type { FreestyleApp } from './types.js';
4
4
  /**
5
5
  * Generate a UI5 application based on the specified Fiori Freestyle floorplan template.
6
6
  *
@@ -11,6 +11,7 @@ import type { Editor } from 'mem-fs-editor';
11
11
  * @returns Reference to a mem-fs-editor
12
12
  */
13
13
  declare function generate<T>(basePath: string, data: FreestyleApp<T>, fs?: Editor, log?: Logger): Promise<Editor>;
14
- export { generate, FreestyleApp };
15
- export { WorklistSettings, ListDetailSettings, BasicAppSettings, TemplateType, Template, OdataVersion } from './types';
14
+ export { generate };
15
+ export type { WorklistSettings, ListDetailSettings, BasicAppSettings, Template, FreestyleApp } from './types.js';
16
+ export { TemplateType, OdataVersion } from './types.js';
16
17
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,24 +1,19 @@
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.OdataVersion = exports.TemplateType = void 0;
7
- exports.generate = generate;
8
- const node_path_1 = require("node:path");
9
- const ejs_1 = require("ejs");
10
- const ui5_application_writer_1 = require("@sap-ux/ui5-application-writer");
11
- const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
12
- const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
13
- const types_1 = require("./types");
14
- const defaults_1 = require("./defaults");
15
- const ui5_config_1 = require("@sap-ux/ui5-config");
16
- const i18n_1 = require("./i18n");
17
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
18
- const utils_1 = require("./utils");
19
- const cap_config_writer_1 = require("@sap-ux/cap-config-writer");
20
- const generateOPATests_1 = require("./generateOPATests");
21
- const ui5_test_writer_1 = require("@sap-ux/ui5-test-writer");
1
+ import { dirname, join } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { render } from 'ejs';
4
+ import { generate as generateUi5Project } from '@sap-ux/ui5-application-writer';
5
+ import { generate as addOdataService } from '@sap-ux/odata-service-writer';
6
+ import cloneDeep from 'lodash/cloneDeep.js';
7
+ import { TemplateType } from './types.js';
8
+ import { setDefaults, escapeFLPText, setVirtualEndpointDefaults } from './defaults.js';
9
+ import { UI5Config } from '@sap-ux/ui5-config';
10
+ import { initI18n } from './i18n.js';
11
+ import { getBootstrapResourceUrls, getPackageScripts } from '@sap-ux/fiori-generator-shared';
12
+ import { getTemplateVersionPath, processDestinationPath } from './utils.js';
13
+ import { applyCAPUpdates } from '@sap-ux/cap-config-writer';
14
+ import { generateOPATests } from './generateOPATests.js';
15
+ import { addVirtualTestConfig } from '@sap-ux/ui5-test-writer';
16
+ const __dirname = dirname(fileURLToPath(import.meta.url));
22
17
  /**
23
18
  * Generate a UI5 application based on the specified Fiori Freestyle floorplan template.
24
19
  *
@@ -31,15 +26,15 @@ const ui5_test_writer_1 = require("@sap-ux/ui5-test-writer");
31
26
  async function generate(basePath, data, fs, log) {
32
27
  // Load i18n translations asynchronously to ensure proper initialization.
33
28
  // This addresses occasional issues where i18n is not initialized in time, causing tests to fail.
34
- await (0, i18n_1.initI18n)();
29
+ await initI18n();
35
30
  // Clone rather than modifying callers refs
36
- const ffApp = (0, cloneDeep_1.default)(data);
31
+ const ffApp = cloneDeep(data);
37
32
  // set defaults
38
- (0, defaults_1.setDefaults)(ffApp);
33
+ setDefaults(ffApp);
39
34
  const isTypeScriptEnabled = ffApp.appOptions?.typescript;
40
- fs = await (0, ui5_application_writer_1.generate)(basePath, ffApp, fs);
35
+ fs = await generateUi5Project(basePath, ffApp, fs);
41
36
  // add new and overwrite files from templates e.g.
42
- const tmplPath = (0, node_path_1.join)(__dirname, '..', 'templates');
37
+ const tmplPath = join(__dirname, '..', 'templates');
43
38
  const ignore = [
44
39
  isTypeScriptEnabled ? '**/*.js' : '**/*.ts',
45
40
  // if using virtual endpoints for preview, do not add the flpSandbox.html file
@@ -48,57 +43,57 @@ async function generate(basePath, data, fs, log) {
48
43
  // Determine if the project type is 'EDMXBackend'.
49
44
  const isEdmxProjectType = ffApp.app.projectType === 'EDMXBackend';
50
45
  // Get the resource URLs for the UShell bootstrap and UI bootstrap based on the project type and UI5 framework details
51
- const { uShellBootstrapResourceUrl, uiBootstrapResourceUrl } = (0, fiori_generator_shared_1.getBootstrapResourceUrls)(isEdmxProjectType, ffApp.ui5?.frameworkUrl, ffApp.ui5?.version);
46
+ const { uShellBootstrapResourceUrl, uiBootstrapResourceUrl } = getBootstrapResourceUrls(isEdmxProjectType, ffApp.ui5?.frameworkUrl, ffApp.ui5?.version);
52
47
  const appConfig = {
53
48
  ...ffApp,
54
49
  uShellBootstrapResourceUrl,
55
50
  uiBootstrapResourceUrl
56
51
  };
57
- const templateVersionPath = (0, utils_1.getTemplateVersionPath)(ffApp);
58
- fs.copyTpl((0, node_path_1.join)(tmplPath, 'common', 'add', templateVersionPath), basePath, {
52
+ const templateVersionPath = getTemplateVersionPath(ffApp);
53
+ fs.copyTpl(join(tmplPath, 'common', 'add', templateVersionPath), basePath, {
59
54
  ...appConfig,
60
- escapeFLPText: defaults_1.escapeFLPText
55
+ escapeFLPText
61
56
  }, undefined, {
62
57
  globOptions: { ignore, dot: true },
63
- processDestinationPath: utils_1.processDestinationPath
58
+ processDestinationPath: processDestinationPath
64
59
  });
65
- fs.copyTpl((0, node_path_1.join)(tmplPath, ffApp.template.type, 'add', ffApp.template.type === types_1.TemplateType.Basic ? templateVersionPath : ''), basePath, ffApp, undefined, {
60
+ fs.copyTpl(join(tmplPath, ffApp.template.type, 'add', ffApp.template.type === TemplateType.Basic ? templateVersionPath : ''), basePath, ffApp, undefined, {
66
61
  globOptions: { ignore, dot: true },
67
- processDestinationPath: utils_1.processDestinationPath
62
+ processDestinationPath: processDestinationPath
68
63
  });
69
- if (ffApp.template.type === types_1.TemplateType.Basic) {
64
+ if (ffApp.template.type === TemplateType.Basic) {
70
65
  const viewName = ffApp.template.settings.viewName;
71
- const viewTarget = (0, node_path_1.join)(basePath, 'webapp', 'view', `${viewName}.view.xml`);
72
- fs.copyTpl((0, node_path_1.join)(tmplPath, ffApp.template.type, `custom/${templateVersionPath}/View.xml`), viewTarget, ffApp, undefined, {
73
- processDestinationPath: utils_1.processDestinationPath
66
+ const viewTarget = join(basePath, 'webapp', 'view', `${viewName}.view.xml`);
67
+ fs.copyTpl(join(tmplPath, ffApp.template.type, `custom/${templateVersionPath}/View.xml`), viewTarget, ffApp, undefined, {
68
+ processDestinationPath: processDestinationPath
74
69
  });
75
70
  const ext = isTypeScriptEnabled ? 'ts' : 'js';
76
- const controllerTarget = (0, node_path_1.join)(basePath, `webapp/controller/${viewName}.controller.${ext}`);
77
- fs.copyTpl((0, node_path_1.join)(tmplPath, ffApp.template.type, `custom/${templateVersionPath}/Controller.${ext}`), controllerTarget, ffApp, undefined, {
78
- processDestinationPath: utils_1.processDestinationPath
71
+ const controllerTarget = join(basePath, `webapp/controller/${viewName}.controller.${ext}`);
72
+ fs.copyTpl(join(tmplPath, ffApp.template.type, `custom/${templateVersionPath}/Controller.${ext}`), controllerTarget, ffApp, undefined, {
73
+ processDestinationPath: processDestinationPath
79
74
  });
80
75
  }
81
76
  // Add template specific manifest settings
82
- const manifestPath = (0, node_path_1.join)(basePath, 'webapp', 'manifest.json');
83
- const extRoot = (0, node_path_1.join)(__dirname, '..', 'templates', ffApp.template.type, 'extend', ffApp.template.type === types_1.TemplateType.Basic ? templateVersionPath : '', 'webapp');
84
- fs.extendJSON(manifestPath, JSON.parse((0, ejs_1.render)(fs.read((0, node_path_1.join)(extRoot, 'manifest.json')), ffApp, {})));
77
+ const manifestPath = join(basePath, 'webapp', 'manifest.json');
78
+ const extRoot = join(__dirname, '..', 'templates', ffApp.template.type, 'extend', ffApp.template.type === TemplateType.Basic ? templateVersionPath : '', 'webapp');
79
+ fs.extendJSON(manifestPath, JSON.parse(render(fs.read(join(extRoot, 'manifest.json')), ffApp, {})));
85
80
  // i18n.properties
86
- fs.append((0, node_path_1.join)(basePath, 'webapp', 'i18n', 'i18n.properties'), (0, ejs_1.render)(fs.read((0, node_path_1.join)(extRoot, 'i18n', 'i18n.properties')), ffApp, {}));
81
+ fs.append(join(basePath, 'webapp', 'i18n', 'i18n.properties'), render(fs.read(join(extRoot, 'i18n', 'i18n.properties')), ffApp, {}));
87
82
  // package.json
88
- const packagePath = (0, node_path_1.join)(basePath, 'package.json');
83
+ const packagePath = join(basePath, 'package.json');
89
84
  // extend package.json with scripts for non-CAP projects
90
- fs.extendJSON(packagePath, JSON.parse((0, ejs_1.render)(fs.read((0, node_path_1.join)(tmplPath, 'common', 'extend', 'package.json')), ffApp, {})));
85
+ fs.extendJSON(packagePath, JSON.parse(render(fs.read(join(tmplPath, 'common', 'extend', 'package.json')), ffApp, {})));
91
86
  const addTests = ffApp.appOptions?.addTests;
92
87
  const packageJson = JSON.parse(fs.read(packagePath));
93
88
  if (ffApp.appOptions?.useVirtualPreviewEndpoints) {
94
- (0, defaults_1.setVirtualEndpointDefaults)(ffApp);
89
+ setVirtualEndpointDefaults(ffApp);
95
90
  }
96
91
  if (isEdmxProjectType) {
97
92
  const addMock = !!ffApp.service?.metadata;
98
93
  // Add scripts for non-CAP applications
99
94
  packageJson.scripts = {
100
95
  ...packageJson.scripts,
101
- ...(0, fiori_generator_shared_1.getPackageScripts)({
96
+ ...getPackageScripts({
102
97
  localOnly: !!ffApp.service && !ffApp.service?.url,
103
98
  addMock,
104
99
  sapClient: ffApp.service?.client,
@@ -106,12 +101,12 @@ async function generate(basePath, data, fs, log) {
106
101
  startFile: ffApp.app?.startFile,
107
102
  localStartFile: ffApp.app?.localStartFile,
108
103
  generateIndex: ffApp.appOptions?.generateIndex,
109
- addTest: addTests && ffApp.template.type === types_1.TemplateType.Basic,
104
+ addTest: addTests && ffApp.template.type === TemplateType.Basic,
110
105
  supportVirtualEndpoints: ffApp.appOptions?.useVirtualPreviewEndpoints // no need for search params if virtual endpoints are used
111
106
  })
112
107
  };
113
108
  if (addTests) {
114
- await (0, generateOPATests_1.generateOPATests)(basePath, ffApp, addMock, packageJson, fs, log);
109
+ await generateOPATests(basePath, ffApp, addMock, packageJson, fs, log);
115
110
  }
116
111
  }
117
112
  else {
@@ -123,12 +118,12 @@ async function generate(basePath, data, fs, log) {
123
118
  fs.writeJSON(packagePath, packageJson);
124
119
  // Add service to the project if provided
125
120
  if (ffApp.service) {
126
- await (0, odata_service_writer_1.generate)(basePath, ffApp.service, fs);
121
+ await addOdataService(basePath, ffApp.service, fs);
127
122
  }
128
123
  else {
129
124
  // Add placeholder middleware so allow adding service later
130
- const ui5LocalConfigPath = (0, node_path_1.join)(basePath, 'ui5-local.yaml');
131
- const ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(ui5LocalConfigPath));
125
+ const ui5LocalConfigPath = join(basePath, 'ui5-local.yaml');
126
+ const ui5LocalConfig = await UI5Config.newInstance(fs.read(ui5LocalConfigPath));
132
127
  ui5LocalConfig.addFioriToolsProxyMiddleware({});
133
128
  fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
134
129
  }
@@ -143,12 +138,12 @@ async function generate(basePath, data, fs, log) {
143
138
  disableRootPackageJsonUpdates: ffApp.appOptions?.disableCapRootPkgJsonUpdates
144
139
  };
145
140
  // apply cap updates when service is cap
146
- await (0, cap_config_writer_1.applyCAPUpdates)(fs, ffApp.service.capService, settings);
141
+ await applyCAPUpdates(fs, ffApp.service.capService, settings);
147
142
  }
148
143
  if (isEdmxProjectType && addTests && ffApp.appOptions?.useVirtualPreviewEndpoints) {
149
144
  // Explicit patterns are required because the freestyle template uses AllJourneys.js (JS) or *Journey.ts (TS)
150
145
  // rather than the preview-middleware default pattern, and unit tests live under controller/ not the default path.
151
- await (0, ui5_test_writer_1.addVirtualTestConfig)(basePath, [
146
+ await addVirtualTestConfig(basePath, [
152
147
  {
153
148
  framework: 'OPA5',
154
149
  path: '/test/integration/opaTests.qunit.html',
@@ -164,7 +159,6 @@ async function generate(basePath, data, fs, log) {
164
159
  }
165
160
  return fs;
166
161
  }
167
- var types_2 = require("./types");
168
- Object.defineProperty(exports, "TemplateType", { enumerable: true, get: function () { return types_2.TemplateType; } });
169
- Object.defineProperty(exports, "OdataVersion", { enumerable: true, get: function () { return types_2.OdataVersion; } });
162
+ export { generate };
163
+ export { TemplateType, OdataVersion } from './types.js';
170
164
  //# sourceMappingURL=index.js.map
package/dist/types.js CHANGED
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OdataVersion = exports.TemplateType = void 0;
4
- exports.TemplateType = {
1
+ export const TemplateType = {
5
2
  Basic: 'basic',
6
3
  Worklist: 'worklist',
7
4
  ListDetail: 'listdetail'
8
5
  };
9
6
  // We need this for the service version
10
- var odata_service_writer_1 = require("@sap-ux/odata-service-writer");
11
- Object.defineProperty(exports, "OdataVersion", { enumerable: true, get: function () { return odata_service_writer_1.OdataVersion; } });
7
+ export { OdataVersion } from '@sap-ux/odata-service-writer';
12
8
  //# sourceMappingURL=types.js.map
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FreestyleApp } from './types';
1
+ import type { FreestyleApp } from './types.js';
2
2
  export declare const ui5LtsVersion_1_71 = "1.71.0";
3
3
  export declare const ui5LtsVersion_1_120 = "1.120.0";
4
4
  /**
package/dist/utils.js CHANGED
@@ -1,14 +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
- const node_path_1 = require("node:path");
8
- const types_1 = require("./types");
9
- const semver_1 = require("semver");
10
- exports.ui5LtsVersion_1_71 = '1.71.0';
11
- exports.ui5LtsVersion_1_120 = '1.120.0';
1
+ import { sep } from 'node:path';
2
+ import { TemplateType } from './types.js';
3
+ import { gte } from 'semver';
4
+ export const ui5LtsVersion_1_71 = '1.71.0';
5
+ export const ui5LtsVersion_1_120 = '1.120.0';
12
6
  /**
13
7
  * Compares two UI5 versions to determine if the first is greater than or equal to the second.
14
8
  *
@@ -16,13 +10,13 @@ exports.ui5LtsVersion_1_120 = '1.120.0';
16
10
  * @param {string} ui5VersionB - The second UI5 version to compare.
17
11
  * @returns {boolean} - True if the first version is greater than or equal to the second, false otherwise.
18
12
  */
19
- function compareUI5VersionGte(ui5VersionA, ui5VersionB) {
13
+ export function compareUI5VersionGte(ui5VersionA, ui5VersionB) {
20
14
  if (ui5VersionA === '') {
21
15
  // latest version
22
16
  return true;
23
17
  }
24
18
  else {
25
- return (0, semver_1.gte)(ui5VersionA, ui5VersionB, { loose: true });
19
+ return gte(ui5VersionA, ui5VersionB, { loose: true });
26
20
  }
27
21
  }
28
22
  /**
@@ -31,15 +25,15 @@ function compareUI5VersionGte(ui5VersionA, ui5VersionB) {
31
25
  * @param {FreestyleApp<unknown>} ffApp - The freestyle app configuration.
32
26
  * @returns {string} - The template version path.
33
27
  */
34
- function getTemplateVersionPath(ffApp) {
28
+ export function getTemplateVersionPath(ffApp) {
35
29
  let templateVersionPath = '';
36
30
  const ui5Version = ffApp.ui5?.minUI5Version ?? ffApp.ui5?.version ?? '';
37
- if (ffApp.template.type === types_1.TemplateType.Basic) {
38
- if (compareUI5VersionGte(ui5Version, exports.ui5LtsVersion_1_120)) {
39
- templateVersionPath = exports.ui5LtsVersion_1_120;
31
+ if (ffApp.template.type === TemplateType.Basic) {
32
+ if (compareUI5VersionGte(ui5Version, ui5LtsVersion_1_120)) {
33
+ templateVersionPath = ui5LtsVersion_1_120;
40
34
  }
41
35
  else {
42
- templateVersionPath = exports.ui5LtsVersion_1_71;
36
+ templateVersionPath = ui5LtsVersion_1_71;
43
37
  }
44
38
  }
45
39
  return templateVersionPath;
@@ -50,7 +44,7 @@ function getTemplateVersionPath(ffApp) {
50
44
  * @param {string} filePath - The file path to process.
51
45
  * @returns {string} - The processed file path.
52
46
  */
53
- function processDestinationPath(filePath) {
54
- return filePath.replace(`${node_path_1.sep}1.120.0`, '').replace(`${node_path_1.sep}1.71.0`, '');
47
+ export function processDestinationPath(filePath) {
48
+ return filePath.replace(`${sep}1.120.0`, '').replace(`${sep}1.71.0`, '');
55
49
  }
56
50
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-freestyle-writer",
3
3
  "description": "SAP Fiori freestyle application writer",
4
- "version": "2.7.15",
4
+ "version": "3.0.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -10,6 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-freestyle-writer"
12
12
  },
13
+ "type": "module",
13
14
  "license": "Apache-2.0",
14
15
  "main": "dist/index.js",
15
16
  "files": [
@@ -27,15 +28,16 @@
27
28
  "mem-fs-editor": "9.4.0",
28
29
  "read-pkg-up": "7.0.1",
29
30
  "semver": "7.7.4",
30
- "@sap-ux/odata-service-writer": "0.32.2",
31
- "@sap-ux/ui5-application-writer": "1.9.2",
32
- "@sap-ux/ui5-config": "0.31.1",
33
- "@sap-ux/fiori-generator-shared": "0.15.6",
34
- "@sap-ux/cap-config-writer": "0.13.6",
35
- "@sap-ux/ui5-test-writer": "0.9.15",
36
- "@sap-ux/logger": "0.9.0"
31
+ "@sap-ux/odata-service-writer": "1.0.1",
32
+ "@sap-ux/ui5-application-writer": "2.0.0",
33
+ "@sap-ux/ui5-config": "1.0.0",
34
+ "@sap-ux/fiori-generator-shared": "1.0.1",
35
+ "@sap-ux/cap-config-writer": "1.0.1",
36
+ "@sap-ux/ui5-test-writer": "1.0.1",
37
+ "@sap-ux/logger": "1.0.0"
37
38
  },
38
39
  "devDependencies": {
40
+ "@jest/globals": "30.3.0",
39
41
  "@types/ejs": "3.1.5",
40
42
  "@types/fs-extra": "11.0.4",
41
43
  "@types/lodash": "4.17.24",
@@ -43,7 +45,7 @@
43
45
  "@types/mem-fs": "1.1.2",
44
46
  "@types/semver": "7.7.1",
45
47
  "fs-extra": "11.3.4",
46
- "@sap-ux/eslint-plugin-fiori-tools": "10.2.2"
48
+ "@sap-ux/eslint-plugin-fiori-tools": "10.4.1"
47
49
  },
48
50
  "engines": {
49
51
  "node": ">=22.x"
@@ -55,8 +57,8 @@
55
57
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
56
58
  "lint": "eslint",
57
59
  "lint:fix": "eslint --fix",
58
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
59
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
60
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
61
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
60
62
  "link": "pnpm link --global",
61
63
  "unlink": "pnpm unlink --global"
62
64
  }