@sap-ux/create 0.14.62 → 0.14.64

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
@@ -68,7 +68,7 @@ Command group for adding features to existing SAP Fiori applications. A subcomma
68
68
 
69
69
  Usage: `npx --yes @sap-ux/create@latest add [subcommand] [options]`
70
70
 
71
- The available subcommands are: `mockserver-config`, `smartlinks-config`, `cds-plugin-ui5`, `inbound-navigation`, `cards-editor`, `model`, `annotations`, `html`, `component-usages`, `deploy-config`, `variants-config` and `adp-cf-config`
71
+ The available subcommands are: `mockserver-config`, `smartlinks-config`, `eslint-config`, `cds-plugin-ui5`, `inbound-navigation`, `cards-editor`, `model`, `annotations`, `html`, `component-usages`, `deploy-config`, `variants-config` and `adp-cf-config`
72
72
 
73
73
 
74
74
  --------------------------------
@@ -103,6 +103,21 @@ Options:
103
103
 
104
104
  --------------------------------
105
105
 
106
+ ## [`add eslint-config`](#add-eslint-config)
107
+
108
+ Add an `eslint` configuration to a project including the SAP Fiori tools lint plugin (`@sap-ux/eslint-plugin-fiori-tools`).
109
+
110
+ Example:
111
+
112
+ `npx --yes @sap-ux/create@latest add eslint-config`
113
+
114
+ Options:
115
+ - `-s, --simulate` - Simulate only. Do not write to the config file. Also, sets `--verbose`
116
+ - `-v, --verbose` - Show verbose information.
117
+ - `-c, --config <string>` _(required)_ - The name of the SAP Fiori tools eslint plugin configuration to be used (default is `recommended`).
118
+
119
+ --------------------------------
120
+
106
121
  ## [`add cds-plugin-ui5`](#add-cds-plugin-ui5)
107
122
 
108
123
  Add the `cds-plugin-ui5` module and all prerequisites to a CAP project for UI5 server integration.
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Add the "add eslint config" command to a passed command.
4
+ *
5
+ * @param cmd - commander command for adding eslint config command
6
+ */
7
+ export declare function addAddEslintConfigCommand(cmd: Command): void;
8
+ //# sourceMappingURL=eslint-config.d.ts.map
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addAddEslintConfigCommand = addAddEslintConfigCommand;
4
+ const app_config_writer_1 = require("@sap-ux/app-config-writer");
5
+ const tracing_1 = require("../../tracing");
6
+ const validation_1 = require("../../validation");
7
+ const project_access_1 = require("@sap-ux/project-access");
8
+ /**
9
+ * Add the "add eslint config" command to a passed command.
10
+ *
11
+ * @param cmd - commander command for adding eslint config command
12
+ */
13
+ function addAddEslintConfigCommand(cmd) {
14
+ cmd.command('eslint-config [path]')
15
+ .description(`Add an \`eslint\` configuration to a project including the SAP Fiori tools lint plugin (\`@sap-ux/eslint-plugin-fiori-tools\`).\n
16
+ Example:
17
+ \`npx --yes @sap-ux/create@latest add 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 (default is `recommended`).')
21
+ .action(async (path, options) => {
22
+ if (options.verbose === true || options.simulate) {
23
+ (0, tracing_1.setLogLevelVerbose)();
24
+ }
25
+ await addEslintConfig(path || process.cwd(), !!options.simulate, options.config);
26
+ });
27
+ }
28
+ /**
29
+ * Adds an eslint config to an app.
30
+ *
31
+ * @param basePath - path to application root
32
+ * @param simulate - if true, do not write but just show what would be changed; otherwise write
33
+ * @param config - the name of the SAP Fiori tools eslint plugin config to be used
34
+ */
35
+ async function addEslintConfig(basePath, simulate, config = 'recommended') {
36
+ const logger = (0, tracing_1.getLogger)();
37
+ try {
38
+ logger.debug(`Called add eslint-config for path '${basePath}', simulate is '${simulate}'`);
39
+ await (0, validation_1.validateBasePath)(basePath);
40
+ const fs = await (0, app_config_writer_1.generateEslintConfig)(basePath, { logger, config });
41
+ await (0, tracing_1.traceChanges)(fs);
42
+ if (!simulate) {
43
+ fs.commit(() => logger.info(`Eslint configuration written. Ensure you install the new dependency by executing 'npm install'.`));
44
+ }
45
+ }
46
+ catch (error) {
47
+ logger.error(`Error while executing add eslint-config '${error.message}'`);
48
+ logger.debug(error);
49
+ }
50
+ if ((await (0, project_access_1.getProjectType)(basePath)) !== 'EDMXBackend') {
51
+ logger.info(`You can execute \`npm run lint --workspaces --if-present\` from the CAP project root to lint app.`);
52
+ logger.info(`You can add a command such as \`&& npm run lint --workspaces --if-present\` to an existing command in the CAP project root where linting is executed.
53
+ A complete command is similar to the following:
54
+ // \`"lint": "cds lint && npm run lint --workspaces --if-present"\``);
55
+ }
56
+ }
57
+ //# sourceMappingURL=eslint-config.js.map
@@ -14,6 +14,7 @@ const component_usages_1 = require("./component-usages");
14
14
  const deploy_config_1 = require("./deploy-config");
