@sap-ux/create 0.2.16 → 0.3.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.
package/dist/cli/add/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const commander_1 = require("commander");
|
|
|
5
5
|
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
|
+
const navigation_config_1 = require("./navigation-config");
|
|
8
9
|
/**
|
|
9
10
|
* Return 'create-fiori add *' commands. Commands include also the handler action.
|
|
10
11
|
*
|
|
@@ -18,6 +19,8 @@ function getAddCommands() {
|
|
|
18
19
|
(0, smartlinks_config_1.addAddSmartLinksConfigCommand)(addCommands);
|
|
19
20
|
// create-fiori add cds-plugin-ui5
|
|
20
21
|
(0, cds_plugin_ui_1.addAddCdsPluginUi5Command)(addCommands);
|
|
22
|
+
// create-fiori add inbound-navigation-config
|
|
23
|
+
(0, navigation_config_1.addInboundNavigationConfigCommand)(addCommands);
|
|
21
24
|
return addCommands;
|
|
22
25
|
}
|
|
23
26
|
exports.getAddCommands = getAddCommands;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Add the "add inbound-navigation" command to a passed command.
|
|
4
|
+
*
|
|
5
|
+
* @param cmd - commander command for adding navigation inbounds config command
|
|
6
|
+
*/
|
|
7
|
+
export declare function addInboundNavigationConfigCommand(cmd: Command): void;
|
|
8
|
+
//# sourceMappingURL=navigation-config.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
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.addInboundNavigationConfigCommand = 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 inbound-navigation" command to a passed command.
|
|
18
|
+
*
|
|
19
|
+
* @param cmd - commander command for adding navigation inbounds config command
|
|
20
|
+
*/
|
|
21
|
+
function addInboundNavigationConfigCommand(cmd) {
|
|
22
|
+
cmd.command('inbound-navigation [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 addInboundNavigationConfig(path || process.cwd(), !!options.simulate);
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
exports.addInboundNavigationConfigCommand = addInboundNavigationConfigCommand;
|
|
33
|
+
/**
|
|
34
|
+
* Adds an inbound navigation config to an app. To prevent overwriting existing inbounds will be checked.
|
|
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 addInboundNavigationConfig(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 inbound navigation-config for path '${basePath}', simulate is '${simulate}'`);
|
|
44
|
+
(0, validation_1.validateBasePath)(basePath);
|
|
45
|
+
const { config, fs } = yield (0, app_config_writer_1.promptInboundNavigationConfig)(basePath);
|
|
46
|
+
if (config) {
|
|
47
|
+
yield (0, app_config_writer_1.generateInboundNavigationConfig)(basePath, config, true, fs);
|
|
48
|
+
}
|
|
49
|
+
yield (0, tracing_1.traceChanges)(fs);
|
|
50
|
+
if (!simulate) {
|
|
51
|
+
fs.commit(() => logger.info(`Inbound navigation configuration complete.`));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
logger.error(`Error while executing add inbound navigation configuration '${error.message}'`);
|
|
56
|
+
logger.debug(error);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=navigation-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.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"commander": "9.4.0",
|
|
30
30
|
"diff": "5.1.0",
|
|
31
31
|
"prompts": "2.4.2",
|
|
32
|
-
"@sap-ux/app-config-writer": "0.0
|
|
32
|
+
"@sap-ux/app-config-writer": "0.1.0",
|
|
33
33
|
"@sap-ux/cap-config-writer": "0.1.8",
|
|
34
34
|
"@sap-ux/logger": "0.3.7",
|
|
35
35
|
"@sap-ux/mockserver-config-writer": "0.1.7",
|