@sap-ux/create 0.13.138 → 0.13.140

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.
@@ -20,27 +20,16 @@ const variants_config_1 = require("./variants-config");
20
20
  */
21
21
  function getAddCommands() {
22
22
  const addCommands = new commander_1.Command('add');
23
- // create-fiori add mockserver-config
24
23
  (0, mockserver_config_1.addAddMockserverConfigCommand)(addCommands);
25
- // create-fiori add smartlinks-config
26
24
  (0, smartlinks_config_1.addAddSmartLinksConfigCommand)(addCommands);
27
- // create-fiori add cds-plugin-ui5
28
25
  (0, cds_plugin_ui_1.addAddCdsPluginUi5Command)(addCommands);
29
- // create-fiori add inbound-navigation-config
30
26
  (0, navigation_config_1.addInboundNavigationConfigCommand)(addCommands);
31
- // create-fiori add cards-editor
32
27
  (0, cards_generator_1.addCardsEditorConfigCommand)(addCommands);
33
- // create-fiori add model
34
28
  (0, new_model_1.addNewModelCommand)(addCommands);
35
- // create-fiori add annotations-to-odata
36
29
  (0, annotations_to_odata_1.addAnnotationsToOdataCommand)(addCommands);
37
- // create-fiori add html
38
30
  (0, html_1.addAddHtmlFilesCmd)(addCommands);
39
- // create-fiori add component-usages
40
31
  (0, component_usages_1.addComponentUsagesCommand)(addCommands);
41
- // create-fiori add deploy-config
42
32
  (0, deploy_config_1.addDeployConfigCommand)(addCommands);
43
- // create-fiori add variants-config
44
33
  (0, variants_config_1.addAddVariantsConfigCommand)(addCommands);
45
34
  return addCommands;
46
35
  }
@@ -10,10 +10,9 @@ const change_inbound_1 = require("./change-inbound");
10
10
  * @returns - commander command containing change <feature> commands
11
11
  */
12
12
  function getChangeCommands() {
13
- const addCommands = new commander_1.Command('change');
14
- // create-fiori change data-source
15
- (0, change_data_source_1.addChangeDataSourceCommand)(addCommands);
16
- (0, change_inbound_1.addChangeInboundCommand)(addCommands);
17
- return addCommands;
13
+ const changeCommands = new commander_1.Command('change');
14
+ (0, change_data_source_1.addChangeDataSourceCommand)(changeCommands);
15
+ (0, change_inbound_1.addChangeInboundCommand)(changeCommands);
16
+ return changeCommands;
18
17
  }
19
18
  //# sourceMappingURL=index.js.map
@@ -8,7 +8,6 @@ const adaptation_project_1 = require("./adaptation-project");
8
8
  */
9
9
  function getGenerateCommands() {
10
10
  const genCommands = new commander_1.Command('generate');
11
- // create-fiori generate adaptation-project
12
11
  (0, adaptation_project_1.addGenerateAdaptationProjectCommand)(genCommands);
13
12
  return genCommands;
14
13
  }
@@ -1,7 +1,15 @@
1
+ import { Command } from 'commander';
1
2
  /**
2
3
  * Run the command line interface.
3
4
  *
4
5
  * @param argv - arguments, typically 'process.argv'
5
6
  */
6
7
  export declare function handleCreateFioriCommand(argv: string[]): void;
8
+ /**
9
+ * Generates the full MCP specification for a top-level commander program.
10
+ *
11
+ * @param cmd - The main Commander program instance.
12
+ * @returns A JSON string representing the CLI's capabilities.
13
+ */
14
+ export declare function generateJsonSpec(cmd: Command): string;
7
15
  //# sourceMappingURL=index.d.ts.map
package/dist/cli/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleCreateFioriCommand = handleCreateFioriCommand;
4
+ exports.generateJsonSpec = generateJsonSpec;
4
5
  const node_fs_1 = require("node:fs");
5
6
  const node_path_1 = require("node:path");
6
7
  const commander_1 = require("commander");