15
15
  const variants_config_1 = require("./variants-config");
16
16
  const adp_cf_config_1 = require("./adp-cf-config");
17
+ const eslint_config_1 = require("./eslint-config");
17
18
  /**
18
19
  * Return 'create-fiori add *' commands. Commands include also the handler action.
19
20
  *
@@ -23,6 +24,7 @@ function getAddCommands() {
23
24
  const addCommands = new commander_1.Command('add');
24
25
  (0, mockserver_config_1.addAddMockserverConfigCommand)(addCommands);
25
26
  (0, smartlinks_config_1.addAddSmartLinksConfigCommand)(addCommands);
27
+ (0, eslint_config_1.addAddEslintConfigCommand)(addCommands);
26
28
  (0, cds_plugin_ui_1.addAddCdsPluginUi5Command)(addCommands);
27
29
  (0, navigation_config_1.addInboundNavigationConfigCommand)(addCommands);
28
30
  (0, cards_generator_1.addCardsEditorConfigCommand)(addCommands);
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.14.62",
4
+ "version": "0.14.64",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -31,19 +31,19 @@
31
31
  "mem-fs": "2.1.0",
32
32
  "mem-fs-editor": "9.4.0",
33
33
  "prompts": "2.4.2",
34
- "@sap-ux/abap-deploy-config-inquirer": "1.6.98",
35
- "@sap-ux/abap-deploy-config-writer": "0.2.71",
36
- "@sap-ux/adp-tooling": "0.18.62",
37
- "@sap-ux/app-config-writer": "0.6.96",
38
- "@sap-ux/cap-config-writer": "0.12.61",
34
+ "@sap-ux/adp-tooling": "0.18.63",
35
+ "@sap-ux/app-config-writer": "0.6.98",
36
+ "@sap-ux/cap-config-writer": "0.12.62",
39
37
  "@sap-ux/logger": "0.8.1",
40
38
  "@sap-ux/mockserver-config-writer": "0.9.50",
41
39
  "@sap-ux/odata-service-writer": "0.29.18",
42
- "@sap-ux/preview-middleware": "0.23.119",
40
+ "@sap-ux/preview-middleware": "0.23.120",
41
+ "@sap-ux/system-access": "0.6.51",
42
+ "@sap-ux/abap-deploy-config-writer": "0.2.72",
43
+ "@sap-ux/abap-deploy-config-inquirer": "1.6.99",
43
44
  "@sap-ux/project-access": "1.35.3",
44
- "@sap-ux/system-access": "0.6.50",
45
45
  "@sap-ux/ui5-config": "0.29.16",
46
- "@sap-ux/flp-config-inquirer": "0.4.121",
46
+ "@sap-ux/flp-config-inquirer": "0.4.122",
47
47
  "@sap-ux/nodejs-utils": "0.2.14"
48
48
  },
49
49
  "devDependencies": {
@@ -52,8 +52,8 @@
52
52
  "@types/mem-fs": "1.1.2",
53
53
  "@types/mem-fs-editor": "7.0.1",
54
54
  "@types/prompts": "2.4.4",
55
- "@sap-ux/inquirer-common": "0.11.4",
56
- "@sap-ux/store": "1.5.5"
55
+ "@sap-ux/inquirer-common": "0.11.5",
56
+ "@sap-ux/store": "1.5.6"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsc --build && node ./scripts/generate-readme.js",