@sap-ux/create 0.10.8 → 0.10.10

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
@@ -44,6 +44,7 @@ Common Options:
44
44
  The `@sap-ux/create` modules provides commands for the following cases:
45
45
  - `sap-ux add` - allows adding a feature
46
46
  - `sap-ux change` allows changing a feature
47
+ - `sap-ux convert` allows converting an app to a new feature
47
48
  - `sap-ux remove` allows removing a feature
48
49
  - `sap-ux generate` allows generating a new project
49
50
 
@@ -148,8 +149,17 @@ Calling `sap-ux change inbound` allows replacing the Inbound FLP configurations
148
149
  sap-ux change inbound [path]
149
150
  ```
150
151
 
152
+ ## sap-ux convert
153
+ Executing `sap-ux convert` converts an app to a new feature.
154
+
155
+ ### preview
156
+ Executing `sap-ux convert preview-config` in the root folder of an app will convert the respective app to the preview with virtual files. It will use the configuration from the scripts in the `package.json` file to adjust the UI5 configuration YAML files accordingly. The obsolete JS and TS sources will be deleted and the HTML files previously used for the preview will be renamed to `*_old.html`.
157
+ ```sh
158
+ sap-ux convert preview [path]
159
+ ```
160
+
151
161
  ## sap-ux remove
152
- Calling `sap-ux remove` allows removing a feature to a project.
162
+ Calling `sap-ux remove` allows removing a feature from a project.
153
163
 
154
164
  ### mockserver-config
155
165
  Calling `sap-ux remove mockserver-config` removes the configuration for mockserver module @sap-ux/ui5-middleware-fe-mockserver.
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Return 'create-fiori convert *' commands. Commands include also the handler action.
4
+ *
5
+ * @returns - commander command containing convert <feature> commands
6
+ */
7
+ export declare function getConvertCommands(): Command;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getConvertCommands = getConvertCommands;
4
+ const commander_1 = require("commander");
5
+ const preview_1 = require("./preview");
6
+ /**
7
+ * Return 'create-fiori convert *' commands. Commands include also the handler action.
8
+ *
9
+ * @returns - commander command containing convert <feature> commands
10
+ */
11
+ function getConvertCommands() {
12
+ const convertCommands = new commander_1.Command('convert');
13
+ (0, preview_1.addConvertPreviewCommand)(convertCommands);
14
+ return convertCommands;
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Add a new sub-command to convert the preview of a project to virtual files.
4
+ *
5
+ * @param {Command} cmd - The command to add the convert sub-command to.
6
+ */
7
+ export declare function addConvertPreviewCommand(cmd: Command): void;
8
+ //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addConvertPreviewCommand = addConvertPreviewCommand;
4
+ const tracing_1 = require("../../tracing");
5
+ const app_config_writer_1 = require("@sap-ux/app-config-writer");
6
+ /**
7
+ * Add a new sub-command to convert the preview of a project to virtual files.
8
+ *
9
+ * @param {Command} cmd - The command to add the convert sub-command to.
10
+ */
11
+ function addConvertPreviewCommand(cmd) {
12
+ cmd.command('preview-config [path]')
13
+ .option('-s, --simulate', 'simulate only do not write or install')
14
+ .option('-v, --verbose', 'show verbose information')
15
+ .action(async (path, options) => {
16
+ if (options.verbose === true || options.simulate) {
17
+ (0, tracing_1.setLogLevelVerbose)();
18
+ }
19
+ await convertPreview(path, !!options.simulate);
20
+ });
21
+ }
22
+ /**
23
+ * Changes the data source of an adaptation project.
24
+ *
25
+ * @param {string} basePath - The path to the adaptation project.
26
+ * @param {boolean} simulate - If set to true, then no files will be written to the filesystem.
27
+ */
28
+ async function convertPreview(basePath, simulate) {
29
+ const logger = (0, tracing_1.getLogger)();
30
+ if (!basePath) {
31
+ basePath = process.cwd();
32
+ }
33
+ logger.debug(`Called convert preview for path '${basePath}'. The simulate path is '${simulate}'.`);
34
+ try {
35
+ const fs = await (0, app_config_writer_1.convertToVirtualPreview)(basePath, logger);
36
+ if (!simulate) {
37
+ fs.commit(() => logger.info(`The changes for preview conversion have been written.`));
38
+ }
39
+ else {
40
+ await (0, tracing_1.traceChanges)(fs);
41
+ }
42
+ }
43
+ catch (error) {
44
+ logger.error(error?.message);
45
+ logger.debug(error);
46
+ }
47
+ }
48
+ //# sourceMappingURL=preview.js.map
package/dist/cli/index.js CHANGED
@@ -9,6 +9,7 @@ const add_1 = require("./add");
9
9
  const remove_1 = require("./remove");
10
10
  const generate_1 = require("./generate");
11
11
  const change_1 = require("./change");
12
+ const convert_1 = require("./convert");
12
13
  /*
13
14
  * We've chosen 'commander' over 'minimist' and 'yargs' for this CLI implementation. Reasons:
14
15
  * (if it still up: https://npmtrends.com/commander-vs-minimist-vs-yargs)
@@ -49,6 +50,8 @@ function getCommanderProgram() {
49
50
  program.addCommand((0, generate_1.getGenerateCommands)());
50
51
  // Handler for create-fiori add <feature> ..
51
52
  program.addCommand((0, add_1.getAddCommands)());
53
+ // Handler for create-fiori convert <feature> ..
54
+ program.addCommand((0, convert_1.getConvertCommands)());
52
55
  // Handler for create-fiori remove <feature> ..
53
56
  program.addCommand((0, remove_1.getRemoveCommands)());
54
57
  // Handler for create-fiori change <feature> ..
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/create",
3
3
  "description": "SAP Fiori tools module to add or remove features",
4
- "version": "0.10.8",
4
+ "version": "0.10.10",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,21 +30,21 @@
30
30
  "mem-fs": "2.1.0",
31
31
  "mem-fs-editor": "9.4.0",
32
32
  "prompts": "2.4.2",
33
- "@sap-ux/abap-deploy-config-inquirer": "1.1.6",
34
- "@sap-ux/adp-tooling": "0.12.91",
35
- "@sap-ux/abap-deploy-config-writer": "0.0.65",
36
- "@sap-ux/app-config-writer": "0.5.3",
37
- "@sap-ux/cap-config-writer": "0.7.62",
33
+ "@sap-ux/abap-deploy-config-inquirer": "1.1.7",
34
+ "@sap-ux/abap-deploy-config-writer": "0.0.66",
35
+ "@sap-ux/adp-tooling": "0.12.92",
36
+ "@sap-ux/app-config-writer": "0.5.4",
37
+ "@sap-ux/cap-config-writer": "0.7.63",
38
38
  "@sap-ux/cards-editor-config-writer": "0.4.8",
39
- "@sap-ux/inquirer-common": "0.5.8",
40
- "@sap-ux/mockserver-config-writer": "0.7.0",
41
- "@sap-ux/odata-service-writer": "0.24.0",
42
- "@sap-ux/preview-middleware": "0.16.143",
39
+ "@sap-ux/inquirer-common": "0.5.9",
43
40
  "@sap-ux/logger": "0.6.0",
44
- "@sap-ux/project-access": "1.28.8",
41
+ "@sap-ux/mockserver-config-writer": "0.7.0",
42
+ "@sap-ux/odata-service-writer": "0.24.1",
43
+ "@sap-ux/preview-middleware": "0.16.144",
44
+ "@sap-ux/project-access": "1.28.9",
45
45
  "@sap-ux/system-access": "0.5.21",
46
46
  "@sap-ux/ui5-config": "0.26.0",
47
- "@sap-ux/flp-config-inquirer": "0.1.4"
47
+ "@sap-ux/flp-config-inquirer": "0.1.5"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/diff": "5.0.9",
@@ -52,8 +52,8 @@
52
52
  "@types/mem-fs": "1.1.2",
53
53
  "@types/mem-fs-editor": "7.0.1",
54
54
  "@types/prompts": "2.4.4",
55
- "@sap-ux/store": "0.9.3",
56
- "@sap-ux/inquirer-common": "0.5.8"
55
+ "@sap-ux/inquirer-common": "0.5.9",
56
+ "@sap-ux/store": "0.9.3"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsc --build",