@sap-ux/fiori-elements-writer 0.6.1 → 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 }
@@ -81,26 +81,27 @@ function generate(basePath, data, fs) {
81
81
  fe_fpm_writer_1.generateCustomPage(basePath, {
82
82
  entity: config.entityConfig.mainEntityName,
83
83
  name: config.pageName,
84
- minUI5Version: (_d = feApp.ui5) === null || _d === void 0 ? void 0 : _d.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
85
86
  }, fs);
86
87
  }
87
88
  else {
88
89
  // Copy version specific common templates and version specific, floorplan specific templates
89
- 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}`);
90
91
  [path_1.join(templateVersionPath, 'common', 'add'), path_1.join(templateVersionPath, feApp.template.type, 'add')].forEach((templatePath) => {
91
- fs.copyTpl(path_1.join(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true });
92
+ fs.copyTpl(path_1.join(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true, globOptions: { ignore } });
92
93
  });
93
94
  }
94
95
  // Update manifest.json with template specific settings
95
96
  manifestSettings_1.extendManifestJson(fs, basePath, rootTemplatesPath, feApp);
96
97
  const packageJson = JSON.parse(fs.read(packagePath));
97
98
  packageJson.scripts = Object.assign(packageJson.scripts, Object.assign({}, packageConfig_1.getPackageJsonTasks({
98
- localOnly: !((_f = feApp.service) === null || _f === void 0 ? void 0 : _f.url),
99
- addMock: !!((_g = feApp.service) === null || _g === void 0 ? void 0 : _g.metadata),
100
- 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,
101
102
  flpAppId: feApp.app.flpAppId,
102
- startFile: (_j = data === null || data === void 0 ? void 0 : data.app) === null || _j === void 0 ? void 0 : _j.startFile,
103
- 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
104
105
  })));
105
106
  fs.writeJSON(packagePath, packageJson);
106
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.6.1",
4
+ "version": "0.6.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@sap-ux/odata-service-writer": "0.14.6",
24
- "@sap-ux/ui5-application-writer": "0.16.0",
24
+ "@sap-ux/ui5-application-writer": "0.16.1",
25
25
  "@sap-ux/fe-fpm-writer": "0.17.0",
26
26
  "@sap-ux/ui5-config": "0.14.5",
27
27
  "ejs": "3.1.7",
@@ -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
+ }