@sap-ux/fiori-generator-shared 0.12.1 → 0.12.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Commonly used shared functionality to support the fiori generator.
4
4
  Add functionality that may be used by multiple generator modules.
5
5
 
6
- When adding additional templates, ensure the calling function (e.g., generateReadMe) remains at the src directory level to align with the template location pattern used during generator bundling.
6
+ When adding additional templates, ensure the calling function (e.g., generateAppGenInfo) remains at the src directory level to align with the template location pattern used during generator bundling.
7
7
 
8
8
  ## License
9
9
 
@@ -0,0 +1,12 @@
1
+ import type { AppGenInfo } from './types';
2
+ import type { Editor } from 'mem-fs-editor';
3
+ /**
4
+ * Generates a README file and .appGenInfo.json at the specified destination path using the provided configuration and file system editor.
5
+ *
6
+ * @param {string} destPath - the desitination path where the info fileswill be created.
7
+ * @param {AppGenInfo} appGenInfo - the configuration object containing the details to be included in the info files.
8
+ * @param {Editor} fs - the file system editor instance used to write the info files.
9
+ * @returns {Editor} the file system editor instance used to write the info files.
10
+ */
11
+ export declare function generateAppGenInfo(destPath: string, appGenInfo: AppGenInfo, fs: Editor): Editor;
12
+ //# sourceMappingURL=app-gen-info.d.ts.map
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateAppGenInfo = generateAppGenInfo;
4
+ const path_1 = require("path");
5
+ /**
6
+ * Generates a README file and .appGenInfo.json at the specified destination path using the provided configuration and file system editor.
7
+ *
8
+ * @param {string} destPath - the desitination path where the info fileswill be created.
9
+ * @param {AppGenInfo} appGenInfo - the configuration object containing the details to be included in the info files.
10
+ * @param {Editor} fs - the file system editor instance used to write the info files.
11
+ * @returns {Editor} the file system editor instance used to write the info files.
12
+ */
13
+ function generateAppGenInfo(destPath, appGenInfo, fs) {
14
+ // N.B. This function must stay at this level in the directory structure, i.e one level below 'templates'
15
+ // Apply the configuration to generate the README file
16
+ const templateSourcePath = (0, path_1.join)(__dirname, '../templates/README.md');
17
+ const templateDestPath = `${destPath}/README.md`;
18
+ const { externalParameters, ...appGenInfoCore } = appGenInfo;
19
+ // Write the README file
20
+ fs.copyTpl(templateSourcePath, templateDestPath, appGenInfoCore);
21
+ const appGenInfoJson = {
22
+ generationParameters: appGenInfoCore
23
+ };
24
+ if (externalParameters) {
25
+ appGenInfoJson.externalParameters = [...externalParameters];
26
+ }
27
+ // Write the .appGenInfo.json file
28
+ fs.writeJSON(`${destPath}/.appGenInfo.json`, appGenInfoJson);
29
+ return fs;
30
+ }
31
+ //# sourceMappingURL=app-gen-info.js.map
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@ export * from './types';
8
8
  export { getPackageScripts } from './npm-package-scripts/getPackageScripts';
9
9
  export { getBootstrapResourceUrls } from './ui5/ui5';
10
10
  export { getDefaultTargetFolder, isExtensionInstalled } from './vscode-helpers/vscode-helpers';
11
- export { generateReadMe } from './read-me';
11
+ export { generateAppGenInfo } from './app-gen-info';
12
12
  export { getHostEnvironment } from './environment';
13
13
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.getHostEnvironment = exports.generateReadMe = exports.isExtensionInstalled = exports.getDefaultTargetFolder = exports.getBootstrapResourceUrls = exports.getPackageScripts = void 0;
17
+ exports.getHostEnvironment = exports.generateAppGenInfo = exports.isExtensionInstalled = exports.getDefaultTargetFolder = exports.getBootstrapResourceUrls = exports.getPackageScripts = void 0;
18
18
  __exportStar(require("./cap"), exports);
19
19
  __exportStar(require("./constants"), exports);
20
20
  __exportStar(require("./environment"), exports);
