@sap-ux/create 0.7.30 → 0.7.31

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
@@ -32,6 +32,13 @@ Calling `sap-ux add annotations` allows adding an annotation to the OData Source
32
32
  sap-ux add annotations /path/to/adaptation-project
33
33
  ```
34
34
 
35
+ ### model
36
+ Calling `sap-ux add model` allows to add new OData Service and SAPUI5 Model to an existing adaptation project.
37
+ ```sh
38
+ sap-ux add model /path/to/adaptation-project
39
+ ```
40
+ If the project path is not provided, the current working directory will be used.
41
+
35
42
  ## change
36
43
  Calling `sap-ux change` allows changing a feature of a project.
37
44
 
@@ -7,6 +7,7 @@ const smartlinks_config_1 = require("./smartlinks-config");
7
7
  const cds_plugin_ui_1 = require("./cds-plugin-ui");
8
8
  const navigation_config_1 = require("./navigation-config");
9
9
  const cards_editor_1 = require("./cards-editor");
10
+ const new_model_1 = require("./new-model");
10
11
  const annotations_to_odata_1 = require("./annotations-to-odata");
11
12
  const html_1 = require("./html");
12
13
  /**
@@ -26,6 +27,8 @@ function getAddCommands() {
26
27
  (0, navigation_config_1.addInboundNavigationConfigCommand)(addCommands);
27
28
  // create-fiori add cards-editor
28
29
  (0, cards_editor_1.addCardsEditorConfigCommand)(addCommands);
30
+ // create-fiori add model
31
+ (0, new_model_1.addNewModelCommand)(addCommands);
29
32
  // create-fiori add annotations-to-odata
30
33
  (0, annotations_to_odata_1.addAnnotationsToOdataCommand)(addCommands);
31
34
  // create-fiori add html
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Add a new sub-command to add new odata service and new sapui5 model of an adaptation project to the given command.
4
+ *
5
+ * @param {Command} cmd - The command to add the model sub-command to.
6
+ */
7
+ export declare function addNewModelCommand(cmd: Command): void;
8
+ //# sourceMappingURL=new-model.d.ts.map
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addNewModelCommand = void 0;
4
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
5
+ const common_1 = require("../../common");
6
+ const tracing_1 = require("../../tracing");
7
+ const validation_1 = require("../../validation/validation");
8
+ /**
9
+ * Add a new sub-command to add new odata service and new sapui5 model of an adaptation project to the given command.
10
+ *
11
+ * @param {Command} cmd - The command to add the model sub-command to.
12
+ */
13
+ function addNewModelCommand(cmd) {
14
+ cmd.command('model [path]')
15
+ .option('-s, --simulate', 'simulate only do not write or install')
16
+ .action(async (path, options) => {
17
+ await addNewModel(path, !!options.simulate);
18
+ });
19
+ }
20
+ exports.addNewModelCommand = addNewModelCommand;
21
+ /**
22
+ * Changes the odata service and new sapui5 model of an adaptation project.
23
+ *
24
+ * @param {string} basePath - The path to the adaptation project.
25
+ * @param {boolean} simulate - If set to true, then no files will be written to the filesystem.
26
+ */
27
+ async function addNewModel(basePath, simulate) {
28
+ const logger = (0, tracing_1.getLogger)();
29
+ try {
30
+ if (!basePath) {
31
+ basePath = process.cwd();
32
+ }
33
+ await (0, validation_1.validateAdpProject)(basePath);
34
+ const variant = (0, adp_tooling_1.getVariant)(basePath);
35
+ const answers = await (0, common_1.promptYUIQuestions)((0, adp_tooling_1.getPromptsForNewModel)(basePath, variant.layer), false);
36
+ const fs = await (0, adp_tooling_1.generateChange)(basePath, "appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */, {
37
+ variant,
38
+ answers
39
+ });
40
+ if (!simulate) {
41
+ await new Promise((resolve) => fs.commit(resolve));
42
+ }
43
+ else {
44
+ await (0, tracing_1.traceChanges)(fs);
45
+ }
46
+ }
47
+ catch (error) {
48
+ logger.error(error.message);
49
+ logger.debug(error);
50
+ }
51
+ }
52
+ //# sourceMappingURL=new-model.js.map
@@ -17,6 +17,7 @@ function isFunction(property) {
17
17
  }
18
18
  const QUESTION_TYPE_MAP = {
19
19
  input: 'text',
20
+ editor: 'text',
20
21
  list: 'autocomplete',
21
22
  checkbox: 'multiselect'
22
23
  };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateCloudAdpProject = exports.validateAdpProject = exports.hasFileDeletes = exports.validateBasePath = void 0;
4
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
5
- const project_access_1 = require("@sap-ux/project-access");
6
- const fs_1 = require("fs");
7
4
  const path_1 = require("path");
5
+ const fs_1 = require("fs");
6
+ const project_access_1 = require("@sap-ux/project-access");
7
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
8
8
  /**
9
9
  * Validate base path of app, throw error if file is missing.
10
10
  *
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.7.30",
4
+ "version": "0.7.31",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,17 +30,17 @@
30
30
  "mem-fs": "2.1.0",
31
31
  "mem-fs-editor": "9.4.0",
32
32
  "prompts": "2.4.2",
33
- "@sap-ux/adp-tooling": "0.12.18",
33
+ "@sap-ux/adp-tooling": "0.12.19",
34
34
  "@sap-ux/app-config-writer": "0.4.12",
35
- "@sap-ux/cap-config-writer": "0.7.5",
35
+ "@sap-ux/cap-config-writer": "0.7.6",
36
36
  "@sap-ux/cards-editor-config-writer": "0.4.1",
37
- "@sap-ux/inquirer-common": "0.4.2",
37
+ "@sap-ux/inquirer-common": "0.4.3",
38
38
  "@sap-ux/logger": "0.6.0",
39
39
  "@sap-ux/mockserver-config-writer": "0.6.1",
40
- "@sap-ux/preview-middleware": "0.16.28",
40
+ "@sap-ux/preview-middleware": "0.16.29",
41
41
  "@sap-ux/project-access": "1.25.7",
42
- "@sap-ux/ui5-config": "0.23.1",
43
- "@sap-ux/system-access": "0.5.3"
42
+ "@sap-ux/system-access": "0.5.3",
43
+ "@sap-ux/ui5-config": "0.23.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/diff": "5.0.9",
@@ -48,7 +48,7 @@
48
48
  "@types/mem-fs": "1.1.2",
49
49
  "@types/mem-fs-editor": "7.0.1",
50
50
  "@types/prompts": "2.4.4",
51
- "@sap-ux/inquirer-common": "0.4.2",
51
+ "@sap-ux/inquirer-common": "0.4.3",
52
52
  "@sap-ux/store": "0.7.0"
53
53
  },
54
54
  "scripts": {