@sap/cds-dk 8.9.4 → 9.0.4

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +89 -2012
  2. package/LICENSE +15 -21
  3. package/bin/bind.js +1 -1
  4. package/bin/build.js +35 -37
  5. package/bin/cds.js +12 -29
  6. package/bin/compile/index.js +2 -2
  7. package/bin/debug.js +27 -7
  8. package/bin/deploy/index.js +6 -23
  9. package/bin/deploy/to-hana.js +4 -2
  10. package/bin/help.js +3 -1
  11. package/bin/init.js +1 -1
  12. package/bin/up.js +45 -12
  13. package/bin/watch.js +45 -63
  14. package/lib/bind/cf.js +2 -1
  15. package/lib/bind/k8s.js +2 -2
  16. package/lib/bind/plugin.js +1 -1
  17. package/lib/bind/shared.js +16 -25
  18. package/lib/build/buildTaskEngine.js +26 -10
  19. package/lib/build/buildTaskFactory.js +3 -2
  20. package/lib/build/buildTaskProvider.js +18 -7
  21. package/lib/build/buildTaskProviderFactory.js +35 -13
  22. package/lib/build/constants.js +4 -0
  23. package/lib/build/index.js +1 -1
  24. package/lib/build/plugin.js +89 -54
  25. package/lib/build/plugins/helm/files/subcharts/web-application/Chart.yaml +3 -1
  26. package/lib/build/plugins/helm/files/subcharts/web-application/templates/_helpers.tpl +4 -2
  27. package/lib/build/plugins/helm/files/subcharts/web-application/templates/api-rule.yaml +4 -2
  28. package/lib/build/plugins/helm/files/subcharts/web-application/templates/deployment.yaml +18 -1
  29. package/lib/build/plugins/helm/files/subcharts/web-application/templates/service-binding.yaml +0 -1
  30. package/lib/build/plugins/helm/files/subcharts/web-application/values.schema.json +34 -2
  31. package/lib/build/plugins/helm/files/subcharts/web-application/values.yaml +9 -2
  32. package/lib/build/plugins/helm/index.js +2 -1
  33. package/lib/build/plugins.js +24 -10
  34. package/lib/build/provider/edmxBuildPlugin.js +1 -11
  35. package/lib/build/provider/hana/index.js +12 -5
  36. package/lib/build/provider/hana/template/package.json +1 -1
  37. package/lib/build/provider/internalBuildPlugin.js +1 -1
  38. package/lib/build/provider/internalBuildTaskProvider.js +3 -24
  39. package/lib/build/provider/java/index.js +1 -1
  40. package/lib/build/provider/mtx-extension/index.js +3 -8
  41. package/lib/build/provider/nodejs/index.js +28 -6
  42. package/lib/build/util.js +186 -125
  43. package/lib/deploy/index.js +5 -0
  44. package/lib/deploy/to-hana/hana.js +27 -33
  45. package/lib/deploy/to-hana/hdiDeployUtil.js +2 -2
  46. package/lib/import/odata/v2parser.js +34 -3
  47. package/lib/import/openapi/importOpenAPI.js +4 -0
  48. package/lib/index.js +2 -11
  49. package/lib/init/constants.js +0 -1
  50. package/lib/init/merge.js +101 -77
  51. package/lib/init/mvn.js +3 -3
  52. package/lib/init/projectReader.js +1 -1
  53. package/lib/init/template/ams/files/mta.yaml.hbs +6 -1
  54. package/lib/init/template/ams/files/package.json.hbs +1 -1
  55. package/lib/init/template/approuter/files/mta.yaml.hbs +5 -0
  56. package/lib/init/template/cf-manifest/files/manifest.yml.hbs +1 -1
  57. package/lib/init/template/cloud-logging/files/package.json.hbs +3 -3
  58. package/lib/init/template/dynatrace/files/mta.yaml.hbs +1 -1
  59. package/lib/init/template/dynatrace/files/package.json.hbs +2 -2
  60. package/lib/init/template/dynatrace/index.js +2 -1
  61. package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +6 -0
  62. package/lib/init/template/enterprise-messaging/index.js +5 -1
  63. package/lib/init/template/extensibility/files/package.json.hbs +1 -1
  64. package/lib/init/template/hana/files/db/package.json +1 -1
  65. package/lib/init/template/hana/files/package.json.hbs +2 -4
  66. package/lib/init/template/helm/index.js +13 -22
  67. package/lib/init/template/helm-unified-runtime/index.js +2 -1
  68. package/lib/init/template/html5-repo/files/values.yaml.hbs +12 -1
  69. package/lib/init/template/html5-repo/index.js +10 -5
  70. package/lib/init/template/http/index.js +1 -1
  71. package/lib/init/template/ias/files/mta.yaml.hbs +1 -1
  72. package/lib/init/template/ias/files/sidecar.package.json.hbs +0 -7
  73. package/lib/init/template/ias/index.js +5 -4
  74. package/lib/init/template/lint/files/package.json +6 -0
  75. package/lib/init/template/lint/index.js +61 -204
  76. package/lib/init/template/mta/files/package.json +1 -1
  77. package/lib/init/template/multitenancy/files/mta.yaml.hbs +2 -2
  78. package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
  79. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +7 -4
  80. package/lib/init/template/multitenancy/index.js +3 -0
  81. package/lib/init/template/nodejs/files/package.json.hbs +5 -2
  82. package/lib/init/template/redis/files/package.json.hbs +1 -1
  83. package/lib/init/template/sqlite/files/package.json +1 -1
  84. package/lib/init/template/toggles/files/package.json.hbs +1 -1
  85. package/lib/init/template/typescript/files/package.json +1 -3
  86. package/lib/init/template/workzone-standard/index.js +2 -0
  87. package/lib/init/template/xsuaa/index.js +2 -6
  88. package/lib/lint/Linter.js +203 -331
  89. package/lib/lint/generators.js +52 -46
  90. package/lib/lint/io.js +77 -289
  91. package/lib/util/fs.js +2 -1
  92. package/lib/util/git.js +1 -1
  93. package/lib/util/glob.js +77 -0
  94. package/lib/watch/livereload-server.js +3 -4
  95. package/lib/watch/node-watch.js +3 -4
  96. package/lib/watch/watched.js +1 -1
  97. package/npm-shrinkwrap.json +59 -1232
  98. package/package.json +6 -8
  99. package/readme.md +1 -1
  100. package/lib/lint/checks.js +0 -135
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "8.9.4",
3
+ "version": "9.0.4",
4
4
  "description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -19,23 +19,21 @@
