@sap/cds-dk 9.4.1 → 9.4.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/bin/up.js +2 -2
  3. package/lib/build/plugins/helm/index.js +0 -1
  4. package/lib/init/constants.js +3 -1
  5. package/lib/init/index.js +4 -5
  6. package/lib/init/projectReader.js +64 -55
  7. package/lib/init/template/ams/index.js +7 -6
  8. package/lib/init/template/app-frontend/files/mta.yaml.hbs +0 -7
  9. package/lib/init/template/app-frontend/index.js +2 -2
  10. package/lib/init/template/application-logging/index.js +13 -10
  11. package/lib/init/template/approuter/index.js +15 -9
  12. package/lib/init/template/attachments/index.js +3 -3
  13. package/lib/init/template/audit-logging/index.js +4 -4
  14. package/lib/init/template/cloud-logging/index.js +13 -10
  15. package/lib/init/template/connectivity/index.js +3 -3
  16. package/lib/init/template/destination/index.js +6 -6
  17. package/lib/init/template/dynatrace/index.js +13 -10
  18. package/lib/init/template/enterprise-messaging/index.js +5 -5
  19. package/lib/init/template/enterprise-messaging-shared/index.js +4 -4
  20. package/lib/init/template/extensibility/index.js +2 -2
  21. package/lib/init/template/file-based-messaging/index.js +2 -2
  22. package/lib/init/template/github-actions/index.js +3 -3
  23. package/lib/init/template/hana/index.js +19 -22
  24. package/lib/init/template/helm/index.js +31 -22
  25. package/lib/init/template/html5-repo/files/containerize.yaml.hbs +0 -1
  26. package/lib/init/template/html5-repo/files/mta.yaml.hbs +3 -0
  27. package/lib/init/template/html5-repo/index.js +8 -6
  28. package/lib/init/template/http/index.js +31 -10
  29. package/lib/init/template/ias/files/mta.yaml.hbs +3 -0
  30. package/lib/init/template/ias/files/values.yaml.hbs +4 -1
  31. package/lib/init/template/ias/index.js +8 -8
  32. package/lib/init/template/kafka/index.js +3 -3
  33. package/lib/init/template/local-messaging/index.js +2 -2
  34. package/lib/init/template/malware-scanner/index.js +3 -7
  35. package/lib/init/template/mta/files/mta.yaml.hbs +10 -0
  36. package/lib/init/template/multitenancy/index.js +8 -10
  37. package/lib/init/template/notifications/index.js +2 -2
  38. package/lib/init/template/portal/files/mta.yaml.hbs +6 -0
  39. package/lib/init/template/portal/index.js +7 -7
  40. package/lib/init/template/postgres/index.js +4 -4
  41. package/lib/init/template/redis/index.js +2 -2
  42. package/lib/init/template/redis-messaging/index.js +2 -2
  43. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +2 -2
  44. package/lib/init/template/sample/files/javascript/admin-service.js.hbs +24 -0
  45. package/lib/init/template/sample/files/javascript/cat-service.js.hbs +43 -0
  46. package/lib/init/template/sample/files/typescript/admin-service.ts.hbs +16 -0
  47. package/lib/init/template/sample/files/typescript/cat-service.ts.hbs +31 -0
  48. package/lib/init/template/test/files/test/test.xs.hbs +1 -1
  49. package/lib/init/template/test/index.js +2 -2
  50. package/lib/init/template/tiny-sample/index.js +1 -1
  51. package/lib/init/template/workzone-standard/index.js +5 -6
  52. package/lib/init/template/xsuaa/files/mta.yaml.hbs +0 -2
  53. package/lib/init/template/xsuaa/index.js +23 -18
  54. package/lib/lint/eslintHelp.json +1 -1
  55. package/npm-shrinkwrap.json +9 -9
  56. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,24 @@ This project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/).
8
8
 
9
+ ## Version 9.4.2 - 2025-10-23
10
+
11
+ ### Changed
12
+
13
+ - `cds add containerize` does not add app module installations scripts to its `containerize.yaml`. Use `cds up --to k8s` instead.
14
+ - `cds add` is less eager with respect to changing unaffected configuration.
15
+ - `cds add ias` adds less unnecessary configuration in combination with the HTML5 repository.
16
+ - `cds add test` includes the service name in the test suite description.
17
+
18
+ ### Fixed
19
+
20
+ - `cds add ams` followed by `cds add mta` correctly generates the AMS deployer module.
21
+ - `cds add hana` does not fail if there's no `.cdsrc.json`.
22
+ - `cds up` doesn't try to create a symlink to the monorepo _package-lock.json_ if a submodule-local one already exists.
23
+ - `cds add test` creates correct OData URLs with unqualified entity names in service paths.
24
+ - `cds add http` skips contained composition targets.
25
+ - `cds add sample` no longer comes with an error when creating a Book through Fiori.
26
+
9
27
  ## Version 9.4.1 - 2025-10-09
