@sap/cds-dk 7.4.0 → 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 +10 -12
- 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 +5 -5
- 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 +6 -3
- 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 +8 -5
- package/lib/build/provider/mtx-sidecar/index.js +2 -1
- package/lib/build/provider/nodejs/index.js +64 -58
- package/lib/compile/openapi/csdl2openapi.js +29 -15
- package/lib/compile/openapi/index.js +6 -6
- package/lib/deploy/to-hana/hana.js +5 -3
- 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 +4 -1
- package/lib/{client → mtx}/pull.js +6 -4
- package/lib/{client → mtx}/push.js +11 -10
- 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 +27 -27
- package/package.json +10 -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
|
@@ -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
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
1
|
+
const { readProject } = require('../../projectReader')
|
|
2
|
+
const { merge } = require('../../merge')
|
|
4
3
|
const { DESTINATION } = require('../../constants').OPTIONS
|
|
5
4
|
|
|
6
|
-
const { notificationTypesDeployer } = require('
|
|
5
|
+
const { notificationTypesDeployer } = require('../../registries/mta')
|
|
7
6
|
|
|
8
|
-
module.exports = class NotificationsTemplate extends require('
|
|
7
|
+
module.exports = class NotificationsTemplate extends require('../../plugin') {
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
return
|
|
9
|
+
requires() {
|
|
10
|
+
return [DESTINATION]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static hasInProduction(env) {
|
|
14
|
+
return !!env.requires?.notifications
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
async canRun() {
|
|
15
|
-
const project =
|
|
18
|
+
const project = readProject()
|
|
16
19
|
const { isJava } = project
|
|
17
20
|
if (isJava) {
|
|
18
21
|
throw `'cds add notifications' is not available for Java yet`
|
|
@@ -20,24 +23,18 @@ module.exports = class NotificationsTemplate extends require('../templateBase')
|
|
|
20
23
|
return true
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
getDependencies() {
|
|
24
|
-
return [DESTINATION]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
26
|
async run() {
|
|
28
|
-
const project =
|
|
27
|
+
const project = readProject()
|
|
29
28
|
const { configFile } = project
|
|
30
|
-
await
|
|
29
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
async
|
|
34
|
-
const project =
|
|
32
|
+
async combine() {
|
|
33
|
+
const project = readProject()
|
|
35
34
|
const { hasMta } = project
|
|
36
35
|
|
|
37
36
|
if (hasMta) {
|
|
38
|
-
await
|
|
39
|
-
additions: [notificationTypesDeployer]
|
|
40
|
-
})
|
|
37
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions: [notificationTypesDeployer] })
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
}
|
|
@@ -3,7 +3,7 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { exists, copy } = cds.utils
|
|
4
4
|
const { URLS } = require('../../constants')
|
|
5
5
|
|
|
6
|
-
module.exports = class PipelineTemplate extends require('
|
|
6
|
+
module.exports = class PipelineTemplate extends require('../../plugin') {
|
|
7
7
|
|
|
8
8
|
async canRun() {
|
|
9
9
|
if (cds.cli.options.force) {
|
|
@@ -1,53 +1,47 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds')
|
|
3
2
|
const { read } = cds.utils
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
6
|
-
const mvn = require('../../
|
|
7
|
-
const {
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
5
|
+
const mvn = require('../../mvn')
|
|
6
|
+
const { srv4, postgres, postgresDeployer } = require('../../registries/mta')
|
|
8
7
|
|
|
9
|
-
module.exports = class PostgresTemplate extends require('
|
|
8
|
+
module.exports = class PostgresTemplate extends require('../../plugin') {
|
|
10
9
|
|
|
11
10
|
async canRun() {
|
|
12
|
-
const { hasMta, hasHelm } =
|
|
13
|
-
if (hasHelm && !hasMta) throw `'cds add postgres' is not available for Kyma yet`
|
|
11
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime } = readProject()
|
|
12
|
+
if ((hasHelm || hasHelmUnifiedRuntime) && !hasMta) throw `'cds add postgres' is not available for Kyma yet`
|
|
14
13
|
return true
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
static
|
|
16
|
+
static hasInProduction(env) {
|
|
18
17
|
return env.requires?.db?.kind === 'postgres'
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
async run() {
|
|
22
|
-
const project =
|
|
21
|
+
const project = readProject()
|
|
23
22
|
const { configFile, isJava } = project
|
|
24
23
|
project.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
|
|
25
|
-
await
|
|
24
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
26
25
|
if (isJava) await mvn.add('postgresql')
|
|
27
|
-
await this.runDependentMerging()
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
async
|
|
31
|
-
const project =
|
|
32
|
-
const { hasMta,
|
|
28
|
+
async combine() {
|
|
29
|
+
const project = readProject()
|
|
30
|
+
const { hasMta, srvPath } = project
|
|
33
31
|
|
|
34
32
|
if (hasMta) {
|
|
35
|
-
const srv = (
|
|
36
|
-
await
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
into: [postgresDeployer, 'requires', 'name']
|
|
48
|
-
}]
|
|
49
|
-
}
|
|
50
|
-
)
|
|
33
|
+
const srv = srv4(srvPath)
|
|
34
|
+
await merge(__dirname, 'files/mta.yml.hbs').into('mta.yaml', {
|
|
35
|
+
project,
|
|
36
|
+
additions: [srv, postgres, postgresDeployer],
|
|
37
|
+
relationships: [{
|
|
38
|
+
insert: [postgres, 'name'],
|
|
39
|
+
into: [srv, 'requires', 'name']
|
|
40
|
+
}, {
|
|
41
|
+
insert: [postgres, 'name'],
|
|
42
|
+
into: [postgresDeployer, 'requires', 'name']
|
|
43
|
+
}]
|
|
44
|
+
})
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
}
|
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds')
|
|
3
2
|
const { read } = cds.utils
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
6
|
-
const {
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
5
|
+
const { srv4, redis } = require('../../registries/mta')
|
|
7
6
|
|
|
8
|
-
module.exports = class RedisMessagingTemplate extends require('
|
|
7
|
+
module.exports = class RedisMessagingTemplate extends require('../../plugin') {
|
|
9
8
|
|
|
10
9
|
async canRun() {
|
|
11
|
-
const { hasMta, hasHelm, isJava } =
|
|
12
|
-
|
|
13
|
-
if (
|
|
10
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime, isJava } = readProject()
|
|
11
|
+
const onlyHelm = !hasMta && (hasHelmUnifiedRuntime || hasHelm)
|
|
12
|
+
if (isJava) throw `'cds add redis-messaging' is not available for Java yet`
|
|
13
|
+
if (onlyHelm) throw `'cds add redis-messaging' is not available for Kyma yet`
|
|
14
14
|
return true
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static
|
|
17
|
+
static hasInProduction(env) {
|
|
18
18
|
return env.requires?.messaging?.kind === 'redis-messaging'
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
|
-
const project =
|
|
22
|
+
const project = readProject()
|
|
23
23
|
const { configFile } = project
|
|
24
24
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
25
|
-
await
|
|
25
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async
|
|
29
|
-
const project =
|
|
30
|
-
const { hasMta,
|
|
28
|
+
async combine() {
|
|
29
|
+
const project = readProject()
|
|
30
|
+
const { hasMta, srvPath } = project
|
|
31
31
|
|
|
32
32
|
if (hasMta) {
|
|
33
|
-
const srv = (
|
|
34
|
-
await
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
into: [srv, 'requires', 'name']
|
|
43
|
-
}]
|
|
44
|
-
}
|
|
45
|
-
)
|
|
33
|
+
const srv = srv4(srvPath)
|
|
34
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
35
|
+
project,
|
|
36
|
+
additions: [srv, redis],
|
|
37
|
+
relationships: [{
|
|
38
|
+
insert: [redis, 'name'],
|
|
39
|
+
into: [srv, 'requires', 'name']
|
|
40
|
+
}]
|
|
41
|
+
})
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds'), { exists, copy } = cds.utils
|
|
3
|
-
const { readProject } = require('../../
|
|
3
|
+
const { env4, readProject } = require('../../projectReader')
|
|
4
4
|
|
|
5
|
-
module.exports = class SampleTemplate extends require('
|
|
5
|
+
module.exports = class SampleTemplate extends require('../../plugin') {
|
|
6
6
|
|
|
7
7
|
async canRun() {
|
|
8
|
-
const { isJava } =
|
|
8
|
+
const { isJava } = readProject()
|
|
9
9
|
if (isJava) throw `'cds add sample' is not available for Java yet`
|
|
10
10
|
return true
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async run() {
|
|
14
|
-
const { db, srv, app } = (
|
|
14
|
+
const { db, srv, app } = env4('production').folders
|
|
15
15
|
const language = exists('pom.xml') ? 'java' : 'nodejs'
|
|
16
16
|
await Promise.all([
|
|
17
17
|
copy(join(__dirname, 'files', 'db')).to(db),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const term = require('../../../util/term')
|
|
2
2
|
const { TINY_SAMPLE } = require('../../constants').OPTIONS
|
|
3
3
|
|
|
4
|
-
module.exports = class SamplesTemplate extends require('
|
|
5
|
-
|
|
4
|
+
module.exports = class SamplesTemplate extends require('../../plugin') {
|
|
5
|
+
requires() {
|
|
6
6
|
console.warn(term.warn(`'cds add samples' is deprecated and will be removed in future versions. Please use 'cds add tiny-sample' instead.\n`))
|
|
7
7
|
return [TINY_SAMPLE]
|
|
8
8
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
4
|
-
const mvn = require('../../util/mvn')
|
|
5
|
-
const { readProject } = require('../../util/projectReader')
|
|
6
|
-
const { mergeJSON } = require('../../util/merge')
|
|
1
|
+
const mvn = require('../../mvn')
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge } = require('../../merge')
|
|
7
4
|
|
|
8
|
-
module.exports = class SQLiteTemplate extends require('
|
|
5
|
+
module.exports = class SQLiteTemplate extends require('../../plugin') {
|
|
9
6
|
|
|
10
7
|
async run() {
|
|
11
|
-
const project =
|
|
8
|
+
const project = readProject()
|
|
12
9
|
const { isNodejs, isJava, configFile } = project
|
|
13
10
|
if (isNodejs) {
|
|
14
|
-
|
|
15
|
-
await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`), project)
|
|
11
|
+
await merge(__dirname, 'files/package.json').into(configFile)
|
|
16
12
|
} else if (isJava) {
|
|
17
13
|
await mvn.add('sqlite')
|
|
18
14
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../../lib/cds'), { copy } = cds.utils
|
|
3
|
-
const { renderAndCopy } = require('../../
|
|
4
|
-
const mvn = require('../../
|
|
5
|
-
const { readProject } = require('../../
|
|
3
|
+
const { renderAndCopy } = require('../../template')
|
|
4
|
+
const mvn = require('../../mvn')
|
|
5
|
+
const { env4, readProject } = require('../../projectReader')
|
|
6
6
|
const { JAVA } = require('../../constants')
|
|
7
7
|
|
|
8
|
-
module.exports = class TinySampleTemplate extends require('
|
|
8
|
+
module.exports = class TinySampleTemplate extends require('../../plugin') {
|
|
9
9
|
|
|
10
10
|
async run() {
|
|
11
|
-
const { isJava } =
|
|
11
|
+
const { isJava } = readProject()
|
|
12
12
|
if (isJava) {
|
|
13
13
|
if (!cds.cli.options.add.has(JAVA)) {
|
|
14
14
|
await mvn.execMvn(mvn.getAddSamplesCmdArgs())
|
|
15
15
|
await mvn.execMvn(mvn.getAddTestsCmdArgs())
|
|
16
16
|
}
|
|
17
17
|
} else {
|
|
18
|
-
const { db, srv } = (
|
|
18
|
+
const { db, srv } = env4('production').folders
|
|
19
19
|
await Promise.all([
|
|
20
20
|
copy(join(__dirname, 'files', 'nodejs', 'db')).to(db),
|
|
21
21
|
renderAndCopy(join(__dirname, 'files', 'nodejs', 'srv'), srv, { dbFolder: db.replace(/[\\/]+$/, '') })
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
const { mergeJSON, sort } = require('../../util/merge')
|
|
1
|
+
const { readProject } = require('../../projectReader')
|
|
2
|
+
const { merge, sort } = require('../../merge')
|
|
4
3
|
|
|
5
|
-
module.exports = class TogglesTemplate extends require('
|
|
4
|
+
module.exports = class TogglesTemplate extends require('../../plugin') {
|
|
6
5
|
|
|
7
|
-
static
|
|
6
|
+
static hasInProduction(env) {
|
|
8
7
|
return !!env.requires?.toggles
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
async run() {
|
|
12
|
-
const project =
|
|
13
|
-
const { isNodejs
|
|
14
|
-
await
|
|
11
|
+
const project = readProject()
|
|
12
|
+
const { isNodejs, configFile } = project
|
|
13
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
|
|
15
14
|
if (isNodejs) await sort('package.json', 'dependencies')
|
|
16
15
|
}
|
|
17
16
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
|
-
const { readProject } = require('../../
|
|
3
|
-
const {
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge, mergeGitignore } = require('../../merge')
|
|
4
4
|
const { warn, secondary } = require('../../../util/term')
|
|
5
5
|
const { TYPER } = require('../../constants').OPTIONS
|
|
6
6
|
const { exists, read } = require('../../../cds').utils
|
|
7
7
|
|
|
8
|
-
module.exports = class TyperTemplate extends require('
|
|
8
|
+
module.exports = class TyperTemplate extends require('../../plugin') {
|
|
9
9
|
async canRun() {
|
|
10
|
-
const { isJava } =
|
|
10
|
+
const { isJava } = readProject()
|
|
11
11
|
if (isJava) {
|
|
12
12
|
console.warn(warn(`This appears to be a Java project. 'cds add ${TYPER}' is intended to be used in Node.js projects. Proceeding anyway.\n`))
|
|
13
13
|
}
|
|
@@ -23,11 +23,11 @@ module.exports = class TyperTemplate extends require('../templateBase') {
|
|
|
23
23
|
source.compilerOptions.paths["#cds-models/*"][0] += '/index.ts'
|
|
24
24
|
target = 'tsconfig.json'
|
|
25
25
|
}
|
|
26
|
-
await
|
|
26
|
+
await merge(template('package.json')).into('package.json')
|
|
27
27
|
await mergeGitignore('.gitignore', template('gitignore'))
|
|
28
28
|
console.log(secondary(` > Adding '@cds-models' to .gitignore to ignore generated types`)) // REVISIT: other facets are silent wrt. what they change
|
|
29
29
|
try {
|
|
30
|
-
await
|
|
30
|
+
await merge(source).into(target)
|
|
31
31
|
} catch (e) {
|
|
32
32
|
throw e instanceof SyntaxError
|
|
33
33
|
? `SyntaxError in ${target}. This could indicate a JSON file with comments, which is not supported at this time. Remove all comments from ${target} and rerun or add the following entries manually:\n${JSON.stringify(source, null, 2)}`
|
|
@@ -6,13 +6,13 @@ modules:
|
|
|
6
6
|
requires:
|
|
7
7
|
- name: {{appName}}-auth
|
|
8
8
|
|
|
9
|
-
{{#
|
|
9
|
+
{{#hasMultitenancy}}
|
|
10
10
|
- name: {{appName}}-mtx
|
|
11
11
|
type: nodejs
|
|
12
12
|
path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
|
|
13
13
|
requires:
|
|
14
14
|
- name: {{appName}}-auth
|
|
15
|
-
{{/
|
|
15
|
+
{{/hasMultitenancy}}
|
|
16
16
|
|
|
17
17
|
resources:
|
|
18
18
|
- name: {{appName}}-auth
|
|
@@ -23,4 +23,4 @@ resources:
|
|
|
23
23
|
path: ./xs-security.json
|
|
24
24
|
config:
|
|
25
25
|
xsappname: {{appName}}-${org}-${space}
|
|
26
|
-
tenant-mode: {{#
|
|
26
|
+
tenant-mode: {{#hasMultitenancy}}shared{{/hasMultitenancy}}{{^hasMultitenancy}}dedicated{{/hasMultitenancy}}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
{{#
|
|
2
|
+
{{#hasMultitenancy}}
|
|
3
3
|
sidecar:
|
|
4
4
|
bindings:
|
|
5
5
|
auth:
|
|
6
6
|
serviceInstanceName: xsuaa
|
|
7
|
-
{{/
|
|
7
|
+
{{/hasMultitenancy}}
|
|
8
8
|
{{#hasApprouter}}
|
|
9
9
|
approuter:
|
|
10
10
|
bindings:
|
|
@@ -20,7 +20,7 @@ xsuaa:
|
|
|
20
20
|
servicePlanName: application
|
|
21
21
|
parameters:
|
|
22
22
|
xsappname: {{appName}}
|
|
23
|
-
tenant-mode: {{#
|
|
23
|
+
tenant-mode: {{#hasMultitenancy}}shared{{/hasMultitenancy}}{{^hasMultitenancy}}dedicated{{/hasMultitenancy}}
|
|
24
24
|
{{#hasApprouter}}
|
|
25
25
|
oauth2-configuration:
|
|
26
26
|
redirect-uris:
|