@@ -29,8 +29,8 @@ Object.defineProperty(exports, "getBootstrapResourceUrls", { enumerable: true, g
29
29
  var vscode_helpers_1 = require("./vscode-helpers/vscode-helpers");
30
30
  Object.defineProperty(exports, "getDefaultTargetFolder", { enumerable: true, get: function () { return vscode_helpers_1.getDefaultTargetFolder; } });
31
31
  Object.defineProperty(exports, "isExtensionInstalled", { enumerable: true, get: function () { return vscode_helpers_1.isExtensionInstalled; } });
32
- var read_me_1 = require("./read-me");
33
- Object.defineProperty(exports, "generateReadMe", { enumerable: true, get: function () { return read_me_1.generateReadMe; } });
32
+ var app_gen_info_1 = require("./app-gen-info");
33
+ Object.defineProperty(exports, "generateAppGenInfo", { enumerable: true, get: function () { return app_gen_info_1.generateAppGenInfo; } });
34
34
  var environment_1 = require("./environment");
35
35
  Object.defineProperty(exports, "getHostEnvironment", { enumerable: true, get: function () { return environment_1.getHostEnvironment; } });
36
36
  //# sourceMappingURL=index.js.map
@@ -1,17 +1,21 @@
1
1
  /**
2
- * Interface representing additional entries for the README file.
2
+ * Interface representing external parameters for the .appGenInfo.json file.
3
3
  */
4
- interface AdditionalEntries {
5
- /** The label for the additional entry. */
6
- label: string;
7
- /** The value corresponding to the label of the additional entry. */
4
+ export type ExternalParameters = {
5
+ [key: string]: string | object | object[];
6
+ };
7
+ /**
8
+ * Interface representing the configuration for entity-related information in AppGen.
9
+ */
10
+ interface EntityRelatedConfig {
11
+ type: string;
8
12
  value: string;
9
13
  }
10
14
  /**
11
- * Interface representing the configuration for generating a README file.
12
- * Extends OptionalEntries to include dynamic properties along with the core properties.
15
+ * Interface representing the configuration for generating info files for AppGen i.e. README.md & .appGenInfo.json.
16
+ * Extendable with externalParameters - which will be used for writing to the .appGenInfo.json file.
13
17
  */
14
- export interface ReadMe {
18
+ export interface AppGenInfo {
15
19
  /** The name of the application. */
16
20
  appName: string;
17
21
  /** The title of the application. */
@@ -50,8 +54,15 @@ export interface ReadMe {
50
54
  showMockDataInfo?: boolean;
51
55
  /** Text used to launch the application */
52
56
  launchText?: string;
53
- /** Additional custom entries for the application. */
54
- additionalEntries?: AdditionalEntries[];
57
+ /**
58
+ * An array used to store information on the various entities, e.g main, navigation entity, and filter entity type.
59
+ */
60
+ entityRelatedConfig?: EntityRelatedConfig[];
61
+ /**
62
+ * Additional external parameters.
63
+ * N.B. these will be added to the .appGenInfo.json file only
64
+ */
65
+ externalParameters?: ExternalParameters[];
55
66
  }
56
67
  export {};
57
- //# sourceMappingURL=read-me.d.ts.map
68
+ //# sourceMappingURL=app-gen.d.ts.map
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=read-me.js.map
3
+ //# sourceMappingURL=app-gen.js.map
@@ -1,4 +1,4 @@
1
- export * from './read-me';
1
+ export * from './app-gen';
2
2
  export * from './environment';
3
3
  export * from './headless';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./read-me"), exports);
17
+ __exportStar(require("./app-gen"), exports);
18
18
  __exportStar(require("./environment"), exports);
19
19
  __exportStar(require("./headless"), exports);
20
20
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-generator-shared",
3
3
  "description": "Commonly used shared functionality and types to support the fiori generator.",
4
- "version": "0.12.1",
4
+ "version": "0.12.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -26,7 +26,7 @@
26
26
  "semver": "7.5.4",
27
27
  "@sap-ux/btp-utils": "1.1.0",
28
28
  "@sap-ux/project-access": "1.30.1",
29
- "@sap-ux/telemetry": "0.6.1"
29
+ "@sap-ux/telemetry": "0.6.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/mem-fs-editor": "7.0.1",
@@ -16,8 +16,8 @@
16
16
  |**UI5 Version**<br><%= locals.ui5Version ? locals.ui5Version : '' %>|
17
17
  |**Enable Code Assist Libraries**<br><% if(locals.enableCodeAssist === true) { %><%= "True" %><% } else { %><%= "False" %><% }%>|
18
18
  |**Enable TypeScript**<br><% if(locals.enableTypeScript === true) { %><%= "True" %><% } else { %><%= "False" %><% }%>|
19
- |**Add Eslint configuration**<br><% if(locals.enableEslint === true) { %><%= "True, see https://www.npmjs.com/package/eslint-plugin-fiori-custom for the eslint rules." %><% } else { %><%= "False" %><% }%>|<% if (locals.additionalEntries) locals.additionalEntries.forEach(entry => { %>
20
- |**<%= entry.label %>**<br><%= entry.value %>|<%})%>
19
+ |**Add Eslint configuration**<br><% if(locals.enableEslint === true) { %><%= "True, see https://www.npmjs.com/package/eslint-plugin-fiori-custom for the eslint rules." %><% } else { %><%= "False" %><% }%>|<% if (locals.entityRelatedConfig) locals.entityRelatedConfig.forEach(entry => { %>
20
+ |**<%= entry.type %>**<br><%= entry.value %>|<%})%>
21
21
 
22
22
  ## <%= appName %>
23
23
 
package/dist/read-me.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { ReadMe } from './types';
2
- import type { Editor } from 'mem-fs-editor';
3
- /**
4
- * Generates a README file at the specified destination path using the provided configuration and file system editor.
5
- *
6
- * @param {string} destPath - The desitination path where the README file will be created.
7
- * @param {ReadMe} readMe - The configuration object containing the details to be included in the README file.
8
- * @param {Editor} fs - The file system editor instance used to write the README file.
9
- * @returns {Editor} The file system editor instance used to write the README file.
10
- */
11
- export declare function generateReadMe(destPath: string, readMe: ReadMe, fs: Editor): Editor;
12
- //# sourceMappingURL=read-me.d.ts.map
package/dist/read-me.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateReadMe = generateReadMe;
4
- const path_1 = require("path");
5
- /**
6
- * Generates a README file at the specified destination path using the provided configuration and file system editor.
7
- *
8
- * @param {string} destPath - The desitination path where the README file will be created.
9
- * @param {ReadMe} readMe - The configuration object containing the details to be included in the README file.
10
- * @param {Editor} fs - The file system editor instance used to write the README file.
11
- * @returns {Editor} The file system editor instance used to write the README file.
12
- */
13
- function generateReadMe(destPath, readMe, fs) {
14
- // N.B. This function must stay at this level in the directory structure, i.e one level below 'templates'
15
- // Apply the configuration to generate the README file
16
- const templateSourcePath = (0, path_1.join)(__dirname, '../templates/README.md');
17
- const templateDestPath = `${destPath}/README.md`;
18
- // copy template
19
- fs.copyTpl(templateSourcePath, templateDestPath, readMe);
20
- return fs;
21
- }
22
- //# sourceMappingURL=read-me.js.map