19
19
  "dependencies": {
20
20
  "@cap-js/asyncapi": "^1.0.0",
21
21
  "@cap-js/openapi": "^1.0.0",
22
- "@sap/cds": "^7 || ^8",
23
- "@sap/cds-foss": "^5.0.0",
24
- "@sap/cds-mtxs": "^1.9.0 || ^2",
25
- "@sap/eslint-plugin-cds": "^3.0.1",
22
+ "@sap/cds": ">=8.3",
23
+ "@sap/cds-mtxs": ">=2",
26
24
  "@sap/hdi-deploy": "^5",
27
25
  "axios": "^1",
28
- "eslint": "^9",
29
26
  "express": "^4.17.3",
30
27
  "hdb": "^0",
31
28
  "livereload-js": "^4.0.1",
32
29
  "mustache": "^4.0.1",
33
30
  "node-watch": ">=0.7",
34
31
  "ws": "^8.4.2",
35
- "xml-js": "^1.6.11"
32
+ "xml-js": "^1.6.11",
33
+ "yaml": "^2"
36
34
  },
37
35
  "optionalDependencies": {
38
- "@cap-js/sqlite": "^1"
36
+ "@cap-js/sqlite": ">=1"
39
37
  },
40
38
  "files": [
41
39
  "bin/",
package/readme.md CHANGED
@@ -10,4 +10,4 @@ In case you find a bug, please report an [incident](https://cap.cloud.sap/docs/r
10
10
 
11
11
  ## License
12
12
 
13
- This package is provided under the terms of the [SAP Developer License Agreement](https://tools.hana.ondemand.com/developer-license-3_1.txt).
13
+ This package is provided under the terms of the [SAP Developer License Agreement](https://cap.cloud.sap/resources/license/developer-license-3_2_CAP.txt).
@@ -1,135 +0,0 @@
1
- const fs = require("fs");
2
- const os = require("os");
3
- const path = require("path");
4
- const term = require("../util/term");
5
-
6
- const IS_WIN = os.platform() === "win32";
7
-
8
- module.exports = {
9
- /**
10
- * Checks whether ESLint v>=8 is installed by trying to resolve
11
- * 'eslint' module from (1) <inputPath> or (2) global npm path
12
- * @param {*} inputPath where to resolve 'eslint' module from
13
- * @param {*} globalPath resolves 'eslint' module from cds-dk
14
- * @param {*} logger if logger is passed, log err messages
15
- * @returns undefined or ESLint cmd string
16
- */
17
- resolveEslint(inputPath, globalPath, logger) {
18
- let cmd;
19
- let version;
20
- let errMessage;
21
- try {
22
- const eslintPath = require.resolve("eslint/package.json", {
23
- paths: [inputPath, globalPath],
24
- });
25
- const packageJson = require(eslintPath);
26
- if (packageJson.version >= "8") {
27
- version = packageJson.version;
28
- } else {
29
- errMessage =
30
- `ESLint v>=8.0.0 required!\n\n` +
31
- ` Make sure to update and check for any breaking changes:\n` +
32
- ` ${term.warn(
33
- "https://eslint.org/docs/user-guide/migrating-to-8.0.0"
34
- )}\n`;
35
- }
36
- const bin = packageJson.bin.eslint;
37
- let script = path.resolve(eslintPath, "..", bin);
38
- if (IS_WIN) {
39
- script = `"${script}"`;
40
- }
41
- cmd = `node ${script}`;
42
- } catch (err) {
43
- errMessage =
44
- `ESLint executable 'eslint' not found!\n\n` +
45
- ` See instructions on how to install ESLint at:\n` +
46
- ` ${term.warn(
47
- "https://eslint.org/docs/user-guide/getting-started"
48
- )}\n`;
49
- }
50
- if (cmd && version) {
51
- return cmd;
52
- }
53
- if (logger) {
54
- logger.error(errMessage);
55
- }
56
- },
57
-
58
- /**
59
- * Checks whether ESLint CDS plugin `@sap/eslint-plugin-cds`
60
- * is installed in inputPath
61
- * @param {*} inputPath CDS project root
62
- * @returns boolean whether plugin is installed in inputPath
63
- */
64
- resolvePlugin(plugin, inputPath) {
65
- try {
66
- require.resolve(plugin, { paths: [inputPath] });
67
- } catch (error) {
68
- return false;
69
- }
70
- return true;
71
- },
72
-
73
- /**
74
- * Checks ESLint config file for proper setup
75
- * in context of a local ESLint plugin installation
76
- * (1) Rules (recommended, model or environment) must be loaded
77
- * (2) Collects rules to overwrite severities for
78
- * @param {*} configPath ESLint config file
79
- * @param {*} options options to check
80
- * @returns boolean whether option checks were successful
81
- */
82
- hasEslintConfigContent(configContents = {}, option = "") {
83
- if (typeof configContents === "object") {
84
- switch (option) {
85
- case "extends":
86
- if (
87
- !configContents.extends ||
88
- (!configContents.extends.includes(`plugin:@sap/cds/recommended`) &&
89
- !configContents.extends.includes(`plugin:@sap/cds/model`) &&
90
- !configContents.extends.includes(`plugin:@sap/cds/environment`))
91
- ) {
92
- return false;
93
- }
94
- break;
95
- case "rules":
96
- if (configContents.rules) {
97
- Object.keys(configContents.rules).forEach((rule) => {
98
- const plugin = require("@sap/eslint-plugin-cds");
99
- const pluginRules = Object.keys(plugin.rules);
100
- if (pluginRules.includes(rule)) {
101
- return true;
102
- }
103
- });
104
- }
105
- break;
106
- default:
107
- break;
108
- }
109
- } else {
110
- return false;
111
- }
112
- return true;
113
- },
114
-
115
- /**
116
- * Checks whether any custom CDS rules are "on"
117
- * @param {*} rulesDir CDS custom rules directory
118
- * @returns boolean whether any CDS custom rules are "on"
119
- */
120
- hasCustomCDSRules(rulesDir, configContents) {
121
- try {
122
- const rules = fs.readdirSync(rulesDir);
123
- if (rules.length > 0) {
124
- for (let rule in configContents.rules) {
125
- if (rules.includes(`${rule}.js`)) {
126
- return true;
127
- }
128
- }
129
- }
130
- } catch (err) {
131
- // Do nothing
132
- }
133
- return false;
134
- }
135
- };