@sap-ux/create 0.8.49 → 0.8.50

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
@@ -1,14 +1,13 @@
1
1
  # @sap-ux/create
2
2
  Module which provides command line interface to configure features for SAP UX projects or applications.
3
3
 
4
- To see usage, run
4
+ ## Installation
5
5
 
6
6
  ```sh
7
- npm init @sap-ux@latest
7
+ npm init @sap-ux@latest
8
8
  # or
9
9
  npx @sap-ux/create@latest
10
10
  ```
11
-
12
11
  To avoid downloading and installing the module every time it is used, you might consider installing it globally or add it as `devDependency` to a project. Once installed, you can run it using
13
12
 
14
13
  ```sh
@@ -17,58 +16,144 @@ sap-ux
17
16
  # locally
18
17
  npx sap-ux
19
18
  ```
19
+ ## Basic usage
20
20
 
21
- ## add
22
- Calling `sap-ux add` allows adding a feature to a project.
23
-
24
- ### html
25
- Calling `sap-ux add html` will add html files for local preview and testing to the project. It will use the configuration from the `ui5.yaml` as default, as provided by the `fiori-tools-preview` or `preview-middleware` e.g.:
26
21
  ```sh
27
- sap-ux change add html ui5-test.yaml
22
+ npx sap-ux [command] [sub-command] /path/to/project
23
+ ```
24
+ `Note:` If the project path is not provided, the current working directory will be used.
25
+
26
+ Options:
27
+ - `-v | --version` output the module version number
28
+ - `-h | --help` display help and options for module
29
+
30
+ ### Command Options
31
+
32
+ To use a option for a specific command run:
33
+ ```sh
34
+ npx sap-ux [command] [sub-command] [options]
28
35
  ```
36
+ To see options for a specific command run: `npx sap-ux [command] [sub-command] -h`
37
+
38
+ Common Options:
39
+ - `-h | --help` display help and options for command
40
+ - `-v | --verbose` show verbose information
41
+ - `-s | --simulate` simulate only do not write config; sets also --verbose
42
+
43
+ ## Command Overview
44
+ The `@sap-ux/create` modules provides commands for the following cases:
45
+ - `sap-ux add` - allows adding a feature
46
+ - `sap-ux change` allows changing a feature
47
+ - `sap-ux remove` allows removing a feature
48
+ - `sap-ux generate` allows generating a new project
49
+
50
+
51
+ ## sap-ux add
52
+ Calling `sap-ux add` allows adding a feature to a project.
53
+
54
+
29
55
  ### annotations
30
56
  Calling `sap-ux add annotations` allows adding an annotation to the OData Source of the base application in an adaptation project.
31
57
  ```sh
32
- sap-ux add annotations /path/to/adaptation-project
58
+ sap-ux add annotations [path]
59
+ ```
60
+ - `-c | --config` path to project configuration file in YAML format, e.g.: `-c ui5.yaml`
61
+
62
+
63
+ ### cards-editor
64
+ Calling `sap-ux add cards-editor` adds a cards editor configuration to a project. To prevent overwriting, existing inbounds will be checked.
65
+ ```sh
66
+ sap-ux add cards-editor [path]
67
+ ```
68
+ - `-n | --skip-install` skip npm install step
69
+
70
+ ### component-usages
71
+ Calling `sap-ux add component-usages` adds the component usages to an adaptation project.
72
+ ```sh
73
+ sap-ux add component-usages [path]
74
+ ```
75
+
76
+
77
+ ### cds-plugin-ui5
78
+ Calling `sap-ux add cds-plugin-ui5` adds the cds-plugin-ui5 and all prerequisites to a CAP project.
79
+ ```sh
80
+ sap-ux add cds-plugin-ui5 [path]
33
81
  ```
82
+ - `-n | --skip-install` skip npm install step
83
+
84
+
34
85
  ### deploy-config
