@sap/cds-dk 7.0.0 → 7.0.2
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/add.js +34 -38
- package/bin/build.js +4 -0
- package/bin/cds.js +13 -8
- package/bin/compile/index.js +3 -3
- package/bin/env.js +4 -1
- package/bin/help.js +2 -3
- package/lib/bind/bindingManager.js +1 -1
- package/lib/bind/bindingResolver.js +1 -1
- package/lib/bind/bindingUtil.js +1 -1
- package/lib/build/buildTaskEngine.js +1 -1
- package/lib/build/provider/buildTaskHandlerFeatureToggles.js +2 -1
- package/lib/build/provider/buildTaskHandlerInternal.js +1 -1
- package/lib/build/provider/java/index.js +2 -2
- package/lib/build/provider/mtx-sidecar/index.js +3 -4
- package/lib/build/provider/nodejs/index.js +6 -5
- package/lib/build/util.js +8 -0
- package/lib/cds.js +2 -2
- package/lib/import/asyncapi/parserContext.js +2 -2
- package/lib/index.js +6 -0
- package/lib/init/constants.js +4 -4
- package/lib/init/index.js +37 -38
- package/lib/init/template/_merging/registry-mta.js +2 -2
- package/lib/init/template/approuter/index.js +12 -8
- package/lib/init/template/auditlog/index.js +7 -7
- package/lib/init/template/cf-manifest/index.js +5 -5
- package/lib/init/template/connectivity/index.js +7 -7
- package/lib/init/template/data/index.js +1 -1
- package/lib/init/template/destination/index.js +6 -6
- package/lib/init/template/enterprise-messaging/index.js +10 -10
- package/lib/init/template/enterprise-messaging-shared/index.js +8 -8
- package/lib/init/template/extensibility/index.js +6 -6
- package/lib/init/template/file-based-messaging/index.js +4 -4
- package/lib/init/template/hana/index.js +11 -11
- package/lib/init/template/helm/index.js +5 -5
- package/lib/init/template/html5-repo/index.js +2 -2
- package/lib/init/template/java/index.js +20 -37
- package/lib/init/template/kibana/files/mta.yaml.hbs +29 -0
- package/lib/init/template/kibana/index.js +55 -0
- package/lib/init/template/multitenancy/files/package.json.hbs +0 -3
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +18 -12
- package/lib/init/template/nodejs/files/package.json.hbs +1 -1
- package/lib/init/template/nodejs/index.js +12 -19
- package/lib/init/template/pipeline/index.js +1 -1
- package/lib/init/template/redis-messaging/index.js +7 -7
- package/lib/init/template/sample/files/app/_i18n/i18n.properties +3 -32
- package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +2 -2
- package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +6 -7
- package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +3 -3
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +3 -11
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +117 -113
- package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +38 -0
- package/lib/init/template/sample/files/app/browse/fiori-service.cds +56 -0
- package/lib/init/template/sample/files/app/browse/webapp/Component.js +7 -0
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +4 -0
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +139 -0
- package/lib/init/template/sample/files/app/common.cds +78 -81
- package/lib/init/template/sample/files/app/services.cds +1 -0
- package/lib/init/template/samples/index.js +3 -3
- package/lib/init/template/sqlite/files/package.json.hbs +1 -21
- package/lib/init/template/sqlite/index.js +4 -4
- package/lib/init/template/templateBase.js +1 -1
- package/lib/init/template/{sample-tiny → tiny-sample}/files/nodejs/db/data-model.cds +1 -1
- package/lib/init/template/{sample-tiny → tiny-sample}/files/nodejs/srv/cat-service.cds.hbs +1 -1
- package/lib/init/template/{sample-tiny → tiny-sample}/index.js +2 -2
- package/lib/init/template/toggles/index.js +3 -3
- package/lib/init/template/typer/index.js +6 -5
- package/lib/init/template/xsuaa/index.js +9 -9
- package/lib/init/util/md5.js +2 -2
- package/lib/init/util/merge.js +9 -9
- package/lib/init/util/mvn.js +1 -1
- package/lib/init/util/projectReader.js +4 -4
- package/lib/util/fs.js +10 -10
- package/lib/util/term.js +2 -0
- package/npm-shrinkwrap.json +281 -334
- package/package.json +1 -1
- package/lib/init/template/kibana-logging/files/cds.package.json +0 -7
- package/lib/init/template/kibana-logging/files/mta.yaml.hbs +0 -14
- package/lib/init/template/kibana-logging/index.js +0 -45
- /package/lib/init/template/{kibana-logging → kibana}/files/package.json.hbs +0 -0
- /package/lib/init/template/{sample-tiny → tiny-sample}/files/nodejs/db/data/my.bookshop-Books.csv +0 -0
package/lib/init/index.js
CHANGED
|
@@ -87,20 +87,20 @@ module.exports = class CDSGenerator {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* @param {string}
|
|
90
|
+
* @param {string} facets, comma separated list of templates, no blanks
|
|
91
91
|
* @param {any} options, additional options
|
|
92
92
|
*/
|
|
93
|
-
async addCmd(
|
|
93
|
+
async addCmd(facets, options = {}) {
|
|
94
94
|
options._cmd = COMMAND_ADD;
|
|
95
|
-
options.add =
|
|
95
|
+
options.add = facets;
|
|
96
96
|
|
|
97
|
-
if (!
|
|
97
|
+
if (!facets) throw 'You must specify a facet to add to the project.'
|
|
98
98
|
|
|
99
99
|
this._initialize(null, options);
|
|
100
100
|
this._greetings(options._cmd);
|
|
101
101
|
|
|
102
102
|
if (!PROJECT_FILES.find(exists)) {
|
|
103
|
-
throw
|
|
103
|
+
throw `The current folder doesn't seem to contain a project. None of the following files found: ${PROJECT_FILES.join(', ')}.`
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
await this._process(options);
|
|
@@ -139,24 +139,19 @@ module.exports = class CDSGenerator {
|
|
|
139
139
|
this._cleanupOptions();
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
_greetings(
|
|
143
|
-
switch (
|
|
142
|
+
_greetings() {
|
|
143
|
+
switch (cds.cli.command) {
|
|
144
144
|
case COMMAND_INIT: {
|
|
145
145
|
const relativeProjectPath = path.relative(this.cwd, cds.root);
|
|
146
146
|
const folderName = (relativeProjectPath ? `.${path.sep}${relativeProjectPath}` : 'current folder');
|
|
147
|
-
LOG.info(`Creating new
|
|
147
|
+
LOG.info(`Creating new CAP project in ${term.bold(folderName)}\n`);
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
|
-
case COMMAND_ADD:
|
|
151
|
-
LOG.info(`Adding feature(s) to project in current folder`);
|
|
152
|
-
break;
|
|
153
150
|
}
|
|
154
151
|
|
|
155
152
|
if (this.options.force) {
|
|
156
|
-
LOG.info(`Using '--force' ... existing files will be overwritten
|
|
153
|
+
LOG.info(`Using '--force' ... existing files will be overwritten`);
|
|
157
154
|
}
|
|
158
|
-
|
|
159
|
-
LOG.info();
|
|
160
155
|
}
|
|
161
156
|
|
|
162
157
|
async _process() {
|
|
@@ -172,11 +167,16 @@ module.exports = class CDSGenerator {
|
|
|
172
167
|
await template.runRelatedMerging();
|
|
173
168
|
}
|
|
174
169
|
|
|
175
|
-
|
|
176
|
-
|
|
170
|
+
if (cds.cli.command === COMMAND_INIT) {
|
|
171
|
+
const relativeProjectPath = path.relative(this.cwd, cds.root)
|
|
172
|
+
LOG.info(`\nSuccessfully created project. Continue with '${term.bold('cd '+relativeProjectPath)}'.\n`)
|
|
173
|
+
} else {
|
|
174
|
+
LOG.info(`\nSuccessfully added features to your project.`)
|
|
175
|
+
}
|
|
177
176
|
}
|
|
178
177
|
|
|
179
178
|
async _createTemplate(filename) {
|
|
179
|
+
|
|
180
180
|
try {
|
|
181
181
|
const TemplateClass = require(`./template/${filename}`);
|
|
182
182
|
return new TemplateClass(this);
|
|
@@ -200,26 +200,28 @@ module.exports = class CDSGenerator {
|
|
|
200
200
|
|
|
201
201
|
async _fillTemplateList() {
|
|
202
202
|
const templates = new Map();
|
|
203
|
-
for (
|
|
203
|
+
for (let option of this.options.add) {
|
|
204
|
+
// Compat
|
|
205
|
+
if (option === 'sample-tiny') option = 'tiny-sample'
|
|
206
|
+
if (option === 'kibana-logging') option = 'kibana'
|
|
207
|
+
|
|
204
208
|
if (!templates.has(option)) {
|
|
205
209
|
const template = await this._createTemplate(option);
|
|
206
|
-
|
|
207
210
|
if (await template.canRun()) {
|
|
208
211
|
DEBUG?.(`Adding feature '${template.name}'`);
|
|
209
|
-
|
|
210
212
|
templates.set(option, template);
|
|
211
213
|
const deps = await template.getDependencies();
|
|
212
214
|
if (deps) {
|
|
213
|
-
deps.forEach(this.options.add.add, this.options.add)
|
|
215
|
+
deps.forEach(this.options.add.add, this.options.add) // REVISIT: Ugly add.add
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
218
|
}
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
const cmds = Object.values(OPTIONS)
|
|
220
|
-
this.templateList = Array.from(templates.entries())
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
const cmds = Object.values(OPTIONS)
|
|
222
|
+
this.templateList = Array.from(templates.entries())
|
|
223
|
+
.sort(([a], [b]) => cmds.indexOf(a) - cmds.indexOf(b))
|
|
224
|
+
.map((entry) => entry[1])
|
|
223
225
|
|
|
224
226
|
// check debug to avoid lengthy computation when not in debug mode
|
|
225
227
|
DEBUG?.(`Features: ${this.templateList.map(({name}) => name).join(', ')}`);
|
|
@@ -229,7 +231,6 @@ module.exports = class CDSGenerator {
|
|
|
229
231
|
for (const template of this.templateList) {
|
|
230
232
|
await template.finalize();
|
|
231
233
|
}
|
|
232
|
-
LOG.info();
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
_cleanupOptions() {
|
|
@@ -247,18 +248,16 @@ module.exports = class CDSGenerator {
|
|
|
247
248
|
|
|
248
249
|
const trimmedTokens = tokens.map((token) => {
|
|
249
250
|
token = token.replace(/\s+/g, '');
|
|
250
|
-
const
|
|
251
|
-
if (
|
|
252
|
-
if (this.options[
|
|
253
|
-
this.options[
|
|
251
|
+
const tokens = token.split(':'), [facet] = tokens
|
|
252
|
+
if (tokens.length > 1) {
|
|
253
|
+
if (this.options[facet]) {
|
|
254
|
+
this.options[facet].add(token);
|
|
254
255
|
} else {
|
|
255
|
-
this.options[
|
|
256
|
+
this.options[facet] = new Set([token]);
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
|
-
return
|
|
259
|
-
}).filter(
|
|
260
|
-
return !!token;
|
|
261
|
-
});
|
|
259
|
+
return facet;
|
|
260
|
+
}).filter(Boolean);
|
|
262
261
|
|
|
263
262
|
// set is ordered ... always
|
|
264
263
|
this.options.add = new Set(trimmedTokens);
|
|
@@ -294,7 +293,7 @@ module.exports = class CDSGenerator {
|
|
|
294
293
|
|
|
295
294
|
async _validateProjectName(projectName) {
|
|
296
295
|
if (!projectName) {
|
|
297
|
-
throw
|
|
296
|
+
throw 'Specify a project name.'
|
|
298
297
|
}
|
|
299
298
|
|
|
300
299
|
// remove duplicates by using a set
|
|
@@ -303,9 +302,9 @@ module.exports = class CDSGenerator {
|
|
|
303
302
|
case 0:
|
|
304
303
|
break;
|
|
305
304
|
case 1:
|
|
306
|
-
throw
|
|
305
|
+
throw `Project name ${projectName} contains an invalid character (${[...invalidChars].join(', ')}). Specify a different project name.`
|
|
307
306
|
default:
|
|
308
|
-
throw
|
|
307
|
+
throw `Project name ${projectName} contains invalid characters (${[...invalidChars].join(', ')}). Specify a different project name.`
|
|
309
308
|
}
|
|
310
309
|
}
|
|
311
310
|
|
|
@@ -318,7 +317,7 @@ module.exports = class CDSGenerator {
|
|
|
318
317
|
} else {
|
|
319
318
|
message = `You seem to be trying to initialize an existing project. Use a different project name instead.`;
|
|
320
319
|
}
|
|
321
|
-
throw
|
|
320
|
+
throw `${message}\nDetails: File '${existingProjectFile}' exists in the project folder which indicates an existing project. Use ${term.bold('cds add')} to add more features.`
|
|
322
321
|
}
|
|
323
322
|
}
|
|
324
323
|
}
|
|
@@ -93,7 +93,7 @@ const enterpriseMessaging = {
|
|
|
93
93
|
}]
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const
|
|
96
|
+
const kibana = {
|
|
97
97
|
in: 'resources',
|
|
98
98
|
where: [{
|
|
99
99
|
property: 'type',
|
|
@@ -278,6 +278,6 @@ module.exports = {
|
|
|
278
278
|
requiredAppApi4,
|
|
279
279
|
providedJavaApprouterApi4,
|
|
280
280
|
providedJavaApprouterApi,
|
|
281
|
-
|
|
281
|
+
kibana,
|
|
282
282
|
approuterExtensibility
|
|
283
283
|
}
|
|
@@ -3,7 +3,7 @@ const { exists } = cds.utils
|
|
|
3
3
|
const { join } = require('path')
|
|
4
4
|
const { readProject } = require('../../util/projectReader')
|
|
5
5
|
const { mergeJSON, mergeYAML, sort } = require('../../util/merge')
|
|
6
|
-
const { XSUAA } = require('../../constants').OPTIONS
|
|
6
|
+
const { XSUAA, KIBANA } = require('../../constants').OPTIONS
|
|
7
7
|
const {
|
|
8
8
|
srvNode4, srvJava4, mtxSidecar4, approuter, // Modules
|
|
9
9
|
xsuaa, // BTP Services
|
|
@@ -23,6 +23,10 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
23
23
|
return [XSUAA]
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
getRelatedFacets() {
|
|
27
|
+
return [KIBANA]
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
async run() {
|
|
27
31
|
const { appPath = 'app' } = await readProject(this.options)
|
|
28
32
|
const appPackageJSONPath = join(appPath, 'package.json')
|
|
@@ -33,8 +37,8 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
async runDependentMerging(context = {}) {
|
|
36
|
-
const
|
|
37
|
-
const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath } =
|
|
40
|
+
const project = await readProject(this.options)
|
|
41
|
+
const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath, appPath } = project
|
|
38
42
|
|
|
39
43
|
if (hasMta) {
|
|
40
44
|
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
@@ -45,7 +49,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
45
49
|
const modules = [srv, approuter]
|
|
46
50
|
if (isMultitenant) modules.push(mtxSidecar)
|
|
47
51
|
const additions = [...modules, xsuaa, ...apis]
|
|
48
|
-
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
52
|
+
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'), project, {
|
|
49
53
|
additions,
|
|
50
54
|
relationships: [{
|
|
51
55
|
insert: [xsuaa, 'name'],
|
|
@@ -67,7 +71,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
67
71
|
await mergeYAML(
|
|
68
72
|
join('chart', 'values.yaml'),
|
|
69
73
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
70
|
-
|
|
74
|
+
project
|
|
71
75
|
)
|
|
72
76
|
|
|
73
77
|
// add dependency entry in chart.yaml
|
|
@@ -88,7 +92,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
88
92
|
]
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
|
-
|
|
95
|
+
project
|
|
92
96
|
)
|
|
93
97
|
|
|
94
98
|
const fileName = isMultitenant ? 'approuter-mtxs-configmap.yaml' : 'approuter-configmap.yaml';
|
|
@@ -113,8 +117,8 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
113
117
|
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
114
118
|
}
|
|
115
119
|
|
|
116
|
-
const xsAppPath = join(
|
|
120
|
+
const xsAppPath = join(appPath, 'xs-app.json')
|
|
117
121
|
const additions = isExtensible ? [{ ...approuterExtensibility, at: 0 }] : []
|
|
118
|
-
await mergeJSON(xsAppPath, join(__dirname, 'files', 'xs-app.json.hbs'),
|
|
122
|
+
await mergeJSON(xsAppPath, join(__dirname, 'files', 'xs-app.json.hbs'), project, { additions })
|
|
119
123
|
}
|
|
120
124
|
}
|
|
@@ -13,23 +13,23 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async run() {
|
|
16
|
-
const
|
|
17
|
-
const { configFile } =
|
|
18
|
-
|
|
19
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'),
|
|
16
|
+
const project = await readProject(this.options)
|
|
17
|
+
const { configFile } = project
|
|
18
|
+
project.shortcut = !(await read(configFile)).cds?.requires?.['audit-log']?.kind
|
|
19
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
20
20
|
await this.runDependentMerging()
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async runDependentMerging(context = {}) {
|
|
24
|
-
const
|
|
25
|
-
const { isNodejs, hasMta, hasHelm, srvPath } =
|
|
24
|
+
const project = await readProject(this.options)
|
|
25
|
+
const { isNodejs, hasMta, hasHelm, srvPath } = project
|
|
26
26
|
|
|
27
27
|
if (hasMta) {
|
|
28
28
|
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
29
29
|
await mergeYAML(
|
|
30
30
|
'mta.yaml',
|
|
31
31
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
32
|
-
|
|
32
|
+
project,
|
|
33
33
|
{
|
|
34
34
|
additions: [srv, auditlog],
|
|
35
35
|
relationships: [{
|
|
@@ -10,16 +10,16 @@ module.exports = class CfManifestTemplate extends require('../templateBase') {
|
|
|
10
10
|
|
|
11
11
|
async canRun() {
|
|
12
12
|
if (this.options.force) {
|
|
13
|
-
return true
|
|
13
|
+
return true
|
|
14
14
|
}
|
|
15
15
|
if (exists(MANIFEST_FILE) || exists(SERVICES_MANIFEST_FILE)) {
|
|
16
|
-
throw
|
|
16
|
+
throw `File ${MANIFEST_FILE} or ${SERVICES_MANIFEST_FILE} already exist in current folder. Use --force to overwrite.`
|
|
17
17
|
}
|
|
18
|
-
return true
|
|
18
|
+
return true
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
|
-
const
|
|
23
|
-
await copyFiles(join(__dirname, 'files'), cds.root,
|
|
22
|
+
const project = await readProject()
|
|
23
|
+
await copyFiles(join(__dirname, 'files'), cds.root, project, this.options.force)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -11,15 +11,15 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async run() {
|
|
14
|
-
const
|
|
15
|
-
const { configFile } =
|
|
16
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'),
|
|
14
|
+
const project = await readProject(this.options)
|
|
15
|
+
const { configFile } = project
|
|
16
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
17
17
|
await this.runDependentMerging()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
async runDependentMerging(context = {}) {
|
|
21
|
-
const
|
|
22
|
-
const { isJava, srvPath, hasHelm, hasMta } =
|
|
21
|
+
const project = await readProject(this.options)
|
|
22
|
+
const { isJava, srvPath, hasHelm, hasMta } = project
|
|
23
23
|
|
|
24
24
|
if (hasMta) {
|
|
25
25
|
const srv = (isJava ? srvJava4 : srvNode4)(srvPath)
|
|
@@ -28,7 +28,7 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
28
28
|
insert: [connectivity, 'name'],
|
|
29
29
|
into: [srv, 'requires', 'name']
|
|
30
30
|
}]
|
|
31
|
-
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
31
|
+
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'), project, { additions, relationships })
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (hasHelm) {
|
|
@@ -41,7 +41,7 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
41
41
|
await mergeYAML(
|
|
42
42
|
join('chart', 'values.yaml'),
|
|
43
43
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
44
|
-
|
|
44
|
+
project,
|
|
45
45
|
{ additions: [{
|
|
46
46
|
in: 'srv.additionalVolumes',
|
|
47
47
|
where: [{
|
|
@@ -15,15 +15,15 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async run() {
|
|
18
|
-
const
|
|
19
|
-
const { configFile } =
|
|
20
|
-
await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`),
|
|
18
|
+
const project = await readProject(this.options)
|
|
19
|
+
const { configFile } = project
|
|
20
|
+
await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`), project)
|
|
21
21
|
await this.runDependentMerging()
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async runDependentMerging(context = {}) {
|
|
25
|
-
const
|
|
26
|
-
const { isJava, hasHelm, hasDestination, hasMta, srvPath, hasHtml5Repo } =
|
|
25
|
+
const project = await readProject(this.options)
|
|
26
|
+
const { isJava, hasHelm, hasDestination, hasMta, srvPath, hasHtml5Repo } = project
|
|
27
27
|
|
|
28
28
|
if (hasMta) {
|
|
29
29
|
const srv = (isJava ? srvJava4 : srvNode4)(srvPath)
|
|
@@ -32,7 +32,7 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
32
32
|
insert: [destination, 'name'],
|
|
33
33
|
into: [srv, 'requires', 'name']
|
|
34
34
|
}]
|
|
35
|
-
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
35
|
+
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'), project, { additions, relationships })
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (hasHelm) {
|
|
@@ -20,23 +20,23 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async run() {
|
|
23
|
-
const
|
|
24
|
-
const { configFile } =
|
|
25
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'),
|
|
23
|
+
const project = await readProject(this.options)
|
|
24
|
+
const { configFile } = project
|
|
25
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
26
26
|
await this.runDependentMerging()
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async runDependentMerging(context = {}) {
|
|
30
|
-
const
|
|
31
|
-
const { hasXsuaa, hasHelm, hasMta, isNodejs, srvPath, appName } =
|
|
30
|
+
const project = await readProject(this.options)
|
|
31
|
+
const { hasXsuaa, hasHelm, hasMta, isNodejs, srvPath, appName } = project
|
|
32
32
|
|
|
33
33
|
if (hasMta) {
|
|
34
|
-
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'),
|
|
34
|
+
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), project)
|
|
35
35
|
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
36
36
|
await mergeYAML(
|
|
37
37
|
'mta.yaml',
|
|
38
38
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
39
|
-
|
|
39
|
+
project,
|
|
40
40
|
{
|
|
41
41
|
additions: [srv, enterpriseMessaging],
|
|
42
42
|
relationships: [{
|
|
@@ -49,14 +49,14 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
49
49
|
|
|
50
50
|
if (hasXsuaa) {
|
|
51
51
|
if (hasMta) {
|
|
52
|
-
|
|
52
|
+
project['em-service-name'] = YAML.parse(await read('mta.yaml'))?.resources?.find(r => r?.parameters?.service === 'enterprise-messaging')?.name
|
|
53
53
|
} else {
|
|
54
|
-
|
|
54
|
+
project['em-service-name'] = `${appName}-messaging`
|
|
55
55
|
}
|
|
56
56
|
await mergeJSON(
|
|
57
57
|
'xs-security.json',
|
|
58
58
|
join(__dirname, 'files', 'xs-security.json.hbs'),
|
|
59
|
-
|
|
59
|
+
project,
|
|
60
60
|
{
|
|
61
61
|
additions: [{
|
|
62
62
|
in: 'scopes',
|
|
@@ -19,24 +19,24 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../tem
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
|
-
const
|
|
23
|
-
const { configFile } =
|
|
24
|
-
|
|
25
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'),
|
|
26
|
-
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'),
|
|
22
|
+
const project = await readProject(this.options)
|
|
23
|
+
const { configFile } = project
|
|
24
|
+
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
25
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
26
|
+
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), project)
|
|
27
27
|
await this.runDependentMerging()
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async runDependentMerging() {
|
|
31
|
-
const
|
|
32
|
-
const { hasMta, isNodejs, srvPath } =
|
|
31
|
+
const project = await readProject(this.options)
|
|
32
|
+
const { hasMta, isNodejs, srvPath } = project
|
|
33
33
|
|
|
34
34
|
if (hasMta) {
|
|
35
35
|
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
36
36
|
await mergeYAML(
|
|
37
37
|
'mta.yaml',
|
|
38
38
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
39
|
-
|
|
39
|
+
project,
|
|
40
40
|
{
|
|
41
41
|
additions: [srv, enterpriseMessaging],
|
|
42
42
|
relationships: [{
|
|
@@ -21,20 +21,20 @@ module.exports = class ExtensibilityTemplate extends require('../templateBase')
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async run() {
|
|
24
|
-
const
|
|
25
|
-
const { configFile } =
|
|
26
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'),
|
|
24
|
+
const project = await readProject(this.options)
|
|
25
|
+
const { configFile } = project
|
|
26
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
27
27
|
await this.runDependentMerging()
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async runDependentMerging() {
|
|
31
|
-
const
|
|
32
|
-
const { hasXsuaa } =
|
|
31
|
+
const project = await readProject(this.options)
|
|
32
|
+
const { hasXsuaa } = project
|
|
33
33
|
if (hasXsuaa) {
|
|
34
34
|
await mergeJSON(
|
|
35
35
|
'xs-security.json',
|
|
36
36
|
join(__dirname, 'files', 'xs-security.json.hbs'),
|
|
37
|
-
|
|
37
|
+
project,
|
|
38
38
|
{
|
|
39
39
|
additions: [{
|
|
40
40
|
in: 'scopes',
|
|
@@ -16,9 +16,9 @@ module.exports = class FileBasedMessagingTemplate extends require('../templateBa
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
async run() {
|
|
19
|
-
const
|
|
20
|
-
const { configFile } =
|
|
21
|
-
|
|
22
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'),
|
|
19
|
+
const project = await readProject(this.options)
|
|
20
|
+
const { configFile } = project
|
|
21
|
+
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
22
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -20,11 +20,11 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async run() {
|
|
23
|
-
const
|
|
24
|
-
const { isJava, configFile } =
|
|
25
|
-
|
|
23
|
+
const project = await readProject(this.options)
|
|
24
|
+
const { isJava, configFile } = project
|
|
25
|
+
project.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
|
|
26
26
|
|
|
27
|
-
const env = await this.getEnv() // REVISIT: Get info from
|
|
27
|
+
const env = await this.getEnv() // REVISIT: Get info from project
|
|
28
28
|
|
|
29
29
|
// REVISIT: Let cds build generate by default
|
|
30
30
|
const hdiConfigPath = join(env.folders.db, 'src', '.hdiconfig')
|
|
@@ -41,7 +41,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
41
41
|
await this._updatePomXml()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'),
|
|
44
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project, { forceOverwrite: true })
|
|
45
45
|
|
|
46
46
|
const packageJson = exists('package.json') ? await read('package.json') : undefined
|
|
47
47
|
if (packageJson?.dependencies) {
|
|
@@ -66,8 +66,8 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async runDependentMerging(context = {}) {
|
|
69
|
-
const
|
|
70
|
-
const { hasMta, hasHelm, hasHtml5Repo, isJava, isMultitenant, srvPath } =
|
|
69
|
+
const project = await readProject(this.options)
|
|
70
|
+
const { hasMta, hasHelm, hasHtml5Repo, isJava, isMultitenant, srvPath } = project
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
if (hasMta) {
|
|
@@ -109,7 +109,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
109
109
|
await mergeYAML(
|
|
110
110
|
'mta.yaml',
|
|
111
111
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
112
|
-
|
|
112
|
+
project,
|
|
113
113
|
{ additions: [...modules, db].filter(a => a), deletions, relationships }
|
|
114
114
|
)
|
|
115
115
|
}
|
|
@@ -159,7 +159,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
159
159
|
}
|
|
160
160
|
]
|
|
161
161
|
},
|
|
162
|
-
|
|
162
|
+
project,
|
|
163
163
|
{ deletions: [{
|
|
164
164
|
item: {
|
|
165
165
|
in: `dependencies`,
|
|
@@ -174,7 +174,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
174
174
|
await mergeYAML(
|
|
175
175
|
join('chart', 'values.yaml'),
|
|
176
176
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
177
|
-
|
|
177
|
+
project
|
|
178
178
|
)
|
|
179
179
|
|
|
180
180
|
// copy content deployment chart if it is not present
|
|
@@ -204,7 +204,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
204
204
|
} catch (err) {
|
|
205
205
|
// REVISIT: This should not have to be checked and tested in a facet implementation, move to Maven util
|
|
206
206
|
if (err.code === 'ENOENT' && err.path === 'mvn') {
|
|
207
|
-
throw
|
|
207
|
+
throw `Maven executable 'mvn' not found, follow ${term.info(URLS.MAVEN_INSTALL_HELP)} and install Maven on your machine.`
|
|
208
208
|
}
|
|
209
209
|
throw err;
|
|
210
210
|
}
|
|
@@ -51,7 +51,7 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
async addDependency(name, alias){
|
|
54
|
-
const
|
|
54
|
+
const project = await readProject(this.options);
|
|
55
55
|
const isInternal = await this.isInternal();
|
|
56
56
|
await mergeYAML(
|
|
57
57
|
join('chart', 'Chart.yaml'),
|
|
@@ -65,7 +65,7 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
|
|
68
|
+
project,
|
|
69
69
|
{ additions: [{
|
|
70
70
|
in: `dependencies`,
|
|
71
71
|
where: [{
|
|
@@ -77,7 +77,7 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
async run() {
|
|
80
|
-
const
|
|
80
|
+
const project = await readProject(this.options)
|
|
81
81
|
const isInternal = this.options['internal-unified-runtime-charts'] !== undefined && this.options['internal-unified-runtime-charts'];
|
|
82
82
|
this.oldTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'));
|
|
83
83
|
await this.addSubChart('web-application', !isInternal);
|
|
@@ -90,7 +90,7 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
90
90
|
await mergeYAML(
|
|
91
91
|
join('chart', 'Chart.yaml'),
|
|
92
92
|
join(__dirname, 'files', 'Chart.yaml.hbs'),
|
|
93
|
-
|
|
93
|
+
project
|
|
94
94
|
)
|
|
95
95
|
|
|
96
96
|
await this.addDependency('web-application', 'srv');
|
|
@@ -98,7 +98,7 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
98
98
|
await mergeYAML(
|
|
99
99
|
join('chart', 'values.yaml'),
|
|
100
100
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
101
|
-
|
|
101
|
+
project
|
|
102
102
|
)
|
|
103
103
|
await this.runDependentMerging();
|
|
104
104
|
await writeMd5File(join('chart', '.cds-add-helm-files.md5'), this.newTrackingData);
|
|
@@ -13,8 +13,8 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async canRun() {
|
|
16
|
-
const
|
|
17
|
-
const { hasMta, hasHelm } =
|
|
16
|
+
const project = await readProject(this.options)
|
|
17
|
+
const { hasMta, hasHelm } = project
|
|
18
18
|
if (!hasHelm && hasMta) {
|
|
19
19
|
throw `'cds add html5-repo' is not available for Cloud Foundry yet`
|
|
20
20
|
}
|