@sap/cds-dk 7.0.3 → 7.1.0
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/bin/bind.js +5 -6
- package/bin/build.js +2 -7
- package/bin/cds.js +0 -4
- package/bin/subscribe.js +4 -4
- package/bin/unsubscribe.js +4 -4
- package/bin/upgrade.js +4 -4
- package/lib/bind/cfKeyProvider.js +9 -10
- package/lib/bind/index.js +1 -3
- package/lib/build/buildTaskEngine.js +9 -22
- package/lib/build/buildTaskFactory.js +18 -27
- package/lib/build/index.js +12 -3
- package/lib/build/provider/buildTaskProviderInternal.js +23 -15
- package/lib/build/provider/mtx/index.js +8 -2
- package/lib/build/util.js +13 -0
- package/lib/client/activate.js +7 -7
- package/lib/client/auth_manager.js +5 -5
- package/lib/client/base_command.js +5 -5
- package/lib/client/extend.js +2 -2
- package/lib/client/helper/logging.js +7 -2
- package/lib/client/params.js +2 -3
- package/lib/client/pull.js +3 -3
- package/lib/client/push.js +3 -3
- package/lib/client/settings_manager.js +7 -8
- package/lib/client/tenant_action.js +3 -3
- package/lib/deploy/to-hana/hana.js +1 -2
- package/lib/import/common.js +3 -0
- package/lib/import/message.js +2 -1
- package/lib/import/odata/v4parser.js +85 -95
- package/lib/init/index.js +24 -11
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +1 -1
- package/lib/init/template/data/index.js +2 -3
- package/lib/init/template/lint/index.js +5 -6
- package/lib/init/template/nodejs/index.js +2 -3
- package/lib/init/template/pipeline/index.js +1 -2
- package/lib/init/util/indent.js +1 -1
- package/lib/init/util/merge.js +3 -3
- package/lib/init/util/mvn.js +17 -22
- package/lib/util/cfUtil.js +1 -2
- package/npm-shrinkwrap.json +353 -300
- package/package.json +1 -1
- package/lib/client/helper/errors.js +0 -26
- package/lib/util/version.js +0 -27
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists, fs } = cds.utils
|
|
4
4
|
const { resolve, join, relative } = require('path');
|
|
5
|
-
const LOG = console
|
|
6
5
|
const DEBUG = cds.debug('cli')
|
|
7
6
|
|
|
8
7
|
module.exports = class DataTemplate extends require('../templateBase') {
|
|
@@ -111,7 +110,7 @@ function createDataFile (isFileExists, dataFilePath, dest, force, entity) {
|
|
|
111
110
|
relFilePath = relative(cds.root, dataFilePath);
|
|
112
111
|
}
|
|
113
112
|
if (isFileExists && !force) {
|
|
114
|
-
|
|
113
|
+
console.log(`Skipping ${relFilePath}`);
|
|
115
114
|
}
|
|
116
115
|
else {
|
|
117
116
|
// continue only if file not already exists, or '--force' option provided
|
|
@@ -119,7 +118,7 @@ function createDataFile (isFileExists, dataFilePath, dest, force, entity) {
|
|
|
119
118
|
if (dataFileContent && dataFileContent.length) {
|
|
120
119
|
if (!exists(dest)) fs.mkdirSync(dest, {recursive: true})
|
|
121
120
|
fs.writeFileSync(dataFilePath, dataFileContent);
|
|
122
|
-
isFileExists ?
|
|
121
|
+
isFileExists ? console.log(`Overwriting `+relFilePath) : console.log(`Creating `+relFilePath)
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
}
|
|
@@ -10,7 +10,6 @@ const { LINT_DEV, LINT_GLOBAL } = require("../../constants").OPTIONS;
|
|
|
10
10
|
const { getConfigPath, getFileExtensions } = require("@sap/eslint-plugin-cds/lib/api");
|
|
11
11
|
const cds = require("../../../cds");
|
|
12
12
|
const { mkdirp, exists } = cds.utils;
|
|
13
|
-
const LOG = console;
|
|
14
13
|
|
|
15
14
|
const IS_WIN = os.platform() === "win32";
|
|
16
15
|
const ALLOWED_FILE_EXTENSIONS = getFileExtensions();
|
|
@@ -100,20 +99,20 @@ module.exports = class LintTemplate extends require('../templateBase') {
|
|
|
100
99
|
].join(" ")}`;
|
|
101
100
|
|
|
102
101
|
if (cds.cli.options.force) {
|
|
103
|
-
|
|
102
|
+
console.log(
|
|
104
103
|
`\n\nAlmost done - installing ${this.missingNpmDependencies["names"].length} npm dependencies:\n${task}`
|
|
105
104
|
);
|
|
106
105
|
this._runTask(task);
|
|
107
106
|
} else {
|
|
108
|
-
|
|
107
|
+
console.log(
|
|
109
108
|
`\n\nAlmost done - ${term.warn(
|
|
110
109
|
`you are missing ${this.missingNpmDependencies["names"].length} npm dependencies`
|
|
111
110
|
)}:\n`
|
|
112
111
|
);
|
|
113
112
|
this.missingNpmDependencies["msgs"].forEach((msg, i) => {
|
|
114
|
-
|
|
113
|
+
console.log(`(${i + 1}) ${msg}`);
|
|
115
114
|
if (i === this.missingNpmDependencies["msgs"].length - 1) {
|
|
116
|
-
|
|
115
|
+
console.log("\n");
|
|
117
116
|
}
|
|
118
117
|
});
|
|
119
118
|
await this._promptInstallDependencies(task);
|
|
@@ -192,7 +191,7 @@ module.exports = class LintTemplate extends require('../templateBase') {
|
|
|
192
191
|
resolve(this._runTask(task));
|
|
193
192
|
// If use declines or question timeout is reached, print todos
|
|
194
193
|
} else if (["n", "no"].includes(received.toLowerCase())) {
|
|
195
|
-
|
|
194
|
+
console.log(todos);
|
|
196
195
|
resolve();
|
|
197
196
|
} else {
|
|
198
197
|
// Close and restart question (with new timeout)
|
|
@@ -4,7 +4,6 @@ const { exists, mkdirp, path } = cds.utils
|
|
|
4
4
|
const { URLS, OPTIONS: { NODEJS, JAVA }, COMMAND_ADD } = require('../../constants')
|
|
5
5
|
const term = require('../../../util/term')
|
|
6
6
|
const { copyFiles } = require('../../util/template')
|
|
7
|
-
const LOG = console
|
|
8
7
|
|
|
9
8
|
module.exports = class NodejsTemplate extends require('../templateBase') {
|
|
10
9
|
|
|
@@ -29,7 +28,7 @@ module.exports = class NodejsTemplate extends require('../templateBase') {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
async finalize() {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
console.log(`Find samples on ${term.link(URLS.SAMPLES)}`)
|
|
32
|
+
console.log(`Learn about next steps at ${term.link(URLS.CAPIRE)}`)
|
|
34
33
|
}
|
|
35
34
|
}
|
|
@@ -3,7 +3,6 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { exists } = cds.utils
|
|
4
4
|
const { copyFiles } = require('../../util/template')
|
|
5
5
|
const { URLS } = require('../../constants')
|
|
6
|
-
const LOG = console
|
|
7
6
|
|
|
8
7
|
module.exports = class PipelineTemplate extends require('../templateBase') {
|
|
9
8
|
|
|
@@ -25,6 +24,6 @@ module.exports = class PipelineTemplate extends require('../templateBase') {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
async finalize() {
|
|
28
|
-
|
|
27
|
+
console.log(`For information on project "Piper" and its pipelines see ${URLS.PIPELINE_HELP}`);
|
|
29
28
|
}
|
|
30
29
|
}
|
package/lib/init/util/indent.js
CHANGED
|
@@ -48,7 +48,7 @@ function detectIndent (file) {
|
|
|
48
48
|
}, { tabs: { indents: {}, total: 0, character: '\t' }, spaces: { indents: {}, total: 0, character: ' ' } })
|
|
49
49
|
|
|
50
50
|
const preferred = indents.tabs.total > indents.spaces.total ? indents.tabs : indents.spaces
|
|
51
|
-
const width = gcd(Object.keys(preferred.indents))
|
|
51
|
+
const width = gcd(Object.keys(preferred.indents)) ?? 2
|
|
52
52
|
return preferred.character.repeat(width)
|
|
53
53
|
}
|
|
54
54
|
|
package/lib/init/util/merge.js
CHANGED
|
@@ -110,14 +110,14 @@ async function mergeJSON(into, from, project, semantics) {
|
|
|
110
110
|
const resultYAML = await mergeYAML(targetYAML, sourceYAML, project, semantics)
|
|
111
111
|
result = YAML.parse(YAML.stringify(resultYAML))
|
|
112
112
|
} else {
|
|
113
|
-
const target = typeof into === 'string' ? await read(into) : into
|
|
113
|
+
const target = typeof into === 'string' ? await read(into, 'json') : into
|
|
114
114
|
result = _deepMerge(target, source)
|
|
115
115
|
}
|
|
116
116
|
// we need to stringify result on site to be able to apply the appropriate indentation.
|
|
117
117
|
// cds-utils.write is currently hardcoded to use spaces for indentation.
|
|
118
118
|
if (typeof into === 'string') {
|
|
119
|
-
const indent = exists(into) && detectIndent((await read(into, 'utf-8')).split(EOL))
|
|
120
|
-
await write(into, JSON.stringify(result, null, indent
|
|
119
|
+
const indent = exists(into) && detectIndent((await read(into, 'utf-8')).split(EOL)) || ' '
|
|
120
|
+
await write(into, JSON.stringify(result, null, indent) + EOL)
|
|
121
121
|
}
|
|
122
122
|
return result
|
|
123
123
|
}
|
package/lib/init/util/mvn.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
const { URLS, MAVEN_ARCHETYPE_VERSION, OPTIONS: { JAVA_MVN, JAVA_PACKAGE, SAMPLES, HANA }, REGEX_JAVA_PACKAGE } = require('../constants');
|
|
3
3
|
|
|
4
|
-
const { CliError } = require('../../client/helper/errors');
|
|
5
|
-
|
|
6
|
-
|
|
7
4
|
const cp = require('child_process');
|
|
8
5
|
const util = require('util');
|
|
9
6
|
const execAsync = util.promisify(cp.exec);
|
|
@@ -132,29 +129,27 @@ class MvnArchetypeUtil {
|
|
|
132
129
|
|
|
133
130
|
// -DjdkVersion=[11|17]
|
|
134
131
|
if (!params.get('-DjdkVersion')) {
|
|
132
|
+
let javaVersion
|
|
135
133
|
try {
|
|
136
|
-
|
|
137
|
-
const match = javaVersion?.stderr?.match(/version\s*"?(\d+\.\d+\.\d+)"?/);
|
|
138
|
-
if (match?.[1]) {
|
|
139
|
-
const segments = match[1]?.split('.');
|
|
140
|
-
const version = new Number(segments?.[0]);
|
|
141
|
-
switch (true) {
|
|
142
|
-
case (version < 17):
|
|
143
|
-
if (process.env.WS_BASE_URL) {
|
|
144
|
-
throw new CliError(`Java version ${match[1]} is not supported. Use Java 17 or higher. You can use command 'Java: Set Default JDK' to switch to Java 17.`)
|
|
145
|
-
}
|
|
146
|
-
throw new CliError(`Java version ${match[1]} is not supported. Use Java 17 or higher.`)
|
|
147
|
-
case (version < 20): params.set(`-DjdkVersion`, 17); break;
|
|
148
|
-
case (version >= 20): params.set(`-DjdkVersion`, 20); break;
|
|
149
|
-
default:
|
|
150
|
-
}
|
|
151
|
-
}
|
|
134
|
+
javaVersion = await execAsync('java -version');
|
|
152
135
|
} catch (err) {
|
|
153
|
-
if (err instanceof CliError) {
|
|
154
|
-
throw err;
|
|
155
|
-
}
|
|
156
136
|
DEBUG?.(err);
|
|
157
137
|
}
|
|
138
|
+
const match = javaVersion?.stderr?.match(/version\s*"?(\d+\.\d+\.\d+)"?/);
|
|
139
|
+
if (match?.[1]) {
|
|
140
|
+
const segments = match[1]?.split('.');
|
|
141
|
+
const version = new Number(segments?.[0]);
|
|
142
|
+
switch (true) {
|
|
143
|
+
case (version < 17):
|
|
144
|
+
if (process.env.WS_BASE_URL) {
|
|
145
|
+
throw `Java version ${match[1]} is not supported. Use Java 17 or higher. You can use command 'Java: Set Default JDK' to switch to Java 17.`
|
|
146
|
+
}
|
|
147
|
+
throw `Java version ${match[1]} is not supported. Use Java 17 or higher.`
|
|
148
|
+
case (version < 20): params.set(`-DjdkVersion`, 17); break;
|
|
149
|
+
case (version >= 20): params.set(`-DjdkVersion`, 20); break;
|
|
150
|
+
default:
|
|
151
|
+
}
|
|
152
|
+
}
|
|
158
153
|
}
|
|
159
154
|
|
|
160
155
|
if (options[JAVA_PACKAGE]) {
|
package/lib/util/cfUtil.js
CHANGED
|
@@ -15,7 +15,6 @@ const LOG = cds.log ? cds.log('deploy') : console;
|
|
|
15
15
|
const DEBUG = cds.debug('deploy');
|
|
16
16
|
|
|
17
17
|
const { bold, warn } = require('./term');
|
|
18
|
-
const { CliError } = require('../client/helper/errors');
|
|
19
18
|
|
|
20
19
|
const CF_COMMAND = 'cf';
|
|
21
20
|
|
|
@@ -143,7 +142,7 @@ class CfUtil {
|
|
|
143
142
|
try {
|
|
144
143
|
return (await this._cfRun('oauth-token')).stdout;
|
|
145
144
|
} catch (err) {
|
|
146
|
-
throw
|
|
145
|
+
throw err.message;
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
|