@sap-ux/fiori-freestyle-writer 0.23.2 → 1.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.
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ const types_1 = require("./types");
14
14
  const defaults_1 = require("./defaults");
15
15
  const ui5_config_1 = require("@sap-ux/ui5-config");
16
16
  const i18n_1 = require("./i18n");
17
+ const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
17
18
  /**
18
19
  * Generate a UI5 application based on the specified Fiori Freestyle floorplan template.
19
20
  *
@@ -34,9 +35,20 @@ async function generate(basePath, data, fs) {
34
35
  fs = await (0, ui5_application_writer_1.generate)(basePath, ffApp, fs);
35
36
  // add new and overwrite files from templates e.g.
36
37
  const tmplPath = (0, path_1.join)(__dirname, '..', 'templates');
37
- // Common files
38
38
  const ignore = [isTypeScriptEnabled ? '**/*.js' : '**/*.ts'];
39
- fs.copyTpl((0, path_1.join)(tmplPath, 'common', 'add'), basePath, { ...ffApp, escapeFLPText: defaults_1.escapeFLPText }, undefined, {
39
+ // Determine if the project type is 'EDMXBackend'.
40
+ const isEdmxProjectType = ffApp.app.projectType === 'EDMXBackend';
41
+ // Get the resource URLs for the UShell bootstrap and UI bootstrap based on the project type and UI5 framework details
42
+ const { uShellBootstrapResourceUrl, uiBootstrapResourceUrl } = (0, fiori_generator_shared_1.getBootstrapResourceUrls)(isEdmxProjectType, ffApp.ui5?.frameworkUrl, ffApp.ui5?.version);
43
+ const appConfig = {
44
+ ...ffApp,
45
+ uShellBootstrapResourceUrl,
46
+ uiBootstrapResourceUrl
47
+ };
48
+ fs.copyTpl((0, path_1.join)(tmplPath, 'common', 'add'), basePath, {
49
+ ...appConfig,
50
+ escapeFLPText: defaults_1.escapeFLPText
51
+ }, undefined, {
40
52
  globOptions: { ignore, dot: true }
41
53
  });
42
54
  fs.copyTpl((0, path_1.join)(tmplPath, ffApp.template.type, 'add'), basePath, ffApp, undefined, {
@@ -58,20 +70,30 @@ async function generate(basePath, data, fs) {
58
70
  fs.append((0, path_1.join)(basePath, 'webapp', 'i18n', 'i18n.properties'), (0, ejs_1.render)(fs.read((0, path_1.join)(extRoot, 'i18n', 'i18n.properties')), ffApp, {}));
59
71
  // package.json
60
72
  const packagePath = (0, path_1.join)(basePath, 'package.json');
73
+ // extend package.json with scripts for non-CAP projects
61
74
  fs.extendJSON(packagePath, JSON.parse((0, ejs_1.render)(fs.read((0, path_1.join)(tmplPath, 'common', 'extend', 'package.json')), ffApp, {})));
62
75
  const packageJson = JSON.parse(fs.read(packagePath));
63
- packageJson.scripts = {
64
- ...packageJson.scripts,
65
- ...(0, packageConfig_1.getPackageJsonTasks)({
66
- localOnly: !!ffApp.service && !ffApp.service?.url,
67
- addMock: !!ffApp.service?.metadata,
68
- sapClient: ffApp.service?.client,
69
- flpAppId: ffApp.app.flpAppId,
70
- startFile: data?.app?.startFile,
71
- localStartFile: data?.app?.localStartFile,
72
- generateIndex: ffApp.appOptions?.generateIndex
73
- })
74
- };
76
+ if (isEdmxProjectType) {
77
+ // Add scripts for non-CAP applications
78
+ packageJson.scripts = {
79
+ ...packageJson.scripts,
80
+ ...(0, packageConfig_1.getPackageJsonTasks)({
81
+ localOnly: !!ffApp.service && !ffApp.service?.url,
82
+ addMock: !!ffApp.service?.metadata,
83
+ sapClient: ffApp.service?.client,
84
+ flpAppId: ffApp.app.flpAppId,
85
+ startFile: data?.app?.startFile,
86
+ localStartFile: data?.app?.localStartFile,
87
+ generateIndex: ffApp.appOptions?.generateIndex
88
+ })
89
+ };
90
+ }
91
+ else {
92
+ // Add deploy-config for CAP applications
93
+ packageJson.scripts = {
94
+ 'deploy-config': 'npx -p @sap/ux-ui5-tooling fiori add deploy-config cf'
95
+ };
96
+ }
75
97
  fs.writeJSON(packagePath, packageJson);
76
98
  // Add service to the project if provided
77
99
  if (ffApp.service) {
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": "0.23.2",
4
+ "version": "1.0.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -26,9 +26,10 @@
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
28
  "read-pkg-up": "7.0.1",
29
- "@sap-ux/odata-service-writer": "0.21.1",
30
- "@sap-ux/ui5-application-writer": "0.27.2",
31
- "@sap-ux/ui5-config": "0.23.1"
29
+ "@sap-ux/odata-service-writer": "0.22.0",
30
+ "@sap-ux/ui5-application-writer": "1.1.0",
31
+ "@sap-ux/ui5-config": "0.23.1",
32
+ "@sap-ux/fiori-generator-shared": "0.3.0"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@types/ejs": "3.1.2",
@@ -55,10 +55,10 @@
55
55
  };
56
56
  </script>
57
57
 
58
- <script src="../test-resources/sap/ushell/bootstrap/sandbox.js" id="sap-ushell-bootstrap"></script>
58
+ <script src="<%- locals.uShellBootstrapResourceUrl %>" id="sap-ushell-bootstrap"></script>
59
59
  <!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"'' is a NON-SECURE setting for test environments -->
60
60
  <script id="sap-ui-bootstrap"
61
- src="../resources/sap-ui-core.js"
61
+ src="<%- locals.uiBootstrapResourceUrl %>"
62
62
  data-sap-ui-libs="<%- ui5.ui5Libs %>"
63
63
  data-sap-ui-async="true"
64
64
  data-sap-ui-preload="async"