@sap/cds-dk 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/add.js +2 -2
- package/bin/bind.js +0 -1
- package/bin/cds.js +6 -4
- package/bin/deploy/to-hana.js +1 -1
- package/bin/init.js +2 -2
- package/lib/bind/cfKeyProvider.js +1 -0
- package/lib/bind/index.js +3 -0
- package/lib/bind/userCdsrcJsonStorageProvider.js +2 -10
- package/lib/build/constants.js +16 -14
- package/lib/build/provider/mtx/resourcesTarBuilder.js +2 -6
- package/lib/build/provider/mtx-sidecar/index.js +13 -8
- package/lib/client/base_command.js +3 -6
- package/lib/compile/asyncapi/components/messages/index.js +41 -18
- package/lib/compile/asyncapi/index.js +23 -2
- package/lib/import/odata/metadataconverter/MetadataConverter.js +1 -0
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +58 -66
- package/lib/init/template/approuter/index.js +3 -4
- package/lib/init/template/auditlog/index.js +3 -4
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +15 -23
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +22 -17
- package/lib/init/template/cf-manifest/index.js +2 -2
- package/lib/init/template/connectivity/index.js +2 -3
- package/lib/init/template/data/index.js +5 -5
- package/lib/init/template/destination/index.js +3 -5
- package/lib/init/template/enterprise-messaging/index.js +4 -5
- package/lib/init/template/enterprise-messaging-shared/index.js +3 -4
- package/lib/init/template/extensibility/index.js +2 -3
- package/lib/init/template/file-based-messaging/index.js +2 -2
- package/lib/init/template/hana/files/mta.yaml.hbs +1 -1
- package/lib/init/template/hana/index.js +39 -63
- package/lib/init/template/helm/index.js +15 -14
- package/lib/init/template/html5-repo/index.js +3 -7
- package/lib/init/template/java/index.js +3 -3
- package/lib/init/template/kibana/index.js +3 -4
- package/lib/init/template/lint/index.js +8 -7
- package/lib/init/template/mta/index.js +3 -2
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +16 -37
- package/lib/init/template/nodejs/index.js +2 -3
- package/lib/init/template/pipeline/index.js +2 -2
- package/lib/init/template/redis-messaging/index.js +3 -4
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +1 -1
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +1 -1
- package/lib/init/template/sample/files/srv/admin-service.cds +1 -1
- package/lib/init/template/sample/files/srv/cat-service.cds +1 -1
- package/lib/init/template/sample/index.js +6 -5
- package/lib/init/template/sqlite/index.js +1 -1
- package/lib/init/template/templateBase.js +9 -19
- package/lib/init/template/tiny-sample/index.js +5 -5
- package/lib/init/template/toggles/index.js +1 -2
- package/lib/init/template/typer/files/xsconfig.json +0 -1
- package/lib/init/template/typer/index.js +1 -1
- package/lib/init/template/xsuaa/index.js +3 -4
- package/lib/init/util/indent.js +57 -0
- package/lib/init/util/merge.js +71 -15
- package/lib/init/util/mvn.js +23 -9
- package/lib/init/util/projectReader.js +52 -168
- package/lib/init/util/template.js +12 -11
- package/lib/init/util/xml.js +6 -6
- package/lib/util/pruneAxiosErrors.js +22 -0
- package/lib/watch/open.js +6 -3
- package/npm-shrinkwrap.json +11 -17
- package/package.json +1 -2
|
@@ -28,16 +28,15 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async run() {
|
|
31
|
-
const { appPath = 'app' } = await readProject(
|
|
31
|
+
const { appPath = 'app' } = await readProject()
|
|
32
32
|
const appPackageJSONPath = join(appPath, 'package.json')
|
|
33
33
|
await mergeJSON(appPackageJSONPath, join(__dirname, 'files', 'package.json'))
|
|
34
34
|
await sort(appPackageJSONPath, 'dependencies')
|
|
35
35
|
await mergeJSON(join(appPath, 'default-env.json'), join(__dirname, 'files', 'default-env.json'))
|
|
36
|
-
await this.runDependentMerging()
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
async runDependentMerging(context = {}) {
|
|
40
|
-
const project = await readProject(
|
|
39
|
+
const project = await readProject()
|
|
41
40
|
const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath, appPath } = project
|
|
42
41
|
|
|
43
42
|
if (hasMta) {
|
|
@@ -76,7 +75,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
76
75
|
|
|
77
76
|
// add dependency entry in chart.yaml
|
|
78
77
|
const HelmTemplate = require(`../helm`);
|
|
79
|
-
const helmTemplate = new HelmTemplate(
|
|
78
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
80
79
|
await helmTemplate.addDependency('web-application', 'approuter');
|
|
81
80
|
|
|
82
81
|
await mergeYAML(
|
|
@@ -13,15 +13,14 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async run() {
|
|
16
|
-
const project = await readProject(
|
|
16
|
+
const project = await readProject()
|
|
17
17
|
const { configFile } = project
|
|
18
18
|
project.shortcut = !(await read(configFile)).cds?.requires?.['audit-log']?.kind
|
|
19
19
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
20
|
-
await this.runDependentMerging()
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
async runDependentMerging(context = {}) {
|
|
24
|
-
const project = await readProject(
|
|
23
|
+
const project = await readProject()
|
|
25
24
|
const { isNodejs, hasMta, hasHelm, srvPath } = project
|
|
26
25
|
|
|
27
26
|
if (hasMta) {
|
|
@@ -63,7 +62,7 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
63
62
|
|
|
64
63
|
// copy service instance chart if it is not present
|
|
65
64
|
const HelmTemplate = require(`../helm`);
|
|
66
|
-
const helmTemplate = new HelmTemplate(
|
|
65
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
67
66
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
68
67
|
|
|
69
68
|
// add dependency entry in chart.yaml
|
|
@@ -7,7 +7,7 @@ applications:
|
|
|
7
7
|
# -----------------------------------------------------------------------------------
|
|
8
8
|
# Backend Service
|
|
9
9
|
# -----------------------------------------------------------------------------------
|
|
10
|
-
- name: {{appName}}-
|
|
10
|
+
- name: {{appName}}-srv
|
|
11
11
|
random-route: true # for development only
|
|
12
12
|
{{#isNodejs}}
|
|
13
13
|
path: {{& srvPath}}
|
|
@@ -15,42 +15,34 @@ applications:
|
|
|
15
15
|
buildpack: nodejs_buildpack
|
|
16
16
|
{{/isNodejs}}
|
|
17
17
|
{{#isJava}}
|
|
18
|
-
path: {{& srvPath}}/target/{{
|
|
18
|
+
path: {{& srvPath}}/target/{{archiveName}}
|
|
19
19
|
memory: 1G
|
|
20
20
|
disk_quota: 512M
|
|
21
21
|
env:
|
|
22
22
|
SPRING_PROFILES_ACTIVE: cloud
|
|
23
23
|
buildpack: java_buildpack
|
|
24
24
|
{{/isJava}}
|
|
25
|
-
{{#hasRequires}}
|
|
26
25
|
services:
|
|
27
|
-
{{#
|
|
28
|
-
{{
|
|
29
|
-
|
|
30
|
-
{{
|
|
31
|
-
{{
|
|
32
|
-
|
|
33
|
-
{{/resource.isXsuaa}}
|
|
34
|
-
{{/requires}}
|
|
35
|
-
{{/hasRequires}}
|
|
26
|
+
{{#hasHana}}
|
|
27
|
+
- {{appName}}-db
|
|
28
|
+
{{/hasHana}}
|
|
29
|
+
{{#hasXsuaa}}
|
|
30
|
+
- {{appNames}}-auth
|
|
31
|
+
{{/hasXsuaa}}
|
|
36
32
|
|
|
37
|
-
{{#
|
|
33
|
+
{{#hasHana}}
|
|
34
|
+
{{^isMultitenant}}
|
|
38
35
|
# -----------------------------------------------------------------------------------
|
|
39
36
|
# HANA Database Content Deployer App
|
|
40
37
|
# -----------------------------------------------------------------------------------
|
|
41
|
-
- name: {{appName}}-{{db.
|
|
42
|
-
path: {{& db.
|
|
38
|
+
- name: {{appName}}-{{db.name}}-deployer
|
|
39
|
+
path: {{& db.path}}
|
|
43
40
|
no-route: true
|
|
44
41
|
health-check-type: process
|
|
45
42
|
memory: 256M
|
|
46
43
|
instances: 1
|
|
47
44
|
buildpack: nodejs_buildpack
|
|
48
|
-
{{#hasRequires}}
|
|
49
45
|
services:
|
|
50
|
-
{{
|
|
51
|
-
{{
|
|
52
|
-
|
|
53
|
-
{{/resource.isHana}}
|
|
54
|
-
{{/requires}}
|
|
55
|
-
{{/hasRequires}}
|
|
56
|
-
{{/needsSidecar}}
|
|
46
|
+
- {{appName}}-db
|
|
47
|
+
{{/isMultitenant}}
|
|
48
|
+
{{/hasHana}}
|
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
# appName = {{appName}}
|
|
3
3
|
---
|
|
4
4
|
create-services:
|
|
5
|
-
{{#
|
|
6
|
-
#
|
|
7
|
-
- name:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
{{#hasHana}}
|
|
6
|
+
{{#isMultitenant}}
|
|
7
|
+
- name: {{appName}}-db
|
|
8
|
+
broker: service-manager
|
|
9
|
+
plan: container
|
|
10
|
+
{{/isMultitenant}}
|
|
11
|
+
{{^isMultitenant}}
|
|
12
|
+
- name: {{appName}}-db
|
|
13
|
+
broker: hana
|
|
14
|
+
plan: hdi-shared
|
|
15
|
+
{{/isMultitenant}}
|
|
16
|
+
{{/hasHana}}
|
|
17
|
+
{{#hasXsuaa}}
|
|
18
|
+
- name: {{appName}}-auth
|
|
19
|
+
broker: xsuaa
|
|
16
20
|
plan: application
|
|
17
|
-
|
|
18
|
-
{{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
parameters: xs-security.json
|
|
22
|
+
{{/hasXsuaa}}
|
|
23
|
+
{{#hasAuditlog}}
|
|
24
|
+
- name: {{appName}}-auditlog
|
|
25
|
+
broker: auditlog
|
|
26
|
+
plan: application
|
|
27
|
+
{{/hasAuditlog}}
|
|
@@ -9,7 +9,7 @@ const SERVICES_MANIFEST_FILE = 'services-manifest.yml'
|
|
|
9
9
|
module.exports = class CfManifestTemplate extends require('../templateBase') {
|
|
10
10
|
|
|
11
11
|
async canRun() {
|
|
12
|
-
if (
|
|
12
|
+
if (cds.cli.options.force) {
|
|
13
13
|
return true
|
|
14
14
|
}
|
|
15
15
|
if (exists(MANIFEST_FILE) || exists(SERVICES_MANIFEST_FILE)) {
|
|
@@ -20,6 +20,6 @@ module.exports = class CfManifestTemplate extends require('../templateBase') {
|
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
22
|
const project = await readProject()
|
|
23
|
-
await copyFiles(join(__dirname, 'files'), cds.root, project,
|
|
23
|
+
await copyFiles(join(__dirname, 'files'), cds.root, project, true)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -11,14 +11,13 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async run() {
|
|
14
|
-
const project = await readProject(
|
|
14
|
+
const project = await readProject()
|
|
15
15
|
const { configFile } = project
|
|
16
16
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
17
|
-
await this.runDependentMerging()
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
async runDependentMerging(context = {}) {
|
|
21
|
-
const project = await readProject(
|
|
20
|
+
const project = await readProject()
|
|
22
21
|
const { isJava, srvPath, hasHelm, hasMta } = project
|
|
23
22
|
|
|
24
23
|
if (hasMta) {
|
|
@@ -8,19 +8,19 @@ const DEBUG = cds.debug('cli')
|
|
|
8
8
|
module.exports = class DataTemplate extends require('../templateBase') {
|
|
9
9
|
|
|
10
10
|
async run() {
|
|
11
|
-
if (
|
|
11
|
+
if (cds.cli.options.for) {
|
|
12
12
|
throw `\nError: Did you mean \`... --data:for\` ?`
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const env = await this.getEnv();
|
|
16
16
|
|
|
17
|
-
let dest = (typeof
|
|
18
|
-
?
|
|
17
|
+
let dest = (typeof cds.cli.options.out === 'string') // target folder
|
|
18
|
+
? cds.cli.options.out
|
|
19
19
|
: getDefaultTargetFolder(env);
|
|
20
20
|
dest = resolve(cds.root, dest);
|
|
21
21
|
|
|
22
|
-
const nameFilter = asRegex(
|
|
23
|
-
const force =
|
|
22
|
+
const nameFilter = asRegex(cds.cli.options['data:for'])
|
|
23
|
+
const { force } = cds.cli.options
|
|
24
24
|
|
|
25
25
|
let csn = await cds.compile.to.csn(cds.env.roots) // normal CSN
|
|
26
26
|
|
|
@@ -15,14 +15,13 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async run() {
|
|
18
|
-
const project = await readProject(
|
|
18
|
+
const project = await readProject()
|
|
19
19
|
const { configFile } = project
|
|
20
20
|
await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`), project)
|
|
21
|
-
await this.runDependentMerging()
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
async runDependentMerging(context = {}) {
|
|
25
|
-
const project = await readProject(
|
|
24
|
+
const project = await readProject()
|
|
26
25
|
const { isJava, hasHelm, hasDestination, hasMta, srvPath, hasHtml5Repo } = project
|
|
27
26
|
|
|
28
27
|
if (hasMta) {
|
|
@@ -36,7 +35,6 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
if (hasHelm) {
|
|
39
|
-
//const env = await this.getEnv()
|
|
40
38
|
const binding = hasDestination && { srv: { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
41
39
|
const html5Binding = hasHtml5Repo && { 'html5-apps-deployer': { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
42
40
|
|
|
@@ -64,7 +62,7 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
64
62
|
|
|
65
63
|
// copy service instance chart if it is not present
|
|
66
64
|
const HelmTemplate = require(`../helm`);
|
|
67
|
-
const helmTemplate = new HelmTemplate(
|
|
65
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
68
66
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
69
67
|
|
|
70
68
|
// add dependency entry in chart.yaml
|
|
@@ -10,7 +10,7 @@ const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registr
|
|
|
10
10
|
module.exports = class EnterpriseMessagingTemplate extends require('../templateBase') {
|
|
11
11
|
|
|
12
12
|
async canRun() {
|
|
13
|
-
const { isJava } = await readProject(
|
|
13
|
+
const { isJava } = await readProject()
|
|
14
14
|
if (isJava) throw `'cds add enterprise-messaging' is not available for Java yet`
|
|
15
15
|
return true
|
|
16
16
|
}
|
|
@@ -20,14 +20,13 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async run() {
|
|
23
|
-
const project = await readProject(
|
|
23
|
+
const project = await readProject()
|
|
24
24
|
const { configFile } = project
|
|
25
25
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
26
|
-
await this.runDependentMerging()
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
async runDependentMerging(context = {}) {
|
|
30
|
-
const project = await readProject(
|
|
29
|
+
const project = await readProject()
|
|
31
30
|
const { hasXsuaa, hasHelm, hasMta, isNodejs, srvPath, appName } = project
|
|
32
31
|
|
|
33
32
|
if (hasMta) {
|
|
@@ -81,7 +80,7 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
81
80
|
|
|
82
81
|
// copy service instance chart if it is not present
|
|
83
82
|
const HelmTemplate = require(`../helm`);
|
|
84
|
-
const helmTemplate = new HelmTemplate(
|
|
83
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
85
84
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
86
85
|
|
|
87
86
|
// add dependency entry in chart.yaml
|
|
@@ -8,7 +8,7 @@ const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registr
|
|
|
8
8
|
module.exports = class EnterpriseMessagingSharedTemplate extends require('../templateBase') {
|
|
9
9
|
|
|
10
10
|
async canRun() {
|
|
11
|
-
const { hasMta, hasHelm, isJava } = await readProject(
|
|
11
|
+
const { hasMta, hasHelm, isJava } = await readProject()
|
|
12
12
|
if (isJava) throw `'cds add enterprise-messaging-shared' is not available for Java yet`
|
|
13
13
|
if (hasHelm && !hasMta) throw `'cds add enterprise-messaging-shared' is not available for Kyma yet`
|
|
14
14
|
return true
|
|
@@ -19,16 +19,15 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../tem
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
|
-
const project = await readProject(
|
|
22
|
+
const project = await readProject()
|
|
23
23
|
const { configFile } = project
|
|
24
24
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
25
25
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
26
26
|
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), project)
|
|
27
|
-
await this.runDependentMerging()
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
async runDependentMerging() {
|
|
31
|
-
const project = await readProject(
|
|
30
|
+
const project = await readProject()
|
|
32
31
|
const { hasMta, isNodejs, srvPath } = project
|
|
33
32
|
|
|
34
33
|
if (hasMta) {
|
|
@@ -21,14 +21,13 @@ module.exports = class ExtensibilityTemplate extends require('../templateBase')
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async run() {
|
|
24
|
-
const project = await readProject(
|
|
24
|
+
const project = await readProject()
|
|
25
25
|
const { configFile } = project
|
|
26
26
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
27
|
-
await this.runDependentMerging()
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
async runDependentMerging() {
|
|
31
|
-
const project = await readProject(
|
|
30
|
+
const project = await readProject()
|
|
32
31
|
const { hasXsuaa } = project
|
|
33
32
|
if (hasXsuaa) {
|
|
34
33
|
await mergeJSON(
|
|
@@ -6,7 +6,7 @@ const { mergeJSON } = require('../../util/merge')
|
|
|
6
6
|
module.exports = class FileBasedMessagingTemplate extends require('../templateBase') {
|
|
7
7
|
|
|
8
8
|
async canRun() {
|
|
9
|
-
const { isJava } = await readProject(
|
|
9
|
+
const { isJava } = await readProject()
|
|
10
10
|
if (isJava) throw `'cds add file-based-messaging' is not available for Java yet`
|
|
11
11
|
return true
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@ module.exports = class FileBasedMessagingTemplate extends require('../templateBa
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
async run() {
|
|
19
|
-
const project = await readProject(
|
|
19
|
+
const project = await readProject()
|
|
20
20
|
const { configFile } = project
|
|
21
21
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
22
22
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
1
|
+
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { read, write, exists, rmdir } = cds.utils
|
|
4
|
-
const
|
|
5
|
-
const mvnArchetypes = require('../../util/mvn');
|
|
6
|
-
const term = require('../../../util/term');
|
|
4
|
+
const { readProject } = require('../../util/projectReader')
|
|
7
5
|
const { mergeJSON, mergeYAML, removeFromYAML, removeFromYAMLArray } = require('../../util/merge')
|
|
6
|
+
const mvn = require('../../util/mvn')
|
|
8
7
|
const { parseMd5File, writeMd5File } = require('../../util/md5')
|
|
9
8
|
const { copyFiles } = require('../../util/template')
|
|
10
|
-
const { readProject } = require('../../util/projectReader');
|
|
11
9
|
|
|
12
|
-
const { OPTIONS: { JAVA }
|
|
10
|
+
const { OPTIONS: { JAVA } } = require('../../constants')
|
|
13
11
|
|
|
14
|
-
const { srvNode4, srvJava4, hdbDeployer, serviceManager, hdiContainer, mtxSidecar4 } = require('../_merging/registry-mta')
|
|
12
|
+
const { srvNode4, srvJava4, hdbDeployer, serviceManager, hdiContainer, mtxSidecar4 } = require('../_merging/registry-mta')
|
|
15
13
|
|
|
16
14
|
module.exports = class HanaTemplate extends require('../templateBase') {
|
|
17
15
|
|
|
@@ -20,56 +18,40 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
async run() {
|
|
23
|
-
const project = await readProject(
|
|
24
|
-
const { isJava, configFile } = project
|
|
21
|
+
const project = await readProject()
|
|
22
|
+
const { isJava, configFile, db } = project
|
|
25
23
|
project.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
|
|
26
24
|
|
|
27
|
-
const env = await this.getEnv() // REVISIT: Get info from project
|
|
28
|
-
|
|
29
25
|
// REVISIT: Let cds build generate by default
|
|
30
|
-
const hdiConfigPath = join(
|
|
26
|
+
const hdiConfigPath = join(db.folder, 'src', '.hdiconfig')
|
|
31
27
|
const hdiConfigTemplatePath = join(__dirname, 'files', 'src', '.hdiconfig')
|
|
32
28
|
await mergeJSON(hdiConfigPath, hdiConfigTemplatePath)
|
|
33
29
|
|
|
34
30
|
// REVISIT: Let csd build generate by default
|
|
35
|
-
const undeployJSONPath = join(
|
|
31
|
+
const undeployJSONPath = join(db.folder, 'undeploy.json')
|
|
36
32
|
const undeployJSONTemplatePath = join(__dirname, 'files', 'undeploy.json')
|
|
37
33
|
await mergeJSON(undeployJSONPath, undeployJSONTemplatePath)
|
|
38
34
|
|
|
39
35
|
if (isJava) {
|
|
40
|
-
await copyFiles(join(__dirname, 'files', 'db'),
|
|
41
|
-
|
|
36
|
+
await copyFiles(join(__dirname, 'files', 'db'), db.folder, {}, cds.cli.options.force)
|
|
37
|
+
// REVISIT: shouldn't behave differently during cds init
|
|
38
|
+
// if called during cds init the project generation call to AT will add settings
|
|
39
|
+
if (!cds.cli.options.add.has(JAVA)) await mvn.execMvn(mvn.getAddHanaCmdArgs())
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project, { forceOverwrite: true })
|
|
42
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project, { forceOverwrite: true }) // REVISIT: forceOverwrite: true as default?
|
|
45
43
|
|
|
46
|
-
const packageJson = exists('package.json') ? await read('package.json') :
|
|
44
|
+
const packageJson = exists('package.json') ? await read('package.json') : null
|
|
47
45
|
if (packageJson?.dependencies) {
|
|
48
46
|
delete packageJson.dependencies['@sap/hana-client']
|
|
49
47
|
await write('package.json', packageJson, { spaces: 2 })
|
|
50
48
|
}
|
|
51
|
-
await this.runDependentMerging()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async removeEntriesFromContext(context, key) {
|
|
55
|
-
Object.keys(context.oldTrackingData).forEach(fileName => {
|
|
56
|
-
if (fileName.startsWith(key)) {
|
|
57
|
-
delete context.oldTrackingData[fileName];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
Object.keys(context.newTrackingData).forEach(fileName => {
|
|
62
|
-
if (fileName.startsWith(key)) {
|
|
63
|
-
delete context.newTrackingData[fileName];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
49
|
}
|
|
67
50
|
|
|
68
51
|
async runDependentMerging(context = {}) {
|
|
69
|
-
const project = await readProject(
|
|
52
|
+
const project = await readProject()
|
|
70
53
|
const { hasMta, hasHelm, hasHtml5Repo, isJava, isMultitenant, srvPath } = project
|
|
71
54
|
|
|
72
|
-
|
|
73
55
|
if (hasMta) {
|
|
74
56
|
const srv = (isJava ? srvJava4 : srvNode4)(srvPath)
|
|
75
57
|
const db = isMultitenant ? serviceManager : hdiContainer
|
|
@@ -92,26 +74,23 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
92
74
|
into: [srv, 'requires', 'name']
|
|
93
75
|
}]
|
|
94
76
|
|
|
95
|
-
if (
|
|
77
|
+
if (isMultitenant) {
|
|
96
78
|
relationships.push({
|
|
97
|
-
insert: [
|
|
98
|
-
into: [
|
|
79
|
+
insert: [serviceManager, 'name'],
|
|
80
|
+
into: [mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar'), 'requires', 'name']
|
|
99
81
|
})
|
|
100
82
|
} else {
|
|
101
83
|
relationships.push({
|
|
102
|
-
insert: [
|
|
103
|
-
into: [
|
|
84
|
+
insert: [hdiContainer, 'name'],
|
|
85
|
+
into: [hdbDeployer, 'requires', 'name']
|
|
104
86
|
})
|
|
105
87
|
}
|
|
106
88
|
|
|
107
|
-
const modules =
|
|
89
|
+
const modules = isMultitenant ? [srv] : [srv, hdbDeployer]
|
|
108
90
|
|
|
109
|
-
await mergeYAML(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
project,
|
|
113
|
-
{ additions: [...modules, db].filter(a => a), deletions, relationships }
|
|
114
|
-
)
|
|
91
|
+
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'), project, {
|
|
92
|
+
additions: [...modules, db].filter(a => a), deletions, relationships
|
|
93
|
+
})
|
|
115
94
|
}
|
|
116
95
|
|
|
117
96
|
if (hasHelm) {
|
|
@@ -123,7 +102,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
123
102
|
}
|
|
124
103
|
|
|
125
104
|
const HelmTemplate = require(`../helm`);
|
|
126
|
-
const helmTemplate = new HelmTemplate(
|
|
105
|
+
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
127
106
|
|
|
128
107
|
if(isMultitenant){
|
|
129
108
|
shouldUpdateTrackingFile = true;
|
|
@@ -137,7 +116,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
137
116
|
// remove content-deployment subchart if html5Repo doesn't exist
|
|
138
117
|
if(!hasHtml5Repo) {
|
|
139
118
|
const contentDeploymentEntriesPattern = "charts/content-deployment/"
|
|
140
|
-
|
|
119
|
+
this.removeEntriesFromContext(context, contentDeploymentEntriesPattern);
|
|
141
120
|
|
|
142
121
|
const contentDeploymentSubchartPath = join('chart', 'charts', 'content-deployment');
|
|
143
122
|
if(exists(contentDeploymentSubchartPath)) {
|
|
@@ -193,21 +172,18 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
193
172
|
}
|
|
194
173
|
}
|
|
195
174
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
await commandUtil.spawnCommand('mvn', mvnAddHanaArgs, {
|
|
202
|
-
cwd: cds.root
|
|
203
|
-
});
|
|
204
|
-
} catch (err) {
|
|
205
|
-
// REVISIT: This should not have to be checked and tested in a facet implementation, move to Maven util
|
|
206
|
-
if (err.code === 'ENOENT' && err.path === 'mvn') {
|
|
207
|
-
throw `Maven executable 'mvn' not found, follow ${term.info(URLS.MAVEN_INSTALL_HELP)} and install Maven on your machine.`
|
|
208
|
-
}
|
|
209
|
-
throw err;
|
|
175
|
+
// REVISIT: tracking data massaging is getting too much -> revisit md5 tracking
|
|
176
|
+
removeEntriesFromContext(context, key) {
|
|
177
|
+
Object.keys(context.oldTrackingData).forEach(fileName => {
|
|
178
|
+
if (fileName.startsWith(key)) {
|
|
179
|
+
delete context.oldTrackingData[fileName]
|
|
210
180
|
}
|
|
211
|
-
}
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
Object.keys(context.newTrackingData).forEach(fileName => {
|
|
184
|
+
if (fileName.startsWith(key)) {
|
|
185
|
+
delete context.newTrackingData[fileName]
|
|
186
|
+
}
|
|
187
|
+
})
|
|
212
188
|
}
|
|
213
189
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
const { join } = require('path');
|
|
2
|
-
const
|
|
2
|
+
const cds = require('../../../cds')
|
|
3
|
+
const { exists, rimraf } = cds.utils
|
|
3
4
|
const { readProject } = require('../../util/projectReader');
|
|
4
5
|
const { mergeYAML } = require('../../util/merge')
|
|
5
6
|
const { parseMd5File, writeMd5File, copyAndTrack } = require('../../util/md5')
|
|
6
7
|
|
|
7
8
|
module.exports = class HelmTemplate extends require('../templateBase') {
|
|
8
9
|
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
10
|
+
constructor(oldTrackingData = undefined, newTrackingData = {}) {
|
|
11
|
+
super()
|
|
11
12
|
this.oldTrackingData = oldTrackingData;
|
|
12
13
|
this.newTrackingData = newTrackingData;
|
|
13
14
|
}
|
|
@@ -16,18 +17,19 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
16
17
|
return ['hana', 'xsuaa', 'auditlog', 'enterprise-messaging', 'destination' , 'multitenancy', 'extensibility', 'approuter', 'connectivity']
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
static hasFacet(
|
|
20
|
+
static hasFacet() {
|
|
20
21
|
// REVISIT: this works, but could be semantically nicer with a 'shouldRunDependentMerging' or the like
|
|
21
|
-
|
|
22
|
+
const { add } = cds.cli.options
|
|
23
|
+
if (add.has('mta') && !add.has('helm')) return false
|
|
22
24
|
return exists(join('chart', 'values.yaml'))
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
async canRun() {
|
|
26
|
-
if (
|
|
28
|
+
if (cds.cli.options.force) {
|
|
27
29
|
await rimraf(join('chart'))
|
|
28
|
-
return true
|
|
30
|
+
return true
|
|
29
31
|
}
|
|
30
|
-
return true
|
|
32
|
+
return true
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
async addSubChart(subchart, force = false) {
|
|
@@ -47,11 +49,11 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
async isInternal() {
|
|
50
|
-
return !exists(join('chart', 'charts', 'web-application')) ||
|
|
52
|
+
return !exists(join('chart', 'charts', 'web-application')) || cds.cli.options['internal-unified-runtime-charts'];
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
async addDependency(name, alias){
|
|
54
|
-
const project = await readProject(
|
|
56
|
+
const project = await readProject();
|
|
55
57
|
const isInternal = await this.isInternal();
|
|
56
58
|
await mergeYAML(
|
|
57
59
|
join('chart', 'Chart.yaml'),
|
|
@@ -77,8 +79,8 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
async run() {
|
|
80
|
-
const project = await readProject(
|
|
81
|
-
const isInternal =
|
|
82
|
+
const project = await readProject()
|
|
83
|
+
const isInternal = cds.cli.options['internal-unified-runtime-charts'] !== undefined && cds.cli.options['internal-unified-runtime-charts'];
|
|
82
84
|
this.oldTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'));
|
|
83
85
|
await this.addSubChart('web-application', !isInternal);
|
|
84
86
|
await copyAndTrack(
|
|
@@ -100,7 +102,6 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
100
102
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
101
103
|
project
|
|
102
104
|
)
|
|
103
|
-
await this.runDependentMerging();
|
|
104
105
|
await writeMd5File(join('chart', '.cds-add-helm-files.md5'), this.newTrackingData);
|
|
105
106
|
}
|
|
106
|
-
}
|
|
107
|
+
}
|