@sap/cds-dk 7.1.1 → 7.3.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 +2 -2
- package/bin/build.js +5 -2
- package/bin/compile/index.js +13 -5
- package/bin/env.js +0 -3
- package/bin/extend.js +25 -3
- package/bin/gen.js +27 -0
- package/bin/help.js +2 -1
- package/bin/import.js +7 -3
- package/bin/push.js +10 -6
- package/bin/watch.js +3 -4
- package/bin/watched.js +2 -3
- package/lib/bind/bindingUtil.js +1 -0
- package/lib/build/{buildTaskHandler.js → buildPlugin.js} +25 -30
- package/lib/build/buildTaskEngine.js +84 -89
- package/lib/build/buildTaskFactory.js +23 -44
- package/lib/build/buildTaskProvider.js +24 -19
- package/lib/build/buildTaskProviderFactory.js +176 -66
- package/lib/build/constants.js +6 -5
- package/lib/build/index.js +4 -3
- package/lib/build/provider/{buildTaskHandlerEdmx.js → edmxBuildPlugin.js} +6 -6
- package/lib/build/provider/{buildTaskHandlerFeatureToggles.js → featureToggleBuildPlugin.js} +3 -3
- package/lib/build/provider/fiori/index.js +5 -6
- package/lib/build/provider/hana/index.js +67 -36
- package/lib/build/provider/{buildTaskHandlerInternal.js → internalBuildPlugin.js} +11 -11
- package/lib/build/provider/{buildTaskProviderInternal.js → internalBuildTaskProvider.js} +42 -53
- package/lib/build/provider/java/index.js +24 -24
- package/lib/build/provider/mtx/index.js +4 -4
- package/lib/build/provider/mtx/resourcesTarBuilder.js +8 -8
- package/lib/build/provider/mtx-extension/index.js +17 -9
- package/lib/build/provider/mtx-sidecar/index.js +17 -11
- package/lib/build/provider/nodejs/index.js +63 -29
- package/lib/build/util.js +11 -19
- package/lib/client/auth_manager.js +6 -12
- package/lib/client/base_command.js +1 -1
- package/lib/client/download_legacy.js +48 -0
- package/lib/client/params.js +5 -0
- package/lib/client/push.js +41 -1
- package/lib/client/settings_manager.js +12 -3
- package/lib/compile/openapi/csdl2openapi.js +30 -21
- package/lib/compile/openapi/index.js +7 -3
- package/lib/env/schema.js +36 -0
- package/lib/env/schemas/cds-rc.json +101 -0
- package/lib/import/common.js +24 -11
- package/lib/import/importapi.js +2 -2
- package/lib/import/message.js +3 -1
- package/lib/import/odata/v4parser.js +23 -7
- package/lib/index.js +5 -0
- package/lib/init/constants.js +9 -12
- package/lib/init/index.js +86 -74
- package/lib/init/template/_merging/registry-mta.js +21 -12
- package/lib/init/template/approuter/files/mta.yaml.hbs +1 -1
- package/lib/init/template/approuter/index.js +3 -2
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +0 -5
- package/lib/init/template/cf-manifest/index.js +2 -2
- package/lib/init/template/connectivity/index.js +5 -4
- package/lib/init/template/destination/index.js +2 -5
- package/lib/init/template/h2/index.js +16 -0
- package/lib/init/template/hana/index.js +2 -3
- package/lib/init/template/helm/chart/values.root.schema.json +0 -5
- package/lib/init/template/helm/chart/values.schema.json +0 -4
- package/lib/init/template/helm/index.js +1 -1
- package/lib/init/template/html5-repo/index.js +27 -3
- package/lib/init/template/lint/index.js +3 -7
- package/lib/init/template/mta/index.js +9 -3
- package/lib/init/template/multitenancy/files/package.json.hbs +0 -3
- package/lib/init/template/multitenancy/index.js +2 -0
- package/lib/init/template/nodejs/index.js +3 -3
- package/lib/init/template/pipeline/index.js +2 -4
- package/lib/init/template/postgres/files/mta.yaml.hbs +27 -0
- package/lib/init/template/postgres/files/package.json.hbs +5 -0
- package/lib/init/template/postgres/index.js +52 -0
- package/lib/init/template/sample/index.js +5 -7
- package/lib/init/template/sqlite/index.js +8 -3
- package/lib/init/template/tiny-sample/index.js +16 -30
- package/lib/init/util/mvn.js +25 -1
- package/lib/init/util/projectReader.js +2 -7
- package/lib/init/util/template.js +7 -6
- package/lib/util/pruneAxiosErrors.js +22 -8
- package/lib/watch/node-watch.js +6 -1
- package/npm-shrinkwrap.json +2207 -384
- package/package.json +3 -3
- package/lib/init/template/auditlog/files/mta.yaml.hbs +0 -14
- package/lib/init/template/auditlog/files/package.json.hbs +0 -27
- package/lib/init/template/auditlog/index.js +0 -74
package/bin/activate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = Object.assign(activate, {
|
|
2
2
|
options: ['--subdomain', '--passcode', '--username', '--clientid', '--to', '--sync'],
|
|
3
3
|
flags: ['--undeploy', '--wsdl'],
|
|
4
|
-
shortcuts: ['-s', '-p', '-u', '-c'],
|
|
4
|
+
shortcuts: ['-s', '-p', '-u', '-c', '-2'],
|
|
5
5
|
help: `
|
|
6
6
|
# SYNOPSIS
|
|
7
7
|
|
|
@@ -55,7 +55,7 @@ module.exports = Object.assign(activate, {
|
|
|
55
55
|
|
|
56
56
|
*cds push* to push an extension to a SaaS app based on current MTX Services
|
|
57
57
|
(@sap/cds-mtxs).
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
https://cap.cloud.sap/docs/guides/multitenancy/mtxs for information on
|
|
60
60
|
@sap/cds-mtxs.
|
|
61
61
|
|
package/bin/build.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module.exports = Object.assign(build, {
|
|
2
|
-
options: ['--project', '--src', '--dest', '--for', '--use', '--opts', '--log-level', '--options-model'
|
|
2
|
+
options: ['--project', '--src', '--dest', '--for', '--use', '--opts', '--log-level', '--options-model'],
|
|
3
3
|
shortcuts: ['-in', '-s', '-o', '-4'],
|
|
4
|
+
flags: ['--ws', '--clean'],
|
|
4
5
|
help: `
|
|
5
6
|
# SYNOPSIS
|
|
6
7
|
|
|
@@ -88,11 +89,13 @@ module.exports = Object.assign(build, {
|
|
|
88
89
|
async function build([project], options = {}) {
|
|
89
90
|
const path = require('path')
|
|
90
91
|
const cds = require('../lib/cds')
|
|
92
|
+
|
|
93
|
+
// plugins are loaded based on cds.root path
|
|
94
|
+
cds.root = path.resolve(process.cwd(), project || options.project || '.')
|
|
91
95
|
|
|
92
96
|
// IMPORTANT: call plugins before subsequent access to cds.env
|
|
93
97
|
await cds.plugins
|
|
94
98
|
|
|
95
|
-
cds.root = path.resolve(process.cwd(), project || options.project || '.')
|
|
96
99
|
cds.env = cds.env.for('cds', cds.root);
|
|
97
100
|
delete options.project // avoid that relative project paths are resolved twice
|
|
98
101
|
|
package/bin/compile/index.js
CHANGED
|
@@ -2,7 +2,7 @@ const path = require("path");
|
|
|
2
2
|
|
|
3
3
|
module.exports = Object.assign ( compile, {
|
|
4
4
|
options: [
|
|
5
|
-
'--from', '--service', '--lang', '--for', '--to', '--dest', '--log-level', '--flavor', '--dialect', '--sql-dialect', '--openapi:url', '--openapi:servers'
|
|
5
|
+
'--from', '--service', '--lang', '--for', '--to', '--dest', '--log-level', '--flavor', '--dialect', '--sql-dialect', '--openapi:url', '--openapi:servers', '--odata-version'
|
|
6
6
|
],
|
|
7
7
|
shortcuts: [
|
|
8
8
|
undefined, '-s', '-l', '-4', '-2', '-o', undefined, '-f'
|
|
@@ -114,6 +114,10 @@ module.exports = Object.assign ( compile, {
|
|
|
114
114
|
The servers definition used in the generated OpenAPI document. *--openapi:url* is
|
|
115
115
|
ignored when this option is specified.
|
|
116
116
|
|
|
117
|
+
*--odata-version* 4.0|4.01
|
|
118
|
+
|
|
119
|
+
Adds the OData version's functionality of the input CDS/CSN file to the generated OpenAPI document.
|
|
120
|
+
|
|
117
121
|
*--openapi:diagram*
|
|
118
122
|
|
|
119
123
|
Include YUML diagram in the generated OpenAPI document, default: *false*.
|
|
@@ -122,7 +126,7 @@ module.exports = Object.assign ( compile, {
|
|
|
122
126
|
|
|
123
127
|
A single AsyncAPI document is generated using the details of all input services. Information of _title_
|
|
124
128
|
and _version_ should be provided as preset.
|
|
125
|
-
|
|
129
|
+
|
|
126
130
|
# EXAMPLES
|
|
127
131
|
|
|
128
132
|
*cds* compile model.cds
|
|
@@ -132,11 +136,13 @@ module.exports = Object.assign ( compile, {
|
|
|
132
136
|
|
|
133
137
|
`})
|
|
134
138
|
|
|
135
|
-
function compile_all (root='.') {
|
|
139
|
+
async function compile_all (root='.') {
|
|
136
140
|
|
|
137
141
|
const {exec} = require ('child_process')
|
|
138
142
|
const cds = require('../../lib') // get the enhanced cds w/ additional compile processors
|
|
139
143
|
|
|
144
|
+
await cds.plugins // ensure plugins that extend compile targets are loaded
|
|
145
|
+
|
|
140
146
|
exec(`find ${root} -name *.cds ! -path '*/node_modules/*'`, (_,stdout)=>{
|
|
141
147
|
const all = stdout.split('\n').slice(0,-1)
|
|
142
148
|
const info = `\n/ compiled ${all.length} cds models in`
|
|
@@ -152,13 +158,15 @@ function compile_all (root='.') {
|
|
|
152
158
|
|
|
153
159
|
}
|
|
154
160
|
|
|
155
|
-
function compile (models, options={}) {
|
|
161
|
+
async function compile (models, options={}) {
|
|
156
162
|
|
|
157
163
|
if (options.all) return compile_all (models[0])
|
|
158
164
|
|
|
159
165
|
const { inspect } = require('util')
|
|
160
166
|
const cds = require('../../lib') // get the enhanced cds w/ additional compile processors
|
|
161
167
|
|
|
168
|
+
await cds.plugins // ensure plugins that extend compile targets are loaded
|
|
169
|
+
|
|
162
170
|
let model, src, _suffix; //> be filled in below
|
|
163
171
|
if (!options.as && !/,/.test(options.to)) options.as = 'str'
|
|
164
172
|
if (options.beta) options.betaMode = true
|
|
@@ -274,7 +282,7 @@ function compile (models, options={}) {
|
|
|
274
282
|
return console.log (o)
|
|
275
283
|
}
|
|
276
284
|
|
|
277
|
-
function suffix4 (x) { return x && ({
|
|
285
|
+
function suffix4 (x) { return x && x !== 'hdbtable' && ({
|
|
278
286
|
edmx: '.xml',
|
|
279
287
|
"edmx-v2": '.xml',
|
|
280
288
|
"edmx-v4": '.xml',
|
package/bin/env.js
CHANGED
|
@@ -62,9 +62,6 @@ async function env ([cmd, key, value], options={}) {
|
|
|
62
62
|
commands[cmd] || ((key = cmd), commands.get)
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
// Ensure loading plugins before calling cds.env!
|
|
66
|
-
await cds.plugins
|
|
67
|
-
|
|
68
65
|
let env = cds.env
|
|
69
66
|
if (options["resolve-bindings"]) {
|
|
70
67
|
const BindingManager = require('../lib/bind/bindingManager')
|
package/bin/extend.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = Object.assign(extend, {
|
|
2
|
-
options: ['--directory', '--subdomain', '--passcode', '--username', '--clientid'],
|
|
3
|
-
flags: ['--wsdl', '--templates', '--force'],
|
|
2
|
+
options: ['--directory', '--subdomain', '--passcode', '--username', '--clientid', '--tagRule'],
|
|
3
|
+
flags: ['--wsdl', '--templates', '--force', '--download-migrated-projects'],
|
|
4
4
|
shortcuts: ['-d', '-s', '-p', '-u', '-c'],
|
|
5
5
|
help: `
|
|
6
6
|
# SYNOPSIS
|
|
@@ -50,13 +50,21 @@ module.exports = Object.assign(extend, {
|
|
|
50
50
|
Download only the templates provided by the SaaS application you want to
|
|
51
51
|
extend.
|
|
52
52
|
|
|
53
|
+
*--download-migrated-projects*
|
|
54
|
+
|
|
55
|
+
To be used only after change to @sap/cds-mtxs. Allows to download migrated extension projects.
|
|
56
|
+
|
|
57
|
+
*--tagRule*
|
|
58
|
+
|
|
59
|
+
Rule used to split up migrated extension projects into separate projects (please check migration documentation for more).
|
|
60
|
+
|
|
53
61
|
# SEE ALSO
|
|
54
62
|
|
|
55
63
|
*cds activate* to activate an extension project.
|
|
56
64
|
|
|
57
65
|
*cds pull* to get the CDS model of a SaaS app based on current MTX Services
|
|
58
66
|
(@sap/cds-mtxs).
|
|
59
|
-
|
|
67
|
+
|
|
60
68
|
https://cap.cloud.sap/docs/guides/multitenancy/mtxs for information on
|
|
61
69
|
@sap/cds-mtxs.
|
|
62
70
|
|
|
@@ -64,6 +72,20 @@ module.exports = Object.assign(extend, {
|
|
|
64
72
|
|
|
65
73
|
|
|
66
74
|
async function extend ([url], options = {}) {
|
|
75
|
+
|
|
76
|
+
if (options['download-migrated-projects']) {
|
|
77
|
+
const [username, password] = options.username?.split(':') ?? [];
|
|
78
|
+
delete options.user;
|
|
79
|
+
|
|
80
|
+
await require('../lib/client/download_legacy').run({
|
|
81
|
+
...options,
|
|
82
|
+
url,
|
|
83
|
+
username,
|
|
84
|
+
password
|
|
85
|
+
});
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
67
89
|
if (options.force) {
|
|
68
90
|
if (! await require('../lib/client/helper/question').askBooleanQuestion('Using option --force will overwrite existing files. Continue (yN)? ', false, false)) {
|
|
69
91
|
console.log('Extend cancelled')
|
package/bin/gen.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { join } = require('path')
|
|
2
|
+
const DEBUG = /\b(y|all|cli)\b/.test(process.env.DEBUG) ? console.debug : undefined
|
|
3
|
+
|
|
4
|
+
module.exports = require(global('@sap/cds-gen', 'bin/cds-gen'))
|
|
5
|
+
|
|
6
|
+
function global (id, subpath) {
|
|
7
|
+
const pkgPath = join(id, 'package.json') // package.json gives a stable entry path
|
|
8
|
+
let mod
|
|
9
|
+
try {
|
|
10
|
+
mod = require.resolve (pkgPath, { paths: [ process.cwd(), __dirname ] })
|
|
11
|
+
} catch (err) { // one more try w/ NPM global paths
|
|
12
|
+
const paths = [ process.cwd(), __dirname, npmGlobalModules() ]
|
|
13
|
+
try {
|
|
14
|
+
mod = require.resolve (pkgPath, { paths })
|
|
15
|
+
} catch (error) {
|
|
16
|
+
DEBUG?.(error)
|
|
17
|
+
throw `\nNo '${id}' package found. Install it with\n\n npm i -g ${id}\n`
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return join(mod, '..', subpath)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function npmGlobalModules() {
|
|
24
|
+
try {
|
|
25
|
+
return require ('child_process').execSync('npm root -g').toString().trim()
|
|
26
|
+
} catch (err) { DEBUG?.(err); return '' }
|
|
27
|
+
}
|
package/bin/help.js
CHANGED
|
@@ -10,6 +10,7 @@ module.exports = exports = Object.assign (help, {formatHelp, help:`
|
|
|
10
10
|
|
|
11
11
|
*i* | *init* jump-start cds-based projects
|
|
12
12
|
*a* | *add* add a feature to an existing project
|
|
13
|
+
* * | *gen* generate models/data using a descriptive prompt [beta]
|
|
13
14
|
*y* | *bind* bind application to remote services
|
|
14
15
|
*m* | *import* add models from external sources
|
|
15
16
|
*c* | *compile* compile cds models to different outputs
|
|
@@ -27,7 +28,7 @@ module.exports = exports = Object.assign (help, {formatHelp, help:`
|
|
|
27
28
|
* * | *logout* logout from extensible multitenant SaaS app
|
|
28
29
|
* * | *pull* pull base model of extensible SaaS app
|
|
29
30
|
* * | *push* push extension to extensible SaaS app
|
|
30
|
-
*t* | *lint*
|
|
31
|
+
*t* | *lint* run linter for env or model checks [beta]
|
|
31
32
|
*v* | *version* get detailed version information
|
|
32
33
|
*?* | *help* get detailed usage information
|
|
33
34
|
|
package/bin/import.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module.exports = Object.assign(_import, {
|
|
2
2
|
_name: 'import',
|
|
3
|
-
options: ['--out', '--as', '--include-namespaces', '--from'],
|
|
3
|
+
options: ['--out', '--as', '--include-namespaces', '--from', '--config'],
|
|
4
4
|
flags: ['--dry', '--force', '--no-copy', '--no-save', '--keep-namespace'],
|
|
5
|
-
shortcuts: ['-o', '-as', '-ns', undefined, '-', '-f'],
|
|
5
|
+
shortcuts: ['-o', '-as', '-ns', undefined, '-c', '-', '-f'],
|
|
6
6
|
help: `
|
|
7
7
|
# SYNOPSIS
|
|
8
8
|
|
|
@@ -43,6 +43,9 @@ module.exports = Object.assign(_import, {
|
|
|
43
43
|
*--from*
|
|
44
44
|
Imports the model from the one of the given options "edmx", "openapi" or
|
|
45
45
|
"asyncapi".
|
|
46
|
+
|
|
47
|
+
*-c | --config* <JSON Object>
|
|
48
|
+
Adds the provided JSON Object as custom configuration data to the package.json.
|
|
46
49
|
|
|
47
50
|
*Below options are valid for OData only*
|
|
48
51
|
|
|
@@ -68,6 +71,7 @@ module.exports = Object.assign(_import, {
|
|
|
68
71
|
cds import ~/Downloads/Petstore_OpenAPI.json --from openapi
|
|
69
72
|
cds import ~/Downloads/BookStore_AsyncAPI.json
|
|
70
73
|
cds import ~/Downloads/BookStore_AsyncAPI.json --from asyncapi
|
|
74
|
+
cds import ~/Downloads/API_BUSINESS_PARTNER.edmx -c {\\"[production]\\":{\\"credentials\\":{\\"destination\\":\\"UI3_noauth\\",\\"path\\":\\"/sap/cap/odata\\"}}}
|
|
71
75
|
|
|
72
76
|
`})
|
|
73
77
|
const messages = require('../lib/import/message').getMessages();
|
|
@@ -95,7 +99,7 @@ async function _import(file, options = {}) {
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
// reads the file version
|
|
98
|
-
options.
|
|
102
|
+
options.inputFileKind = apiOptions.odataVersion ? apiOptions.odataVersion : apiOptions.inputFileKind;
|
|
99
103
|
|
|
100
104
|
// postprocess
|
|
101
105
|
return await common.postProcess(destFilePath, options, csn, cwd);
|
package/bin/push.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = Object.assign(push, {
|
|
2
|
-
options: ['--subdomain', '--passcode', '--user', '--client', '--to'],
|
|
2
|
+
options: ['--subdomain', '--passcode', '--user', '--client', '--to', '--sync'],
|
|
3
3
|
flags: [],
|
|
4
|
-
shortcuts: ['-s', '-p', '-u', '-c'],
|
|
4
|
+
shortcuts: ['-s', '-p', '-u', '-c', '-2'],
|
|
5
5
|
help: `
|
|
6
6
|
# SYNOPSIS
|
|
7
7
|
|
|
@@ -13,9 +13,9 @@ module.exports = Object.assign(push, {
|
|
|
13
13
|
a local file or as a URL to download it from.
|
|
14
14
|
A download URL may contain Basic-Auth credentials as in
|
|
15
15
|
'https://user:pass@host'.
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
By default, the current working directory is used as project directory.
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
Unless a custom archive is given, the extension project will be
|
|
20
20
|
automatically built in order to update the generated extension archive. This
|
|
21
21
|
ensures the most recent extension model is pushed.
|
|
@@ -48,13 +48,17 @@ module.exports = Object.assign(push, {
|
|
|
48
48
|
|
|
49
49
|
Client ID and optionally Client Secret for authentication.
|
|
50
50
|
|
|
51
|
+
*--sync*
|
|
52
|
+
|
|
53
|
+
Use the synchronous server API to upload extensions.
|
|
54
|
+
|
|
51
55
|
|
|
52
56
|
# SEE ALSO
|
|
53
57
|
|
|
54
58
|
*cds pull* to get the CDS model of the SaaS app.
|
|
55
|
-
|
|
59
|
+
|
|
56
60
|
*cds login* for more information on authentication options.
|
|
57
|
-
|
|
61
|
+
|
|
58
62
|
*cds login* to save project settings and authentication data, simplifying
|
|
59
63
|
multiple runs of this command.
|
|
60
64
|
|
package/bin/watch.js
CHANGED
|
@@ -60,7 +60,7 @@ const t = module.exports.codes = {
|
|
|
60
60
|
}
|
|
61
61
|
const extDefaults = 'cds,csn,csv,ts,mjs,cjs,js,json,properties,edmx,xml,env'
|
|
62
62
|
const fioriIncludes = /_?(change|variant)$/ // according to fiori: change,variant,ctrl_variant,ctrl_variant_change,ctrl_variant_management_change.
|
|
63
|
-
|
|
63
|
+
const ignore = RegExp(`(node_modules\\${sep}|app(\\${sep}.+)?\\${sep}((webapp|dist|target)\\${sep}|\\.cds-services\\.json$|tsconfig\\.json$|.*\\.tsbuildinfo$))`)
|
|
64
64
|
|
|
65
65
|
async function watch ([cwd], {
|
|
66
66
|
args = ['serve', 'all'],
|
|
@@ -99,8 +99,6 @@ async function watch ([cwd], {
|
|
|
99
99
|
env.CDS_LIVERELOAD_PATH = require.resolve ('../lib/watch/livereload-connect')
|
|
100
100
|
env.CDS_LIVERELOAD_URL = await liveReload.start (options['livereload'])
|
|
101
101
|
.catch(err => { console.log(`Error starting live reload: ${err.message}`); liveReload = null })
|
|
102
|
-
} else {
|
|
103
|
-
ignore = RegExp(`app${sep}.*\\.(js|ts)|`+ignore.source) // exclude more frontend stuff
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
const log = (first,...more) => console.log (t.yellow + (first||''), ...more, t.reset)
|
|
@@ -115,7 +113,8 @@ async function watch ([cwd], {
|
|
|
115
113
|
log ()
|
|
116
114
|
log (`${t.bold}cds ${args.join(' ')}`)
|
|
117
115
|
DEBUG && log (process.pid, 'watching:', ext, '...')
|
|
118
|
-
|
|
116
|
+
includes && DEBUG && log (`also watching: ${includes.source}`)
|
|
117
|
+
DEBUG && log ('ignoring:', ignore.source)
|
|
119
118
|
if (liveReload) log (`live reload enabled for browsers`)
|
|
120
119
|
|
|
121
120
|
const BindingManager = require('../lib/bind/bindingManager')
|
package/bin/watched.js
CHANGED
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
case 'NO_SERVICES_FOUND': return _no_services_found(e)
|
|
22
22
|
case 'MODEL_NOT_FOUND': return _no_models_found(e)
|
|
23
23
|
case 'EADDRINUSE': return process.send(e) //> tell cds watch
|
|
24
|
-
default: if (
|
|
25
|
-
|
|
26
|
-
}
|
|
24
|
+
default: if (e.messages?.length) return cds._log(e.messages, { 'log-level': cds.env.log.levels.cli }) // REVISIT: no special handling for compiler messages
|
|
25
|
+
else console.error('\n❗️ ERROR on server start: ❗️\n\n', e)
|
|
27
26
|
}}
|
|
28
27
|
|
|
29
28
|
function _no_models_found(e) { console.log (`
|
package/lib/bind/bindingUtil.js
CHANGED
|
@@ -2,13 +2,13 @@ const path = require('path')
|
|
|
2
2
|
const fs = require('fs').promises
|
|
3
3
|
const cds = require('../cds')
|
|
4
4
|
|
|
5
|
-
const { OUTPUT_MODE, OUTPUT_MODE_FILESYSTEM, SEVERITY_INFO, SEVERITY_WARNING, SEVERITY_ERROR
|
|
6
|
-
const { hasOptionValue, getProperty, relativePaths,
|
|
5
|
+
const { OUTPUT_MODE, OUTPUT_MODE_FILESYSTEM, SEVERITY_INFO, SEVERITY_WARNING, SEVERITY_ERROR } = require('./constants')
|
|
6
|
+
const { hasOptionValue, getProperty, relativePaths, BuildMessage } = require('./util')
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* The build
|
|
10
|
-
* by the build task's <code>use</code>
|
|
11
|
-
* of the build
|
|
9
|
+
* The build plugin creates the build output for a dedicated build task. It is uniquely identified
|
|
10
|
+
* by the build task's <code>for</code> or <code>use</code>property. The <code>use</code> property represents
|
|
11
|
+
* the fully qualified node module path of the build plugin implementation.
|
|
12
12
|
* <p>
|
|
13
13
|
* The build task engine defines the following protocol. The methods are invoked in descending order:
|
|
14
14
|
* <ul>
|
|
@@ -19,14 +19,11 @@ const { hasOptionValue, getProperty, relativePaths, copy, BuildMessage } = requi
|
|
|
19
19
|
* </ul>
|
|
20
20
|
* The reflected CSN can be accessed using the async method <code>model()</code>.
|
|
21
21
|
*/
|
|
22
|
-
class
|
|
22
|
+
class BuildPlugin {
|
|
23
23
|
/**
|
|
24
|
-
* @
|
|
24
|
+
* @constructor
|
|
25
25
|
*/
|
|
26
26
|
constructor() {
|
|
27
|
-
if (new.target === BuildTaskHandler) {
|
|
28
|
-
throw new TypeError("Cannot construct BuildTaskHandler instances directly");
|
|
29
|
-
}
|
|
30
27
|
this._written = new Set()
|
|
31
28
|
this._messages = []
|
|
32
29
|
}
|
|
@@ -47,7 +44,7 @@ class BuildTaskHandler {
|
|
|
47
44
|
return this._context
|
|
48
45
|
}
|
|
49
46
|
/**
|
|
50
|
-
* Returns the build task executed by this build
|
|
47
|
+
* Returns the build task executed by this build plugin.
|
|
51
48
|
* @return {object}
|
|
52
49
|
*/
|
|
53
50
|
get task() {
|
|
@@ -56,7 +53,8 @@ class BuildTaskHandler {
|
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
/**
|
|
59
|
-
* Returns
|
|
56
|
+
* Returns a list of build and compiler messages created by this build plugin.
|
|
57
|
+
* Supported message severities are 'Info', 'Warning', and 'Error'.
|
|
60
58
|
* @return {Array}
|
|
61
59
|
*/
|
|
62
60
|
get messages() {
|
|
@@ -64,7 +62,7 @@ class BuildTaskHandler {
|
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
/**
|
|
67
|
-
* Returns the list of files written by this build
|
|
65
|
+
* Returns the list of files written by this build plugin.
|
|
68
66
|
* @return {Array}
|
|
69
67
|
*/
|
|
70
68
|
get files() {
|
|
@@ -72,14 +70,14 @@ class BuildTaskHandler {
|
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
/**
|
|
75
|
-
* Returns the priority of this
|
|
73
|
+
* Returns the priority of this plugin as number, where 0 represents the minimum value and
|
|
76
74
|
* Number.MAX_SAFE_INTEGER the maximum value.
|
|
77
|
-
* Positive numbers mean higher and negative numbers lower priority. Build
|
|
78
|
-
* with higher priority value are executed before
|
|
75
|
+
* Positive numbers mean higher and negative numbers lower priority. Build plugins
|
|
76
|
+
* with higher priority value are executed before plugins with lower priority.
|
|
79
77
|
* <br>
|
|
80
|
-
* Note: Currently not supported for custom build
|
|
81
|
-
* before the built-in
|
|
82
|
-
* @return {number} the priority for this
|
|
78
|
+
* Note: Currently not supported for custom build plugins as they are always executed
|
|
79
|
+
* before the built-in plugins.
|
|
80
|
+
* @return {number} the priority for this plugin as integer.
|
|
83
81
|
*/
|
|
84
82
|
get priority() {
|
|
85
83
|
return 1
|
|
@@ -91,26 +89,26 @@ class BuildTaskHandler {
|
|
|
91
89
|
init() { }
|
|
92
90
|
|
|
93
91
|
/**
|
|
94
|
-
*
|
|
92
|
+
* @abstract
|
|
93
|
+
* Called by the framework to create the artifacts of this build plugin.
|
|
95
94
|
*/
|
|
96
95
|
async build() {
|
|
97
|
-
throw new TypeError(OVERRIDE_METHOD_MSG)
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
/**
|
|
101
|
-
*
|
|
99
|
+
* @abstract
|
|
100
|
+
* Called by the framework immediately before 'build' to delete any output created by this build plugin.
|
|
102
101
|
* <p>
|
|
103
102
|
* Note: The <code>BuildTaskEngine</code> is cleaning the common generation target folder if the build is
|
|
104
103
|
* executed in staging mode, e.g. build.target: "gen".
|
|
105
104
|
*/
|
|
106
105
|
async clean() {
|
|
107
|
-
throw new TypeError(OVERRIDE_METHOD_MSG)
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
/**
|
|
111
109
|
* Asynchronously write the given content to a given file path.
|
|
112
110
|
* If the file exists the content is replaced. If the file does not exist, a new file will be created.
|
|
113
|
-
* The file name is stored in the list of files written by this build
|
|
111
|
+
* The file name is stored in the list of files written by this build plugin.
|
|
114
112
|
* @param {string} dest - absolute or relative file path. Relative paths will be resolved to this task's destination path.
|
|
115
113
|
* @param {any} data - If data is of type object the JSON-stringified version is written.
|
|
116
114
|
*/
|
|
@@ -135,7 +133,7 @@ class BuildTaskHandler {
|
|
|
135
133
|
* Copy a file or directory if the build task option 'outputMode' does not have the value 'resultOnly'.
|
|
136
134
|
* The directory can have contents.
|
|
137
135
|
* <p>
|
|
138
|
-
* Note: The file name is stored in the list of files written by this build
|
|
136
|
+
* Note: The file name is stored in the list of files written by this build plugin.
|
|
139
137
|
* </p>
|
|
140
138
|
* @param {string} src The absolute or relative source path of the file or directory to copy.
|
|
141
139
|
* Relative paths will be resolved to this task's source path.
|
|
@@ -155,10 +153,7 @@ class BuildTaskHandler {
|
|
|
155
153
|
dest = path.resolve(this.task.dest, dest)
|
|
156
154
|
}
|
|
157
155
|
this.pushFile(dest)
|
|
158
|
-
|
|
159
|
-
return fs.cp(src, dest, { recursive: true })
|
|
160
|
-
}
|
|
161
|
-
return copy(src, dest)
|
|
156
|
+
return fs.cp(src, dest, { recursive: true })
|
|
162
157
|
}
|
|
163
158
|
return dest
|
|
164
159
|
}
|
|
@@ -234,4 +229,4 @@ class BuildTaskHandler {
|
|
|
234
229
|
return value
|
|
235
230
|
}
|
|
236
231
|
}
|
|
237
|
-
module.exports =
|
|
232
|
+
module.exports = BuildPlugin
|