@sap/cds-dk 7.0.2 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/add.js +2 -2
- package/bin/bind.js +5 -7
- package/bin/build.js +2 -7
- package/bin/cds.js +6 -8
- package/bin/deploy/to-hana.js +1 -1
- package/bin/init.js +2 -2
- package/bin/subscribe.js +4 -4
- package/bin/unsubscribe.js +4 -4
- package/bin/upgrade.js +4 -4
- package/lib/bind/cfKeyProvider.js +10 -10
- package/lib/bind/index.js +4 -3
- package/lib/bind/userCdsrcJsonStorageProvider.js +2 -10
- package/lib/build/buildTaskEngine.js +9 -22
- package/lib/build/buildTaskFactory.js +18 -27
- package/lib/build/constants.js +16 -14
- package/lib/build/index.js +12 -3
- package/lib/build/provider/buildTaskProviderInternal.js +23 -15
- package/lib/build/provider/mtx/index.js +8 -2
- package/lib/build/provider/mtx/resourcesTarBuilder.js +2 -6
- package/lib/build/provider/mtx-sidecar/index.js +13 -8
- package/lib/build/util.js +13 -0
- package/lib/client/activate.js +7 -7
- package/lib/client/auth_manager.js +5 -5
- package/lib/client/base_command.js +7 -10
- package/lib/client/extend.js +2 -2
- package/lib/client/helper/logging.js +7 -2
- package/lib/client/params.js +2 -3
- package/lib/client/pull.js +3 -3
- package/lib/client/push.js +3 -3
- package/lib/client/settings_manager.js +7 -8
- package/lib/client/tenant_action.js +3 -3
- package/lib/compile/asyncapi/components/messages/index.js +41 -18
- package/lib/compile/asyncapi/index.js +23 -2
- package/lib/deploy/to-hana/hana.js +1 -2
- package/lib/import/common.js +3 -0
- package/lib/import/message.js +2 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +1 -0
- package/lib/import/odata/v4parser.js +85 -95
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +78 -73
- package/lib/init/template/approuter/index.js +3 -4
- package/lib/init/template/auditlog/index.js +3 -4
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +15 -23
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +22 -17
- package/lib/init/template/cf-manifest/index.js +2 -2
- package/lib/init/template/connectivity/index.js +2 -3
- package/lib/init/template/data/index.js +7 -8
- package/lib/init/template/destination/index.js +3 -5
- package/lib/init/template/enterprise-messaging/index.js +4 -5
- package/lib/init/template/enterprise-messaging-shared/index.js +3 -4
- package/lib/init/template/extensibility/index.js +2 -3
- package/lib/init/template/file-based-messaging/index.js +2 -2
- package/lib/init/template/hana/files/mta.yaml.hbs +1 -1
- package/lib/init/template/hana/index.js +39 -63
- package/lib/init/template/helm/index.js +15 -14
- package/lib/init/template/html5-repo/index.js +3 -7
- package/lib/init/template/java/index.js +3 -3
- package/lib/init/template/kibana/index.js +3 -4
- package/lib/init/template/lint/index.js +13 -13
- package/lib/init/template/mta/index.js +3 -2
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +16 -37
- package/lib/init/template/nodejs/index.js +4 -6
- package/lib/init/template/pipeline/index.js +3 -4
- package/lib/init/template/redis-messaging/index.js +3 -4
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +1 -1
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +1 -1
- package/lib/init/template/sample/files/srv/admin-service.cds +1 -1
- package/lib/init/template/sample/files/srv/cat-service.cds +1 -1
- package/lib/init/template/sample/index.js +6 -5
- package/lib/init/template/sqlite/index.js +1 -1
- package/lib/init/template/templateBase.js +9 -19
- package/lib/init/template/tiny-sample/index.js +5 -5
- package/lib/init/template/toggles/index.js +1 -2
- package/lib/init/template/typer/files/xsconfig.json +0 -1
- package/lib/init/template/typer/index.js +1 -1
- package/lib/init/template/xsuaa/index.js +3 -4
- package/lib/init/util/indent.js +57 -0
- package/lib/init/util/merge.js +72 -16
- package/lib/init/util/mvn.js +40 -31
- package/lib/init/util/projectReader.js +52 -168
- package/lib/init/util/template.js +12 -11
- package/lib/init/util/xml.js +6 -6
- package/lib/util/cfUtil.js +1 -2
- package/lib/util/pruneAxiosErrors.js +22 -0
- package/lib/watch/open.js +6 -3
- package/npm-shrinkwrap.json +356 -309
- package/package.json +1 -2
- package/lib/client/helper/errors.js +0 -26
- package/lib/util/version.js +0 -27
package/lib/init/index.js
CHANGED
|
@@ -2,11 +2,10 @@ const path = require('path');
|
|
|
2
2
|
|
|
3
3
|
const term = require('../util/term');
|
|
4
4
|
|
|
5
|
-
const { OPTIONS,
|
|
6
|
-
const { NODEJS, JAVA, HANA, MTA,PIPELINE,
|
|
5
|
+
const { OPTIONS, COMMAND_INIT, PROJECT_FILES, REGEX_PROJECT_NAME } = require('./constants')
|
|
6
|
+
const { NODEJS, JAVA, HANA, MTA,PIPELINE, TINY_SAMPLE, CF_MANIFEST } = OPTIONS
|
|
7
7
|
|
|
8
8
|
const cds = require('../cds'), { exists, readdir } = cds.utils
|
|
9
|
-
const LOG = console
|
|
10
9
|
const DEBUG = /\b(y|all|cli)\b/.test(process.env.DEBUG) ? console.debug : undefined
|
|
11
10
|
|
|
12
11
|
module.exports = class CDSGenerator {
|
|
@@ -28,7 +27,7 @@ module.exports = class CDSGenerator {
|
|
|
28
27
|
|
|
29
28
|
return true;
|
|
30
29
|
} catch (err) {
|
|
31
|
-
return err
|
|
30
|
+
return err;
|
|
32
31
|
}
|
|
33
32
|
},
|
|
34
33
|
guiOptions: {
|
|
@@ -75,7 +74,7 @@ module.exports = class CDSGenerator {
|
|
|
75
74
|
description: `Add sample content to your project.`,
|
|
76
75
|
default: '',
|
|
77
76
|
choices: [
|
|
78
|
-
{ name: 'Basic Sample Files', value:
|
|
77
|
+
{ name: 'Basic Sample Files', value: TINY_SAMPLE }
|
|
79
78
|
],
|
|
80
79
|
multiple: true,
|
|
81
80
|
target: 'add',
|
|
@@ -90,67 +89,68 @@ module.exports = class CDSGenerator {
|
|
|
90
89
|
* @param {string} facets, comma separated list of templates, no blanks
|
|
91
90
|
* @param {any} options, additional options
|
|
92
91
|
*/
|
|
93
|
-
async addCmd(facets
|
|
94
|
-
options._cmd = COMMAND_ADD;
|
|
95
|
-
options.add = facets;
|
|
96
|
-
|
|
92
|
+
async addCmd(facets) {
|
|
97
93
|
if (!facets) throw 'You must specify a facet to add to the project.'
|
|
98
94
|
|
|
99
|
-
this._initialize(null
|
|
100
|
-
this._greetings(
|
|
95
|
+
this._initialize(null);
|
|
96
|
+
this._greetings();
|
|
101
97
|
|
|
102
98
|
if (!PROJECT_FILES.find(exists)) {
|
|
103
99
|
throw `The current folder doesn't seem to contain a project. None of the following files found: ${PROJECT_FILES.join(', ')}.`
|
|
104
100
|
}
|
|
105
101
|
|
|
106
|
-
await this._process(
|
|
107
|
-
await this.stepEnd(
|
|
102
|
+
await this._process();
|
|
103
|
+
await this.stepEnd();
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
/**
|
|
111
107
|
* @param {string} projectName, the project name
|
|
112
|
-
* @param {any} options, additional options
|
|
113
108
|
*/
|
|
114
|
-
async initCmd(projectName
|
|
115
|
-
await this.stepInit(projectName
|
|
109
|
+
async initCmd(projectName) {
|
|
110
|
+
await this.stepInit(projectName);
|
|
116
111
|
await this.stepEnd();
|
|
117
112
|
}
|
|
118
113
|
|
|
119
|
-
async stepInit(projectName, options
|
|
120
|
-
|
|
114
|
+
async stepInit(projectName, options) {
|
|
115
|
+
|
|
116
|
+
if (!cds.cli?.command) {
|
|
117
|
+
// called from CAP generator
|
|
118
|
+
cds.cli = {
|
|
119
|
+
command: COMMAND_INIT,
|
|
120
|
+
// keep caller independent from internal names
|
|
121
|
+
options: {
|
|
122
|
+
cwd: options.cwd,
|
|
123
|
+
add: options.add
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
121
127
|
|
|
122
|
-
this._initialize(projectName
|
|
123
|
-
this._greetings(
|
|
128
|
+
this._initialize(projectName);
|
|
129
|
+
this._greetings();
|
|
124
130
|
|
|
125
131
|
await this._process();
|
|
126
132
|
}
|
|
127
133
|
|
|
128
|
-
_initialize(projectName
|
|
129
|
-
|
|
130
|
-
if (options.verbose) {
|
|
131
|
-
LOG.warn(`Parameter 'verbose' is no longer supported. Use environment variable 'DEBUG=true' to obtain detailed output.`);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
+
_initialize(projectName) {
|
|
135
|
+
const { options } = cds.cli
|
|
134
136
|
this.cwd = options.cwd || process.cwd();
|
|
135
137
|
cds.root = path.resolve(this.cwd, projectName || '.');
|
|
136
138
|
this.projectName = path.basename(cds.root);
|
|
137
139
|
|
|
138
|
-
this.options = options;
|
|
139
140
|
this._cleanupOptions();
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
_greetings() {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
LOG.info(`Creating new CAP project in ${term.bold(folderName)}\n`);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
144
|
+
if (cds.cli.command === COMMAND_INIT) {
|
|
145
|
+
const relativeProjectPath = path.relative(this.cwd, cds.root)
|
|
146
|
+
const folderName = relativeProjectPath ? `.${path.sep}${relativeProjectPath}` : 'current folder'
|
|
147
|
+
console.log(`Creating new CAP project in ${term.bold(folderName)}\n`)
|
|
150
148
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
if (cds.cli.options.for && typeof cds.cli.options.for !== 'string') {
|
|
150
|
+
throw 'The --for argument must not be empty.'
|
|
151
|
+
}
|
|
152
|
+
if (cds.cli.options.force) {
|
|
153
|
+
console.log(`Using '--force' ... existing files will be overwritten`)
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -161,22 +161,21 @@ module.exports = class CDSGenerator {
|
|
|
161
161
|
await this._fillTemplateList();
|
|
162
162
|
|
|
163
163
|
for (const template of this.templateList) {
|
|
164
|
-
|
|
165
|
-
LOG.info(msg);
|
|
164
|
+
console.log(`Adding feature '${template.name}'...`);
|
|
166
165
|
await template.run();
|
|
166
|
+
await template.runDependentMerging();
|
|
167
167
|
await template.runRelatedMerging();
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
if (cds.cli.command === COMMAND_INIT) {
|
|
171
171
|
const relativeProjectPath = path.relative(this.cwd, cds.root)
|
|
172
|
-
|
|
172
|
+
console.log(`\nSuccessfully created project. Continue with '${term.bold('cd '+relativeProjectPath)}'.\n`)
|
|
173
173
|
} else {
|
|
174
|
-
|
|
174
|
+
console.log(`\nSuccessfully added features to your project.`)
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
async _createTemplate(filename) {
|
|
179
|
-
|
|
180
179
|
try {
|
|
181
180
|
const TemplateClass = require(`./template/${filename}`);
|
|
182
181
|
return new TemplateClass(this);
|
|
@@ -191,7 +190,7 @@ module.exports = class CDSGenerator {
|
|
|
191
190
|
);
|
|
192
191
|
const fuzzySearch = require('../../bin/util/fuzzySearch');
|
|
193
192
|
const [bestMatch] = fuzzySearch(filename, entries);
|
|
194
|
-
|
|
193
|
+
console.log(`Unknown facet '${term.bold(filename)}'. Did you mean ${term.bold(`cds add ${bestMatch}`)}?\n\nHaven't found the proper facet yet? Here are all supported facets:\n\n ${term.bold(entries.join('\n '))}\n`);
|
|
195
194
|
process.exit(1);
|
|
196
195
|
}
|
|
197
196
|
throw err;
|
|
@@ -199,21 +198,23 @@ module.exports = class CDSGenerator {
|
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
async _fillTemplateList() {
|
|
202
|
-
const templates = new Map
|
|
203
|
-
|
|
201
|
+
const templates = new Map
|
|
202
|
+
const { command, options, argv } = cds.cli
|
|
203
|
+
|
|
204
|
+
const facets = command === COMMAND_INIT ? options.add : new Set(argv[0].split(','))
|
|
205
|
+
|
|
206
|
+
for (let facet of facets) {
|
|
204
207
|
// Compat
|
|
205
|
-
if (
|
|
206
|
-
if (
|
|
208
|
+
if (facet === 'sample-tiny') facet = 'tiny-sample'
|
|
209
|
+
if (facet === 'kibana-logging') facet = 'kibana'
|
|
207
210
|
|
|
208
|
-
if (!templates.has(
|
|
209
|
-
const template = await this._createTemplate(
|
|
211
|
+
if (!templates.has(facet)) {
|
|
212
|
+
const template = await this._createTemplate(facet)
|
|
210
213
|
if (await template.canRun()) {
|
|
211
|
-
DEBUG?.(`Adding feature '${template.name}'`)
|
|
212
|
-
templates.set(
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
deps.forEach(this.options.add.add, this.options.add) // REVISIT: Ugly add.add
|
|
216
|
-
}
|
|
214
|
+
DEBUG?.(`Adding feature '${template.name}'`)
|
|
215
|
+
templates.set(facet, template)
|
|
216
|
+
const dependencies = await template.getDependencies()
|
|
217
|
+
dependencies?.forEach(d => facets.add(d))
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
}
|
|
@@ -227,6 +228,7 @@ module.exports = class CDSGenerator {
|
|
|
227
228
|
DEBUG?.(`Features: ${this.templateList.map(({name}) => name).join(', ')}`);
|
|
228
229
|
}
|
|
229
230
|
|
|
231
|
+
// CAP Generator API
|
|
230
232
|
async stepEnd() {
|
|
231
233
|
for (const template of this.templateList) {
|
|
232
234
|
await template.finalize();
|
|
@@ -236,56 +238,59 @@ module.exports = class CDSGenerator {
|
|
|
236
238
|
_cleanupOptions() {
|
|
237
239
|
let tokens = [];
|
|
238
240
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
+
const { options } = cds.cli
|
|
242
|
+
if (typeof options.add === 'string') {
|
|
243
|
+
tokens = options.add.split(/[,\s+]/g);
|
|
241
244
|
|
|
242
|
-
} else if (Array.isArray(
|
|
243
|
-
tokens =
|
|
245
|
+
} else if (Array.isArray(options.add)) {
|
|
246
|
+
tokens = options.add
|
|
244
247
|
|
|
245
|
-
} else if (
|
|
246
|
-
tokens = [...
|
|
248
|
+
} else if (options.add instanceof Set) {
|
|
249
|
+
tokens = [...options.add];
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
const trimmedTokens = tokens.map((token) => {
|
|
250
253
|
token = token.replace(/\s+/g, '');
|
|
251
254
|
const tokens = token.split(':'), [facet] = tokens
|
|
252
255
|
if (tokens.length > 1) {
|
|
253
|
-
if (
|
|
254
|
-
|
|
256
|
+
if (options[facet]) {
|
|
257
|
+
options[facet].add(token);
|
|
255
258
|
} else {
|
|
256
|
-
|
|
259
|
+
options[facet] = new Set([token]);
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
return facet;
|
|
260
263
|
}).filter(Boolean);
|
|
261
264
|
|
|
262
265
|
// set is ordered ... always
|
|
263
|
-
|
|
266
|
+
options.add = new Set(trimmedTokens);
|
|
264
267
|
|
|
265
|
-
if (
|
|
266
|
-
|
|
268
|
+
if (cds.cli.command === COMMAND_INIT && !options.add.has(JAVA)) {
|
|
269
|
+
options.add.add(NODEJS);
|
|
267
270
|
}
|
|
268
271
|
|
|
269
272
|
this._checkAdditionalOptions();
|
|
270
273
|
}
|
|
271
274
|
|
|
272
275
|
_checkAdditionalOptions() {
|
|
273
|
-
|
|
274
|
-
|
|
276
|
+
const { options } = cds.cli
|
|
277
|
+
for (const [key] of Object.entries(options)) {
|
|
278
|
+
const keySplit = key.split(/:/)
|
|
275
279
|
if (keySplit.length === 2) {
|
|
276
|
-
if (!
|
|
277
|
-
|
|
280
|
+
if (!options.add.has(keySplit[0])) {
|
|
281
|
+
console.log(`ignoring option ${key} since ${keySplit[0]} is not part of specified feature list: ${Array.from(options.add).join(', ')}`)
|
|
278
282
|
}
|
|
279
283
|
}
|
|
280
284
|
}
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
async _validateOptions() {
|
|
284
|
-
|
|
288
|
+
const { options, command } = cds.cli
|
|
289
|
+
if (options.force) {
|
|
285
290
|
return;
|
|
286
291
|
}
|
|
287
292
|
|
|
288
|
-
if (
|
|
293
|
+
if (command === COMMAND_INIT) {
|
|
289
294
|
await this._validateProjectName(this.projectName);
|
|
290
295
|
await this._validateProjectFolder(this.cwd);
|
|
291
296
|
}
|
|
@@ -28,16 +28,15 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async run() {
|
|
31
|
-
const { appPath = 'app' } = await readProject(
|
|
31
|
+
const { appPath = 'app' } = await readProject()
|
|
32
32
|
const appPackageJSONPath = join(appPath, 'package.json')
|
|
33
33
|
await mergeJSON(appPackageJSONPath, join(__dirname, 'files', 'package.json'))
|
|
34
34
|
await sort(appPackageJSONPath, 'dependencies')
|
|
35
35
|
await mergeJSON(join(appPath, 'default-env.json'), join(__dirname, 'files', 'default-env.json'))
|
|
36
|
-
await this.runDependentMerging()
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
async runDependentMerging(context = {}) {
|
|
40
|
-
const project = await readProject(
|
|
39
|
+
const project = await readProject()
|
|
41
40
|
const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath, appPath } = project
|
|
42
41
|
|
|
43
42
|
if (hasMta) {
|
|
@@ -76,7 +75,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
76
75
|
|
|
77
76
|
// add dependency entry in chart.yaml
|
|
78
77
|
const HelmTemplate = require(`../helm`);
|
|
79
|
-
const helmTemplate = new HelmTemplate(
|
|
78
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
80
79
|
await helmTemplate.addDependency('web-application', 'approuter');
|
|
81
80
|
|
|
82
81
|
await mergeYAML(
|
|
@@ -13,15 +13,14 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async run() {
|
|
16
|
-
const project = await readProject(
|
|
16
|
+
const project = await readProject()
|
|
17
17
|
const { configFile } = project
|
|
18
18
|
project.shortcut = !(await read(configFile)).cds?.requires?.['audit-log']?.kind
|
|
19
19
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
20
|
-
await this.runDependentMerging()
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
async runDependentMerging(context = {}) {
|
|
24
|
-
const project = await readProject(
|
|
23
|
+
const project = await readProject()
|
|
25
24
|
const { isNodejs, hasMta, hasHelm, srvPath } = project
|
|
26
25
|
|
|
27
26
|
if (hasMta) {
|
|
@@ -63,7 +62,7 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
63
62
|
|
|
64
63
|
// copy service instance chart if it is not present
|
|
65
64
|
const HelmTemplate = require(`../helm`);
|
|
66
|
-
const helmTemplate = new HelmTemplate(
|
|
65
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
67
66
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
68
67
|
|
|
69
68
|
// add dependency entry in chart.yaml
|
|
@@ -7,7 +7,7 @@ applications:
|
|
|
7
7
|
# -----------------------------------------------------------------------------------
|
|
8
8
|
# Backend Service
|
|
9
9
|
# -----------------------------------------------------------------------------------
|
|
10
|
-
- name: {{appName}}-
|
|
10
|
+
- name: {{appName}}-srv
|
|
11
11
|
random-route: true # for development only
|
|
12
12
|
{{#isNodejs}}
|
|
13
13
|
path: {{& srvPath}}
|
|
@@ -15,42 +15,34 @@ applications:
|
|
|
15
15
|
buildpack: nodejs_buildpack
|
|
16
16
|
{{/isNodejs}}
|
|
17
17
|
{{#isJava}}
|
|
18
|
-
path: {{& srvPath}}/target/{{
|
|
18
|
+
path: {{& srvPath}}/target/{{archiveName}}
|
|
19
19
|
memory: 1G
|
|
20
20
|
disk_quota: 512M
|
|
21
21
|
env:
|
|
22
22
|
SPRING_PROFILES_ACTIVE: cloud
|
|
23
23
|
buildpack: java_buildpack
|
|
24
24
|
{{/isJava}}
|
|
25
|
-
{{#hasRequires}}
|
|
26
25
|
services:
|
|
27
|
-
{{#
|
|
28
|
-
{{
|
|
29
|
-
|
|
30
|
-
{{
|
|
31
|
-
{{
|
|
32
|
-
|
|
33
|
-
{{/resource.isXsuaa}}
|
|
34
|
-
{{/requires}}
|
|
35
|
-
{{/hasRequires}}
|
|
26
|
+
{{#hasHana}}
|
|
27
|
+
- {{appName}}-db
|
|
28
|
+
{{/hasHana}}
|
|
29
|
+
{{#hasXsuaa}}
|
|
30
|
+
- {{appName}}-auth
|
|
31
|
+
{{/hasXsuaa}}
|
|
36
32
|
|
|
37
|
-
{{#
|
|
33
|
+
{{#hasHana}}
|
|
34
|
+
{{^isMultitenant}}
|
|
38
35
|
# -----------------------------------------------------------------------------------
|
|
39
36
|
# HANA Database Content Deployer App
|
|
40
37
|
# -----------------------------------------------------------------------------------
|
|
41
|
-
- name: {{appName}}-{{db.
|
|
42
|
-
path: {{& db.
|
|
38
|
+
- name: {{appName}}-{{db.name}}-deployer
|
|
39
|
+
path: {{& db.path}}
|
|
43
40
|
no-route: true
|
|
44
41
|
health-check-type: process
|
|
45
42
|
memory: 256M
|
|
46
43
|
instances: 1
|
|
47
44
|
buildpack: nodejs_buildpack
|
|
48
|
-
{{#hasRequires}}
|
|
49
45
|
services:
|
|
50
|
-
{{
|
|
51
|
-
{{
|
|
52
|
-
|
|
53
|
-
{{/resource.isHana}}
|
|
54
|
-
{{/requires}}
|
|
55
|
-
{{/hasRequires}}
|
|
56
|
-
{{/needsSidecar}}
|
|
46
|
+
- {{appName}}-db
|
|
47
|
+
{{/isMultitenant}}
|
|
48
|
+
{{/hasHana}}
|
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
# appName = {{appName}}
|
|
3
3
|
---
|
|
4
4
|
create-services:
|
|
5
|
-
{{#
|
|
6
|
-
#
|
|
7
|
-
- name:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
{{#hasHana}}
|
|
6
|
+
{{#isMultitenant}}
|
|
7
|
+
- name: {{appName}}-db
|
|
8
|
+
broker: service-manager
|
|
9
|
+
plan: container
|
|
10
|
+
{{/isMultitenant}}
|
|
11
|
+
{{^isMultitenant}}
|
|
12
|
+
- name: {{appName}}-db
|
|
13
|
+
broker: hana
|
|
14
|
+
plan: hdi-shared
|
|
15
|
+
{{/isMultitenant}}
|
|
16
|
+
{{/hasHana}}
|
|
17
|
+
{{#hasXsuaa}}
|
|
18
|
+
- name: {{appName}}-auth
|
|
19
|
+
broker: xsuaa
|
|
16
20
|
plan: application
|
|
17
|
-
|
|
18
|
-
{{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
parameters: xs-security.json
|
|
22
|
+
{{/hasXsuaa}}
|
|
23
|
+
{{#hasAuditlog}}
|
|
24
|
+
- name: {{appName}}-auditlog
|
|
25
|
+
broker: auditlog
|
|
26
|
+
plan: application
|
|
27
|
+
{{/hasAuditlog}}
|
|
@@ -9,7 +9,7 @@ const SERVICES_MANIFEST_FILE = 'services-manifest.yml'
|
|
|
9
9
|
module.exports = class CfManifestTemplate extends require('../templateBase') {
|
|
10
10
|
|
|
11
11
|
async canRun() {
|
|
12
|
-
if (
|
|
12
|
+
if (cds.cli.options.force) {
|
|
13
13
|
return true
|
|
14
14
|
}
|
|
15
15
|
if (exists(MANIFEST_FILE) || exists(SERVICES_MANIFEST_FILE)) {
|
|
@@ -20,6 +20,6 @@ module.exports = class CfManifestTemplate extends require('../templateBase') {
|
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
22
|
const project = await readProject()
|
|
23
|
-
await copyFiles(join(__dirname, 'files'), cds.root, project,
|
|
23
|
+
await copyFiles(join(__dirname, 'files'), cds.root, project, true)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -11,14 +11,13 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async run() {
|
|
14
|
-
const project = await readProject(
|
|
14
|
+
const project = await readProject()
|
|
15
15
|
const { configFile } = project
|
|
16
16
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
17
|
-
await this.runDependentMerging()
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
async runDependentMerging(context = {}) {
|
|
21
|
-
const project = await readProject(
|
|
20
|
+
const project = await readProject()
|
|
22
21
|
const { isJava, srvPath, hasHelm, hasMta } = project
|
|
23
22
|
|
|
24
23
|
if (hasMta) {
|
|
@@ -2,25 +2,24 @@
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists, fs } = cds.utils
|
|
4
4
|
const { resolve, join, relative } = require('path');
|
|
5
|
-
const LOG = console
|
|
6
5
|
const DEBUG = cds.debug('cli')
|
|
7
6
|
|
|
8
7
|
module.exports = class DataTemplate extends require('../templateBase') {
|
|
9
8
|
|
|
10
9
|
async run() {
|
|
11
|
-
if (
|
|
10
|
+
if (cds.cli.options.for) {
|
|
12
11
|
throw `\nError: Did you mean \`... --data:for\` ?`
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
const env = await this.getEnv();
|
|
16
15
|
|
|
17
|
-
let dest = (typeof
|
|
18
|
-
?
|
|
16
|
+
let dest = (typeof cds.cli.options.out === 'string') // target folder
|
|
17
|
+
? cds.cli.options.out
|
|
19
18
|
: getDefaultTargetFolder(env);
|
|
20
19
|
dest = resolve(cds.root, dest);
|
|
21
20
|
|
|
22
|
-
const nameFilter = asRegex(
|
|
23
|
-
const force =
|
|
21
|
+
const nameFilter = asRegex(cds.cli.options['data:for'])
|
|
22
|
+
const { force } = cds.cli.options
|
|
24
23
|
|
|
25
24
|
let csn = await cds.compile.to.csn(cds.env.roots) // normal CSN
|
|
26
25
|
|
|
@@ -111,7 +110,7 @@ function createDataFile (isFileExists, dataFilePath, dest, force, entity) {
|
|
|
111
110
|
relFilePath = relative(cds.root, dataFilePath);
|
|
112
111
|
}
|
|
113
112
|
if (isFileExists && !force) {
|
|
114
|
-
|
|
113
|
+
console.log(`Skipping ${relFilePath}`);
|
|
115
114
|
}
|
|
116
115
|
else {
|
|
117
116
|
// continue only if file not already exists, or '--force' option provided
|
|
@@ -119,7 +118,7 @@ function createDataFile (isFileExists, dataFilePath, dest, force, entity) {
|
|
|
119
118
|
if (dataFileContent && dataFileContent.length) {
|
|
120
119
|
if (!exists(dest)) fs.mkdirSync(dest, {recursive: true})
|
|
121
120
|
fs.writeFileSync(dataFilePath, dataFileContent);
|
|
122
|
-
isFileExists ?
|
|
121
|
+
isFileExists ? console.log(`Overwriting `+relFilePath) : console.log(`Creating `+relFilePath)
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
}
|
|
@@ -15,14 +15,13 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async run() {
|
|
18
|
-
const project = await readProject(
|
|
18
|
+
const project = await readProject()
|
|
19
19
|
const { configFile } = project
|
|
20
20
|
await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`), project)
|
|
21
|
-
await this.runDependentMerging()
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
async runDependentMerging(context = {}) {
|
|
25
|
-
const project = await readProject(
|
|
24
|
+
const project = await readProject()
|
|
26
25
|
const { isJava, hasHelm, hasDestination, hasMta, srvPath, hasHtml5Repo } = project
|
|
27
26
|
|
|
28
27
|
if (hasMta) {
|
|
@@ -36,7 +35,6 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
if (hasHelm) {
|
|
39
|
-
//const env = await this.getEnv()
|
|
40
38
|
const binding = hasDestination && { srv: { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
41
39
|
const html5Binding = hasHtml5Repo && { 'html5-apps-deployer': { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
42
40
|
|
|
@@ -64,7 +62,7 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
64
62
|
|
|
65
63
|
// copy service instance chart if it is not present
|
|
66
64
|
const HelmTemplate = require(`../helm`);
|
|
67
|
-
const helmTemplate = new HelmTemplate(
|
|
65
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
68
66
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
69
67
|
|
|
70
68
|
// add dependency entry in chart.yaml
|
|
@@ -10,7 +10,7 @@ const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registr
|
|
|
10
10
|
module.exports = class EnterpriseMessagingTemplate extends require('../templateBase') {
|
|
11
11
|
|
|
12
12
|
async canRun() {
|
|
13
|
-
const { isJava } = await readProject(
|
|
13
|
+
const { isJava } = await readProject()
|
|
14
14
|
if (isJava) throw `'cds add enterprise-messaging' is not available for Java yet`
|
|
15
15
|
return true
|
|
16
16
|
}
|
|
@@ -20,14 +20,13 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async run() {
|
|
23
|
-
const project = await readProject(
|
|
23
|
+
const project = await readProject()
|
|
24
24
|
const { configFile } = project
|
|
25
25
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
26
|
-
await this.runDependentMerging()
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
async runDependentMerging(context = {}) {
|
|
30
|
-
const project = await readProject(
|
|
29
|
+
const project = await readProject()
|
|
31
30
|
const { hasXsuaa, hasHelm, hasMta, isNodejs, srvPath, appName } = project
|
|
32
31
|
|
|
33
32
|
if (hasMta) {
|
|
@@ -81,7 +80,7 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
81
80
|
|
|
82
81
|
// copy service instance chart if it is not present
|
|
83
82
|
const HelmTemplate = require(`../helm`);
|
|
84
|
-
const helmTemplate = new HelmTemplate(
|
|
83
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
85
84
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
86
85
|
|
|
87
86
|
// add dependency entry in chart.yaml
|
|
@@ -8,7 +8,7 @@ const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registr
|
|
|
8
8
|
module.exports = class EnterpriseMessagingSharedTemplate extends require('../templateBase') {
|
|
9
9
|
|
|
10
10
|
async canRun() {
|
|
11
|
-
const { hasMta, hasHelm, isJava } = await readProject(
|
|
11
|
+
const { hasMta, hasHelm, isJava } = await readProject()
|
|
12
12
|
if (isJava) throw `'cds add enterprise-messaging-shared' is not available for Java yet`
|
|
13
13
|
if (hasHelm && !hasMta) throw `'cds add enterprise-messaging-shared' is not available for Kyma yet`
|
|
14
14
|
return true
|
|
@@ -19,16 +19,15 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../tem
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
|
-
const project = await readProject(
|
|
22
|
+
const project = await readProject()
|
|
23
23
|
const { configFile } = project
|
|
24
24
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
25
25
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
26
26
|
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), project)
|
|
27
|
-
await this.runDependentMerging()
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
async runDependentMerging() {
|
|
31
|
-
const project = await readProject(
|
|
30
|
+
const project = await readProject()
|
|
32
31
|
const { hasMta, isNodejs, srvPath } = project
|
|
33
32
|
|
|
34
33
|
if (hasMta) {
|
|
@@ -21,14 +21,13 @@ module.exports = class ExtensibilityTemplate extends require('../templateBase')
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async run() {
|
|
24
|
-
const project = await readProject(
|
|
24
|
+
const project = await readProject()
|
|
25
25
|
const { configFile } = project
|
|
26
26
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
27
|
-
await this.runDependentMerging()
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
async runDependentMerging() {
|
|
31
|
-
const project = await readProject(
|
|
30
|
+
const project = await readProject()
|
|
32
31
|
const { hasXsuaa } = project
|
|
33
32
|
if (hasXsuaa) {
|
|
34
33
|
await mergeJSON(
|