@sap-ux/create 0.5.63 → 0.5.65

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.
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Add the cards-editor-config command.
4
+ *
5
+ * @param cmd - commander command for adding navigation inbounds config command
6
+ */
7
+ export declare function addCardsEditorConfigCommand(cmd: Command): void;
8
+ //# sourceMappingURL=cards-editor.d.ts.map
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.addCardsEditorConfigCommand = void 0;
13
+ const cards_editor_config_writer_1 = require("@sap-ux/cards-editor-config-writer");
14
+ const tracing_1 = require("../../tracing");
15
+ const validation_1 = require("../../validation");
16
+ const common_1 = require("../../common");
17
+ /**
18
+ * Add the cards-editor-config command.
19
+ *
20
+ * @param cmd - commander command for adding navigation inbounds config command
21
+ */
22
+ function addCardsEditorConfigCommand(cmd) {
23
+ cmd.command('cards-editor [path]')
24
+ .option('-n, --skip-install', 'skip npm install step')
25
+ .option('-s, --simulate', 'simulate only do not write config; sets also --verbose')
26
+ .option('-v, --verbose', 'show verbose information')
27
+ .action((path, options) => __awaiter(this, void 0, void 0, function* () {
28
+ if (options.verbose === true || options.simulate) {
29
+ (0, tracing_1.setLogLevelVerbose)();
30
+ }
31
+ yield addCardsEditorConfig(path || process.cwd(), !!options.simulate, !!options.skipInstall);
32
+ }));
33
+ }
34
+ exports.addCardsEditorConfigCommand = addCardsEditorConfigCommand;
35
+ /**
36
+ * Adds an cards editor config to an app. To prevent overwriting existing inbounds will be checked.
37
+ *
38
+ * @param basePath - path to application root
39
+ * @param simulate - if true, do not write but just show what would be change; otherwise write
40
+ * @param skipInstall - if true, do not run npm install
41
+ */
42
+ function addCardsEditorConfig(basePath, simulate, skipInstall) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const logger = (0, tracing_1.getLogger)();
45
+ try {
46
+ logger.debug(`Called add cards-editor-config for path '${basePath}', simulate is '${simulate}'`);
47
+ (0, validation_1.validateBasePath)(basePath);
48
+ const fs = yield (0, cards_editor_config_writer_1.enableCardsEditor)(basePath);
49
+ if (!simulate) {
50
+ yield new Promise((resolve) => fs.commit(resolve));
51
+ if (!skipInstall) {
52
+ (0, common_1.runNpmInstallCommand)(basePath);
53
+ logger.info('Executed npm install');
54
+ }
55
+ }
56
+ else {
57
+ yield (0, tracing_1.traceChanges)(fs);
58
+ }
59
+ }
60
+ catch (error) {
61
+ logger.error(`Error while executing add cards editor configuration '${error.message}'`);
62
+ logger.debug(error);
63
+ }
64
+ });
65
+ }
66
+ //# sourceMappingURL=cards-editor.js.map
@@ -6,6 +6,7 @@ const mockserver_config_1 = require("./mockserver-config");
6
6
  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
+ const cards_editor_1 = require("./cards-editor");
9
10
  /**
10
11
  * Return 'create-fiori add *' commands. Commands include also the handler action.
11
12
  *
@@ -21,6 +22,8 @@ function getAddCommands() {
21
22
  (0, cds_plugin_ui_1.addAddCdsPluginUi5Command)(addCommands);
22
23
  // create-fiori add inbound-navigation-config
23
24
  (0, navigation_config_1.addInboundNavigationConfigCommand)(addCommands);
25
+ // create-fiori add cards-editor
26
+ (0, cards_editor_1.addCardsEditorConfigCommand)(addCommands);
24
27
  return addCommands;
25
28
  }
26
29
  exports.getAddCommands = getAddCommands;
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.5.63",
4
+ "version": "0.5.65",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -28,9 +28,10 @@
28
28
  "commander": "9.4.0",
29
29
  "diff": "5.1.0",
30
30
  "prompts": "2.4.2",
31
- "@sap-ux/adp-tooling": "0.9.17",
32
- "@sap-ux/app-config-writer": "0.3.48",
31
+ "@sap-ux/adp-tooling": "0.9.18",
32
+ "@sap-ux/app-config-writer": "0.3.49",
33
33
  "@sap-ux/cap-config-writer": "0.2.30",
34
+ "@sap-ux/cards-editor-config-writer": "0.3.0",
34
35
  "@sap-ux/logger": "0.5.1",
35
36
  "@sap-ux/mockserver-config-writer": "0.4.1",
36
37
  "@sap-ux/project-access": "1.19.10"