@sap-ux/create 0.15.24 → 0.15.25
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
|
@@ -105,7 +105,7 @@ Options:
|
|
|
105
105
|
|
|
106
106
|
## [`add eslint-config`](#add-eslint-config)
|
|
107
107
|
|
|
108
|
-
Add an
|
|
108
|
+
Add an ESLint configuration to a project including the SAP Fiori tools lint plugin (`@sap-ux/eslint-plugin-fiori-tools`).
|
|
109
109
|
|
|
110
110
|
Example:
|
|
111
111
|
|
|
@@ -114,7 +114,8 @@ Example:
|
|
|
114
114
|
Options:
|
|
115
115
|
- `-s, --simulate` - Simulate only. Do not write to the config file. Also, sets `--verbose`
|
|
116
116
|
- `-v, --verbose` - Show verbose information.
|
|
117
|
-
- `-c, --config <string>`
|
|
117
|
+
- `-c, --config <string>` - The name of the SAP Fiori tools eslint plugin configuration to be used. _(default: `recommended`)_
|
|
118
|
+
- `-n, --skip-install` - Skip the `npm install` step.
|
|
118
119
|
|
|
119
120
|
--------------------------------
|
|
120
121
|
|
|
@@ -144,7 +145,7 @@ Example:
|
|
|
144
145
|
Options:
|
|
145
146
|
- `-s, --simulate` - Simulate only. Do not write to the config file. Also, sets `--verbose`
|
|
146
147
|
- `-v, --verbose` - Show verbose information.
|
|
147
|
-
- `-c, --config <string>`
|
|
148
|
+
- `-c, --config <string>` - Path to the project configuration file in YAML format. _(default: `ui5.yaml`)_
|
|
148
149
|
|
|
149
150
|
--------------------------------
|
|
150
151
|
|
|
@@ -157,7 +158,7 @@ Example:
|
|
|
157
158
|
`npx --yes @sap-ux/create@latest add cards-editor`
|
|
158
159
|
|
|
159
160
|
Options:
|
|
160
|
-
- `-c, --config <string>`
|
|
161
|
+
- `-c, --config <string>` - Path to the project configuration file in YAML format. _(default: `ui5.yaml`)_
|
|
161
162
|
- `-s, --simulate` - Simulate only. Do not write to the config file. Also, sets `--verbose`
|
|
162
163
|
- `-v, --verbose` - Show verbose information.
|
|
163
164
|
|
|
@@ -192,7 +193,7 @@ Example:
|
|
|
192
193
|
|
|
193
194
|
Options:
|
|
194
195
|
- `-s, --simulate` - Simulate only. Do not write or install.
|
|
195
|
-
- `-c, --config <string>`
|
|
196
|
+
- `-c, --config <string>` - Path to the project configuration file in YAML format. _(default: `ui5.yaml`)_
|
|
196
197
|
|
|
197
198
|
--------------------------------
|
|
198
199
|
|
|
@@ -205,7 +206,7 @@ Example:
|
|
|
205
206
|
`npx --yes @sap-ux/create@latest add html`
|
|
206
207
|
|
|
207
208
|
Options:
|
|
208
|
-
- `-c, --config <string>`
|
|
209
|
+
- `-c, --config <string>` - Path to the project configuration file in YAML format. _(default: `ui5.yaml`)_
|
|
209
210
|
- `-s, --simulate` - Simulate only. Do not write to the config file. Also, sets `--verbose`
|
|
210
211
|
- `-v, --verbose` - Show verbose information.
|
|
211
212
|
|
|
@@ -233,11 +234,11 @@ Example:
|
|
|
233
234
|
`npx --yes @sap-ux/create@latest add deploy-config`
|
|
234
235
|
|
|
235
236
|
Options:
|
|
236
|
-
- `-t, --target <string>`
|
|
237
|
+
- `-t, --target <string>` - Target for deployment: ABAP or Cloud Foundry (not yet implemented)
|
|
237
238
|
- `-s, --simulate` - Simulate only. Do not write. Also, sets `--verbose`
|
|
238
239
|
- `-v, --verbose` - Show verbose information.
|
|
239
|
-
- `-b, --base-file <string>`
|
|
240
|
-
- `-d, --deploy-file <string>`
|
|
240
|
+
- `-b, --base-file <string>` - The base config file of the project. _(default: "ui5.yaml")_
|
|
241
|
+
- `-d, --deploy-file <string>` - The name of the deploy config file to be written. _(default: "ui5-deploy.yaml")_
|
|
241
242
|
|
|
242
243
|
--------------------------------
|
|
243
244
|
|
|
@@ -250,7 +251,7 @@ Example:
|
|
|
250
251
|
`npx --yes @sap-ux/create@latest add variants-config`
|
|
251
252
|
|
|
252
253
|
Options:
|
|
253
|
-
- `-c, --config <string>`
|
|
254
|
+
- `-c, --config <string>` - Path to the project configuration file in YAML format. _(default: `ui5.yaml`)_
|
|
254
255
|
- `-s, --simulate` - Simulate only. Do not write to the config file. Also, sets `--verbose`
|
|
255
256
|
- `-v, --verbose` - Show verbose information.
|
|
256
257
|
|
|
@@ -269,7 +270,7 @@ Example:
|
|
|
269
270
|
|
|
270
271
|
Options:
|
|
271
272
|
- `-v, --verbose` - Show verbose information.
|
|
272
|
-
- `-c, --config <string>`
|
|
273
|
+
- `-c, --config <string>` - Path to the project configuration file in YAML format. _(default: `ui5.yaml`)_
|
|
273
274
|
|
|
274
275
|
--------------------------------
|
|
275
276
|
|
|
@@ -279,7 +280,7 @@ Command group for converting existing SAP Fiori applications. A subcommand is re
|
|
|
279
280
|
|
|
280
281
|
Usage: `npx --yes @sap-ux/create@latest convert [subcommand] [options]`
|
|
281
282
|
|
|
282
|
-
The available subcommands are: `preview-config`
|
|
283
|
+
The available subcommands are: `preview-config` and `eslint-config`
|
|
283
284
|
|
|
284
285
|
|
|
285
286
|
--------------------------------
|
|
@@ -295,9 +296,25 @@ Examples:
|
|
|
295
296
|
`npx --yes @sap-ux/create@latest convert preview-config`
|
|
296
297
|
|
|
297
298
|
Options:
|
|
298
|
-
- `-s, --simulate <boolean>`
|
|
299
|
+
- `-s, --simulate <boolean>` - Simulate only. Do not write.
|
|
299
300
|
- `-v, --verbose` - Show verbose information.
|
|
300
|
-
- `-t, --tests <boolean>`
|
|
301
|
+
- `-t, --tests <boolean>` - Also, convert test suite and test runners.
|
|
302
|
+
|
|
303
|
+
--------------------------------
|
|
304
|
+
|
|
305
|
+
## [`convert eslint-config`](#convert-eslint-config)
|
|
306
|
+
|
|
307
|
+
Executed in the root folder of an app, it converts the ESLint configuration of the respective app to flat config format (ESLint version 9).
|
|
308
|
+
|
|
309
|
+
Examples:
|
|
310
|
+
|
|
311
|
+
`npx --yes @sap-ux/create@latest convert eslint-config`
|
|
312
|
+
|
|
313
|
+
Options:
|
|
314
|
+
- `-s, --simulate` - Simulate only. Do not write to the config file. Also, sets `--verbose`
|
|
315
|
+
- `-v, --verbose` - Show verbose information.
|
|
316
|
+
- `-c, --config <string>` - The name of the SAP Fiori tools ESLint plugin configuration to be used. _(default: `recommended`)_
|
|
317
|
+
- `-n, --skip-install` - Skip the `npm install` step.
|
|
301
318
|
|
|
302
319
|
--------------------------------
|
|
303
320
|
|
|
@@ -349,7 +366,7 @@ Example:
|
|
|
349
366
|
|
|
350
367
|
Options:
|
|
351
368
|
- `-s, --simulate` - Simulate only. Do not write or install.
|
|
352
|
-
- `-c, --config <string>`
|
|
369
|
+
- `-c, --config <string>` - Path to the project configuration file in YAML format. _(default: `ui5.yaml`)_
|
|
353
370
|
|
|
354
371
|
--------------------------------
|
|
355
372
|
|
|
@@ -5,6 +5,7 @@ const app_config_writer_1 = require("@sap-ux/app-config-writer");
|
|
|
5
5
|
const tracing_1 = require("../../tracing");
|
|
6
6
|
const validation_1 = require("../../validation");
|
|
7
7
|
const project_access_1 = require("@sap-ux/project-access");
|
|
8
|
+
const common_1 = require("../../common");
|
|
8
9
|
/**
|
|
9
10
|
* Add the "add eslint config" command to a passed command.
|
|
10
11
|
*
|
|
@@ -12,17 +13,18 @@ const project_access_1 = require("@sap-ux/project-access");
|
|
|
12
13
|
*/
|
|
13
14
|
function addAddEslintConfigCommand(cmd) {
|
|
14
15
|
cmd.command('eslint-config [path]')
|
|
15
|
-
.description(`Add an
|
|
16
|
+
.description(`Add an ESLint configuration to a project including the SAP Fiori tools lint plugin (\`@sap-ux/eslint-plugin-fiori-tools\`).\n
|
|
16
17
|
Example:
|
|
17
18
|
\`npx --yes @sap-ux/create@latest add eslint-config\``)
|
|
18
19
|
.option('-s, --simulate', 'Simulate only. Do not write to the config file. Also, sets `--verbose`')
|
|
19
20
|
.option('-v, --verbose', 'Show verbose information.')
|
|
20
|
-
.option('-c, --config <string>', 'The name of the SAP Fiori tools eslint plugin configuration to be used
|
|
21
|
+
.option('-c, --config <string>', 'The name of the SAP Fiori tools eslint plugin configuration to be used.', 'recommended')
|
|
22
|
+
.option('-n, --skip-install', 'Skip the `npm install` step.')
|
|
21
23
|
.action(async (path, options) => {
|
|
22
24
|
if (options.verbose === true || options.simulate) {
|
|
23
25
|
(0, tracing_1.setLogLevelVerbose)();
|
|
24
26
|
}
|
|
25
|
-
await addEslintConfig(path || process.cwd(), !!options.simulate, options.config);
|
|
27
|
+
await addEslintConfig(path || process.cwd(), !!options.simulate, options.config, !!options.skipInstall);
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
@@ -31,8 +33,9 @@ Example:
|
|
|
31
33
|
* @param basePath - path to application root
|
|
32
34
|
* @param simulate - if true, do not write but just show what would be changed; otherwise write
|
|
33
35
|
* @param config - the name of the SAP Fiori tools eslint plugin config to be used
|
|
36
|
+
* @param skipInstall - if true, skips the `npm install` step after adding the eslint config
|
|
34
37
|
*/
|
|
35
|
-
async function addEslintConfig(basePath, simulate, config =
|
|
38
|
+
async function addEslintConfig(basePath, simulate, config, skipInstall = false) {
|
|
36
39
|
const logger = (0, tracing_1.getLogger)();
|
|
37
40
|
try {
|
|
38
41
|
logger.debug(`Called add eslint-config for path '${basePath}', simulate is '${simulate}'`);
|
|
@@ -40,11 +43,20 @@ async function addEslintConfig(basePath, simulate, config = 'recommended') {
|
|
|
40
43
|
const fs = await (0, app_config_writer_1.generateEslintConfig)(basePath, { logger, config });
|
|
41
44
|
await (0, tracing_1.traceChanges)(fs);
|
|
42
45
|
if (!simulate) {
|
|
43
|
-
fs.commit(() =>
|
|
46
|
+
fs.commit(() => {
|
|
47
|
+
logger.info(`ESlint configuration written. Ensure you install the new dependency by executing 'npm install'.`);
|
|
48
|
+
if (skipInstall) {
|
|
49
|
+
logger.info(`\`npm install\` will be skipped. Please make sure to install the dependencies before executing any linting commands.`);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
logger.info(`Executing \`npm install\`.`);
|
|
53
|
+
(0, common_1.runNpmInstallCommand)(basePath, undefined, { logger });
|
|
54
|
+
}
|
|
55
|
+
});
|
|
44
56
|
}
|
|
45
57
|
}
|
|
46
58
|
catch (error) {
|
|
47
|
-
logger.error(`Error while executing add eslint-config '${error.message}'`);
|
|
59
|
+
logger.error(`Error while executing add eslint-config. '${error.message}'`);
|
|
48
60
|
logger.debug(error);
|
|
49
61
|
}
|
|
50
62
|
if ((await (0, project_access_1.getProjectType)(basePath)) !== 'EDMXBackend') {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Add a new sub-command to convert the eslint configuration of a project to flat config format (eslint version 9).
|
|
4
|
+
*
|
|
5
|
+
* @param {Command} cmd - The command to add the convert sub-command to.
|
|
6
|
+
*/
|
|
7
|
+
export declare function addConvertEslintCommand(cmd: Command): void;
|
|
8
|
+
//# sourceMappingURL=eslint-config.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addConvertEslintCommand = addConvertEslintCommand;
|
|
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 common_1 = require("../../common");
|
|
8
|
+
/**
|
|
9
|
+
* Add a new sub-command to convert the eslint configuration of a project to flat config format (eslint version 9).
|
|
10
|
+
*
|
|
11
|
+
* @param {Command} cmd - The command to add the convert sub-command to.
|
|
12
|
+
*/
|
|
13
|
+
function addConvertEslintCommand(cmd) {
|
|
14
|
+
cmd.command('eslint-config [path]')
|
|
15
|
+
.description(`Executed in the root folder of an app, it converts the ESLint configuration of the respective app to flat config format (ESLint version 9).\n
|
|
16
|
+
Examples:
|
|
17
|
+
\`npx --yes @sap-ux/create@latest convert eslint-config\``)
|
|
18
|
+
.option('-s, --simulate', 'Simulate only. Do not write to the config file. Also, sets `--verbose`')
|
|
19
|
+
.option('-v, --verbose', 'Show verbose information.')
|
|
20
|
+
.option('-c, --config <string>', 'The name of the SAP Fiori tools ESLint plugin configuration to be used.', 'recommended')
|
|
21
|
+
.option('-n, --skip-install', 'Skip the `npm install` step.')
|
|
22
|
+
.action(async (path, options) => {
|
|
23
|
+
if (options.verbose === true || options.simulate) {
|
|
24
|
+
(0, tracing_1.setLogLevelVerbose)();
|
|
25
|
+
}
|
|
26
|
+
await convertEslintConfig(path || process.cwd(), !!options.simulate, options.config, !!options.skipInstall);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Converts an eslint config to flat config format (eslint version 9).
|
|
31
|
+
*
|
|
32
|
+
* @param basePath - path to application root
|
|
33
|
+
* @param simulate - if true, simulates the conversion without writing to the config file. Also, sets `--verbose`
|
|
34
|
+
* @param config - the name of the SAP Fiori tools eslint plugin config to be used
|
|
35
|
+
* @param skipInstall - if true, skips the `npm install` step after converting the eslint config
|
|
36
|
+
*/
|
|
37
|
+
async function convertEslintConfig(basePath, simulate, config, skipInstall = false) {
|
|
38
|
+
const logger = (0, tracing_1.getLogger)();
|
|
39
|
+
try {
|
|
40
|
+
logger.debug(`Called add eslint-config for path '${basePath}', simulate is '${simulate}'`);
|
|
41
|
+
await (0, validation_1.validateBasePath)(basePath);
|
|
42
|
+
const fs = await (0, app_config_writer_1.convertEslintConfig)(basePath, { logger, config });
|
|
43
|
+
await (0, tracing_1.traceChanges)(fs);
|
|
44
|
+
if (!simulate) {
|
|
45
|
+
fs.commit(() => {
|
|
46
|
+
logger.info(`ESlint configuration converted. Ensure the new configuration is working correctly before deleting old configuration files like '.eslintrc.json' or '.eslintignore'.`);
|
|
47
|
+
if (skipInstall) {
|
|
48
|
+
logger.info(`\`npm install\` was skipped. Ensure you install the dependencies before executing any linting commands.`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
logger.info(`Executing \`npm install\`.`);
|
|
52
|
+
(0, common_1.runNpmInstallCommand)(basePath, undefined, { logger });
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
logger.error(`Error while executing convert eslint-config. '${error.message}'`);
|
|
59
|
+
logger.debug(error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=eslint-config.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getConvertCommands = getConvertCommands;
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
5
|
const preview_1 = require("./preview");
|
|
6
|
+
const eslint_config_1 = require("./eslint-config");
|
|
6
7
|
/**
|
|
7
8
|
* Return 'create-fiori convert *' commands. Commands include also the handler action.
|
|
8
9
|
*
|
|
@@ -11,6 +12,7 @@ const preview_1 = require("./preview");
|
|
|
11
12
|
function getConvertCommands() {
|
|
12
13
|
const convertCommands = new commander_1.Command('convert');
|
|
13
14
|
(0, preview_1.addConvertPreviewCommand)(convertCommands);
|
|
15
|
+
(0, eslint_config_1.addConvertEslintCommand)(convertCommands);
|
|
14
16
|
return convertCommands;
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js
CHANGED
|
@@ -116,7 +116,7 @@ function parseOption(opt) {
|
|
|
116
116
|
return {
|
|
117
117
|
name: opt.flags,
|
|
118
118
|
description: opt.description,
|
|
119
|
-
required: opt.required
|
|
119
|
+
required: opt.mandatory === true, // Only true for .requiredOption() not for required values (.option('<value>'))
|
|
120
120
|
...(opt.defaultValue !== undefined && { defaultValue: opt.defaultValue })
|
|
121
121
|
};
|
|
122
122
|
}
|
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.15.
|
|
4
|
+
"version": "0.15.25",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@sap-ux/abap-deploy-config-inquirer": "1.7.15",
|
|
35
35
|
"@sap-ux/abap-deploy-config-writer": "0.2.87",
|
|
36
36
|
"@sap-ux/adp-tooling": "0.18.82",
|
|
37
|
-
"@sap-ux/app-config-writer": "0.6.
|
|
37
|
+
"@sap-ux/app-config-writer": "0.6.114",
|
|
38
38
|
"@sap-ux/cap-config-writer": "0.12.75",
|
|
39
39
|
"@sap-ux/logger": "0.8.2",
|
|
40
40
|
"@sap-ux/mockserver-config-writer": "0.9.60",
|