35
- Calling `sap-ux add deploy-config` will prompt for ABAP deployment configuration details and add/update the project files accordingly
86
+ Calling `sap-ux add deploy-config` will prompt for ABAP deployment configuration details and add/update the project files accordingly.
87
+ ```sh
88
+ sap-ux add deploy-config [path]
89
+ ```
90
+ - `-t | --target` target for deployment; ABAP or Cloud Foundry (not yet implemented)
91
+ - `-b | --base-file` the base file config file of the project; default: ui5.yaml
92
+ - `-d | --deploy-file` the name of the deploy config file to be written; default: ui5-deploy.yaml
93
+
94
+
95
+ ### html
96
+ Calling `sap-ux add html` will add html files for local preview and testing to the project. It will use the configuration from the `ui5.yaml` as default, as provided by the `fiori-tools-preview` or `preview-middleware`.
36
97
  ```sh
37
- sap-ux add deploy-config /path/to/project
98
+ sap-ux add html [path]
38
99
  ```
39
- #### deploy-config options:
40
- `--target` abap | cf (cf deploy config inquirer not yet implemented)\
41
- `--base-file` e.g ui5.yaml\
42
- `--deploy-file` e.g. ui5-deploy.yaml
100
+ - `-c | --config` path to project configuration file in YAML format, e.g.: `-c ui5.yaml`
43
101
 
44
102
  ### model
45
- Calling `sap-ux add model` allows to add new OData Service and SAPUI5 Model to an existing adaptation project.
103
+ Calling `sap-ux add model` allows to add new OData Service and SAPUI5 Model to an existing adaptation project.
46
104
  ```sh
47
- sap-ux add model /path/to/adaptation-project
105
+ sap-ux add model [path]
48
106
  ```
49
- If the project path is not provided, the current working directory will be used.
50
107
 
51
- ## change
108
+ ### mockserver-config
109
+ Calling `sap-ux add mockserver-config` adds the necessary configuration for mockserver module @sap-ux/ui5-middleware-fe-mockserver.
110
+ ```sh
111
+ sap-ux add mockserver-config [path]
112
+ ```
113
+ - `-i | --interactive` ask for config options, otherwise use defaults'
114
+ - `-n | --skip-install` skip npm install step
115
+
116
+ ### smartlinks-config
117
+ Calling `sap-ux add smartlinks-config` adds a smartLinks configuration to a project
118
+ ```sh
119
+ sap-ux add smartlinks-config [path]
120
+ ```
121
+
122
+ ### variants-config
123
+ Calling `sap-ux add variants-config` will add the necessary configuration to existing yaml files and the script to package.json for variants management. It will use the configuration from the `ui5.yaml` as default, as provided by the `fiori-tools-preview` or `preview-middleware`.
124
+ ```sh
125
+ sap-ux add variants-config [path]
126
+ ```
127
+ - `-c | --config` path to project configuration file in YAML format, e.g.: `-c ui5.yaml`
128
+
129
+ ## sap-ux change
52
130
  Calling `sap-ux change` allows changing a feature of a project.
53
131
 
54
132
  ### data-source
55
133
  Calling `sap-ux change data-source` allows replacing the OData Source of the base application in an adaptation project.
56
134
  ```sh
57
- sap-ux change data-source /path/to/adaptation-project
135
+ sap-ux change data-source [path]
58
136
  ```
59
- If the project path is not provided, the current working directory will be used.
137
+ - `-c | --config` path to project configuration file in YAML format, e.g.: `-c ui5.yaml`
60
138
 
61
139
  ### inbound
62
140
  Calling `sap-ux change inbound` allows replacing the Inbound FLP configurations of the base application in an adaptation project.
63
141
  ```sh
64
- sap-ux change inbound /path/to/adaptation-project
142
+ sap-ux change inbound [path]
65
143
  ```
66
- If the project path is not provided, the current working directory will be used.
67
144
 
68
- ## remove
145
+ ## sap-ux remove
69
146
  Calling `sap-ux remove` allows removing a feature to a project.
70
147
 
71
- ## generate
148
+ ### mockserver-config
149
+ Calling `sap-ux remove mockserver-config` removes the configuration for mockserver module @sap-ux/ui5-middleware-fe-mockserver.
150
+ ```sh
151
+ sap-ux remove mockserver-config [path]
152
+ ```
153
+ - `-f | --force` do not ask for confirmation when deleting files
154
+
155
+
156
+ ## sap-ux generate
72
157
  Calling `sap-ux generate` allows generating a new project.
