@sap/cds-dk 7.4.1 → 7.5.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/activate.js +1 -1
- package/bin/add.js +6 -4
- package/bin/build.js +4 -6
- package/bin/cds.js +4 -1
- package/bin/deploy/index.js +5 -2
- package/bin/eval.js +1 -1
- package/bin/extend.js +3 -3
- package/bin/login.js +2 -2
- package/bin/logout.js +1 -1
- package/bin/pull.js +1 -1
- package/bin/push.js +2 -2
- package/bin/subscribe.js +2 -2
- package/bin/unsubscribe.js +2 -2
- package/bin/upgrade.js +2 -2
- package/bin/version.js +2 -2
- package/bin/watch.js +1 -1
- package/lib/bind/bindingUtil.js +2 -1
- package/lib/bind/cfKeyProvider.js +1 -1
- package/lib/bind/userCdsrcJsonStorageProvider.js +1 -1
- package/lib/build/buildPlugin.js +6 -12
- package/lib/build/buildTaskEngine.js +24 -19
- package/lib/build/buildTaskFactory.js +27 -33
- package/lib/build/buildTaskProvider.js +1 -1
- package/lib/build/buildTaskProviderFactory.js +26 -41
- package/lib/build/constants.js +0 -1
- package/lib/build/index.js +3 -3
- package/lib/build/plugins.js +15 -15
- package/lib/build/provider/edmxBuildPlugin.js +6 -7
- package/lib/build/provider/fiori/index.js +8 -8
- package/lib/build/provider/hana/2migration.js +12 -16
- package/lib/build/provider/hana/index.js +5 -7
- package/lib/build/provider/hana/template/package.json +1 -1
- package/lib/build/provider/internalBuildPlugin.js +0 -8
- package/lib/build/provider/internalBuildTaskProvider.js +17 -21
- package/lib/build/provider/java/index.js +2 -1
- package/lib/build/provider/mtx-extension/index.js +3 -3
- package/lib/build/provider/mtx-sidecar/index.js +2 -1
- package/lib/build/provider/nodejs/index.js +6 -5
- package/lib/compile/openapi/csdl2openapi.js +29 -15
- package/lib/compile/openapi/index.js +6 -6
- package/lib/deploy/to-hana/hana.js +2 -2
- package/lib/env/schema.js +2 -3
- package/lib/index.js +68 -28
- package/lib/init/add.js +17 -0
- package/lib/init/constants.js +5 -3
- package/lib/init/index.js +39 -25
- package/lib/init/{util/merge.js → merge.js} +32 -20
- package/lib/init/{util/mvn.js → mvn.js} +5 -5
- package/lib/init/plugin.js +85 -0
- package/lib/init/projectReader.js +145 -0
- package/lib/init/registries/mta.js +151 -0
- package/lib/init/template/{kibana → application-logging}/files/mta.yaml.hbs +3 -3
- package/lib/init/template/application-logging/index.js +49 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +11 -11
- package/lib/init/template/approuter/files/xs-app.json.hbs +2 -2
- package/lib/init/template/approuter/index.js +36 -81
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +3 -3
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +4 -4
- package/lib/init/template/cf-manifest/index.js +4 -4
- package/lib/init/template/connectivity/index.js +22 -35
- package/lib/init/template/data/index.js +3 -2
- package/lib/init/template/destination/files/values.yaml +9 -0
- package/lib/init/template/destination/index.js +15 -47
- package/lib/init/template/enterprise-messaging/index.js +26 -58
- package/lib/init/template/enterprise-messaging-shared/index.js +23 -39
- package/lib/init/template/extensibility/index.js +16 -30
- package/lib/init/template/file-based-messaging/index.js +7 -8
- package/lib/init/template/h2/index.js +4 -4
- package/lib/init/template/hana/files/mta.yaml.hbs +8 -8
- package/lib/init/template/hana/index.js +29 -115
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +12 -0
- package/lib/init/template/helm/files/chart/templates/_deployment_helpers.tpl +82 -0
- package/lib/init/template/helm/files/chart/templates/_helpers.tpl +28 -0
- package/lib/init/template/helm/files/chart/values.root.schema.json +61 -0
- package/lib/init/template/helm/files/chart/values.schema.json +366 -0
- package/lib/init/template/helm/{subcharts → files}/web-application/Chart.yaml +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/templates/_api.tpl +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/values.yaml +1 -1
- package/lib/init/template/helm/index.js +84 -85
- package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +10 -0
- package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +26 -0
- package/lib/init/template/helm-unified-runtime/index.js +91 -0
- package/lib/init/template/helm-unified-runtime/lib/build.js +0 -0
- package/lib/init/template/helm-unified-runtime/package.json +4 -0
- package/lib/init/template/html5-repo/files/values.yaml.hbs +28 -0
- package/lib/init/template/html5-repo/index.js +23 -97
- package/lib/init/template/java/index.js +3 -3
- package/lib/init/template/lint/index.js +2 -2
- package/lib/init/template/liquibase/index.js +16 -0
- package/lib/init/template/local-messaging/index.js +7 -8
- package/lib/init/template/mta/index.js +7 -19
- package/lib/init/template/mtx/index.js +2 -2
- package/lib/init/template/multitenancy/index.js +38 -89
- package/lib/init/template/nodejs/index.js +5 -4
- package/lib/init/template/notebook/index.js +1 -1
- package/lib/init/template/notifications/index.js +16 -19
- package/lib/init/template/pipeline/index.js +1 -1
- package/lib/init/template/postgres/index.js +25 -31
- package/lib/init/template/redis-messaging/index.js +23 -27
- package/lib/init/template/sample/index.js +4 -4
- package/lib/init/template/samples/index.js +2 -2
- package/lib/init/template/sqlite/files/{package.json.hbs → package.json} +0 -2
- package/lib/init/template/sqlite/index.js +6 -10
- package/lib/init/template/tiny-sample/index.js +6 -6
- package/lib/init/template/toggles/index.js +7 -8
- package/lib/init/template/typer/index.js +6 -6
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/index.js +27 -52
- package/lib/init/{util/template.js → template.js} +1 -1
- package/lib/{client → mtx}/activate.js +15 -11
- package/lib/{client → mtx}/auth_manager.js +5 -4
- package/lib/{client → mtx}/download_legacy.js +6 -4
- package/lib/{client → mtx}/extend.js +14 -9
- package/lib/{client → mtx}/index.js +1 -1
- package/lib/{client → mtx}/params.js +3 -1
- package/lib/{client → mtx}/pull.js +6 -4
- package/lib/{client → mtx}/push.js +10 -9
- package/lib/{client → mtx}/settings_manager.js +8 -6
- package/lib/{client → mtx}/tenant_action.js +9 -8
- package/lib/{client/helper/cf_helper.js → mtx/util/cf.js} +4 -3
- package/lib/{client/helper/dependency_helper.js → mtx/util/dependencies.js} +1 -0
- package/lib/mtx/util/errors.js +27 -0
- package/lib/mtx/util/legacy_ext.js +16 -0
- package/lib/{client/helper/url_helper.js → mtx/util/urls.js} +12 -1
- package/lib/util/fs.js +5 -1
- package/lib/util/pruneAxiosErrors.js +35 -18
- package/lib/util/write.js +1 -1
- package/npm-shrinkwrap.json +310 -270
- package/package.json +1 -1
- package/lib/client/base_command.js +0 -54
- package/lib/init/template/_merging/registry-mta.js +0 -304
- package/lib/init/template/helm/Model.d.ts +0 -53
- package/lib/init/template/kibana/files/package.json.hbs +0 -17
- package/lib/init/template/kibana/index.js +0 -54
- package/lib/init/template/templateBase.js +0 -100
- package/lib/init/util/md5.js +0 -86
- package/lib/init/util/projectReader.js +0 -94
- /package/lib/init/{util/indent.js → indent.js} +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/job.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/serviceinstance.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/NOTES.txt +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/api-rule.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/deployment.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/network-policy.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/pod-disruption-budget.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/rbac.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/virtual-service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/values.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/NOTES.txt +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_deployment_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.root.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.schema.json +0 -0
- /package/lib/init/template/postgres/files/{mta.yaml.hbs → mta.yml.hbs} +0 -0
- /package/lib/init/{util/xml.js → xml.js} +0 -0
- /package/lib/{client/helper/env_helper.js → mtx/util/env.js} +0 -0
- /package/lib/{client/helper/fs_helper.js → mtx/util/fs.js} +0 -0
- /package/lib/{client/helper → mtx/util}/logging.js +0 -0
- /package/lib/{client/helper → mtx/util}/question.js +0 -0
- /package/lib/{client/helper/string_helper.js → mtx/util/strings.js} +0 -0
- /package/lib/util/{cfUtil.js → cf.js} +0 -0
- /package/lib/util/{gitUtil.js → git.js} +0 -0
package/bin/activate.js
CHANGED
package/bin/add.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const cds = require('../lib/cds')
|
|
1
2
|
const term = require('../lib/util/term')
|
|
2
3
|
|
|
3
4
|
module.exports = Object.assign(add, {
|
|
@@ -91,10 +92,11 @@ module.exports = Object.assign(add, {
|
|
|
91
92
|
|
|
92
93
|
*cds init*
|
|
93
94
|
|
|
94
|
-
`})
|
|
95
|
+
`})
|
|
95
96
|
|
|
96
97
|
async function add(args) {
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
98
|
+
await cds.plugins
|
|
99
|
+
const CDSGenerator = require('../lib/init')
|
|
100
|
+
const generator = new CDSGenerator()
|
|
101
|
+
await generator.addCmd(args[0])
|
|
100
102
|
}
|
package/bin/build.js
CHANGED
|
@@ -80,7 +80,6 @@ module.exports = Object.assign(build, {
|
|
|
80
80
|
a tarball will be created in folder 'gen/srv'. Dependencies in package.json
|
|
81
81
|
will be adapted to point to the correct tarball file URL.
|
|
82
82
|
Contents is packaged based on the rules of the 'npm pack' command.
|
|
83
|
-
See 'npm workspaces' and 'npm pack' for further details.
|
|
84
83
|
|
|
85
84
|
# EXAMPLES
|
|
86
85
|
|
|
@@ -94,6 +93,9 @@ module.exports = Object.assign(build, {
|
|
|
94
93
|
async function build([project], options = {}) {
|
|
95
94
|
const path = require('path')
|
|
96
95
|
|
|
96
|
+
// ensure that cds build plugins defined as devDependencies are loaded
|
|
97
|
+
if (process.env.NODE_ENV === 'production') delete process.env.NODE_ENV
|
|
98
|
+
|
|
97
99
|
const cds = require('../lib/cds')
|
|
98
100
|
|
|
99
101
|
// plugins are loaded based on cds.root path
|
|
@@ -105,11 +107,6 @@ async function build([project], options = {}) {
|
|
|
105
107
|
cds.env = cds.env.for('cds', cds.root);
|
|
106
108
|
delete options.project // avoid that relative project paths are resolved twice
|
|
107
109
|
|
|
108
|
-
const { build } = require('../lib/build')
|
|
109
|
-
const [major] = cds.version.split('.')
|
|
110
|
-
if (Number(major) < 6) {
|
|
111
|
-
throw "This application uses @sap/cds version < 6, which is not compatible with the installed @sap/cds-dk version >= 7. Update @sap/cds to version >= 6."
|
|
112
|
-
}
|
|
113
110
|
if (typeof options["options-model"] === "string") {
|
|
114
111
|
options.opts = "model=[" + options["options-model"].split(",").map((entry) => entry.trim()) + "]"
|
|
115
112
|
delete options["options-model"]
|
|
@@ -122,5 +119,6 @@ async function build([project], options = {}) {
|
|
|
122
119
|
delete options["no-clean"]
|
|
123
120
|
}
|
|
124
121
|
|
|
122
|
+
const { build } = require('../lib/build')
|
|
125
123
|
await build(options)
|
|
126
124
|
}
|
package/bin/cds.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
const cli = {
|
|
4
|
+
const cli = {
|
|
5
5
|
|
|
6
6
|
Shortcuts: {
|
|
7
7
|
i: 'init',
|
|
@@ -90,6 +90,9 @@ const cli = { //NOSONAR
|
|
|
90
90
|
else if (_global.test(a)) add_global(a, _flags[a] || argv[++i])
|
|
91
91
|
else throw 'Invalid option: '+ a
|
|
92
92
|
}
|
|
93
|
+
// consistent production setting for NODE_ENV and CDS_ENV
|
|
94
|
+
if (process.env.NODE_ENV !== 'production') process.env.NODE_ENV = process.env.CDS_ENV?.split(',').find(p => p === 'production') || process.env.NODE_ENV
|
|
95
|
+
else process.env.CDS_ENV = Array.from(new Set([...process.env.CDS_ENV?.split(',') ?? [], 'production']))
|
|
93
96
|
|
|
94
97
|
function add (k,v) { options[k.slice(2)] = v || true }
|
|
95
98
|
function add_global (k,v='') {
|
package/bin/deploy/index.js
CHANGED
|
@@ -88,8 +88,6 @@ module.exports = Object.assign(deploy, {
|
|
|
88
88
|
|
|
89
89
|
`})
|
|
90
90
|
|
|
91
|
-
const cds = require('../../lib/cds')
|
|
92
|
-
|
|
93
91
|
async function deploy(_model, options) { // NOSONAR
|
|
94
92
|
|
|
95
93
|
if (process.stdout.isTTY && options['no-save']) {
|
|
@@ -98,6 +96,11 @@ async function deploy(_model, options) { // NOSONAR
|
|
|
98
96
|
|
|
99
97
|
if (_model && _model.length === 0) _model = undefined // empty array (no model args) means default models
|
|
100
98
|
|
|
99
|
+
// ensure that cds build plugins defined as devDependencies are loaded
|
|
100
|
+
if (process.env.NODE_ENV === 'production') delete process.env.NODE_ENV
|
|
101
|
+
|
|
102
|
+
const cds = require('../../lib/cds')
|
|
103
|
+
|
|
101
104
|
// IMPORTANT: call plugins before subsequent access to cds.env
|
|
102
105
|
await cds.plugins
|
|
103
106
|
|
package/bin/eval.js
CHANGED
package/bin/extend.js
CHANGED
|
@@ -81,7 +81,7 @@ async function extend ([url], options = {}) {
|
|
|
81
81
|
const [username, password] = options.username?.split(':') ?? [];
|
|
82
82
|
delete options.user;
|
|
83
83
|
|
|
84
|
-
await require('../lib/
|
|
84
|
+
await require('../lib/mtx/download_legacy').run({
|
|
85
85
|
...options,
|
|
86
86
|
url,
|
|
87
87
|
username,
|
|
@@ -91,14 +91,14 @@ async function extend ([url], options = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (options.force) {
|
|
94
|
-
if (! await require('../lib/
|
|
94
|
+
if (! await require('../lib/mtx/util/question').askBooleanQuestion('Using option --force will overwrite existing files. Continue (yN)? ', false, false)) {
|
|
95
95
|
console.log('Extend cancelled')
|
|
96
96
|
return
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
Object.assign(options, { url })
|
|
101
|
-
await require('../lib/
|
|
101
|
+
await require('../lib/mtx/extend').run(options);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
|
package/bin/login.js
CHANGED
|
@@ -3,7 +3,7 @@ module.exports = Object.assign(login, {
|
|
|
3
3
|
shortcuts: ['-s', '-d', '-p', '-u', '-c', '-m'],
|
|
4
4
|
flags: ['--plain'],
|
|
5
5
|
get help() {
|
|
6
|
-
const config = require('../lib/
|
|
6
|
+
const config = require('../lib/mtx/settings_manager').SettingsManager.config
|
|
7
7
|
return `
|
|
8
8
|
# SYNOPSIS
|
|
9
9
|
|
|
@@ -169,7 +169,7 @@ async function login ([url], options = {}) {
|
|
|
169
169
|
});
|
|
170
170
|
delete options.plain;
|
|
171
171
|
|
|
172
|
-
await require('../lib/
|
|
172
|
+
await require('../lib/mtx/auth_manager').login(options);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
|
package/bin/logout.js
CHANGED
|
@@ -54,7 +54,7 @@ module.exports = Object.assign(logout, {
|
|
|
54
54
|
async function logout ([projectFolder], options = {}) {
|
|
55
55
|
Object.assign(options, { projectFolder })
|
|
56
56
|
|
|
57
|
-
await require('../lib/
|
|
57
|
+
await require('../lib/mtx/auth_manager').logout(options)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
|
package/bin/pull.js
CHANGED
package/bin/push.js
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = Object.assign(push, {
|
|
|
25
25
|
|
|
26
26
|
# OPTIONS
|
|
27
27
|
|
|
28
|
-
*--to* <url>
|
|
28
|
+
*-2* | *--to* <url>
|
|
29
29
|
|
|
30
30
|
Specify the URL of the extensible SaaS app. Determined from the current
|
|
31
31
|
user's active
|
|
@@ -100,5 +100,5 @@ async function push([projectFolder], options = {}) {
|
|
|
100
100
|
args.push({ extArchive });
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
await require('../lib/
|
|
103
|
+
await require('../lib/mtx/push').run(...args);
|
|
104
104
|
}
|
package/bin/subscribe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = Object.assign(subscribe, {
|
|
2
|
-
init: cmd => new (require('../lib/
|
|
2
|
+
init: cmd => new (require('../lib/mtx/tenant_action'))(cmd),
|
|
3
3
|
options: ['--to', '--user'],
|
|
4
4
|
flags: ['--local', '--resolve-bindings'],
|
|
5
5
|
shortcuts: ['-2', '-u', '-l', '-b'],
|
|
@@ -50,7 +50,7 @@ module.exports = Object.assign(subscribe, {
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
async function subscribe([tenant], options = {}) {
|
|
53
|
-
const { getMessage } = require('../lib/
|
|
53
|
+
const { getMessage } = require('../lib/mtx/util/logging');
|
|
54
54
|
if (!tenant) {
|
|
55
55
|
throw getMessage('Tenant not given.', { command: 'subscribe' });
|
|
56
56
|
}
|
package/bin/unsubscribe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = Object.assign(unsubscribe, {
|
|
2
|
-
init: cmd => new (require('../lib/
|
|
2
|
+
init: cmd => new (require('../lib/mtx/tenant_action'))(cmd),
|
|
3
3
|
options: ['--from', '--user'],
|
|
4
4
|
flags: ['--local', '--resolve-bindings'],
|
|
5
5
|
shortcuts: ['-f', '-u', '-l', '-b'],
|
|
@@ -51,7 +51,7 @@ module.exports = Object.assign(unsubscribe, {
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
async function unsubscribe([tenant], options = {}) {
|
|
54
|
-
const { getMessage } = require('../lib/
|
|
54
|
+
const { getMessage } = require('../lib/mtx/util/logging');
|
|
55
55
|
if (!tenant) {
|
|
56
56
|
throw getMessage('Tenant not given.', { command: 'unsubscribe' });
|
|
57
57
|
}
|
package/bin/upgrade.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = Object.assign(upgrade, {
|
|
2
|
-
init: cmd => new (require('../lib/
|
|
2
|
+
init: cmd => new (require('../lib/mtx/tenant_action'))(cmd),
|
|
3
3
|
options: ['--at', '--user'],
|
|
4
4
|
flags: ['--local', '--resolve-bindings'],
|
|
5
5
|
shortcuts: ['-a', '-u', '-l', '-b'],
|
|
@@ -51,7 +51,7 @@ module.exports = Object.assign(upgrade, {
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
async function upgrade([tenant], options = {}) {
|
|
54
|
-
const { getMessage } = require('../lib/
|
|
54
|
+
const { getMessage } = require('../lib/mtx/util/logging');
|
|
55
55
|
if (!tenant) {
|
|
56
56
|
throw getMessage('Tenant not given.', { command: 'upgrade' });
|
|
57
57
|
}
|
package/bin/version.js
CHANGED
|
@@ -34,7 +34,7 @@ module.exports = Object.assign(list_versions, {
|
|
|
34
34
|
|
|
35
35
|
const MISSING = '-- missing --'
|
|
36
36
|
|
|
37
|
-
function list_versions(args, options) {
|
|
37
|
+
function list_versions(args, options) {
|
|
38
38
|
if (options['npm-list'] || options['npm-tree']) {
|
|
39
39
|
let [pattern] = args, re = pattern ? RegExp(pattern) : /@sap\/cd[rs]|@sap\/eslint-plugin-cds/
|
|
40
40
|
let cmd = 'npm ls --depth ' + (options['npm-tree'] ? 11 : 0)
|
|
@@ -93,7 +93,7 @@ function _markdown (versions) {
|
|
|
93
93
|
const pkg = { name:'', repository:'', version:'' }; try {
|
|
94
94
|
Object.assign (pkg, require (resolve('package.json')))
|
|
95
95
|
} catch (e) {/* ignored */}
|
|
96
|
-
console.log ('|', pkg.name, '|', pkg.repository.url || pkg.repository, '|')
|
|
96
|
+
console.log ('|', pkg.name, '|', pkg.repository.url || pkg.repository || 'https://github.com/<your/repo>', '|')
|
|
97
97
|
console.log ('|:---------------------- | ----------- |')
|
|
98
98
|
if (require('../lib').env['project-nature'] === 'nodejs') {
|
|
99
99
|
console.log ('|', v('Node.js'), '|')
|
package/bin/watch.js
CHANGED
|
@@ -64,7 +64,7 @@ const t = module.exports.codes = {
|
|
|
64
64
|
orange: colors ? '\x1b[38;2;255;140;0m' : '' // darker orange, works with bright and dark background
|
|
65
65
|
}
|
|
66
66
|
const extDefaults = 'cds,csn,csv,ts,mjs,cjs,js,json,properties,edmx,xml,env'
|
|
67
|
-
const ignore = RegExp(`(node_modules\\${sep}|@cds-models\\${sep}|@types\\${sep}|app(\\${sep}.+)?\\${sep}((webapp|dist|target)\\${sep}|\\.cds-services\\.json$|tsconfig\\.json$|.*\\.tsbuildinfo$))`)
|
|
67
|
+
const ignore = RegExp(`(_out\\${sep}|node_modules\\${sep}|@cds-models\\${sep}|@types\\${sep}|app(\\${sep}.+)?\\${sep}((webapp|dist|target)\\${sep}|\\.cds-services\\.json$|tsconfig\\.json$|.*\\.tsbuildinfo$))`)
|
|
68
68
|
|
|
69
69
|
async function watch ([cwd], {
|
|
70
70
|
args = ['serve', 'all'],
|
package/lib/bind/bindingUtil.js
CHANGED
|
@@ -9,7 +9,8 @@ const KindToRequiresNameMap = {
|
|
|
9
9
|
'sql-mt': 'db', // For compatibility only
|
|
10
10
|
destinations: 'destinations',
|
|
11
11
|
connectivity: 'connectivity',
|
|
12
|
-
'audit-log': '
|
|
12
|
+
'audit-log': 'auditlog',
|
|
13
|
+
'audit-log-to-restv2': 'auditlog',
|
|
13
14
|
'enterprise-messaging': 'messaging',
|
|
14
15
|
'enterprise-messaging-amqp': 'messaging',
|
|
15
16
|
'enterprise-messaging-http': 'messaging',
|
|
@@ -6,7 +6,7 @@ const fs = require('fs').promises;
|
|
|
6
6
|
const { highlight } = require('../util/term');
|
|
7
7
|
const { logger } = require('./bindingUtil');
|
|
8
8
|
|
|
9
|
-
const gitUtil = require('../util/
|
|
9
|
+
const gitUtil = require('../util/git');
|
|
10
10
|
|
|
11
11
|
const CDSRC_FILENAME = '.cdsrc-private.json';
|
|
12
12
|
|
package/lib/build/buildPlugin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const fs = require('fs').promises
|
|
3
3
|
const cds = require('../cds')
|
|
4
|
-
|
|
5
4
|
const { OUTPUT_MODE, OUTPUT_MODE_FILESYSTEM, SEVERITY_INFO, SEVERITY_WARNING, SEVERITY_ERROR } = require('./constants')
|
|
6
5
|
const { hasOptionValue, getProperty, relativePaths, BuildMessage, pathExists } = require('./util')
|
|
6
|
+
const DEBUG = cds.debug('cli|build')
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The build plugin creates the build output for a dedicated build task. It is uniquely identified
|
|
@@ -30,15 +30,9 @@ class BuildPlugin {
|
|
|
30
30
|
static hasTask() {
|
|
31
31
|
return true
|
|
32
32
|
}
|
|
33
|
-
static
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
static get WARNING() {
|
|
37
|
-
return SEVERITY_WARNING
|
|
38
|
-
}
|
|
39
|
-
static get ERROR() {
|
|
40
|
-
return SEVERITY_ERROR
|
|
41
|
-
}
|
|
33
|
+
static INFO = SEVERITY_INFO
|
|
34
|
+
static WARNING = SEVERITY_WARNING
|
|
35
|
+
static ERROR = SEVERITY_ERROR
|
|
42
36
|
/**
|
|
43
37
|
* Returns the build context
|
|
44
38
|
* @returns {object}
|
|
@@ -194,10 +188,10 @@ class BuildPlugin {
|
|
|
194
188
|
async model() {
|
|
195
189
|
const files = this._resolveModel()
|
|
196
190
|
if (!files || files.length === 0) {
|
|
197
|
-
|
|
191
|
+
console.log(`no CDS model found for [${this.task.for}] build task [${this.task.src}] - nothing to be done`)
|
|
198
192
|
return null
|
|
199
193
|
}
|
|
200
|
-
|
|
194
|
+
DEBUG?.(`model: ${relativePaths(cds.root, files).join(", ")}`)
|
|
201
195
|
// $location paths are relative to current working dir by default - make sure a given project root folder is taken
|
|
202
196
|
const options = { ...this.options(), cwd: cds.root }
|
|
203
197
|
|
|
@@ -2,13 +2,13 @@ const fs = require('fs')
|
|
|
2
2
|
const path = require('path')
|
|
3
3
|
const cds = require('../cds'), { _log: log } = cds
|
|
4
4
|
const { sortMessagesSeverityAware, deduplicateMessages, CompilationError } = cds.compiler
|
|
5
|
-
const { relativePaths, BuildError, resolveRequiredSapModels } = require('./util')
|
|
5
|
+
const { relativePaths, BuildError, resolveRequiredSapModels, redactCredentials } = require('./util')
|
|
6
6
|
const { SEVERITIES, LOG_LEVELS } = require('./constants')
|
|
7
7
|
const BuildTaskFactory = require('./buildTaskFactory')
|
|
8
8
|
const InternalBuildPlugin = require('./provider/internalBuildPlugin')
|
|
9
|
-
|
|
10
9
|
const COMPILATION_ERROR = 'CompilationError'
|
|
11
10
|
const COMPILE_MESSAGE = 'CompileMessage'
|
|
11
|
+
const DEBUG = cds.debug('cli|build')
|
|
12
12
|
|
|
13
13
|
class BuildTaskEngine {
|
|
14
14
|
constructor(options) {
|
|
@@ -17,9 +17,6 @@ class BuildTaskEngine {
|
|
|
17
17
|
get taskFactory() {
|
|
18
18
|
return this._taskFactory
|
|
19
19
|
}
|
|
20
|
-
get logger() {
|
|
21
|
-
return this.taskFactory.logger
|
|
22
|
-
}
|
|
23
20
|
get options() {
|
|
24
21
|
return this.taskFactory.options
|
|
25
22
|
}
|
|
@@ -27,8 +24,12 @@ class BuildTaskEngine {
|
|
|
27
24
|
async processTasks(tasks) {
|
|
28
25
|
const startTime = Date.now()
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
console.log(`building project [${cds.root}], clean [${this.options.clean}]`)
|
|
28
|
+
|
|
29
|
+
DEBUG?.("cds configuration settings:")
|
|
30
|
+
DEBUG?.(redactCredentials(cds.env))
|
|
31
|
+
|
|
32
|
+
console.log(`cds-dk [${require('../../package.json').version}], cds [${cds.version}], compiler [${cds.compiler.version()}], home [${cds.home}]\n`)
|
|
32
33
|
|
|
33
34
|
if (!tasks) {
|
|
34
35
|
tasks = await this.taskFactory.getTasks()
|
|
@@ -98,7 +99,7 @@ class BuildTaskEngine {
|
|
|
98
99
|
for (let plugin of pluginGroup) {
|
|
99
100
|
// prepare has been deprecated
|
|
100
101
|
if (plugin instanceof InternalBuildPlugin) {
|
|
101
|
-
|
|
102
|
+
DEBUG?.(`preparing, plugin [${plugin.constructor.name}], src [${relativePaths(cds.root, plugin.task.src)}]`)
|
|
102
103
|
const result = await plugin.prepare()
|
|
103
104
|
if (result === false) {
|
|
104
105
|
break
|
|
@@ -112,12 +113,12 @@ class BuildTaskEngine {
|
|
|
112
113
|
// clean entire build staging folder once
|
|
113
114
|
if (cds.env.build.target !== '.') {
|
|
114
115
|
const target = path.resolve(cds.root, cds.env.build.target)
|
|
115
|
-
|
|
116
|
+
DEBUG?.(`cleaning staging folder ${target}`)
|
|
116
117
|
await fs.promises.rm(target, { force: true, recursive: true })
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
const results = await Promise.allSettled(plugins.map((plugin) => {
|
|
120
|
-
|
|
121
|
+
DEBUG?.(`cleaning, plugin [${plugin.constructor.name}], src [${relativePaths(cds.root, plugin.task.src)}]`)
|
|
121
122
|
return plugin.clean()
|
|
122
123
|
}))
|
|
123
124
|
// check for errors and throw exception
|
|
@@ -155,7 +156,7 @@ class BuildTaskEngine {
|
|
|
155
156
|
let allResults = []
|
|
156
157
|
for (const group of pipeline) {
|
|
157
158
|
const results = await Promise.allSettled(group.map((plugin) => {
|
|
158
|
-
|
|
159
|
+
DEBUG?.(`building, plugin [${plugin.constructor.name}], src [${relativePaths(cds.root, plugin.task.src)}]`)
|
|
159
160
|
return plugin.build()
|
|
160
161
|
.then(pluginResult => {
|
|
161
162
|
return Promise.resolve({
|
|
@@ -220,7 +221,11 @@ class BuildTaskEngine {
|
|
|
220
221
|
const files = BuildTaskEngine._getOutput(plugins)
|
|
221
222
|
if (files.length > 0) {
|
|
222
223
|
const term = require('../util/term')
|
|
223
|
-
|
|
224
|
+
if (!process.env.DEBUG && files.length > 20) {
|
|
225
|
+
files.length = 20
|
|
226
|
+
files.push('...')
|
|
227
|
+
}
|
|
228
|
+
console.log(`done > wrote output to:\n ${term.secondary(files.join("\n "))}\n`)
|
|
224
229
|
}
|
|
225
230
|
}
|
|
226
231
|
|
|
@@ -228,13 +233,13 @@ class BuildTaskEngine {
|
|
|
228
233
|
const outputFile = cds.env.build.outputfile || process.env.GENERATION_LOG
|
|
229
234
|
if (outputFile) {
|
|
230
235
|
const files = BuildTaskEngine._getOutput(plugins)
|
|
231
|
-
|
|
236
|
+
console.log(`writing generation log to [${outputFile}]\n`)
|
|
232
237
|
try {
|
|
233
238
|
await fs.promises.mkdir(path.dirname(outputFile), { recursive: true })
|
|
234
239
|
await fs.promises.writeFile(outputFile, files.join('\n'))
|
|
235
240
|
} catch (error) {
|
|
236
|
-
|
|
237
|
-
|
|
241
|
+
console.error(`failed to write generation log`)
|
|
242
|
+
console.error(error.stack || error)
|
|
238
243
|
}
|
|
239
244
|
}
|
|
240
245
|
}
|
|
@@ -250,18 +255,18 @@ class BuildTaskEngine {
|
|
|
250
255
|
}
|
|
251
256
|
|
|
252
257
|
_logTimer(start, end) {
|
|
253
|
-
|
|
258
|
+
console.log(`build completed in ${end - start} ms\n`)
|
|
254
259
|
}
|
|
255
260
|
|
|
256
261
|
_logTaskHandler(plugin) {
|
|
257
|
-
|
|
258
|
-
|
|
262
|
+
DEBUG?.(`plugin ${plugin.constructor.name}`)
|
|
263
|
+
DEBUG?.(`details src [${relativePaths(cds.root, plugin.task.src)}], dest [${relativePaths(cds.root, plugin.task.dest)}], use [${plugin.task.use}], options [${JSON.stringify(plugin.task.options)}]`)
|
|
259
264
|
}
|
|
260
265
|
|
|
261
266
|
_logMessages(messages) {
|
|
262
267
|
if (messages.length > 0) {
|
|
263
268
|
const options = {
|
|
264
|
-
log:
|
|
269
|
+
log: console.log,
|
|
265
270
|
"log-level": this._getLogLevel() // ensures that for tests the correct cds.env is used
|
|
266
271
|
}
|
|
267
272
|
deduplicateMessages(messages)
|
|
@@ -2,9 +2,10 @@ const fs = require('fs')
|
|
|
2
2
|
const path = require('path')
|
|
3
3
|
const cds = require('../cds')
|
|
4
4
|
const BuildTaskProviderFactory = require('./buildTaskProviderFactory')
|
|
5
|
-
const { hasJavaNature, getProperty,
|
|
5
|
+
const { hasJavaNature, getProperty, flatten, getDefaultModelOptions } = require('./util')
|
|
6
6
|
const { FILE_EXT_CDS, BUILD_TASK_JAVA_CF, BUILD_TASK_JAVA } = require("./constants")
|
|
7
7
|
const term = require('../util/term')
|
|
8
|
+
const DEBUG = cds.debug('cli|build')
|
|
8
9
|
|
|
9
10
|
class BuildTaskFactory {
|
|
10
11
|
constructor(options) {
|
|
@@ -13,9 +14,6 @@ class BuildTaskFactory {
|
|
|
13
14
|
get providerFactory() {
|
|
14
15
|
return this._providerFactory
|
|
15
16
|
}
|
|
16
|
-
get logger() {
|
|
17
|
-
return this.providerFactory.logger
|
|
18
|
-
}
|
|
19
17
|
get options() {
|
|
20
18
|
return this.providerFactory.options
|
|
21
19
|
}
|
|
@@ -33,11 +31,7 @@ class BuildTaskFactory {
|
|
|
33
31
|
tasksOutput += " " + BuildTaskFactory._stringifyTask(tasks[i]) + (i + 1 < tasks.length ? ",\n" : "\n")
|
|
34
32
|
}
|
|
35
33
|
tasksOutput += " ]\n }\n}\n"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// for testing purposes
|
|
39
|
-
this.logger.debug("cds.env used for build:")
|
|
40
|
-
this.logger._debug && this.logger.debug(redactCredentials(cds.env))
|
|
34
|
+
console.log(tasksOutput)
|
|
41
35
|
|
|
42
36
|
// always resolve tasks for input validation
|
|
43
37
|
const resolvedTasks = this.providerFactory.resolveTasks(tasks)
|
|
@@ -52,7 +46,7 @@ class BuildTaskFactory {
|
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
async _createTasks() {
|
|
55
|
-
|
|
49
|
+
DEBUG?.(`determining build tasks for project [${cds.root}].`)
|
|
56
50
|
|
|
57
51
|
// clearing model cache (details https://github.tools.sap/cap/cds/pull/181) is no longer required
|
|
58
52
|
// because of changes https://github.tools.sap/cap/cds/pull/1121
|
|
@@ -118,7 +112,7 @@ class BuildTaskFactory {
|
|
|
118
112
|
|
|
119
113
|
// Java projects use "." as the default build target folder
|
|
120
114
|
if (hasJavaNature([path.join(cds.root, srv), cds.root]) && BuildTaskFactory._adaptBuildTargetSettingForJava()) {
|
|
121
|
-
|
|
115
|
+
DEBUG?.("using inplace build for java project instead of default staging build")
|
|
122
116
|
}
|
|
123
117
|
}
|
|
124
118
|
|
|
@@ -201,31 +195,31 @@ class BuildTaskFactory {
|
|
|
201
195
|
return keys.reduce((acc, key, i) => {
|
|
202
196
|
const prefix = acc !== '{' ? ', ' : (i === 0 ? ' ' : '')
|
|
203
197
|
if (!key.startsWith('_')) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
198
|
+
// render either "for" OR "use" value
|
|
199
|
+
if (key in { src: 1, for: 1 } || (!task.for && key === 'use')) {
|
|
200
|
+
return `${acc}${prefix}${key}: ${term.info(`'${task[key]}'`)}`
|
|
201
|
+
} else if (key === 'options') {
|
|
202
|
+
const options = Object.entries(task.options)
|
|
203
|
+
.map(([key, value]) => {
|
|
204
|
+
if (Array.isArray(value)) {
|
|
205
|
+
return `${key}: [${value.map(v => term.info(`'${v}'`)).join(', ')}]`
|
|
206
|
+
} else if (typeof value === 'object') {
|
|
207
|
+
const nested = Object.entries(value)
|
|
208
|
+
.map(([key, value]) => `${key}: ${term.info(`'${value}'`)}`)
|
|
209
|
+
.join(', ')
|
|
210
|
+
return `${key}: { ${nested} }`
|
|
211
|
+
} else {
|
|
212
|
+
return `${key}: ${term.info(`'${value}'`)}`
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
215
|
.join(', ')
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
})
|
|
221
|
-
.join(', ')
|
|
222
|
-
return `${acc}${prefix}${key}: { ${options} }`
|
|
223
|
-
} else if (key !== 'use') {
|
|
224
|
-
return `${acc}${prefix}${key}: ${term.info(`'${task[key]}'`)}`
|
|
225
|
-
}
|
|
216
|
+
return `${acc}${prefix}${key}: { ${options} }`
|
|
217
|
+
} else if (key !== 'use') {
|
|
218
|
+
return `${acc}${prefix}${key}: ${term.info(`'${task[key]}'`)}`
|
|
219
|
+
}
|
|
226
220
|
}
|
|
227
221
|
return acc
|
|
228
|
-
|
|
222
|
+
}, '{') + '}'
|
|
229
223
|
}
|
|
230
224
|
|
|
231
225
|
static _scanTaskOptionParams(optsParams) {
|