10
28
 
11
29
  ### Added
package/bin/up.js CHANGED
@@ -52,7 +52,7 @@ async function up() {
52
52
  for (const { app } of apps) {
53
53
  const appPath = path.join(cds.root, cds.env.folders.app, app)
54
54
  if (exists(path.join(appPath, 'package.json')) && !exists(path.join(appPath, 'package-lock.json'))) {
55
- run(`npm i --package-lock-only --prefix ${appPath}`)
55
+ run(`npm i --prefix ${appPath}`)
56
56
  }
57
57
  }
58
58
 
@@ -91,7 +91,7 @@ async function up() {
91
91
  const target = path.join(process.cwd(), 'package-lock.json')
92
92
  if (exists(target) && fs.lstatSync(target).isSymbolicLink()) fs.unlinkSync(target)
93
93
  const relative = path.relative(process.cwd(), source)
94
- fs.symlinkSync(relative, target, 'junction')
94
+ if (!exists(target)) fs.symlinkSync(relative, target, 'junction')
95
95
  }
96
96
 
97
97
  if (cds.cli.options.to === 'k8s') {
@@ -66,7 +66,6 @@ module.exports = class HelmBuildPlugin extends Plugin {
66
66
  await this.copy(join(pluginResourcePath, 'connectivity/connectivity-proxy-info.yaml')).to('templates/connectivity-proxy-info.yaml')
67
67
  }
68
68
 
69
-
70
69
  if (hasHtml5Repo) {
71
70
  await this.copy(join(pluginResourcePath, 'html5-repo/html5-apps-deployer-configmap.yaml')).to('templates/html5-apps-deployer-configmap.yaml')
72
71
  }
@@ -5,7 +5,7 @@ module.exports = {
5
5
  COMMAND_ADD: 'add',
6
6
 
7
7
  JAVA_LTS_VERSIONS: [17, 21],
8
- MAVEN_ARCHETYPE_VERSION: '4.4.0',
8
+ MAVEN_ARCHETYPE_VERSION: '4.4.1',
9
9
 
10
10
  OPTIONS: Object.freeze({
11
11
  COMPLETION: 'completion',
@@ -57,6 +57,8 @@ module.exports = {
57
57
  APP_FRONTEND: 'app-frontend',
58
58
  PORTAL: 'portal',
59
59
  APPLICATION_LOGGING: 'application-logging',
60
+ CLOUD_LOGGING: 'cloud-logging',
61
+ TELEMETRY: 'telemetry',
60
62
  AUDIT_LOGGING: 'audit-logging',
61
63
  NOTIFICATIONS: 'notifications',
62
64
  WORKZONE: 'workzone',
package/lib/init/index.js CHANGED
@@ -161,9 +161,7 @@ module.exports = class CDSGenerator {
161
161
  if (!cds.cli.options.dry) console.log(`adding ${term.bold(facet)}`)
162
162
  const template = this.templateList[i]
163
163
  await template.run()
164
- await template.combine()
165
164
  }
166
-
167
165
  DEBUG && console.log()
168
166
  DEBUG && console.log('plugins active for production:')
169
167
  const fromDk = readdirSync(join(__dirname, './template'))
@@ -176,7 +174,7 @@ module.exports = class CDSGenerator {
176
174
  for (const plugin of sorted) {
177
175
  const Plugin = registered.get(plugin) ?? require('./template/' + plugin)
178
176
  const template = new Plugin()
179
- const inProduction = Plugin.hasInProduction(env4('production')) || cds.cli.argv.includes(plugin) || cds.cli.options.add?.has(plugin)
177
+ const inProduction = Plugin.hasInProduction(env4('production')) || cds.cli.argv[0]?.includes(plugin) || cds.cli.options.add?.has(plugin)
180
178
  DEBUG && console.log(inProduction ? '✅' : '❌', plugin)
181
179
  if (inProduction) await template.combine()
182
180
  }
@@ -236,8 +234,8 @@ module.exports = class CDSGenerator {
236
234
  if (plugin === 'appfront') plugin = 'app-front'
237
235
  if (plugin === 'helm' && cds.cli.options['internal-unified-runtime-charts']) {
238
236
  plugin = 'helm-unified-runtime'
239
- cds.cli.options.add.delete('helm')
240
- cds.cli.options.add.add('helm-unified-runtime')
237
+ cds.cli.options.add?.delete('helm')
238
+ cds.cli.options.add?.add('helm-unified-runtime')
241
239
  }
242
240
  if (plugin === 'sample-tiny') plugin = 'tiny-sample'
243
241
  if (plugin in { 'kibana-logging': 1, 'kibana': 1 }) plugin = 'application-logging'
@@ -250,6 +248,7 @@ module.exports = class CDSGenerator {
250
248
  if (await template.canRun()) {
251
249
  templates.set(plugin, template)
252
250
  const dependencies = await template.requires()
251
+ dependencies?.forEach(d => cds.cli.options.add?.add(d))
253
252
  dependencies?.forEach(d => plugins.add(d))
254
253
  } else {
255
254
  throw 'cannot run plugin \'' + plugin + '\'' + (DEBUG ? 'Does not satisfy the canRun() function:\n ' + template.canRun : '')
@@ -60,58 +60,6 @@ module.exports = new class ProjectReader {
60
60
  }
61
61
  }
62
62
 
63
- /**
64
- * @typedef {Object} ProjectConfig
65
- * @property {string} appVersion The version of the application.
66
- * @property {string} appName The name of the application.
67
- * @property {string} appId The ID of the application.
68
- * @property {string} appDescription The description of the application.
69
- * @property {'java' | 'nodejs'} language The programming language of the project.
70
- * @property {string} srvPath The path to the server module.
71
- * @property {string} archiveName The name of the archive.
72
- * @property {Object} db Database configuration.
73
- * @property {string} configFile The name of the configuration file. This is typically the `package.json` for Node.js and `.cdsrc.json` for Java.
74
- * @property {string} appPath The path to the app folder.
75
- * @property {string} approuterPath The path to the approuter folder.
76
- * @property {boolean} hasUIEmbedded Indicates if the project uses an embedded UI.
77
- * @property {boolean} hasUIModule Indicates if the project is using a modular UI.
78
- * @property {boolean} hasUI Indicates if the project has a UI.
79
- * @property {boolean} hasUI5 Indicates if the project is a UI5 project.
80
- * @property {boolean} isUI5 Indicates if the project is a UI5 project.
81
- * @property {boolean} isJava Indicates if the project is using Java.
82
- * @property {boolean} isNodejs Indicates if the project is using Node.js.
83
- * @property {boolean} isESM Indicates if the project is an ESM project (type 'module')
84
- * @property {boolean} hasEsmStyle Indicates if code supports ESM-style imports and exports. This is true for ESM and Typescript projects.
85
- * @property {boolean} isTypescript Indicates if the project is a Typescript project.
86
- * @property {boolean} hasTyper Indicates if code supports CDS typer.
87
- * @property {boolean} hasHelmUnifiedRuntime Indicates if the project uses Unified Runtime Helm deployment.
88
- * @property {boolean} hasHelm Indicates if the project uses CAP Helm deployment.
89
- * @property {boolean} hasMta Indicates if the project uses MTA deployment.
90
- * @property {boolean} hasConnectivity Indicates if the project uses connectivity.
91
- * @property {boolean} hasMultitenancy Indicates if the project is multitenant.
92
- * @property {boolean} hasToggles Indicates if the project uses feature toggles.
93
- * @property {boolean} hasExtensibility Indicates if the project is extensible.
94
- * @property {boolean} hasXsuaa Indicates if the project uses XSUAA.
95
- * @property {boolean} hasHana Indicates if the project uses HANA.
96
- * @property {boolean} hasPostgres Indicates if the project uses PostgreSQL.
97
- * @property {boolean} hasEnterpriseMessaging Indicates if the project uses SAP BTP Event Mesh.
98
- * @property {boolean} hasAttachments Indicates if the project uses SAP BTP Object Store Service.
99
- * @property {boolean} hasApprouter Indicates if the project uses the SAP Application Router.
100
- * @property {boolean} hasHtml5Repo Indicates if the project uses the SAP BTP HTML5 Application Repository.
101
- * @property {boolean} hasPortal Indicates if the project uses the SAP Cloud Portal service.
102
- * @property {boolean} hasWorkzoneStandard Indicates if the project uses the SAP Build Work Zone, Standard Edition service.
103
- * @property {boolean} hasDestination Indicates if the project uses the SAP BTP Destination service.
104
- * @property {boolean} hasMTXRoute Indicates if the approuter should have a multitenant route.
105
- * @property {boolean} hasMTXRouteJava Indicates if the approuter should have a multitenant subscription route (java).
106
- * @property {boolean} hasMalwareScanner Indicates if the project uses the SAP Malware Scanning service.
107
- * @property {boolean} hasDynatrace Indicates if the project uses Dynatrace.
108
- * @property {boolean} hasCloudLogging Indicates if the project uses Cloud Logging.
109
- * @property {String} extendsApp Indicates which project is extended if any.
110
- * @property {String} githubSlug GitHub org/repo.
111
- * @property {boolean} isMonorepoMicroservice Indicates if the project is a monorepo microservice.
112
- * @property {String} npmWorkspaceRoot The root path of the monorepo workspace.
113
- */
114
-
115
63
  /**
116
64
  * Reads the project configuration and constructs a project object.
117
65
  * This function dynamically resolves project properties and returns an object with these properties.
@@ -128,7 +76,7 @@ module.exports = new class ProjectReader {
128
76
  const _isESM = () => pkgJson().type === 'module'
129
77
  const _isTypescript = () => !!pkgJson().dependencies?.typescript || !!pkgJson().devDependencies?.typescript
130
78
  const _hasTyper = () => !!pkgJson().dependencies?.['@cap-js/cds-typer'] || !!pkgJson().devDependencies?.['@cap-js/cds-typer']
131
- const _inProd = plugin => require(`./template/${plugin}`).hasInProduction(env) || cds.cli.argv.includes(plugin) || cds.cli.options.add?.has(plugin)
79
+ const _inProd = plugin => require(`./template/${plugin}`).hasInProduction(env) || cds.cli.argv[0]?.includes(plugin) || cds.cli.options.add?.has(plugin)
132
80
  const _uiEmbedded = () => exists(join(env.folders.app, 'xs-app.json'))
133
81
  const _uiModule = () => !_uiEmbedded() && isdir(env.folders.app) && fs.readdirSync(resolve(cds.root, env.folders.app)).length > 0
134
82
  const _isJava = () => this.isJava
@@ -223,8 +171,15 @@ module.exports = new class ProjectReader {
223
171
  const defined = {}
224
172
  const _get = property => { const p = property
225
173
  if (p in reserved) return reserved[p]()
226
- for (const prefix of ['has', 'is']) if (p.startsWith(prefix) && p.length > prefix.length) {
227
- return _inProd(p.slice(prefix.length).replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase())
174
+ for (const prefix of ['has', 'is', 'add']) if (p.startsWith(prefix) && p.length > prefix.length) {
175
+ const facet = p.slice(prefix.length).replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
176
+ const inProd = _inProd(facet)
177
+ if (prefix === 'add') {
178
+ const adding = facet => cds.cli.argv[0]?.includes(facet) || cds.cli.options.add?.has(facet)
179
+ const caller = new Error().stack.split('\n')[3].replace(/\\/g, '/').match(/lib\/init\/template\/([^/]+)\/index\.js/)[1]
180
+ return inProd && (adding(facet) || adding(caller))
181
+ }
182
+ return inProd
228
183
  }
229
184
  }
230
185
  return new Proxy({}, {
@@ -288,3 +243,57 @@ function _normalizeSpringBootCfg(obj) {
288
243
  })
289
244
  return obj
290
245
  }
246
+
247
+ /* Types */
248
+
249
+ /**
250
+ * @typedef {Object} ProjectConfig
251
+ * @property {string} appVersion The version of the application.
252
+ * @property {string} appName The name of the application.
253
+ * @property {string} appId The ID of the application.
254
+ * @property {string} appDescription The description of the application.
255
+ * @property {'java' | 'nodejs'} language The programming language of the project.
256
+ * @property {string} srvPath The path to the server module.
257
+ * @property {string} archiveName The name of the archive.
258
+ * @property {Object} db Database configuration.
259
+ * @property {string} configFile The name of the configuration file. This is typically the `package.json` for Node.js and `.cdsrc.json` for Java.
260
+ * @property {string} appPath The path to the app folder.
261
+ * @property {string} approuterPath The path to the approuter folder.
262
+ * @property {boolean} hasUIEmbedded Indicates if the project uses an embedded UI.
263
+ * @property {boolean} hasUIModule Indicates if the project is using a modular UI.
264
+ * @property {boolean} hasUI Indicates if the project has a UI.
265
+ * @property {boolean} hasUI5 Indicates if the project is a UI5 project.
266
+ * @property {boolean} isUI5 Indicates if the project is a UI5 project.
267
+ * @property {boolean} isJava Indicates if the project is using Java.
268
+ * @property {boolean} isNodejs Indicates if the project is using Node.js.
269
+ * @property {boolean} isESM Indicates if the project is an ESM project (type 'module')
270
+ * @property {boolean} hasEsmStyle Indicates if code supports ESM-style imports and exports. This is true for ESM and Typescript projects.
271
+ * @property {boolean} isTypescript Indicates if the project is a Typescript project.
272
+ * @property {boolean} hasTyper Indicates if code supports CDS typer.
273
+ * @property {boolean} hasHelmUnifiedRuntime Indicates if the project uses Unified Runtime Helm deployment.
274
+ * @property {boolean} hasHelm Indicates if the project uses CAP Helm deployment.
275
+ * @property {boolean} hasMta Indicates if the project uses MTA deployment.
276
+ * @property {boolean} hasConnectivity Indicates if the project uses connectivity.
277
+ * @property {boolean} hasMultitenancy Indicates if the project is multitenant.
278
+ * @property {boolean} hasToggles Indicates if the project uses feature toggles.
279
+ * @property {boolean} hasExtensibility Indicates if the project is extensible.
280
+ * @property {boolean} hasXsuaa Indicates if the project uses XSUAA.
281
+ * @property {boolean} hasHana Indicates if the project uses HANA.
282
+ * @property {boolean} hasPostgres Indicates if the project uses PostgreSQL.
283
+ * @property {boolean} hasEnterpriseMessaging Indicates if the project uses SAP BTP Event Mesh.
284
+ * @property {boolean} hasAttachments Indicates if the project uses SAP BTP Object Store Service.
285
+ * @property {boolean} hasApprouter Indicates if the project uses the SAP Application Router.
286
+ * @property {boolean} hasHtml5Repo Indicates if the project uses the SAP BTP HTML5 Application Repository.
287
+ * @property {boolean} hasPortal Indicates if the project uses the SAP Cloud Portal service.
288
+ * @property {boolean} hasWorkzoneStandard Indicates if the project uses the SAP Build Work Zone, Standard Edition service.
289
+ * @property {boolean} hasDestination Indicates if the project uses the SAP BTP Destination service.
290
+ * @property {boolean} hasMTXRoute Indicates if the approuter should have a multitenant route.
291
+ * @property {boolean} hasMTXRouteJava Indicates if the approuter should have a multitenant subscription route (java).
292
+ * @property {boolean} hasMalwareScanner Indicates if the project uses the SAP Malware Scanning service.
293
+ * @property {boolean} hasDynatrace Indicates if the project uses Dynatrace.
294
+ * @property {boolean} hasCloudLogging Indicates if the project uses Cloud Logging.
295
+ * @property {String} extendsApp Indicates which project is extended if any.
296
+ * @property {String} githubSlug GitHub org/repo.
297
+ * @property {boolean} isMonorepoMicroservice Indicates if the project is a monorepo microservice.
298
+ * @property {String} npmWorkspaceRoot The root path of the monorepo workspace.
299
+ */
@@ -14,7 +14,8 @@ module.exports = class AmsTemplate extends require('../../plugin') {
14
14
  }
15
15
 
16
16
  static hasInProduction(env) {
17
- return env.requires?.auth?.ams || readProject().devDependencies?.['@sap/ams']
17
+ const { dependencies, devDependencies } = readProject()
18
+ return env.requires?.auth?.ams || devDependencies?.['@sap/ams-dev'] || dependencies?.['@sap/ams']
18
19
  }
19
20
 
20
21
  async run() {
@@ -27,21 +28,21 @@ module.exports = class AmsTemplate extends require('../../plugin') {
27
28
 
28
29
  async combine() {
29
30
  const project = readProject()
30
- const { hasMta, hasCfManifest, hasHelm, hasHelmUnifiedRuntime, hasContainerize } = project
31
+ const { addMta, addCfManifest, addHelm, addHelmUnifiedRuntime, addContainerize } = project
31
32
 
32
- if (hasMta) {
33
+ if (addMta) {
33
34
  await this.#combineWithMta(project)
34
35
  }
35
36
 
36
- if (hasCfManifest) {
37
+ if (addCfManifest) {
37
38
  await this.#combineWithCfManifest(project)
38
39
  }
39
40
 
40
- if (hasHelm || hasHelmUnifiedRuntime) {
41
+ if (addHelm || addHelmUnifiedRuntime) {
41
42
  await this.#combineWithHelm(project)
42
43
  }
43
44
 
44
- if (hasContainerize) {
45
+ if (addContainerize) {
45
46
  await this.#combineWithContainerize(project)
46
47
  }
47
48
  }
@@ -29,13 +29,6 @@ modules:
29
29
  {{#hasXsuaa}}
30
30
  - name: {{appName}}-auth
31
31
  {{/hasXsuaa}}
32
- {{#hasIas}}
33
- - name: {{appName}}-ias
34
- parameters:
35
- config:
36
- credential-type: X509_GENERATED
37
- app-identifier: app-deployer
38
- {{/hasIas}}
39
32
  - name: {{appName}}-app-front
40
33
  parameters:
41
34
  content-target: true
@@ -49,7 +49,7 @@ module.exports = class extends require('../../plugin') {
49
49
 
50
50
  async combine() {
51
51
  const project = readProject()
52
- const { srvPath, appPath, hasMta, apps } = project
52
+ const { srvPath, appPath, addMta, apps } = project
53
53
 
54
54
  await Promise.all(apps.map(async ({ app }) => {
55
55
  project.app = app
@@ -63,7 +63,7 @@ module.exports = class extends require('../../plugin') {
63
63
  // await merge({ cds: { requires: { 'app-front':true } } }).into('mtx/sidecar/package.json')
64
64
  // }
65
65
 
66
- if (hasMta) {
66
+ if (addMta) {
67
67
  const srv = srv4(srvPath)
68
68
  project.apps = apps
69
69
  const appModules = project.apps.map(app => ({
@@ -28,16 +28,19 @@ module.exports = class ApplicationLoggingTemplate extends require('../../plugin'
28
28
 
29
29
  async combine() {
30
30
  const project = readProject()
31
- const { hasMta, hasApprouter, isJava, hasMultitenancy, srvPath } = project
31
+ const { addMta, addApprouter, isJava, addMultitenancy, srvPath } = project
32
32
 
33
- if (hasMta) {
34
- const srv = srv4(srvPath)
35
- const additions = [srv, applicationLogging]
36
- const relationships = [{
37
- insert: [applicationLogging, 'name'],
38
- into: [srv, 'requires', 'name']
39
- }]
40
- if (hasMultitenancy) {
33
+ if (addMta || addMultitenancy) {
34
+ const additions = [], relationships = []
35
+ if (addMta) {
36
+ const srv = srv4(srvPath)
37
+ additions.push(srv, applicationLogging)
38
+ relationships.push({
39
+ insert: [applicationLogging, 'name'],
40
+ into: [srv, 'requires', 'name']
41
+ })
42
+ }
43
+ if (addMultitenancy) {
41
44
  const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
42
45
  additions.push(mtxSidecar)
43
46
  relationships.push({
@@ -45,7 +48,7 @@ module.exports = class ApplicationLoggingTemplate extends require('../../plugin'
45
48
  into: [mtxSidecar, 'requires', 'name']
46
49
  })
47
50
  }
48
- if (hasApprouter) {
51
+ if (addApprouter) {
49
52
  additions.push(approuter)
50
53
  relationships.push({
51
54
  insert: [applicationLogging, 'name'],
@@ -31,17 +31,23 @@ module.exports = class ApprouterTemplate extends require('../../plugin') {
31
31
  }
32
32
 
33
33
  async combine() {
34
- const project = readProject(this.options)
35
- const { isNodejs, isJava, hasMTXRoute, hasMultitenancy, hasXsuaa, hasMta, hasHelm, hasHelmUnifiedRuntime, hasMTXRouteJava, hasContainerize, srvPath, approuterPath } = project
34
+ const project = readProject()
35
+ const {
36
+ isNodejs, isJava,
37
+ addXsuaa, hasXsuaa, addMultitenancy, hasMTXRoute, hasMTXRouteJava,
38
+ addMta, addHelm, addHelmUnifiedRuntime, hasMta, hasHelm, hasHelmUnifiedRuntime,
39
+ addContainerize, srvPath, approuterPath
40
+ } = project
36
41
 
37
- if (hasMta) {
42
+
43
+ if (addMta || (addMultitenancy || addXsuaa) && hasMta) {
38
44
  const srv = srv4(srvPath)
39
- const apis = isJava && hasMultitenancy ? [requiredJavaApprouterApi4(srv), providedJavaApprouterApi] : []
45
+ const apis = isJava && addMultitenancy ? [requiredJavaApprouterApi4(srv), providedJavaApprouterApi] : []
40
46
  const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
41
- if (isNodejs && hasMultitenancy) apis.push(requiredMtxApi, requiredAppApi4(mtxSidecar), providedAppApi)
42
- if (isJava && hasMultitenancy) apis.push(requiredMtxApi)
47
+ if (isNodejs && addMultitenancy) apis.push(requiredMtxApi, requiredAppApi4(mtxSidecar), providedAppApi)
48
+ if (isJava && addMultitenancy) apis.push(requiredMtxApi)
43
49
  const modules = [srv, approuter]
44
- if (hasMultitenancy) modules.push(mtxSidecar)
50
+ if (addMultitenancy) modules.push(mtxSidecar)
45
51
  const additions = [...modules, ...apis]
46
52
  if (hasXsuaa) additions.push(xsuaa)
47
53
  const relationships = []
@@ -57,11 +63,11 @@ module.exports = class ApprouterTemplate extends require('../../plugin') {
57
63
  })
58
64
  }
59
65
 
60
- if (hasHelm || hasHelmUnifiedRuntime) {
66
+ if (addHelm || addHelmUnifiedRuntime || addMultitenancy && (hasHelm || hasHelmUnifiedRuntime)) {
61
67
  await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
62
68
  }
63
69
 
64
- if (hasContainerize) {
70
+ if (addContainerize) {
65
71
  const additions = [{
66
72
  in: 'modules',
67
73
  where: { name: `${project.appName}-approuter` }
@@ -26,9 +26,9 @@ module.exports = class AttachmentsTemplate extends require('../../plugin') {
26
26
 
27
27
  async combine() {
28
28
  const project = readProject()
29
- const { hasMta, hasHelm, hasHelmUnifiedRuntime, srvPath } = project
29
+ const { addMta, addHelm, addHelmUnifiedRuntime, srvPath } = project
30
30
 
31
- if (hasMta) {
31
+ if (addMta) {
32
32
  const srv = srv4(srvPath)
33
33
  const additions = [srv, attachments]
34
34
  const relationships = [{
@@ -40,7 +40,7 @@ module.exports = class AttachmentsTemplate extends require('../../plugin') {
40
40
  })
41
41
  }
42
42
 
43
- if (hasHelm || hasHelmUnifiedRuntime) {
43
+ if (addHelm || addHelmUnifiedRuntime) {
44
44
  await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
45
45
  }
46
46
  }
@@ -33,15 +33,15 @@ module.exports = class AuditLoggingTemplate extends require('../../plugin') {
33
33
 
34
34
  async combine() {
35
35
  const project = readProject()
36
- const { hasMta, hasHelm, hasMultitenancy, srvPath } = project
36
+ const { addMta, addHelm, addMultitenancy, srvPath } = project
37
37
  const { plan = 'premium' } = cds.cli.options
38
38
  project.servicePlan = plan
39
39
 
40
- if (hasMultitenancy) {
40
+ if (addMultitenancy) {
41
41
  await merge(__dirname, 'files/package.sidecar.json').into('mtx/sidecar/package.json')
42
42
  }
43
43
 
44
- if (hasMta) {
44
+ if (addMta) {
45
45
  const srv = srv4(srvPath)
46
46
  await merge(join(__dirname, 'files/mta.yaml.hbs')).into('mta.yaml', {
47
47
  with: project,
@@ -53,7 +53,7 @@ module.exports = class AuditLoggingTemplate extends require('../../plugin') {
53
53
  ]
54
54
  })
55
55
  }
56
- if (hasHelm) {
56
+ if (addHelm) {
57
57
  await merge({
58
58
  srv: { bindings: { auditlog: { serviceInstanceName: 'auditlog' }}},
59
59
  auditlog: {
@@ -37,9 +37,9 @@ module.exports = class extends require('../../plugin') {
37
37
 
38
38
  async combine() {
39
39
  const project = readProject()
40
- const { hasMta, hasHelm, hasHelmUnifiedRuntime, hasApprouter, isJava, hasMultitenancy, srvPath } = project
40
+ const { hasMta, addMta, addHelm, addHelmUnifiedRuntime, addApprouter, isJava, addMultitenancy, srvPath } = project
41
41
 
42
- if (hasMta) {
42
+ if (addMta || (addMultitenancy || addApprouter) && hasMta) {
43
43
  const cloudLogging = {
44
44
  in: 'resources',
45
45
  where: {
@@ -47,13 +47,16 @@ module.exports = class extends require('../../plugin') {
47
47
  'parameters.service': 'cloud-logging'
48
48
  }
49
49
  }
50
+ const additions = [cloudLogging], relationships = []
50
51
  const srv = srv4(srvPath)
51
- const additions = [srv, cloudLogging]
52
- const relationships = [{
53
- insert: [cloudLogging, 'name'],
54
- into: [srv, 'requires', 'name']
55
- }]
56
- if (hasMultitenancy) {
52
+ if (addMta) {
53
+ additions.push(srv)
54
+ relationships.push({
55
+ insert: [cloudLogging, 'name'],
56
+ into: [srv, 'requires', 'name']
57
+ })
58
+ }
59
+ if (addMultitenancy) {
57
60
  const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
58
61
  additions.push(mtxSidecar)
59
62
  relationships.push({
@@ -61,7 +64,7 @@ module.exports = class extends require('../../plugin') {
61
64
  into: [mtxSidecar, 'requires', 'name']
62
65
  })
63
66
  }
64
- if (hasApprouter) {
67
+ if (addApprouter) {
65
68
  additions.push(approuter)
66
69
  relationships.push({
67
70
  insert: [cloudLogging, 'name'],
@@ -74,7 +77,7 @@ module.exports = class extends require('../../plugin') {
74
77
  with: project, additions, relationships
75
78
  })
76
79
  }
77
- if (hasHelm || hasHelmUnifiedRuntime) {
80
+ if (addHelm || addHelmUnifiedRuntime) {
78
81
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml')
79
82
  }
80
83
  }
@@ -20,9 +20,9 @@ module.exports = class ConnectivityTemplate extends require('../../plugin') {
20
20
 
21
21
  async combine() {
22
22
  const project = readProject()
23
- const { srvPath, hasHelm, hasHelmUnifiedRuntime, hasMta } = project
23
+ const { srvPath, addHelm, addHelmUnifiedRuntime, addMta } = project
24
24
 
25
- if (hasMta) {
25
+ if (addMta) {
26
26
  const srv = srv4(srvPath)
27
27
  const additions = [srv, connectivity]
28
28
  const relationships = [{
@@ -32,7 +32,7 @@ module.exports = class ConnectivityTemplate extends require('../../plugin') {
32
32
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions, relationships })
33
33
  }
34
34
 
35
- if (hasHelm || hasHelmUnifiedRuntime) {
35
+ if (addHelm || addHelmUnifiedRuntime) {
36
36
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', {
37
37
  project,
38
38
  additions: [{
@@ -24,26 +24,26 @@ module.exports = class DestinationTemplate extends require('../../plugin') {
24
24
 
25
25
  async combine() {
26
26
  const project = readProject()
27
- const { hasHelm, hasApprouter, hasMultitenancy, hasHelmUnifiedRuntime, hasMta, srvPath, isJava } = project
27
+ const { addHelm, addApprouter, addMultitenancy, addHelmUnifiedRuntime, addMta, hasMta, srvPath, isJava } = project
28
28
 
29
- if (hasMultitenancy) {
29
+ if (addMultitenancy) {
30
30
  await merge({ cds: { requires: { destinations:true } } }).into('mtx/sidecar/package.json')
31
31
  }
32
32
 
33
- if (hasMta) {
33
+ if (addMta || (addApprouter || addMultitenancy) && hasMta) {
34
34
  const srv = srv4(srvPath)
35
35
  const additions = [srv, destination]
36
36
  const relationships = [{
37
37
  insert: [destination, 'name'],
38
38
  into: [srv, 'requires', 'name']
39
39
  }]
40
- if (hasApprouter) {
40
+ if (addApprouter) {
41
41
  relationships.push({
42
42
  insert: [destination, 'name'],
43
43
  into: [approuter, 'requires', 'name']
44
44
  })
45
45
  }
46
- if (hasMultitenancy) {
46
+ if (addMultitenancy) {
47
47
  relationships.push({
48
48
  insert: [destination, 'name'],
49
49
  into: [mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar'), 'requires', 'name']
@@ -52,7 +52,7 @@ module.exports = class DestinationTemplate extends require('../../plugin') {
52
52
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { with: project, additions, relationships })
53
53
  }
54
54
 
55
- if (hasHelm || hasHelmUnifiedRuntime) {
55
+ if (addHelm || addHelmUnifiedRuntime) {
56
56
  await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
57
57
  }
58
58
  }
@@ -24,9 +24,9 @@ module.exports = class extends require('../../plugin') {
24
24
 
25
25
  async combine() {
26
26
  const project = readProject()
27
- const { appName, hasMta, hasHelm, hasHelmUnifiedRuntime, isJava, hasMultitenancy, srvPath } = project
27
+ const { appName, addMta, addHelm, addHelmUnifiedRuntime, isJava, addMultitenancy, srvPath } = project
28
28
 
29
- if (hasMta) {
29
+ if (addMta || addMultitenancy) {
30
30
  const dynatrace = {
31
31
  in: 'resources',
32
32
  where: {
@@ -34,13 +34,16 @@ module.exports = class extends require('../../plugin') {
34
34
  'parameters.service': 'dynatrace'
35
35
  }
36
36
  }
37
- const srv = srv4(srvPath)
38
- const additions = [srv, dynatrace]
39
- const relationships = [{
40
- insert: [dynatrace, 'name'],
41
- into: [srv, 'requires', 'name']
42
- }]
43
- if (hasMultitenancy) {
37
+ const additions = [dynatrace], relationships = []
38
+ if (addMta) {
39
+ const srv = srv4(srvPath)
40
+ additions.push(srv)
41
+ relationships.push({
42
+ insert: [dynatrace, 'name'],
43
+ into: [srv, 'requires', 'name']
44
+ })
45
+ }
46
+ if (addMultitenancy) {
44
47
  const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
45
48
  additions.push(mtxSidecar)
46
49
  relationships.push({
@@ -54,7 +57,7 @@ module.exports = class extends require('../../plugin') {
54
57
  })
55
58
  }
56
59
 
57
- if (hasHelm || hasHelmUnifiedRuntime) {
60
+ if (addHelm || addHelmUnifiedRuntime) {
58
61
  await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
59
62
  }
60
63
  }