@@ -42,26 +43,108 @@ function handleCreateFioriCommand(argv) {
42
43
  * @returns - commander program
43
44
  */
44
45
  function getCommanderProgram() {
46
+ const logger = (0, tracing_1.getLogger)();
45
47
  const program = new commander_1.Command();
46
48
  const version = getVersion();
47
49
  program.description(`Configure features for Fiori applications and projects. (${version})`);
50
+ program.addHelpText('after', `\nExample Usage:
51
+ 'npx --yes @sap-ux/create@latest add --help' Get available subcommands for the 'add' command.
52
+ 'npx --yes @sap-ux/create@latest add html --help' Get available options for the 'add html' command.
53
+ 'npx --yes @sap-ux/create@latest add html --simulate' Execute the 'add html' command using the 'simulate' option.\n`);
54
+ program.option('--generateJsonSpec', 'Output the command structure as JSON');
55
+ program.action((options) => {
56
+ if (options.generateJsonSpec) {
57
+ logger.info(generateJsonSpec(program));
58
+ }
59
+ else if (options.V || options.version) {
60
+ logger.info(version);
61
+ }
62
+ else {
63
+ program.outputHelp();
64
+ }
65
+ });
48
66
  program.version(version);
49
67
  // Handler for create-fiori generate <feature> ..
50
- program.addCommand((0, generate_1.getGenerateCommands)());
68
+ const genCommands = (0, generate_1.getGenerateCommands)();
69
+ genCommands.description(`Generate adaptation projects.
70
+ Available Subcommands: ${getFeatureSummary(genCommands.commands)}\n`);
71
+ program.addCommand(genCommands);
51
72
  // Handler for create-fiori add <feature> ..
52
- program.addCommand((0, add_1.getAddCommands)());
73
+ const addCommands = (0, add_1.getAddCommands)();
74
+ addCommands.description(`Add features to an SAP Fiori app.
75
+ Available Subcommands: ${getFeatureSummary(addCommands.commands)}\n`);
76
+ program.addCommand(addCommands);
53
77
  // Handler for create-fiori convert <feature> ..
54
- program.addCommand((0, convert_1.getConvertCommands)());
78
+ const convertCommands = (0, convert_1.getConvertCommands)();
79
+ convertCommands.description(`Convert existing SAP Fiori applications.
80
+ Available Subcommands: ${getFeatureSummary(convertCommands.commands)}\n`);
81
+ program.addCommand(convertCommands);
55
82
  // Handler for create-fiori remove <feature> ..
56
- program.addCommand((0, remove_1.getRemoveCommands)());
83
+ const removeCommands = (0, remove_1.getRemoveCommands)();
84
+ removeCommands.description(`Remove features from existing SAP Fiori applications.
85
+ Available Subcommands: ${getFeatureSummary(removeCommands.commands)}\n`);
86
+ program.addCommand(removeCommands);
57
87
  // Handler for create-fiori change <feature> ..
58
- program.addCommand((0, change_1.getChangeCommands)());
59
- // Override exit so calling this command without arguments does not result in an exit code 1, which causes an error message when running from npm init
60
- program.exitOverride();
88
+ const changeCommands = (0, change_1.getChangeCommands)();
89
+ changeCommands.description(`Change existing adaptation projects.
90
+ Available Subcommands: ${getFeatureSummary(changeCommands.commands)}`);
91
+ program.addCommand(changeCommands);
61
92
  return program;
62
93
  }
63
94
  /**
64
- * Return the version from package.json.
95
+ * Return a summary of the subcommands from the provided commands.
96
+ *
97
+ * @param commands - List of commands
98
+ * @returns - Summary of the subcommands
99
+ */
100
+ function getFeatureSummary(commands) {
101
+ const subCommandNames = commands.map((cmd) => cmd.name());
102
+ return subCommandNames.join(', ');
103
+ }
104
+ /**
105
+ * Parses a commander.Option object into a simpler format for the JSON spec.
106
+ *
107
+ * @param {Option} opt - The Commander Option object.
108
+ * @returns {object} A simplified option object.
109
+ */
110
+ function parseOption(opt) {
111
+ return {
112
+ name: opt.flags,
113
+ description: opt.description,
114
+ required: opt.required,
115
+ ...(opt.defaultValue !== undefined && { defaultValue: opt.defaultValue })
116
+ };
117
+ }
118
+ /**
119
+ * Recursively parses a commander.Command object and its subcommands.
120
+ *
121
+ * @param cmd - The Commander Command object to parse.
122
+ * @returns A structured object representing the command.
123
+ */
124
+ function parseCommand(cmd) {
125
+ const options = 'options' in cmd ? cmd.options : [];
126
+ return {
127
+ name: cmd.name(),
128
+ description: cmd.description(),
129
+ ...(options?.length > 0 && { options: options.map(parseOption) }),
130
+ ...(cmd.commands?.length > 0 && { subcommands: cmd.commands.map(parseCommand) })
131
+ };
132
+ }
133
+ /**
134
+ * Generates the full MCP specification for a top-level commander program.
135
+ *
136
+ * @param cmd - The main Commander program instance.
137
+ * @returns A JSON string representing the CLI's capabilities.
138
+ */
139
+ function generateJsonSpec(cmd) {
140
+ const spec = {
141
+ description: cmd.description(),
142
+ commands: cmd.commands.map(parseCommand)
143
+ };
144
+ return JSON.stringify(spec, null, 2);
145
+ }
146
+ /**
147
+ * Return the version from the package.json file.
65
148
  *
66
149
  * @returns - version from package.json
67
150
  */
@@ -10,7 +10,6 @@ const mockserver_config_1 = require("./mockserver-config");
10
10
  */
11
11
  function getRemoveCommands() {
12
12
  const removeCommands = new commander_1.Command('remove');
13
- // create-fiori remove mockserver-config
14
13
  (0, mockserver_config_1.addRemoveMockserverConfigCommand)(removeCommands);
15
14
  return removeCommands;
16
15
  }
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.13.138",
4
+ "version": "0.13.140",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,19 +30,19 @@
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.6.32",
34
33
  "@sap-ux/abap-deploy-config-writer": "0.2.23",
35
- "@sap-ux/adp-tooling": "0.16.6",
36
- "@sap-ux/app-config-writer": "0.6.46",
34
+ "@sap-ux/adp-tooling": "0.16.7",
35
+ "@sap-ux/abap-deploy-config-inquirer": "1.6.32",
37
36
  "@sap-ux/cap-config-writer": "0.12.16",
37
+ "@sap-ux/app-config-writer": "0.6.46",
38
38
  "@sap-ux/logger": "0.7.0",
39
39
  "@sap-ux/mockserver-config-writer": "0.9.21",
40
40
  "@sap-ux/odata-service-writer": "0.27.25",
41
- "@sap-ux/preview-middleware": "0.23.29",
41
+ "@sap-ux/preview-middleware": "0.23.30",
42
42
  "@sap-ux/project-access": "1.32.4",
43
43
  "@sap-ux/system-access": "0.6.21",
44
44
  "@sap-ux/ui5-config": "0.29.8",
45
- "@sap-ux/flp-config-inquirer": "0.4.41"
45
+ "@sap-ux/flp-config-inquirer": "0.4.42"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/diff": "5.0.9",