@sap-ux/create 0.0.12 → 0.1.0

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.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddCommands = void 0;
4
4
  const commander_1 = require("commander");
5
5
  const mockserver_config_1 = require("./mockserver-config");
6
+ const smartlinks_config_1 = require("./smartlinks-config");
6
7
  /**
7
8
  * Return 'create-fiori add *' commands. Commands include also the handler action.
8
9
  *
@@ -12,6 +13,8 @@ function getAddCommands() {
12
13
  const addCommands = new commander_1.Command('add');
13
14
  // create-fiori add mockserver-config
14
15
  (0, mockserver_config_1.addAddMockserverConfigCommand)(addCommands);
16
+ // create-fiori add smartlinks-config
17
+ (0, smartlinks_config_1.addAddSmartLinksConfigCommand)(addCommands);
15
18
  return addCommands;
16
19
  }
17
20
  exports.getAddCommands = getAddCommands;
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Add the "add smartlinks config" command to a passed command.
4
+ *
5
+ * @param cmd - commander command for adding smartlinks config command
6
+ */
7
+ export declare function addAddSmartLinksConfigCommand(cmd: Command): void;
8
+ //# sourceMappingURL=smartlinks-config.d.ts.map
@@ -0,0 +1,58 @@
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.addAddSmartLinksConfigCommand = void 0;
13
+ const app_config_writer_1 = require("@sap-ux/app-config-writer");
14
+ const tracing_1 = require("../../tracing");
15
+ const validation_1 = require("../../validation");
16
+ /**
17
+ * Add the "add smartlinks config" command to a passed command.
18
+ *
19
+ * @param cmd - commander command for adding smartlinks config command
20
+ */
21
+ function addAddSmartLinksConfigCommand(cmd) {
22
+ cmd.command('smartlinks-config [path]')
23
+ .option('-s, --simulate', 'simulate only do not write config; sets also --verbose')
24
+ .option('-v, --verbose', 'show verbose information')
25
+ .action((path, options) => __awaiter(this, void 0, void 0, function* () {
26
+ if (options.verbose === true || options.simulate) {
27
+ (0, tracing_1.setLogLevelVerbose)();
28
+ }
29
+ yield addSmartLinksConfig(path || process.cwd(), !!options.simulate);
30
+ }));
31
+ }
32
+ exports.addAddSmartLinksConfigCommand = addAddSmartLinksConfigCommand;
33
+ /**
34
+ * Adds a smartLinks config to an app or project.
35
+ *
36
+ * @param basePath - path to application root
37
+ * @param simulate - if true, do not write but just show what would be change; otherwise write
38
+ */
39
+ function addSmartLinksConfig(basePath, simulate) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const logger = (0, tracing_1.getLogger)();
42
+ try {
43
+ logger.debug(`Called add smartlinks-config for path '${basePath}', simulate is '${simulate}'`);
44
+ (0, validation_1.validateBasePath)(basePath);
45
+ const config = yield (0, app_config_writer_1.getSmartLinksTargetFromPrompt)(basePath, logger);
46
+ const fs = yield (0, app_config_writer_1.generateSmartLinksConfig)(basePath, config, logger);
47
+ yield (0, tracing_1.traceChanges)(fs);
48
+ if (!simulate) {
49
+ fs.commit(() => logger.info(`SmartLinks configuration written.`));
50
+ }
51
+ }
52
+ catch (error) {
53
+ logger.error(`Error while executing add smartlinks-config '${error.message}'`);
54
+ logger.debug(error);
55
+ }
56
+ });
57
+ }
58
+ //# sourceMappingURL=smartlinks-config.js.map
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.0.12",
4
+ "version": "0.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -25,9 +25,10 @@
25
25
  "!dist/**/*.map"
26
26
  ],
27
27
  "dependencies": {
28
+ "@sap-ux/app-config-writer": "0.0.2",
28
29
  "@sap-ux/logger": "0.3.5",
29
- "@sap-ux/mockserver-config-writer": "0.1.0",
30
- "@sap-ux/project-access": "1.2.0",
30
+ "@sap-ux/mockserver-config-writer": "0.1.1",
31
+ "@sap-ux/project-access": "1.3.0",
31
32
  "chalk": "4.1.2",
32
33
  "commander": "9.4.0",
33
34
  "diff": "5.1.0",