@sap-ux/fiori-elements-writer 0.5.4 → 0.6.2

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
@@ -45,7 +45,7 @@ const semver_1 = __importDefault(require("semver"));
45
45
  * @returns Reference to a mem-fs-editor
46
46
  */
47
47
  function generate(basePath, data, fs) {
48
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
49
49
  return __awaiter(this, void 0, void 0, function* () {
50
50
  // Clone rather than modifying callers refs
51
51
  const feApp = cloneDeep_1.default(data);
@@ -66,7 +66,7 @@ function generate(basePath, data, fs) {
66
66
  const rootTemplatesPath = path_1.join(__dirname, '..', 'templates');
67
67
  // Add templates common to all template types
68
68
  // Common files
69
- const ignore = ((_c = feApp.appOptions) === null || _c === void 0 ? void 0 : _c.typescript) ? '**/*.js' : '**/*.ts';
69
+ const ignore = [((_c = feApp.appOptions) === null || _c === void 0 ? void 0 : _c.typescript) ? '**/*.js' : '**/*.ts'];
70
70
  fs.copyTpl(path_1.join(rootTemplatesPath, 'common', 'add', '**/*.*'), basePath, Object.assign(Object.assign({}, feApp), { templateOptions,
71
71
  escapeFLPText: templateAttributes_1.escapeFLPText }), undefined, {
72
72
  globOptions: { ignore }
@@ -78,32 +78,30 @@ function generate(basePath, data, fs) {
78
78
  // Special handling for FPM because it is not based on template files but used the fpm writer
79
79
  if (feApp.template.type === types_1.TemplateType.FlexibleProgrammingModel) {
80
80
  const config = feApp.template.settings;
81
- // Convert string version to float for FPM writer
82
- const minUI5VerSemVer = semver_1.default.coerce((_d = feApp.ui5) === null || _d === void 0 ? void 0 : _d.minUI5Version);
83
- const minUI5Version = parseFloat(`${minUI5VerSemVer.major}.${minUI5VerSemVer.minor}`);
84
81
  fe_fpm_writer_1.generateCustomPage(basePath, {
85
82
  entity: config.entityConfig.mainEntityName,
86
83
  name: config.pageName,
87
- ui5Version: minUI5Version
84
+ minUI5Version: (_d = feApp.ui5) === null || _d === void 0 ? void 0 : _d.minUI5Version,
85
+ typescript: (_e = feApp.appOptions) === null || _e === void 0 ? void 0 : _e.typescript
88
86
  }, fs);
89
87
  }
90
88
  else {
91
89
  // Copy version specific common templates and version specific, floorplan specific templates
92
- const templateVersionPath = path_1.join(rootTemplatesPath, `v${(_e = feApp.service) === null || _e === void 0 ? void 0 : _e.version}`);
90
+ const templateVersionPath = path_1.join(rootTemplatesPath, `v${(_f = feApp.service) === null || _f === void 0 ? void 0 : _f.version}`);
93
91
  [path_1.join(templateVersionPath, 'common', 'add'), path_1.join(templateVersionPath, feApp.template.type, 'add')].forEach((templatePath) => {
94
- fs.copyTpl(path_1.join(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true });
92
+ fs.copyTpl(path_1.join(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true, globOptions: { ignore } });
95
93
  });
96
94
  }
97
95
  // Update manifest.json with template specific settings
98
96
  manifestSettings_1.extendManifestJson(fs, basePath, rootTemplatesPath, feApp);
99
97
  const packageJson = JSON.parse(fs.read(packagePath));
100
98
  packageJson.scripts = Object.assign(packageJson.scripts, Object.assign({}, packageConfig_1.getPackageJsonTasks({
101
- localOnly: !((_f = feApp.service) === null || _f === void 0 ? void 0 : _f.url),
102
- addMock: !!((_g = feApp.service) === null || _g === void 0 ? void 0 : _g.metadata),
103
- sapClient: (_h = feApp.service) === null || _h === void 0 ? void 0 : _h.client,
99
+ localOnly: !((_g = feApp.service) === null || _g === void 0 ? void 0 : _g.url),
100
+ addMock: !!((_h = feApp.service) === null || _h === void 0 ? void 0 : _h.metadata),
101
+ sapClient: (_j = feApp.service) === null || _j === void 0 ? void 0 : _j.client,
104
102
  flpAppId: feApp.app.flpAppId,
105
- startFile: (_j = data === null || data === void 0 ? void 0 : data.app) === null || _j === void 0 ? void 0 : _j.startFile,
106
- localStartFile: (_k = data === null || data === void 0 ? void 0 : data.app) === null || _k === void 0 ? void 0 : _k.localStartFile
103
+ startFile: (_k = data === null || data === void 0 ? void 0 : data.app) === null || _k === void 0 ? void 0 : _k.startFile,
104
+ localStartFile: (_l = data === null || data === void 0 ? void 0 : data.app) === null || _l === void 0 ? void 0 : _l.localStartFile
107
105
  })));
108
106
  fs.writeJSON(packagePath, packageJson);
109
107
  return fs;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-elements-writer",
3
3
  "description": "SAP Fiori elements application writer",
4
- "version": "0.5.4",
4
+ "version": "0.6.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -21,8 +21,8 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@sap-ux/odata-service-writer": "0.14.6",
24
- "@sap-ux/ui5-application-writer": "0.15.1",
25
- "@sap-ux/fe-fpm-writer": "0.15.0",
24
+ "@sap-ux/ui5-application-writer": "0.16.1",
25
+ "@sap-ux/fe-fpm-writer": "0.17.0",
26
26
  "@sap-ux/ui5-config": "0.14.5",
27
27
  "ejs": "3.1.7",
28
28
  "i18next": "20.3.2",
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE HTML>
2
- <html>
2
+ <html lang="en">
3
3
  <!-- Copyright (c) 2015 SAP AG, All Rights Reserved -->
4
4
  <head>
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -67,9 +67,14 @@
67
67
  data-sap-ui-resourceroots='{"<%- app.id %>": "../"}'
68
68
  data-sap-ui-frameOptions="allow"<% if (templateOptions.changesLoader) {%>
69
69
  data-sap-ui-flexibilityServices='[{"applyConnector":"<%= app.id.replace(/\./g, "/") %>/test/changes_loader", "custom":true}]'<% } %>>
70
- </script><% if (appOptions.loadReuseLibs) { %>
71
- <script id="locate-reuse-libs" src="../utils/locate-reuse-libs.js" data-sap-ui-manifest-uri="../manifest.json">
72
- </script><% } %><% if (templateOptions.changesPreview) { %>
70
+ </script><% if (appOptions.loadReuseLibs) { %>
71
+ <script id="locate-reuse-libs" src="../utils/locate-reuse-libs.js" data-sap-ui-manifest-uri="../manifest.json">
72
+ </script><% } else { %>
73
+ <script>
74
+ sap.ui.getCore().attachInit(function () {
75
+ sap.ushell.Container.createRenderer().placeAt("content");
76
+ });
77
+ </script><% } %><% if (templateOptions.changesPreview) { %>
73
78
  <!-- relevant for version < 1.78.0 only -->
74
79
  <script src="changes_preview.js"></script><% } %>
75
80
  </head>
@@ -0,0 +1,22 @@
1
+ import AppComponent from '<%- app.baseComponent %>';
2
+
3
+ /**
4
+ * @namespace <%- app.id %>
5
+ */
6
+ export default class Component extends AppComponent {
7
+
8
+ public static metadata = {
9
+ manifest: "json"
10
+ };
11
+
12
+ /**
13
+ * Gets the component startup parameters, setting preferredMode to 'create'.
14
+ *
15
+ * @returns startup parameters containing preferredMode set to 'create'
16
+ */
17
+ public getStartupParameters(): Promise<object> {
18
+ return Promise.resolve({
19
+ preferredMode: ["create"]
20
+ });
21
+ }
22
+ }