73
158
 
74
159
  ### adaptation-project
@@ -76,4 +161,12 @@ Calling `sap-ux generate adaptation-project` allows generating a new adaptation
76
161
  ```sh
77
162
  sap-ux generate adaptation-project --id my.adp --reference the.original.app --url http://my.sapsystem.example
78
163
  ```
79
- Additional options are `--skip-install` to skip running `npm install` after the project generation and `--simulate` to only simulate the files that would be generated instead of writing them to the file system.
164
+ - `-n | --skip-install` skip npm install step
165
+ - `-y | --yes` use default values for all prompts
166
+ - `--id [id]` id of the adaptation project
167
+ - `--reference [reference]` id of the original application
168
+ - `--url [url]` url pointing to the target system containing the original app
169
+ - `--ignoreCertErrors` ignore certificate errors when connecting to the target system
170
+ - `--ft` enable the Fiori tools for the generated project
171
+ - `--package [package]` ABAP package to be used for deployments
172
+ - `--transport [transport]` ABAP transport to be used for deployments
@@ -26,7 +26,7 @@ function addCardsEditorConfigCommand(cmd) {
26
26
  * Adds an cards editor config to an app. To prevent overwriting existing inbounds will be checked.
27
27
  *
28
28
  * @param basePath - path to application root
29
- * @param simulate - if true, do not write but just show what would be change; otherwise write
29
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
30
30
  * @param skipInstall - if true, do not run npm install
31
31
  */
32
32
  async function addCardsEditorConfig(basePath, simulate, skipInstall) {
@@ -26,7 +26,7 @@ function addAddCdsPluginUi5Command(cmd) {
26
26
  * Add cds-plugin-ui5 and all prerequisites to a CAP project.
27
27
  *
28
28
  * @param basePath - CAP project root
29
- * @param simulate - if true, do not write but just show what would be change; otherwise write
29
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
30
30
  * @param skipInstall - if true, skip execution of npm install
31
31
  */
32
32
  async function addCdsPluginUi5(basePath, simulate, skipInstall) {
@@ -29,7 +29,7 @@ function addAddHtmlFilesCmd(cmd) {
29
29
  * Adds the virtual html files hosted by the preview middleware to the file system.
30
30
  *
31
31
  * @param basePath - path to application root
32
- * @param simulate - if true, do not write but just show what would be change; otherwise write
32
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
33
33
  * @param yamlPath - path to the ui5*.yaml file
34
34
  */
35
35
  async function addHtmlFiles(basePath, simulate, yamlPath) {
@@ -12,6 +12,7 @@ const annotations_to_odata_1 = require("./annotations-to-odata");
12
12
  const html_1 = require("./html");
13
13
  const component_usages_1 = require("./component-usages");
14
14
  const deploy_config_1 = require("./deploy-config");
15
+ const variants_config_1 = require("./variants-config");
15
16
  /**
16
17
  * Return 'create-fiori add *' commands. Commands include also the handler action.
17
18
  *
@@ -39,6 +40,8 @@ function getAddCommands() {
39
40
  (0, component_usages_1.addComponentUsagesCommand)(addCommands);
40
41
  // create-fiori add deploy-config
41
42
  (0, deploy_config_1.addDeployConfigCommand)(addCommands);
43
+ // create-fiori add variants-config
44
+ (0, variants_config_1.addAddVariantsConfigCommand)(addCommands);
42
45
  return addCommands;
43
46
  }
44
47
  //# sourceMappingURL=index.js.map
@@ -30,7 +30,7 @@ function addAddMockserverConfigCommand(cmd) {
30
30
  * Adds a mockserver config to an app or project.
31
31
  *
32
32
  * @param basePath - path to application root
33
- * @param simulate - if true, do not write but just show what would be change; otherwise write
33
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
34
34
  * @param skipInstall - if true, skip execution of npm install
35
35
  * @param interactive - if true, prompt user for config options, otherwise use defaults
36
36
  */
@@ -24,7 +24,7 @@ function addInboundNavigationConfigCommand(cmd) {
24
24
  * Adds an inbound navigation config to an app. To prevent overwriting existing inbounds will be checked.
25
25
  *
26
26
  * @param basePath - path to application root
27
- * @param simulate - if true, do not write but just show what would be change; otherwise write
27
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
28
28
  */
29
29
  async function addInboundNavigationConfig(basePath, simulate) {
30
30
  const logger = (0, tracing_1.getLogger)();
@@ -24,7 +24,7 @@ function addAddSmartLinksConfigCommand(cmd) {
24
24
  * Adds a smartLinks config to an app or project.
25
25
  *
26
26
  * @param basePath - path to application root
27
- * @param simulate - if true, do not write but just show what would be change; otherwise write
27
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
28
28
  */
29
29
  async function addSmartLinksConfig(basePath, simulate) {
30
30
  const logger = (0, tracing_1.getLogger)();
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Add the "add variants config" command to a passed command.
4
+ *
5
+ * @param cmd - commander command for adding variants config command
6
+ */
7
+ export declare function addAddVariantsConfigCommand(cmd: Command): void;
8
+ //# sourceMappingURL=variants-config.d.ts.map
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addAddVariantsConfigCommand = addAddVariantsConfigCommand;
4
+ const tracing_1 = require("../../tracing");
5
+ const validation_1 = require("../../validation");
6
+ const app_config_writer_1 = require("@sap-ux/app-config-writer");
7
+ const path_1 = require("path");
8
+ /**
9
+ * Add the "add variants config" command to a passed command.
10
+ *
11
+ * @param cmd - commander command for adding variants config command
12
+ */
13
+ function addAddVariantsConfigCommand(cmd) {
14
+ cmd.command('variants-config [path]')
15
+ .option('-c, --config <string>', 'Path to project configuration file in YAML format', 'ui5.yaml')
16
+ .option('-s, --simulate', 'simulate only do not write config; sets also --verbose')
17
+ .option('-v, --verbose', 'show verbose information')
18
+ .action(async (path, options) => {
19
+ if (options.verbose === true || options.simulate) {
20
+ (0, tracing_1.setLogLevelVerbose)();
21
+ }
22
+ await addVariantsConfig(path || process.cwd(), !!options.simulate, options.config);
23
+ });
24
+ }
25
+ /**
26
+ * Adds a variants config to an app or project.
27
+ *
28
+ * @param basePath - the base path where the package.json and ui5.yaml is
29
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
30
+ * @param yamlPath - path to the ui5*.yaml file
31
+ */
32
+ async function addVariantsConfig(basePath, simulate, yamlPath) {
33
+ const logger = (0, tracing_1.getLogger)();
34
+ try {
35
+ logger.debug(`Called add variants-config for path '${basePath}', simulate is '${simulate}'`);
36
+ const ui5ConfigPath = (0, path_1.isAbsolute)(yamlPath) ? yamlPath : (0, path_1.join)(basePath, yamlPath);
37
+ await (0, validation_1.validateBasePath)(basePath, ui5ConfigPath);
38
+ const fs = await (0, app_config_writer_1.generateVariantsConfig)(basePath, ui5ConfigPath, logger);
39
+ if (!simulate) {
40
+ fs.commit(() => logger.info(`Variants configuration written.`));
41
+ }
42
+ else {
43
+ await (0, tracing_1.traceChanges)(fs);
44
+ }
45
+ }
46
+ catch (error) {
47
+ logger.error(`Error while executing add variants-config: ${error.message}`);
48
+ logger.debug(error);
49
+ }
50
+ }
51
+ //# sourceMappingURL=variants-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.8.49",
4
+ "version": "0.8.50",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -33,7 +33,7 @@
33
33
  "@sap-ux/abap-deploy-config-inquirer": "1.0.7",
34
34
  "@sap-ux/abap-deploy-config-writer": "0.0.51",
35
35
  "@sap-ux/adp-tooling": "0.12.62",
36
- "@sap-ux/app-config-writer": "0.4.43",
36
+ "@sap-ux/app-config-writer": "0.4.44",
37
37
  "@sap-ux/cap-config-writer": "0.7.49",
38
38
  "@sap-ux/cards-editor-config-writer": "0.4.5",
39
39
  "@sap-ux/inquirer-common": "0.4.8",