@sap/cds-dk 7.4.1 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/activate.js +1 -1
- package/bin/add.js +6 -4
- package/bin/build.js +4 -6
- package/bin/cds.js +4 -1
- package/bin/deploy/index.js +5 -2
- package/bin/eval.js +1 -1
- package/bin/extend.js +3 -3
- package/bin/login.js +2 -2
- package/bin/logout.js +1 -1
- package/bin/pull.js +1 -1
- package/bin/push.js +2 -2
- package/bin/subscribe.js +2 -2
- package/bin/unsubscribe.js +2 -2
- package/bin/upgrade.js +2 -2
- package/bin/version.js +2 -2
- package/bin/watch.js +1 -1
- package/lib/bind/bindingUtil.js +2 -1
- package/lib/bind/cfKeyProvider.js +1 -1
- package/lib/bind/userCdsrcJsonStorageProvider.js +1 -1
- package/lib/build/buildPlugin.js +6 -12
- package/lib/build/buildTaskEngine.js +24 -19
- package/lib/build/buildTaskFactory.js +27 -33
- package/lib/build/buildTaskProvider.js +1 -1
- package/lib/build/buildTaskProviderFactory.js +26 -41
- package/lib/build/constants.js +0 -1
- package/lib/build/index.js +3 -3
- package/lib/build/plugins.js +15 -15
- package/lib/build/provider/edmxBuildPlugin.js +6 -7
- package/lib/build/provider/fiori/index.js +8 -8
- package/lib/build/provider/hana/2migration.js +12 -16
- package/lib/build/provider/hana/index.js +5 -7
- package/lib/build/provider/hana/template/package.json +1 -1
- package/lib/build/provider/internalBuildPlugin.js +0 -8
- package/lib/build/provider/internalBuildTaskProvider.js +17 -21
- package/lib/build/provider/java/index.js +2 -1
- package/lib/build/provider/mtx-extension/index.js +3 -3
- package/lib/build/provider/mtx-sidecar/index.js +2 -1
- package/lib/build/provider/nodejs/index.js +6 -5
- package/lib/compile/openapi/csdl2openapi.js +29 -15
- package/lib/compile/openapi/index.js +6 -6
- package/lib/deploy/to-hana/hana.js +2 -2
- package/lib/env/schema.js +2 -3
- package/lib/index.js +68 -28
- package/lib/init/add.js +17 -0
- package/lib/init/constants.js +5 -3
- package/lib/init/index.js +39 -25
- package/lib/init/{util/merge.js → merge.js} +32 -20
- package/lib/init/{util/mvn.js → mvn.js} +5 -5
- package/lib/init/plugin.js +85 -0
- package/lib/init/projectReader.js +145 -0
- package/lib/init/registries/mta.js +151 -0
- package/lib/init/template/{kibana → application-logging}/files/mta.yaml.hbs +3 -3
- package/lib/init/template/application-logging/index.js +49 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +11 -11
- package/lib/init/template/approuter/files/xs-app.json.hbs +2 -2
- package/lib/init/template/approuter/index.js +36 -81
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +3 -3
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +4 -4
- package/lib/init/template/cf-manifest/index.js +4 -4
- package/lib/init/template/connectivity/index.js +22 -35
- package/lib/init/template/data/index.js +3 -2
- package/lib/init/template/destination/files/values.yaml +9 -0
- package/lib/init/template/destination/index.js +15 -47
- package/lib/init/template/enterprise-messaging/index.js +26 -58
- package/lib/init/template/enterprise-messaging-shared/index.js +23 -39
- package/lib/init/template/extensibility/index.js +16 -30
- package/lib/init/template/file-based-messaging/index.js +7 -8
- package/lib/init/template/h2/index.js +4 -4
- package/lib/init/template/hana/files/mta.yaml.hbs +8 -8
- package/lib/init/template/hana/index.js +29 -115
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +12 -0
- package/lib/init/template/helm/files/chart/templates/_deployment_helpers.tpl +82 -0
- package/lib/init/template/helm/files/chart/templates/_helpers.tpl +28 -0
- package/lib/init/template/helm/files/chart/values.root.schema.json +61 -0
- package/lib/init/template/helm/files/chart/values.schema.json +366 -0
- package/lib/init/template/helm/{subcharts → files}/web-application/Chart.yaml +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/templates/_api.tpl +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/values.yaml +1 -1
- package/lib/init/template/helm/index.js +84 -85
- package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +10 -0
- package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +26 -0
- package/lib/init/template/helm-unified-runtime/index.js +91 -0
- package/lib/init/template/helm-unified-runtime/lib/build.js +0 -0
- package/lib/init/template/helm-unified-runtime/package.json +4 -0
- package/lib/init/template/html5-repo/files/values.yaml.hbs +28 -0
- package/lib/init/template/html5-repo/index.js +23 -97
- package/lib/init/template/java/index.js +3 -3
- package/lib/init/template/lint/index.js +2 -2
- package/lib/init/template/liquibase/index.js +16 -0
- package/lib/init/template/local-messaging/index.js +7 -8
- package/lib/init/template/mta/index.js +7 -19
- package/lib/init/template/mtx/index.js +2 -2
- package/lib/init/template/multitenancy/index.js +38 -89
- package/lib/init/template/nodejs/index.js +5 -4
- package/lib/init/template/notebook/index.js +1 -1
- package/lib/init/template/notifications/index.js +16 -19
- package/lib/init/template/pipeline/index.js +1 -1
- package/lib/init/template/postgres/index.js +25 -31
- package/lib/init/template/redis-messaging/index.js +23 -27
- package/lib/init/template/sample/index.js +4 -4
- package/lib/init/template/samples/index.js +2 -2
- package/lib/init/template/sqlite/files/{package.json.hbs → package.json} +0 -2
- package/lib/init/template/sqlite/index.js +6 -10
- package/lib/init/template/tiny-sample/index.js +6 -6
- package/lib/init/template/toggles/index.js +7 -8
- package/lib/init/template/typer/index.js +6 -6
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/index.js +27 -52
- package/lib/init/{util/template.js → template.js} +1 -1
- package/lib/{client → mtx}/activate.js +15 -11
- package/lib/{client → mtx}/auth_manager.js +5 -4
- package/lib/{client → mtx}/download_legacy.js +6 -4
- package/lib/{client → mtx}/extend.js +14 -9
- package/lib/{client → mtx}/index.js +1 -1
- package/lib/{client → mtx}/params.js +3 -1
- package/lib/{client → mtx}/pull.js +6 -4
- package/lib/{client → mtx}/push.js +10 -9
- package/lib/{client → mtx}/settings_manager.js +8 -6
- package/lib/{client → mtx}/tenant_action.js +9 -8
- package/lib/{client/helper/cf_helper.js → mtx/util/cf.js} +4 -3
- package/lib/{client/helper/dependency_helper.js → mtx/util/dependencies.js} +1 -0
- package/lib/mtx/util/errors.js +27 -0
- package/lib/mtx/util/legacy_ext.js +16 -0
- package/lib/{client/helper/url_helper.js → mtx/util/urls.js} +12 -1
- package/lib/util/fs.js +5 -1
- package/lib/util/pruneAxiosErrors.js +35 -18
- package/lib/util/write.js +1 -1
- package/npm-shrinkwrap.json +310 -270
- package/package.json +1 -1
- package/lib/client/base_command.js +0 -54
- package/lib/init/template/_merging/registry-mta.js +0 -304
- package/lib/init/template/helm/Model.d.ts +0 -53
- package/lib/init/template/kibana/files/package.json.hbs +0 -17
- package/lib/init/template/kibana/index.js +0 -54
- package/lib/init/template/templateBase.js +0 -100
- package/lib/init/util/md5.js +0 -86
- package/lib/init/util/projectReader.js +0 -94
- /package/lib/init/{util/indent.js → indent.js} +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/job.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/serviceinstance.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/NOTES.txt +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/api-rule.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/deployment.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/network-policy.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/pod-disruption-budget.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/rbac.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/virtual-service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/values.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/NOTES.txt +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_deployment_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.root.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.schema.json +0 -0
- /package/lib/init/template/postgres/files/{mta.yaml.hbs → mta.yml.hbs} +0 -0
- /package/lib/init/{util/xml.js → xml.js} +0 -0
- /package/lib/{client/helper/env_helper.js → mtx/util/env.js} +0 -0
- /package/lib/{client/helper/fs_helper.js → mtx/util/fs.js} +0 -0
- /package/lib/{client/helper → mtx/util}/logging.js +0 -0
- /package/lib/{client/helper → mtx/util}/question.js +0 -0
- /package/lib/{client/helper/string_helper.js → mtx/util/strings.js} +0 -0
- /package/lib/util/{cfUtil.js → cf.js} +0 -0
- /package/lib/util/{gitUtil.js → git.js} +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const cds = require('../../..')
|
|
2
|
+
const { copy, rimraf, exists } = cds.utils
|
|
3
|
+
const { join } = require('path')
|
|
4
|
+
|
|
5
|
+
// cds.build?.register('helm-unified-runtime', {
|
|
6
|
+
// impl: '@cap-js-community/helm-unified-runtime/lib/build.js'
|
|
7
|
+
// })
|
|
8
|
+
|
|
9
|
+
const { merge, readProject } = cds.add ?? {}
|
|
10
|
+
|
|
11
|
+
module.exports = class HelmUnifiedRuntimeTemplate extends cds.add.Plugin {
|
|
12
|
+
|
|
13
|
+
async canRun() {
|
|
14
|
+
if (cds.cli.options.force) {
|
|
15
|
+
await rimraf(join('chart'))
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static hasInProduction() {
|
|
22
|
+
return exists(join('chart', 'values.yaml')) && !exists(join('chart', 'charts', 'web-application')) || cds.cli.options.add.has('helm-unified-runtime')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async run() {
|
|
26
|
+
const project = readProject()
|
|
27
|
+
|
|
28
|
+
await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { with: project })
|
|
29
|
+
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
30
|
+
|
|
31
|
+
await copy(join(__dirname, 'files', 'templates')).to('chart/templates') // REVISIT: Move to build
|
|
32
|
+
await copy(join(__dirname, 'files', 'values.schema.json')).to('chart/values.schema.json') // REVISIT: Move to build (if possible)
|
|
33
|
+
await copy(join(__dirname, 'files', 'values.root.schema.json')).to('chart/values.root.schema.json') // REVISIT: Move to build (if possible)
|
|
34
|
+
|
|
35
|
+
await this._mergeDependency('web-application', 'srv')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async combine() {
|
|
39
|
+
const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter } = readProject()
|
|
40
|
+
|
|
41
|
+
if (hasApprouter) {
|
|
42
|
+
await this._mergeDependency('web-application', 'approuter')
|
|
43
|
+
}
|
|
44
|
+
if (hasHtml5Repo) {
|
|
45
|
+
await this._mergeDependency('service-instance', 'html5-apps-repo-host')
|
|
46
|
+
await this._mergeDependency('content-deployment', 'html5-apps-deployer')
|
|
47
|
+
if (hasApprouter) {
|
|
48
|
+
await this._mergeDependency('service-instance', 'html5-apps-repo-runtime')
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (hasMultitenancy) {
|
|
52
|
+
await this._mergeDependency('web-application', 'sidecar')
|
|
53
|
+
await this._mergeDependency('service-instance', 'saas-registry')
|
|
54
|
+
}
|
|
55
|
+
if (hasDestination) {
|
|
56
|
+
await this._mergeDependency('service-instance', 'destination')
|
|
57
|
+
}
|
|
58
|
+
if (hasEnterpriseMessaging) {
|
|
59
|
+
await this._mergeDependency('service-instance', 'event-mesh')
|
|
60
|
+
}
|
|
61
|
+
if (hasXsuaa) {
|
|
62
|
+
await this._mergeDependency('service-instance', 'xsuaa')
|
|
63
|
+
}
|
|
64
|
+
if (hasHana) {
|
|
65
|
+
if (hasMultitenancy) {
|
|
66
|
+
await this._mergeDependency('service-instance', 'service-manager')
|
|
67
|
+
} else {
|
|
68
|
+
await this._mergeDependency('service-instance', 'hana')
|
|
69
|
+
await this._mergeDependency('content-deployment', 'hana-deployer')
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async _mergeDependency(name, alias) {
|
|
75
|
+
const project = readProject()
|
|
76
|
+
await merge({
|
|
77
|
+
dependencies: [{
|
|
78
|
+
name,
|
|
79
|
+
alias,
|
|
80
|
+
version: '>0.0.0',
|
|
81
|
+
repository: 'https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz'
|
|
82
|
+
}]
|
|
83
|
+
}).into('chart/Chart.yaml', {
|
|
84
|
+
with: project,
|
|
85
|
+
additions: [{
|
|
86
|
+
in: 'dependencies',
|
|
87
|
+
where: { alias }
|
|
88
|
+
}]}
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
html5-apps-repo-host:
|
|
3
|
+
serviceOfferingName: html5-apps-repo
|
|
4
|
+
servicePlanName: app-host
|
|
5
|
+
html5-apps-deployer:
|
|
6
|
+
env:
|
|
7
|
+
SAP_CLOUD_SERVICE: null
|
|
8
|
+
image:
|
|
9
|
+
repository: "<your-container-registry>/{{appName}}-html5-deployer"
|
|
10
|
+
tag: latest
|
|
11
|
+
bindings:
|
|
12
|
+
xsuaa:
|
|
13
|
+
serviceInstanceName: xsuaa
|
|
14
|
+
destination:
|
|
15
|
+
serviceInstanceName: destination
|
|
16
|
+
html5-apps-repo:
|
|
17
|
+
serviceInstanceName: html5-apps-repo-host
|
|
18
|
+
resources:
|
|
19
|
+
limits:
|
|
20
|
+
cpu: 2000m
|
|
21
|
+
memory: 1G
|
|
22
|
+
requests:
|
|
23
|
+
cpu: 1000m
|
|
24
|
+
memory: 1G
|
|
25
|
+
backendDestinations: {}
|
|
26
|
+
destination:
|
|
27
|
+
parameters:
|
|
28
|
+
HTML5Runtime_enabled: true
|
|
@@ -1,117 +1,43 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
|
-
const { exists } = require('../../../cds').utils
|
|
3
|
-
const { readProject } = require('../../
|
|
4
|
-
const {
|
|
5
|
-
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
6
|
-
const { DESTINATION } = require('../../constants').OPTIONS
|
|
2
|
+
const { exists, copy } = require('../../../cds').utils
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
7
5
|
|
|
8
|
-
module.exports = class Html5RepoTemplate extends require('
|
|
6
|
+
module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return [DESTINATION]
|
|
8
|
+
requires() {
|
|
9
|
+
return ['destination']
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
async canRun() {
|
|
16
|
-
const project =
|
|
17
|
-
const { hasMta, hasHelm } = project
|
|
18
|
-
if (!hasHelm && hasMta) {
|
|
13
|
+
const project = readProject()
|
|
14
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime } = project
|
|
15
|
+
if (!(hasHelm || hasHelmUnifiedRuntime) && hasMta) {
|
|
19
16
|
throw `'cds add html5-repo' is not available for Cloud Foundry yet`
|
|
20
17
|
}
|
|
21
18
|
return true
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
static
|
|
21
|
+
static hasInProduction() {
|
|
25
22
|
// REVISIT: Should be detectable without helm charts
|
|
26
23
|
return exists(join('chart', 'templates', 'html5-apps-deployer-configmap.yaml'))
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
async
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
if (hasHelm) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await mergeYAML(
|
|
40
|
-
join('chart', 'values.yaml'),
|
|
41
|
-
{
|
|
42
|
-
'html5-apps-repo-host': {
|
|
43
|
-
serviceOfferingName: 'html5-apps-repo',
|
|
44
|
-
servicePlanName: 'app-host'
|
|
45
|
-
},
|
|
46
|
-
'html5-apps-deployer': {
|
|
47
|
-
env: {
|
|
48
|
-
SAP_CLOUD_SERVICE: null
|
|
49
|
-
},
|
|
50
|
-
envFrom: [
|
|
51
|
-
{
|
|
52
|
-
configMapRef: {
|
|
53
|
-
name: "{{ .Release.Name }}-html5-apps-deployer-configmap"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
image: {
|
|
58
|
-
repository: `<your-container-registry>/${appName}-html5-deployer`,
|
|
59
|
-
tag: 'latest'
|
|
60
|
-
},
|
|
61
|
-
bindings: {
|
|
62
|
-
xsuaa: { serviceInstanceName: 'xsuaa' },
|
|
63
|
-
destination: { serviceInstanceName: 'destination' },
|
|
64
|
-
'html5-apps-repo': { serviceInstanceName: 'html5-apps-repo-host' }
|
|
65
|
-
},
|
|
66
|
-
resources: {
|
|
67
|
-
limits: { cpu: '2000m', memory: '1G' },
|
|
68
|
-
requests: { cpu: '1000m', memory: '1G' }
|
|
26
|
+
async combine() {
|
|
27
|
+
const project = readProject()
|
|
28
|
+
const { hasHelm, hasHelmUnifiedRuntime } = project
|
|
29
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
30
|
+
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
31
|
+
await merge({
|
|
32
|
+
'html5-apps-deployer': {
|
|
33
|
+
envFrom: [{
|
|
34
|
+
configMapRef: {
|
|
35
|
+
name: '{{ .Release.Name }}-html5-apps-deployer-configmap'
|
|
69
36
|
}
|
|
70
|
-
}
|
|
71
|
-
backendDestinations: {},
|
|
72
|
-
destination: {
|
|
73
|
-
parameters: {
|
|
74
|
-
HTML5Runtime_enabled: true
|
|
75
|
-
}
|
|
76
|
-
}
|
|
37
|
+
}]
|
|
77
38
|
}
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
// copy content deployment chart if it is not present
|
|
81
|
-
const HelmTemplate = require(`../helm`);
|
|
82
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
83
|
-
|
|
84
|
-
if (hasApprouter) {
|
|
85
|
-
await mergeYAML(
|
|
86
|
-
join('chart', 'values.yaml'),
|
|
87
|
-
{
|
|
88
|
-
'html5-apps-repo-runtime': {
|
|
89
|
-
serviceOfferingName: 'html5-apps-repo',
|
|
90
|
-
servicePlanName: 'app-runtime'
|
|
91
|
-
},
|
|
92
|
-
approuter: {
|
|
93
|
-
bindings: {
|
|
94
|
-
'html5-apps-repo-runtime': { serviceInstanceName: 'html5-apps-repo-runtime' }
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
}
|
|
98
|
-
)
|
|
99
|
-
await helmTemplate.addDependency('service-instance', 'html5-apps-repo-runtime');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('content-deployment');
|
|
103
|
-
|
|
104
|
-
// add dependency entry in chart.yaml
|
|
105
|
-
await helmTemplate.addDependency('content-deployment', 'html5-apps-deployer');
|
|
106
|
-
|
|
107
|
-
// copy service-instance chart
|
|
108
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
109
|
-
|
|
110
|
-
// add dependency entry in chart.yaml
|
|
111
|
-
await helmTemplate.addDependency('service-instance', 'html5-apps-repo-host');
|
|
112
|
-
|
|
113
|
-
await copyAndTrack(join(__dirname, 'files', 'html5-apps-deployer-configmap.yaml'), join('chart', 'templates', 'html5-apps-deployer-configmap.yaml'), context)
|
|
114
|
-
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
39
|
+
}).into('chart/values.yaml')
|
|
40
|
+
await copy(join(__dirname, 'files', 'html5-apps-deployer-configmap.yaml')).to('chart', 'templates', 'html5-apps-deployer-configmap.yaml')
|
|
115
41
|
}
|
|
116
42
|
}
|
|
117
43
|
}
|
|
@@ -2,13 +2,13 @@ const os = require('os')
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists, copy, rimraf, fs, path } = cds.utils, { join } = path
|
|
4
4
|
const cmd = require('../../../util/command')
|
|
5
|
-
const mvn = require('../../
|
|
5
|
+
const mvn = require('../../mvn')
|
|
6
6
|
const term = require('../../../util/term')
|
|
7
7
|
const { URLS, OPTIONS: { NODEJS, JAVA }, COMMAND_ADD } = require('../../constants')
|
|
8
8
|
|
|
9
|
-
module.exports = class JavaTemplate extends require('
|
|
9
|
+
module.exports = class JavaTemplate extends require('../../plugin') {
|
|
10
10
|
|
|
11
|
-
static
|
|
11
|
+
static hasInProduction() {
|
|
12
12
|
return exists('pom.xml') || cds.cli.options?.add?.has(JAVA)
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -5,7 +5,7 @@ const term = require("../../../util/term");
|
|
|
5
5
|
const checks = require("../../../lint/checks");
|
|
6
6
|
const io = require("../../../lint/io");
|
|
7
7
|
const readline = require("readline");
|
|
8
|
-
const { renderAndCopy } = require('../../
|
|
8
|
+
const { renderAndCopy } = require('../../template')
|
|
9
9
|
const { LINT_DEV, LINT_GLOBAL } = require("../../constants").OPTIONS;
|
|
10
10
|
const { getConfigPath, getFileExtensions } = require("@sap/eslint-plugin-cds/lib/api");
|
|
11
11
|
const cds = require("../../../cds");
|
|
@@ -17,7 +17,7 @@ const VSCODE_FILE_ASSOCIATIONS = {
|
|
|
17
17
|
"csv": [ "csv", "csv (semicolon)", "tsv", "tab" ]
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
module.exports = class LintTemplate extends require('
|
|
20
|
+
module.exports = class LintTemplate extends require('../../plugin') {
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
23
|
this.customPath = path.join(cds.root, ".eslint");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const mvn = require('../../mvn')
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
|
|
4
|
+
module.exports = class LiquibaseTemplate extends require('../../plugin') {
|
|
5
|
+
|
|
6
|
+
async canRun() {
|
|
7
|
+
const { isNodejs } = readProject()
|
|
8
|
+
if (isNodejs) throw `'cds add liquibase' is not available for Node.js yet`
|
|
9
|
+
return true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async run() {
|
|
13
|
+
const { isJava } = readProject()
|
|
14
|
+
if (isJava) await mvn.add('liquibase')
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds')
|
|
3
2
|
const { read } = cds.utils
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
6
5
|
|
|
7
|
-
module.exports = class LocalMessagingTemplate extends require('
|
|
6
|
+
module.exports = class LocalMessagingTemplate extends require('../../plugin') {
|
|
8
7
|
|
|
9
8
|
async canRun() {
|
|
10
|
-
const { isJava } =
|
|
9
|
+
const { isJava } = readProject()
|
|
11
10
|
if (isJava) throw `'cds add local-messaging' is not available for Java yet`
|
|
12
11
|
return true
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
static
|
|
14
|
+
static hasInProduction(env) {
|
|
16
15
|
return env.requires?.messaging?.kind === 'local-messaging'
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async run() {
|
|
20
|
-
const project =
|
|
19
|
+
const project = readProject()
|
|
21
20
|
const { configFile } = project
|
|
22
21
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
23
|
-
await
|
|
22
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
|
|
24
23
|
}
|
|
25
24
|
}
|
|
@@ -2,33 +2,21 @@ const { join } = require('path')
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists } = cds.utils
|
|
4
4
|
const { copyRenderedYAML } = require('../../../util/fs')
|
|
5
|
-
const { readProject } = require('../../
|
|
6
|
-
const {
|
|
7
|
-
const {
|
|
8
|
-
APPROUTER, XSUAA, MULTITENANCY, EXTENSIBILITY,
|
|
9
|
-
MTA, HELM,
|
|
10
|
-
HANA, POSTGRES,
|
|
11
|
-
ENTERPRISE_MESSAGING, ENTERPRISE_MESSAGING_SHARED, REDIS_MESSAGING,
|
|
12
|
-
CONNECTIVITY, DESTINATION, NOTIFICATIONS
|
|
13
|
-
} = require('../../constants').OPTIONS
|
|
14
|
-
module.exports = class MtaTemplate extends require('../templateBase') {
|
|
5
|
+
const { readProject } = require('../../projectReader')
|
|
6
|
+
const { merge, sort } = require('../../merge')
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
const { options } = cds.cli
|
|
18
|
-
if (!options?.add.has(MTA) && options?.add.has(HELM)) return false
|
|
19
|
-
return exists('mta.yaml')
|
|
20
|
-
}
|
|
8
|
+
module.exports = class MtaTemplate extends require('../../plugin') {
|
|
21
9
|
|
|
22
|
-
|
|
23
|
-
return
|
|
10
|
+
static hasInProduction() {
|
|
11
|
+
return exists('mta.yaml')
|
|
24
12
|
}
|
|
25
13
|
|
|
26
14
|
async run() {
|
|
27
|
-
const project =
|
|
15
|
+
const project = readProject()
|
|
28
16
|
if (!exists('mta.yaml')) {
|
|
29
17
|
await copyRenderedYAML(join(__dirname, 'files', 'mta.yaml.hbs'), 'mta.yaml', project)
|
|
30
18
|
}
|
|
31
|
-
await
|
|
19
|
+
await merge(__dirname, 'files/package.json').into('package.json')
|
|
32
20
|
await sort('package.json', 'devDependencies')
|
|
33
21
|
}
|
|
34
22
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { MULTITENANCY, TOGGLES, EXTENSIBILITY } = require('../../constants').OPTIONS
|
|
2
2
|
|
|
3
|
-
module.exports = class MtxTemplate extends require('
|
|
3
|
+
module.exports = class MtxTemplate extends require('../../plugin') {
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
requires() {
|
|
6
6
|
return [MULTITENANCY, TOGGLES, EXTENSIBILITY]
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -1,35 +1,29 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const { read, write } = cds.utils
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
7
|
-
const { mergeJSON, mergeYAML, sort } = require('../../util/merge')
|
|
8
|
-
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
3
|
+
const { read, write, copy } = cds.utils
|
|
4
|
+
const mvn = require('../../mvn')
|
|
5
|
+
const { readProject } = require('../../projectReader')
|
|
6
|
+
const { merge, sort } = require('../../merge')
|
|
9
7
|
const { copyRenderedJSON } = require('../../../util/fs')
|
|
10
8
|
const {
|
|
11
|
-
|
|
9
|
+
srv4, // Server
|
|
12
10
|
mtxSidecar4, // Additional Modules
|
|
13
11
|
saasRegistry, serviceManager, xsuaa, // BTP Services
|
|
14
12
|
srvApi4, providedMtxApiSidecar4, requiredMtxSidecarApi4 // APIs
|
|
15
|
-
} = require('
|
|
13
|
+
} = require('../../registries/mta')
|
|
16
14
|
|
|
17
|
-
module.exports = class MultitenancyTemplate extends require('
|
|
15
|
+
module.exports = class MultitenancyTemplate extends require('../../plugin') {
|
|
18
16
|
|
|
19
|
-
static
|
|
17
|
+
static hasInProduction(env) {
|
|
20
18
|
const { options } = cds.cli.options
|
|
21
19
|
// REVISIT: Check if this can be simplified
|
|
22
20
|
return options?.add?.has('mtx') || options?.add?.has('multitenancy') || !!env.requires?.multitenancy || false
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
getRelatedFacets() {
|
|
26
|
-
return [APPROUTER, HANA, KIBANA]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
23
|
async run() {
|
|
30
|
-
const project =
|
|
24
|
+
const project = readProject()
|
|
31
25
|
const { isNodejs, isJava, configFile } = project
|
|
32
|
-
await
|
|
26
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
|
|
33
27
|
if (isJava) {
|
|
34
28
|
const packageJson = await read('package.json')
|
|
35
29
|
packageJson.workspaces = ['mtx/sidecar']
|
|
@@ -40,12 +34,12 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
40
34
|
await copyRenderedJSON(join(__dirname, 'files', 'package.sidecar.json.hbs'), join('mtx', 'sidecar', 'package.json'), project)
|
|
41
35
|
}
|
|
42
36
|
|
|
43
|
-
async
|
|
44
|
-
const project =
|
|
45
|
-
const { isNodejs, isJava, hasMta, hasHelm, hasXsuaa, hasHana, srvPath } = project
|
|
37
|
+
async combine() {
|
|
38
|
+
const project = readProject()
|
|
39
|
+
const { isNodejs, isJava, hasMta, hasHelm, hasHelmUnifiedRuntime, hasXsuaa, hasHana, srvPath } = project
|
|
46
40
|
|
|
47
41
|
if (hasMta) {
|
|
48
|
-
const srv = (
|
|
42
|
+
const srv = srv4(srvPath)
|
|
49
43
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
50
44
|
const modules = [srv, mtxSidecar]
|
|
51
45
|
const services = [saasRegistry]
|
|
@@ -80,91 +74,46 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
const templateMtaPath = join(__dirname, 'files', 'mta.yaml.hbs')
|
|
83
|
-
|
|
84
|
-
await mergeYAML('mta.yaml', templateMtaPath, project, mergingRules)
|
|
77
|
+
await merge(templateMtaPath).into('mta.yaml', { with: project, additions, overwrites, relationships })
|
|
85
78
|
}
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (hasHelm) {
|
|
90
|
-
// in case facet is being added to the already existing charts folder
|
|
91
|
-
if (Object.keys(context).length == 0) {
|
|
92
|
-
isIndependentCommand = true
|
|
93
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
await mergeYAML(join('chart', 'values.yaml'), join(__dirname, 'files', 'values.yaml.hbs'), project)
|
|
80
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
81
|
+
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
97
82
|
|
|
98
83
|
const envFromObject = {
|
|
99
|
-
envFrom: [
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
name: "{{ .Release.Name }}-mtxs-configmap"
|
|
103
|
-
}
|
|
84
|
+
envFrom: [{
|
|
85
|
+
configMapRef: {
|
|
86
|
+
name: "{{ .Release.Name }}-mtxs-configmap"
|
|
104
87
|
}
|
|
105
|
-
]
|
|
88
|
+
}]
|
|
106
89
|
}
|
|
107
90
|
|
|
108
|
-
await
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
name: "{{ .Release.Name }}-saas-registry-secret",
|
|
118
|
-
key: "parameters"
|
|
119
|
-
}
|
|
91
|
+
await merge({
|
|
92
|
+
...(isNodejs) && { sidecar: envFromObject },
|
|
93
|
+
...(isJava) && { srv: envFromObject },
|
|
94
|
+
'saas-registry': {
|
|
95
|
+
parametersFrom: [
|
|
96
|
+
{
|
|
97
|
+
secretKeyRef: {
|
|
98
|
+
name: "{{ .Release.Name }}-saas-registry-secret",
|
|
99
|
+
key: "parameters"
|
|
120
100
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
project
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
// REVISIT: Don't reference other templates except for the safe `runDependentMerging` -> low coupling, high cohesion
|
|
128
|
-
const HelmTemplate = require(`../helm`);
|
|
129
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
130
|
-
|
|
131
|
-
await helmTemplate.addDependency('web-application', 'sidecar');
|
|
132
|
-
|
|
133
|
-
// copy service-instance chart
|
|
134
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
135
|
-
|
|
136
|
-
// add dependency entry in chart.yaml
|
|
137
|
-
await helmTemplate.addDependency('service-instance', 'saas-registry');
|
|
138
|
-
await helmTemplate.addDependency('service-instance', 'service-manager');
|
|
139
|
-
|
|
140
|
-
// add mtxs configmap
|
|
141
|
-
await copyAndTrack(
|
|
142
|
-
join(__dirname, 'files', `mtxs-configmap-${isJava ? 'java' : 'nodejs'}.yaml`),
|
|
143
|
-
join('chart', 'templates', 'mtxs-configmap.yaml'),
|
|
144
|
-
context,
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
// add saas registry secret
|
|
148
|
-
await copyAndTrack(
|
|
149
|
-
join(__dirname, 'files', 'saas-registry-secret.yaml'),
|
|
150
|
-
join('chart', 'templates', 'saas-registry-secret.yaml'),
|
|
151
|
-
context
|
|
152
|
-
);
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}}).into('chart/values.yaml', { with: project })
|
|
153
104
|
|
|
154
|
-
|
|
105
|
+
await copy(join(__dirname, 'files', `mtxs-configmap-${isJava ? 'java' : 'nodejs'}.yaml`)).to('chart', 'templates', 'mtxs-configmap.yaml') // REVISIT: Move to build task
|
|
106
|
+
await copy(join(__dirname, 'files', 'saas-registry-secret.yaml')).to('chart', 'templates', 'saas-registry-secret.yaml') // REVISIT: Move to build task
|
|
155
107
|
}
|
|
156
108
|
|
|
157
109
|
if (hasXsuaa) {
|
|
158
|
-
await
|
|
110
|
+
await merge(__dirname, 'files/xs-security.json.hbs').into('xs-security.json', {
|
|
111
|
+
project,
|
|
159
112
|
additions: [{
|
|
160
113
|
in: 'scopes',
|
|
161
|
-
where:
|
|
114
|
+
where: { name: '$XSAPPNAME.mtcallback' },
|
|
162
115
|
}]
|
|
163
116
|
})
|
|
164
|
-
if (hasHelm) {
|
|
165
|
-
await mergeYAML(join('chart', 'values.yaml'), { xsuaa: { parameters: { 'tenant-mode': 'shared' }}}, null, { forceOverwrite: true })
|
|
166
|
-
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
167
|
-
}
|
|
168
117
|
}
|
|
169
118
|
}
|
|
170
119
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists, mkdirp, path } = cds.utils
|
|
4
|
+
const { env4 } = require('../../projectReader')
|
|
4
5
|
const { URLS, OPTIONS: { NODEJS, JAVA }, COMMAND_ADD } = require('../../constants')
|
|
5
6
|
const term = require('../../../util/term')
|
|
6
|
-
const { renderAndCopy } = require('../../
|
|
7
|
+
const { renderAndCopy } = require('../../template')
|
|
7
8
|
|
|
8
|
-
module.exports = class NodejsTemplate extends require('
|
|
9
|
+
module.exports = class NodejsTemplate extends require('../../plugin') {
|
|
9
10
|
|
|
10
|
-
static
|
|
11
|
+
static hasInProduction() {
|
|
11
12
|
return !exists('pom.xml') && !cds.cli.options?.add?.has(JAVA)
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -22,7 +23,7 @@ module.exports = class NodejsTemplate extends require('../templateBase') {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
async run() {
|
|
25
|
-
const { db, srv, app } = (
|
|
26
|
+
const { db, srv, app } = env4('production').folders
|
|
26
27
|
await renderAndCopy(join(__dirname, 'files'), cds.root, { projectName: path.basename(cds.root) })
|
|
27
28
|
await Promise.all([db, srv, app].map(p => mkdirp(p)))
|
|
28
29
|
}
|