@sap-ux/fiori-freestyle-writer 2.7.14 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +15 -21
- package/dist/generateOPATests.d.ts +1 -1
- package/dist/generateOPATests.js +7 -10
- package/dist/i18n.js +9 -19
- package/dist/index.d.ts +4 -3
- package/dist/index.js +52 -58
- package/dist/types.js +2 -6
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +14 -20
- package/package.json +13 -11
package/dist/defaults.d.ts
CHANGED
package/dist/defaults.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 ||
|
|
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 =
|
|
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 ===
|
|
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 (
|
|
67
|
-
ffApp.template.type ===
|
|
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
|
package/dist/generateOPATests.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 ===
|
|
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
|
|
43
|
+
await generateFreestyleOPAFiles(basePath, config, fs, log);
|
|
47
44
|
}
|
|
48
45
|
else {
|
|
49
|
-
log?.info(
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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
|
|
8
|
+
export async function initI18n() {
|
|
9
|
+
await i18n.init({
|
|
18
10
|
resources: {
|
|
19
11
|
en: {
|
|
20
|
-
[NS]:
|
|
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
|
|
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
|
|
15
|
-
export { WorklistSettings, ListDetailSettings, BasicAppSettings,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
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
|
|
29
|
+
await initI18n();
|
|
35
30
|
// Clone rather than modifying callers refs
|
|
36
|
-
const ffApp = (
|
|
31
|
+
const ffApp = cloneDeep(data);
|
|
37
32
|
// set defaults
|
|
38
|
-
|
|
33
|
+
setDefaults(ffApp);
|
|
39
34
|
const isTypeScriptEnabled = ffApp.appOptions?.typescript;
|
|
40
|
-
fs = await (
|
|
35
|
+
fs = await generateUi5Project(basePath, ffApp, fs);
|
|
41
36
|
// add new and overwrite files from templates e.g.
|
|
42
|
-
const tmplPath =
|
|
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 } =
|
|
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 =
|
|
58
|
-
fs.copyTpl(
|
|
52
|
+
const templateVersionPath = getTemplateVersionPath(ffApp);
|
|
53
|
+
fs.copyTpl(join(tmplPath, 'common', 'add', templateVersionPath), basePath, {
|
|
59
54
|
...appConfig,
|
|
60
|
-
escapeFLPText
|
|
55
|
+
escapeFLPText
|
|
61
56
|
}, undefined, {
|
|
62
57
|
globOptions: { ignore, dot: true },
|
|
63
|
-
processDestinationPath:
|
|
58
|
+
processDestinationPath: processDestinationPath
|
|
64
59
|
});
|
|
65
|
-
fs.copyTpl(
|
|
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:
|
|
62
|
+
processDestinationPath: processDestinationPath
|
|
68
63
|
});
|
|
69
|
-
if (ffApp.template.type ===
|
|
64
|
+
if (ffApp.template.type === TemplateType.Basic) {
|
|
70
65
|
const viewName = ffApp.template.settings.viewName;
|
|
71
|
-
const viewTarget =
|
|
72
|
-
fs.copyTpl(
|
|
73
|
-
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 =
|
|
77
|
-
fs.copyTpl(
|
|
78
|
-
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 =
|
|
83
|
-
const extRoot =
|
|
84
|
-
fs.extendJSON(manifestPath, JSON.parse(
|
|
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(
|
|
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 =
|
|
83
|
+
const packagePath = join(basePath, 'package.json');
|
|
89
84
|
// extend package.json with scripts for non-CAP projects
|
|
90
|
-
fs.extendJSON(packagePath, JSON.parse(
|
|
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
|
-
|
|
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
|
-
...
|
|
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 ===
|
|
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
|
|
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 (
|
|
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 =
|
|
131
|
-
const ui5LocalConfig = await
|
|
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
|
|
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
|
|
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
|
-
|
|
168
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
package/dist/utils.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
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 ===
|
|
38
|
-
if (compareUI5VersionGte(ui5Version,
|
|
39
|
-
templateVersionPath =
|
|
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 =
|
|
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(`${
|
|
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": "
|
|
4
|
+
"version": "3.0.0",
|
|
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.
|
|
31
|
-
"@sap-ux/ui5-application-writer": "
|
|
32
|
-
"@sap-ux/ui5-config": "0.
|
|
33
|
-
"@sap-ux/fiori-generator-shared": "0.
|
|
34
|
-
"@sap-ux/cap-config-writer": "0.
|
|
35
|
-
"@sap-ux/ui5-test-writer": "0.
|
|
36
|
-
"@sap-ux/logger": "0.
|
|
31
|
+
"@sap-ux/odata-service-writer": "1.0.0",
|
|
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.0",
|
|
35
|
+
"@sap-ux/cap-config-writer": "1.0.0",
|
|
36
|
+
"@sap-ux/ui5-test-writer": "1.0.0",
|
|
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.
|
|
48
|
+
"@sap-ux/eslint-plugin-fiori-tools": "10.4.0"
|
|
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
|
}
|