@sap/cds-dk 7.1.1 → 7.3.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 +2 -2
- package/bin/build.js +5 -2
- package/bin/compile/index.js +13 -5
- package/bin/env.js +0 -3
- package/bin/extend.js +25 -3
- package/bin/gen.js +27 -0
- package/bin/help.js +2 -1
- package/bin/import.js +7 -3
- package/bin/push.js +10 -6
- package/bin/watch.js +3 -4
- package/bin/watched.js +2 -3
- package/lib/bind/bindingUtil.js +1 -0
- package/lib/build/{buildTaskHandler.js → buildPlugin.js} +25 -30
- package/lib/build/buildTaskEngine.js +84 -89
- package/lib/build/buildTaskFactory.js +23 -44
- package/lib/build/buildTaskProvider.js +24 -19
- package/lib/build/buildTaskProviderFactory.js +176 -66
- package/lib/build/constants.js +6 -5
- package/lib/build/index.js +4 -3
- package/lib/build/provider/{buildTaskHandlerEdmx.js → edmxBuildPlugin.js} +6 -6
- package/lib/build/provider/{buildTaskHandlerFeatureToggles.js → featureToggleBuildPlugin.js} +3 -3
- package/lib/build/provider/fiori/index.js +5 -6
- package/lib/build/provider/hana/index.js +67 -36
- package/lib/build/provider/{buildTaskHandlerInternal.js → internalBuildPlugin.js} +11 -11
- package/lib/build/provider/{buildTaskProviderInternal.js → internalBuildTaskProvider.js} +42 -53
- package/lib/build/provider/java/index.js +24 -24
- package/lib/build/provider/mtx/index.js +4 -4
- package/lib/build/provider/mtx/resourcesTarBuilder.js +8 -8
- package/lib/build/provider/mtx-extension/index.js +17 -9
- package/lib/build/provider/mtx-sidecar/index.js +17 -11
- package/lib/build/provider/nodejs/index.js +63 -29
- package/lib/build/util.js +11 -19
- package/lib/client/auth_manager.js +6 -12
- package/lib/client/base_command.js +1 -1
- package/lib/client/download_legacy.js +48 -0
- package/lib/client/params.js +5 -0
- package/lib/client/push.js +41 -1
- package/lib/client/settings_manager.js +12 -3
- package/lib/compile/openapi/csdl2openapi.js +30 -21
- package/lib/compile/openapi/index.js +7 -3
- package/lib/env/schema.js +36 -0
- package/lib/env/schemas/cds-rc.json +101 -0
- package/lib/import/common.js +24 -11
- package/lib/import/importapi.js +2 -2
- package/lib/import/message.js +3 -1
- package/lib/import/odata/v4parser.js +23 -7
- package/lib/index.js +5 -0
- package/lib/init/constants.js +9 -12
- package/lib/init/index.js +86 -74
- package/lib/init/template/_merging/registry-mta.js +21 -12
- package/lib/init/template/approuter/files/mta.yaml.hbs +1 -1
- package/lib/init/template/approuter/index.js +3 -2
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +0 -5
- package/lib/init/template/cf-manifest/index.js +2 -2
- package/lib/init/template/connectivity/index.js +5 -4
- package/lib/init/template/destination/index.js +2 -5
- package/lib/init/template/h2/index.js +16 -0
- package/lib/init/template/hana/index.js +2 -3
- package/lib/init/template/helm/chart/values.root.schema.json +0 -5
- package/lib/init/template/helm/chart/values.schema.json +0 -4
- package/lib/init/template/helm/index.js +1 -1
- package/lib/init/template/html5-repo/index.js +27 -3
- package/lib/init/template/lint/index.js +3 -7
- package/lib/init/template/mta/index.js +9 -3
- package/lib/init/template/multitenancy/files/package.json.hbs +0 -3
- package/lib/init/template/multitenancy/index.js +2 -0
- package/lib/init/template/nodejs/index.js +3 -3
- package/lib/init/template/pipeline/index.js +2 -4
- package/lib/init/template/postgres/files/mta.yaml.hbs +27 -0
- package/lib/init/template/postgres/files/package.json.hbs +5 -0
- package/lib/init/template/postgres/index.js +52 -0
- package/lib/init/template/sample/index.js +5 -7
- package/lib/init/template/sqlite/index.js +8 -3
- package/lib/init/template/tiny-sample/index.js +16 -30
- package/lib/init/util/mvn.js +25 -1
- package/lib/init/util/projectReader.js +2 -7
- package/lib/init/util/template.js +7 -6
- package/lib/util/pruneAxiosErrors.js +22 -8
- package/lib/watch/node-watch.js +6 -1
- package/npm-shrinkwrap.json +2207 -384
- package/package.json +3 -3
- package/lib/init/template/auditlog/files/mta.yaml.hbs +0 -14
- package/lib/init/template/auditlog/files/package.json.hbs +0 -27
- package/lib/init/template/auditlog/index.js +0 -74
package/lib/init/index.js
CHANGED
|
@@ -3,7 +3,12 @@ const path = require('path');
|
|
|
3
3
|
const term = require('../util/term');
|
|
4
4
|
|
|
5
5
|
const { OPTIONS, COMMAND_INIT, PROJECT_FILES, REGEX_PROJECT_NAME } = require('./constants')
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
NODEJS, JAVA,
|
|
8
|
+
HANA, APPROUTER, XSUAA, KIBANA, ENTERPRISE_MESSAGING,
|
|
9
|
+
MTA, HELM, MULTITENANCY, PIPELINE,
|
|
10
|
+
TINY_SAMPLE, SAMPLE
|
|
11
|
+
} = OPTIONS
|
|
7
12
|
|
|
8
13
|
const cds = require('../cds'), { exists, readdir } = cds.utils
|
|
9
14
|
const DEBUG = /\b(y|all|cli)\b/.test(process.env.DEBUG) ? console.debug : undefined
|
|
@@ -12,77 +17,86 @@ module.exports = class CDSGenerator {
|
|
|
12
17
|
constructor() {
|
|
13
18
|
this.cwd = process.cwd();
|
|
14
19
|
|
|
15
|
-
this.uiConfig = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return true;
|
|
29
|
-
} catch (err) {
|
|
30
|
-
return err;
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
guiOptions: {
|
|
34
|
-
hint: 'This name is restricted to certain characters. A valid project name is compatible across platforms.',
|
|
35
|
-
mandatory: true
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
title: `Type`,
|
|
40
|
-
description: `Select your runtime.`,
|
|
41
|
-
default: NODEJS,
|
|
42
|
-
choices: [
|
|
43
|
-
{ name: 'Node.js', value: NODEJS },
|
|
44
|
-
{ name: 'Java', value: JAVA }
|
|
45
|
-
],
|
|
46
|
-
multiple: false,
|
|
47
|
-
target: 'add',
|
|
48
|
-
guiOptions: {
|
|
49
|
-
hint: `The preferred runtime can't be changed afterwards. To use a different runtime, create a new project.`,
|
|
50
|
-
mandatory: true
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
title: `Features`,
|
|
55
|
-
description: `Add features to your project.`,
|
|
56
|
-
default: '',
|
|
57
|
-
choices: [
|
|
58
|
-
{ name: 'CI/CD Pipeline Integration', value: PIPELINE },
|
|
59
|
-
{ name: 'Configuration for SAP HANA Deployment', value: HANA },
|
|
60
|
-
{ name: 'MTA based SAP Business Technology Platform Deployment', value: MTA },
|
|
61
|
-
// { name: 'Multitenancy', value: mtx },
|
|
62
|
-
{ name: `Cloud Foundry native Deployment`, value: CF_MANIFEST }
|
|
63
|
-
// { name: `CDS Linter for custom rules`, value: lint },
|
|
64
|
-
// { name: `CDS Linter for custom rules with sample`, value: lintDev }
|
|
65
|
-
],
|
|
66
|
-
multiple: true,
|
|
67
|
-
target: 'add',
|
|
68
|
-
guiOptions: {
|
|
69
|
-
hint: `Choose any combination of features enriching the capabilities of your project. You can also add features later with ${term.bold('cds add')}`
|
|
20
|
+
this.uiConfig = [{
|
|
21
|
+
title: 'Project Name',
|
|
22
|
+
description: 'Enter your project name.',
|
|
23
|
+
default: '',
|
|
24
|
+
target: 'projectName',
|
|
25
|
+
validate: async (value) => {
|
|
26
|
+
try {
|
|
27
|
+
cds.root = path.resolve(this.cwd, value || '.');
|
|
28
|
+
|
|
29
|
+
await this._validateProjectName(value);
|
|
30
|
+
await this._validateProjectFolder(path.join(this.cwd, value), this.cwd);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return e
|
|
70
33
|
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
71
36
|
},
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
default: '',
|
|
76
|
-
choices: [
|
|
77
|
-
{ name: 'Basic Sample Files', value: TINY_SAMPLE }
|
|
78
|
-
],
|
|
79
|
-
multiple: true,
|
|
80
|
-
target: 'add',
|
|
81
|
-
guiOptions: {
|
|
82
|
-
hint: 'Speed up your ramp-up phase with some sample files in your project.'
|
|
83
|
-
}
|
|
37
|
+
guiOptions: {
|
|
38
|
+
hint: 'This name is restricted to certain characters. A valid project name is compatible across platforms.',
|
|
39
|
+
mandatory: true
|
|
84
40
|
}
|
|
85
|
-
|
|
41
|
+
}, {
|
|
42
|
+
title: 'Type',
|
|
43
|
+
description: `Select your runtime.`,
|
|
44
|
+
default: NODEJS,
|
|
45
|
+
choices: [
|
|
46
|
+
{ name: 'Node.js', value: NODEJS },
|
|
47
|
+
{ name: 'Java', value: JAVA }
|
|
48
|
+
],
|
|
49
|
+
multiple: false,
|
|
50
|
+
target: 'add',
|
|
51
|
+
guiOptions: {
|
|
52
|
+
hint: `The preferred runtime can't be changed afterwards. To use a different runtime, create a new project.`,
|
|
53
|
+
mandatory: true
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
title: 'Features',
|
|
57
|
+
description: 'Choose productive runtime capabilities for your application.',
|
|
58
|
+
default: '',
|
|
59
|
+
choices: [
|
|
60
|
+
{ name: 'SAP HANA Cloud', value: HANA },
|
|
61
|
+
{ name: 'SAP Application Router', value: APPROUTER },
|
|
62
|
+
{ name: 'User Authentication via XSUAA', value: XSUAA },
|
|
63
|
+
{ name: 'Kibana Logging Dashboard', value: KIBANA },
|
|
64
|
+
{ name: 'SAP BTP Event Mesh', value: ENTERPRISE_MESSAGING }
|
|
65
|
+
],
|
|
66
|
+
multiple: true,
|
|
67
|
+
target: 'add',
|
|
68
|
+
guiOptions: {
|
|
69
|
+
hint: `Choose any combination of features enriching the capabilities of your project. You can also add features later with ${term.bold('cds add')}`
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
title: 'Deployment',
|
|
73
|
+
description: 'Choose which way to deploy your project.',
|
|
74
|
+
default: '',
|
|
75
|
+
choices: [
|
|
76
|
+
{ name: 'Cloud Foundry: MTA Deployment', value: MTA },
|
|
77
|
+
{ name: 'Kyma: Helm Deployment', value: HELM },
|
|
78
|
+
{ name: 'Multitenancy', value: MULTITENANCY },
|
|
79
|
+
{ name: 'CI/CD Pipeline Integration', value: PIPELINE },
|
|
80
|
+
],
|
|
81
|
+
multiple: true,
|
|
82
|
+
target: 'add',
|
|
83
|
+
guiOptions: {
|
|
84
|
+
hint: `Choose any combination of features enriching the capabilities of your project. You can also add features later with ${term.bold('cds add')}`
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
title: 'Samples',
|
|
88
|
+
description: `Add sample content to your project.`,
|
|
89
|
+
default: '',
|
|
90
|
+
choices: [
|
|
91
|
+
{ name: 'Minimal Sample', value: TINY_SAMPLE },
|
|
92
|
+
{ name: 'Extended Sample with UI', value: SAMPLE }
|
|
93
|
+
],
|
|
94
|
+
multiple: true,
|
|
95
|
+
target: 'add',
|
|
96
|
+
guiOptions: {
|
|
97
|
+
hint: 'Speed up your ramp-up phase with sample files in your project.'
|
|
98
|
+
}
|
|
99
|
+
}]
|
|
86
100
|
}
|
|
87
101
|
|
|
88
102
|
/**
|
|
@@ -112,9 +126,8 @@ module.exports = class CDSGenerator {
|
|
|
112
126
|
}
|
|
113
127
|
|
|
114
128
|
async stepInit(projectName, options) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// called from CAP generator
|
|
129
|
+
if (options) {
|
|
130
|
+
// called from CAP generator with options
|
|
118
131
|
cds.cli = {
|
|
119
132
|
command: COMMAND_INIT,
|
|
120
133
|
// keep caller independent from internal names
|
|
@@ -190,8 +203,7 @@ module.exports = class CDSGenerator {
|
|
|
190
203
|
);
|
|
191
204
|
const fuzzySearch = require('../../bin/util/fuzzySearch');
|
|
192
205
|
const [bestMatch] = fuzzySearch(filename, entries);
|
|
193
|
-
|
|
194
|
-
process.exit(1);
|
|
206
|
+
throw `Unknown facet '${term.bold(filename)}'. Did you mean ${term.bold(`cds add ${bestMatch}`)}?\n\nHaven't found the proper facet yet? Here are all supported facets:\n\n ${term.bold(entries.join('\n '))}\n`
|
|
195
207
|
}
|
|
196
208
|
throw err;
|
|
197
209
|
}
|
|
@@ -60,17 +60,6 @@ const connectivity = {
|
|
|
60
60
|
}]
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const auditlog = {
|
|
64
|
-
in: 'resources',
|
|
65
|
-
where: [{
|
|
66
|
-
property: 'type',
|
|
67
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
68
|
-
}, {
|
|
69
|
-
property: 'parameters.service',
|
|
70
|
-
isEqualTo: 'auditlog-api',
|
|
71
|
-
}]
|
|
72
|
-
}
|
|
73
|
-
|
|
74
63
|
const redis = {
|
|
75
64
|
in: 'resources',
|
|
76
65
|
where: [{
|
|
@@ -137,6 +126,25 @@ const serviceManager = {
|
|
|
137
126
|
}]
|
|
138
127
|
}
|
|
139
128
|
|
|
129
|
+
const postgres = {
|
|
130
|
+
in: 'resources',
|
|
131
|
+
where: [{
|
|
132
|
+
property: 'parameters.service',
|
|
133
|
+
isEqualTo: 'postgresql-db',
|
|
134
|
+
}]
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const postgresDeployer = {
|
|
138
|
+
in: 'modules',
|
|
139
|
+
where: [{
|
|
140
|
+
property: 'type',
|
|
141
|
+
isEqualTo: 'nodejs',
|
|
142
|
+
}, {
|
|
143
|
+
property: 'path',
|
|
144
|
+
isEqualTo: 'gen/pg',
|
|
145
|
+
}]
|
|
146
|
+
}
|
|
147
|
+
|
|
140
148
|
const saasRegistry = {
|
|
141
149
|
in: 'resources',
|
|
142
150
|
where: [{
|
|
@@ -260,13 +268,14 @@ module.exports = {
|
|
|
260
268
|
srvJava4,
|
|
261
269
|
approuter,
|
|
262
270
|
xsuaa,
|
|
263
|
-
auditlog,
|
|
264
271
|
destination,
|
|
265
272
|
connectivity,
|
|
266
273
|
enterpriseMessaging,
|
|
267
274
|
hdbDeployer,
|
|
268
275
|
hdiContainer,
|
|
269
276
|
serviceManager,
|
|
277
|
+
postgres,
|
|
278
|
+
postgresDeployer,
|
|
270
279
|
saasRegistry,
|
|
271
280
|
redis,
|
|
272
281
|
srvApi4,
|
|
@@ -3,7 +3,7 @@ const { exists } = cds.utils
|
|
|
3
3
|
const { join } = require('path')
|
|
4
4
|
const { readProject } = require('../../util/projectReader')
|
|
5
5
|
const { mergeJSON, mergeYAML, sort } = require('../../util/merge')
|
|
6
|
-
const { XSUAA, KIBANA } = require('../../constants').OPTIONS
|
|
6
|
+
const { XSUAA, KIBANA, HTML5_REPO } = require('../../constants').OPTIONS
|
|
7
7
|
const {
|
|
8
8
|
srvNode4, srvJava4, mtxSidecar4, approuter, // Modules
|
|
9
9
|
xsuaa, // BTP Services
|
|
@@ -24,7 +24,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
getRelatedFacets() {
|
|
27
|
-
return [KIBANA]
|
|
27
|
+
return [KIBANA, HTML5_REPO]
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async run() {
|
|
@@ -114,6 +114,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
117
|
+
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
const xsAppPath = join(appPath, 'xs-app.json')
|
|
@@ -2,7 +2,7 @@ const { join } = require('path')
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists } = require('../../../cds').utils
|
|
4
4
|
const { readProject } = require('../../util/projectReader')
|
|
5
|
-
const {
|
|
5
|
+
const { renderAndCopy } = require('../../util/template')
|
|
6
6
|
const MANIFEST_FILE = 'manifest.yml'
|
|
7
7
|
const SERVICES_MANIFEST_FILE = 'services-manifest.yml'
|
|
8
8
|
|
|
@@ -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
|
|
23
|
+
await renderAndCopy(join(__dirname, 'files'), cds.root, project)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const { readProject } = require('../../util/projectReader')
|
|
3
|
-
const {
|
|
3
|
+
const { mergeYAML } = require('../../util/merge')
|
|
4
4
|
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
5
5
|
const { srvJava4, srvNode4, connectivity } = require('../_merging/registry-mta')
|
|
6
6
|
|
|
@@ -11,9 +11,10 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async run() {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
// Disable setting cds.requires.connectivity for now.
|
|
15
|
+
// const project = await readProject()
|
|
16
|
+
// const { configFile } = project
|
|
17
|
+
// await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
async runDependentMerging(context = {}) {
|
|
@@ -22,7 +22,7 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
22
22
|
|
|
23
23
|
async runDependentMerging(context = {}) {
|
|
24
24
|
const project = await readProject()
|
|
25
|
-
const { isJava, hasHelm, hasDestination, hasMta, srvPath
|
|
25
|
+
const { isJava, hasHelm, hasDestination, hasMta, srvPath } = project
|
|
26
26
|
|
|
27
27
|
if (hasMta) {
|
|
28
28
|
const srv = (isJava ? srvJava4 : srvNode4)(srvPath)
|
|
@@ -36,7 +36,6 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
36
36
|
|
|
37
37
|
if (hasHelm) {
|
|
38
38
|
const binding = hasDestination && { srv: { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
39
|
-
const html5Binding = hasHtml5Repo && { 'html5-apps-deployer': { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
40
39
|
|
|
41
40
|
//in case facet is being added to the already exisiting charts folder
|
|
42
41
|
let isIndependentCommand = false
|
|
@@ -48,13 +47,11 @@ module.exports = class DestinationTemplate extends require('../templateBase') {
|
|
|
48
47
|
join('chart', 'values.yaml'),
|
|
49
48
|
{
|
|
50
49
|
...binding,
|
|
51
|
-
...html5Binding,
|
|
52
50
|
destination: {
|
|
53
51
|
serviceOfferingName: 'destination',
|
|
54
52
|
servicePlanName: 'lite',
|
|
55
53
|
parameters: {
|
|
56
|
-
version: '1.0.0'
|
|
57
|
-
...(hasHtml5Repo) && { HTML5Runtime_enabled: true }
|
|
54
|
+
version: '1.0.0'
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const mvn = require('../../util/mvn')
|
|
2
|
+
const { readProject } = require('../../util/projectReader')
|
|
3
|
+
const { H2 } = require('../../constants').OPTIONS
|
|
4
|
+
|
|
5
|
+
module.exports = class H2Template extends require('../templateBase') {
|
|
6
|
+
|
|
7
|
+
async canRun() {
|
|
8
|
+
const { isNodejs } = await readProject()
|
|
9
|
+
if (isNodejs) throw `'cds add ${H2}' is not available for Node.js`
|
|
10
|
+
return true
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async run() {
|
|
14
|
+
await mvn.add(H2)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const { read, write, exists, rmdir } = cds.utils
|
|
3
|
+
const { read, write, exists, rmdir, copy } = cds.utils
|
|
4
4
|
const { readProject } = require('../../util/projectReader')
|
|
5
5
|
const { mergeJSON, mergeYAML, removeFromYAML, removeFromYAMLArray } = require('../../util/merge')
|
|
6
6
|
const mvn = require('../../util/mvn')
|
|
7
7
|
const { parseMd5File, writeMd5File } = require('../../util/md5')
|
|
8
|
-
const { copyFiles } = require('../../util/template')
|
|
9
8
|
|
|
10
9
|
const { OPTIONS: { JAVA } } = require('../../constants')
|
|
11
10
|
|
|
@@ -33,7 +32,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
33
32
|
await mergeJSON(undeployJSONPath, undeployJSONTemplatePath)
|
|
34
33
|
|
|
35
34
|
if (isJava) {
|
|
36
|
-
await
|
|
35
|
+
await copy(join(__dirname, 'files', 'db')).to(db.folder)
|
|
37
36
|
// REVISIT: shouldn't behave differently during cds init
|
|
38
37
|
// if called during cds init the project generation call to AT will add settings
|
|
39
38
|
if (!cds.cli.options.add.has(JAVA)) await mvn.execMvn(mvn.getAddHanaCmdArgs())
|
|
@@ -37,11 +37,6 @@
|
|
|
37
37
|
"description": "Service Instance",
|
|
38
38
|
"$ref": "./charts/service-instance/values.schema.json"
|
|
39
39
|
},
|
|
40
|
-
"auditlog": {
|
|
41
|
-
"$id": "#/properties/auditlog",
|
|
42
|
-
"description": "Service Instance",
|
|
43
|
-
"$ref": "./charts/service-instance/values.schema.json"
|
|
44
|
-
},
|
|
45
40
|
"destination": {
|
|
46
41
|
"$id": "#/properties/destination",
|
|
47
42
|
"description": "Service Instance",
|
|
@@ -66,10 +66,6 @@
|
|
|
66
66
|
"$id": "#/properties/xsuaa",
|
|
67
67
|
"description": "Service Instance"
|
|
68
68
|
},
|
|
69
|
-
"auditlog": {
|
|
70
|
-
"$id": "#/properties/auditlog",
|
|
71
|
-
"description": "Service Instance"
|
|
72
|
-
},
|
|
73
69
|
"destination": {
|
|
74
70
|
"$id": "#/properties/destination",
|
|
75
71
|
"description": "Service Instance"
|
|
@@ -14,7 +14,7 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
getRelatedFacets() {
|
|
17
|
-
return ['hana', 'xsuaa', '
|
|
17
|
+
return ['hana', 'xsuaa', 'enterprise-messaging', 'destination' , 'multitenancy', 'extensibility', 'approuter', 'connectivity']
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
static hasFacet() {
|
|
@@ -27,7 +27,7 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async runDependentMerging(context = {}) {
|
|
30
|
-
const { appName, hasHelm } = await readProject()
|
|
30
|
+
const { appName, hasHelm, hasApprouter} = await readProject()
|
|
31
31
|
|
|
32
32
|
if (hasHelm) {
|
|
33
33
|
//in case facet is being added to the already exisiting charts folder
|
|
@@ -69,14 +69,38 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
backendDestinations: {},
|
|
72
|
+
destination: {
|
|
73
|
+
parameters: {
|
|
74
|
+
HTML5Runtime_enabled: true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
78
|
)
|
|
74
|
-
|
|
79
|
+
|
|
75
80
|
// copy content deployment chart if it is not present
|
|
76
81
|
const HelmTemplate = require(`../helm`);
|
|
77
82
|
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
78
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('content-deployment');
|
|
79
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
|
+
|
|
80
104
|
// add dependency entry in chart.yaml
|
|
81
105
|
await helmTemplate.addDependency('content-deployment', 'html5-apps-deployer');
|
|
82
106
|
|
|
@@ -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 {
|
|
8
|
+
const { renderAndCopy } = require('../../util/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");
|
|
@@ -62,10 +62,10 @@ module.exports = class LintTemplate extends require('../templateBase') {
|
|
|
62
62
|
await this._generateEslintDirs();
|
|
63
63
|
|
|
64
64
|
if (!exists(".eslint/rules/no-entity-moo.js")) {
|
|
65
|
-
await
|
|
65
|
+
await renderAndCopy(".eslint/rules", this.rulesPath);
|
|
66
66
|
}
|
|
67
67
|
if (!exists(".eslint/tests/no-entity-moo.test.js")) {
|
|
68
|
-
await
|
|
68
|
+
await renderAndCopy(".eslint/tests", this.testsPath);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -150,10 +150,6 @@ module.exports = class LintTemplate extends require('../templateBase') {
|
|
|
150
150
|
await mkdirp(this.testsPath);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
async _copyFromTemplate(source, dest) {
|
|
154
|
-
await copyFiles(source, dest, {}, true);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
153
|
async _addEslintPluginConfig() {
|
|
158
154
|
let configPath = getConfigPath(cds.root);
|
|
159
155
|
if (!configPath) {
|
|
@@ -4,17 +4,23 @@ const { exists } = cds.utils
|
|
|
4
4
|
const { copyRenderedYAML } = require('../../../util/fs')
|
|
5
5
|
const { readProject } = require('../../util/projectReader')
|
|
6
6
|
const { mergeJSON, sort } = require('../../util/merge')
|
|
7
|
-
|
|
7
|
+
const {
|
|
8
|
+
APPROUTER, XSUAA, MULTITENANCY, EXTENSIBILITY,
|
|
9
|
+
MTA, HELM,
|
|
10
|
+
HANA, POSTGRES,
|
|
11
|
+
ENTERPRISE_MESSAGING, ENTERPRISE_MESSAGING_SHARED, REDIS_MESSAGING,
|
|
12
|
+
CONNECTIVITY, DESTINATION
|
|
13
|
+
} = require('../../constants').OPTIONS
|
|
8
14
|
module.exports = class MtaTemplate extends require('../templateBase') {
|
|
9
15
|
|
|
10
16
|
static hasFacet() {
|
|
11
17
|
const { options } = cds.cli
|
|
12
|
-
if (!options?.add.has(
|
|
18
|
+
if (!options?.add.has(MTA) && options?.add.has(HELM)) return false
|
|
13
19
|
return exists('mta.yaml')
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
getRelatedFacets() {
|
|
17
|
-
return [
|
|
23
|
+
return [APPROUTER, XSUAA, MULTITENANCY, HANA, POSTGRES, EXTENSIBILITY, ENTERPRISE_MESSAGING, ENTERPRISE_MESSAGING_SHARED, REDIS_MESSAGING, CONNECTIVITY, DESTINATION]
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
async run() {
|
|
@@ -2,6 +2,7 @@ const { join } = require('path')
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists, read, write } = cds.utils
|
|
4
4
|
const { APPROUTER, HANA, KIBANA } = require('../../constants').OPTIONS
|
|
5
|
+
const mvn = require('../../util/mvn')
|
|
5
6
|
const { readProject } = require('../../util/projectReader')
|
|
6
7
|
const { mergeJSON, mergeYAML, sort } = require('../../util/merge')
|
|
7
8
|
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
@@ -35,6 +36,7 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
35
36
|
const packageJson = await read('package.json')
|
|
36
37
|
packageJson.workspaces = ['mtx/sidecar']
|
|
37
38
|
await write('package.json', packageJson, { spaces: 2 })
|
|
39
|
+
await mvn.execMvn(mvn.getAddArgs('mtx'))
|
|
38
40
|
}
|
|
39
41
|
if (isNodejs) await sort('package.json', 'dependencies')
|
|
40
42
|
await copyRenderedJSON(join(__dirname, 'files', 'package.sidecar.json.hbs'), join('mtx', 'sidecar', 'package.json'), project)
|
|
@@ -3,12 +3,12 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { exists, mkdirp, path } = cds.utils
|
|
4
4
|
const { URLS, OPTIONS: { NODEJS, JAVA }, COMMAND_ADD } = require('../../constants')
|
|
5
5
|
const term = require('../../../util/term')
|
|
6
|
-
const {
|
|
6
|
+
const { renderAndCopy } = require('../../util/template')
|
|
7
7
|
|
|
8
8
|
module.exports = class NodejsTemplate extends require('../templateBase') {
|
|
9
9
|
|
|
10
10
|
static hasFacet() {
|
|
11
|
-
return !exists('pom.xml')
|
|
11
|
+
return !exists('pom.xml') && !cds.cli.options?.add?.has(JAVA)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
async canRun() {
|
|
@@ -23,7 +23,7 @@ module.exports = class NodejsTemplate extends require('../templateBase') {
|
|
|
23
23
|
|
|
24
24
|
async run() {
|
|
25
25
|
const { db, srv, app } = (await this.getEnv()).folders
|
|
26
|
-
await
|
|
26
|
+
await renderAndCopy(join(__dirname, 'files'), cds.root, { projectName: path.basename(cds.root) })
|
|
27
27
|
await Promise.all([db, srv, app].map(p => mkdirp(p)))
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
const { join } = require('path');
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const { exists } = cds.utils
|
|
4
|
-
const { copyFiles } = require('../../util/template')
|
|
3
|
+
const { exists, copy } = cds.utils
|
|
5
4
|
const { URLS } = require('../../constants')
|
|
6
5
|
|
|
7
6
|
module.exports = class PipelineTemplate extends require('../templateBase') {
|
|
8
7
|
|
|
9
|
-
|
|
10
8
|
async canRun() {
|
|
11
9
|
if (cds.cli.options.force) {
|
|
12
10
|
return true;
|
|
@@ -20,7 +18,7 @@ module.exports = class PipelineTemplate extends require('../templateBase') {
|
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
async run() {
|
|
23
|
-
await
|
|
21
|
+
await copy(join(__dirname, 'files')).to(cds.root)
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
async finalize() {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
modules:
|
|
3
|
+
- name: {{appName}}-srv
|
|
4
|
+
type: {{language}}
|
|
5
|
+
path: {{& srvPath}}
|
|
6
|
+
requires:
|
|
7
|
+
- name: {{appName}}-postgres
|
|
8
|
+
|
|
9
|
+
- name: {{appName}}-postgres-deployer
|
|
10
|
+
type: nodejs
|
|
11
|
+
path: gen/pg
|
|
12
|
+
parameters:
|
|
13
|
+
buildpack: nodejs_buildpack
|
|
14
|
+
no-route: true
|
|
15
|
+
no-start: true
|
|
16
|
+
tasks:
|
|
17
|
+
- name: deploy-to-postgresql
|
|
18
|
+
command: npm start
|
|
19
|
+
requires:
|
|
20
|
+
- name: {{appName}}-postgres
|
|
21
|
+
|
|
22
|
+
resources:
|
|
23
|
+
- name: {{appName}}-postgres
|
|
24
|
+
type: org.cloudfoundry.managed-service
|
|
25
|
+
parameters:
|
|
26
|
+
service: postgresql-db
|
|
27
|
+
service-plan: development
|