@sap/cds-dk 7.9.4 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2116 -0
- package/bin/add.js +18 -52
- package/bin/bind.js +2 -2
- package/bin/build.js +29 -4
- package/bin/cds.js +23 -11
- package/bin/compile/index.js +7 -6
- package/bin/completion/index.js +70 -46
- package/bin/completion/scripts/cds-bash.sh +4 -1
- package/bin/completion/scripts/cds-fish.fish +13 -0
- package/bin/completion/scripts/cds-ps.ps1 +2 -1
- package/bin/completion/scripts/cds-zsh.sh +2 -1
- package/bin/deploy/index.js +6 -5
- package/bin/deploy/to-sqlite.js +2 -2
- package/bin/extend.js +19 -50
- package/bin/help.js +2 -2
- package/bin/init.js +10 -77
- package/bin/login.js +13 -5
- package/bin/migrate.js +1 -1
- package/bin/pull.js +11 -0
- package/bin/repl.js +3 -0
- package/bin/test.js +5 -0
- package/bin/version.js +7 -7
- package/bin/watch.js +2 -11
- package/lib/bind/KubernetesApiAccessor.js +10 -9
- package/lib/build/buildTaskEngine.js +11 -7
- package/lib/build/buildTaskFactory.js +15 -43
- package/lib/build/buildTaskProviderFactory.js +16 -44
- package/lib/build/constants.js +3 -3
- package/lib/build/index.js +2 -2
- package/lib/build/{buildPlugin.js → plugin.js} +65 -46
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/_helpers.tpl +7 -0
- package/lib/build/plugins/helm/files/subcharts/service-instance/templates/servicebinding.yaml +32 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/serviceinstance.yaml +3 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.schema.json +63 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.yaml +23 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/deployment.yaml +2 -0
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/hpa.yaml +22 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/pod-disruption-budget.yaml +1 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.schema.json +49 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.yaml +8 -2
- package/lib/{init/template/helm/files/chart → build/plugins/helm/files}/templates/_deployment_helpers.tpl +5 -0
- package/lib/build/plugins/helm/files/templates/_helpers.tpl +13 -0
- package/lib/build/plugins/helm/index.js +81 -0
- package/lib/build/plugins.js +12 -15
- package/lib/build/provider/featureToggleBuildPlugin.js +7 -39
- package/lib/build/provider/hana/2migration.js +168 -124
- package/lib/build/provider/hana/index.js +20 -25
- package/lib/build/provider/hana/template/.hdiconfig-all +3 -0
- package/lib/build/provider/hana/template/.hdiconfig-cloud +3 -0
- package/lib/build/provider/hana/template/package.json +4 -3
- package/lib/build/provider/internalBuildPlugin.js +32 -97
- package/lib/build/provider/internalBuildTaskProvider.js +10 -46
- package/lib/build/provider/java/index.js +2 -3
- package/lib/build/provider/mtx/index.js +5 -4
- package/lib/build/provider/mtx-extension/index.js +5 -2
- package/lib/build/provider/mtx-sidecar/index.js +2 -2
- package/lib/build/util.js +83 -12
- package/lib/compile/to-mermaid.js +108 -0
- package/lib/compile/to_asyncapi.js +7 -0
- package/lib/compile/to_openapi.js +7 -0
- package/lib/deploy/to-hana/hana.js +37 -34
- package/lib/deploy/to-hana/hdiDeployUtil.js +8 -6
- package/lib/env/schemas/cds-rc.js +1 -1
- package/lib/import/common.js +2 -2
- package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -4
- package/lib/import/odata/v2parser.js +83 -197
- package/lib/import/odata/v4parser.js +1 -38
- package/lib/import/openapi/importOpenAPI.js +164 -42
- package/lib/index.js +10 -12
- package/lib/init/bas.js +91 -0
- package/lib/init/constants.js +16 -10
- package/lib/init/index.js +74 -150
- package/lib/init/merge.js +12 -20
- package/lib/init/mvn.js +103 -150
- package/lib/init/plugin.js +11 -7
- package/lib/init/projectReader.js +53 -19
- package/lib/init/registries/mta.js +51 -6
- package/lib/init/template/application-logging/files/package.json.hbs +7 -0
- package/lib/init/template/application-logging/index.js +13 -1
- package/lib/init/template/approuter/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +1 -2
- package/lib/init/template/approuter/files/values.yaml.hbs +19 -4
- package/lib/init/template/approuter/files/xs-app.json.hbs +12 -3
- package/lib/init/template/approuter/index.js +29 -25
- package/lib/init/template/attachments/files/mta.yaml.hbs +14 -0
- package/lib/init/template/attachments/files/package.json.hbs +5 -0
- package/lib/init/template/attachments/files/values.yaml +7 -0
- package/lib/init/template/attachments/index.js +53 -0
- package/lib/init/template/audit-logging/files/mta.yaml.hbs +14 -0
- package/lib/init/template/audit-logging/files/package.json.hbs +7 -0
- package/lib/init/template/audit-logging/index.js +66 -0
- package/lib/init/template/cf-manifest/index.js +4 -0
- package/lib/init/template/completion/completionSetup.js +54 -33
- package/lib/init/template/completion/index.js +7 -1
- package/lib/init/template/connectivity/index.js +4 -4
- package/lib/init/template/containerize/files/containerize.yaml.hbs +26 -0
- package/lib/init/template/containerize/index.js +24 -0
- package/lib/init/template/data/index.js +4 -0
- package/lib/init/template/destination/files/mta.yaml.hbs +25 -1
- package/lib/init/template/destination/index.js +12 -2
- package/lib/init/template/enterprise-messaging/index.js +6 -3
- package/lib/init/template/enterprise-messaging-shared/index.js +5 -1
- package/lib/init/template/extensibility/files/package.json.hbs +1 -1
- package/lib/init/template/extensibility/files/xs-security.json.hbs +2 -8
- package/lib/init/template/extensibility/index.js +3 -1
- package/lib/init/template/file-based-messaging/index.js +4 -0
- package/lib/init/template/h2/index.js +4 -0
- package/lib/init/template/hana/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/hana/files/db/package.json +3 -2
- package/lib/init/template/hana/files/package.json.hbs +4 -7
- package/lib/init/template/hana/files/src/.hdiconfig +3 -0
- package/lib/init/template/hana/files/values.yaml.hbs +1 -2
- package/lib/init/template/hana/index.js +15 -7
- package/lib/init/template/helm/files/Chart.yaml.hbs +2 -3
- package/lib/init/template/helm/files/values.schema.json +2173 -0
- package/lib/init/template/helm/files/values.yaml.hbs +11 -6
- package/lib/init/template/helm/index.js +77 -18
- package/lib/init/template/helm-unified-runtime/index.js +19 -56
- package/lib/init/template/html5-repo/files/app-package.json.hbs +11 -7
- package/lib/init/template/html5-repo/files/manifest.json +13 -0
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +41 -8
- package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +21 -0
- package/lib/init/template/html5-repo/files/ui5.yaml.hbs +2 -29
- package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -2
- package/lib/init/template/html5-repo/files/xs-app.json.hbs +21 -8
- package/lib/init/template/html5-repo/index.js +33 -30
- package/lib/init/template/http/index.js +36 -12
- package/lib/init/template/java/index.js +18 -12
- package/lib/init/template/kafka/index.js +4 -0
- package/lib/init/template/lint/index.js +7 -2
- package/lib/init/template/liquibase/index.js +4 -0
- package/lib/init/template/local-messaging/index.js +4 -0
- package/lib/init/template/malware-scanner/files/mta.yaml.hbs +14 -0
- package/lib/init/template/malware-scanner/files/package.json.hbs +17 -0
- package/lib/init/template/malware-scanner/files/values.yaml +7 -0
- package/lib/init/template/malware-scanner/index.js +47 -0
- package/lib/init/template/mta/files/mta.yaml.hbs +3 -3
- package/lib/init/template/mta/files/package.json +1 -1
- package/lib/init/template/mta/index.js +4 -0
- package/lib/init/template/mtx/index.js +4 -0
- package/lib/init/template/multitenancy/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +0 -1
- package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +6 -5
- package/lib/init/template/multitenancy/files/values.yaml.hbs +14 -24
- package/lib/init/template/multitenancy/index.js +50 -28
- package/lib/init/template/nodejs/files/eslint.config.mjs +2 -0
- package/lib/init/template/nodejs/files/package.json.hbs +2 -3
- package/lib/init/template/nodejs/index.js +4 -0
- package/lib/init/template/notifications/files/mta.yaml.hbs +2 -2
- package/lib/init/template/notifications/index.js +4 -0
- package/lib/init/template/pipeline/files/.pipeline/config.yml +1 -1
- package/lib/init/template/pipeline/files/Jenkinsfile +1 -1
- package/lib/init/template/pipeline/index.js +4 -0
- package/lib/init/template/portal/files/mta.yaml.hbs +52 -0
- package/lib/init/template/portal/files/package.json.hbs +11 -0
- package/lib/init/template/portal/files/package.sidecar.json +7 -0
- package/lib/init/template/portal/files/portal-site/CommonDataModel.json.hbs +97 -0
- package/lib/init/template/portal/files/portal-site/i18n/catalog.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/catalog_de.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/group.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/group_de.properties +1 -0
- package/lib/init/template/portal/index.js +84 -0
- package/lib/init/template/postgres/index.js +5 -1
- package/lib/init/template/redis-messaging/index.js +4 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +13 -1
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +2 -2
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -0
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +4 -0
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +3 -3
- package/lib/init/template/sample/files/app/index.html +1 -1
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -5
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -6
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -5
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -16
- package/lib/init/template/sample/files/nodejs/cat-service.js +2 -2
- package/lib/init/template/sample/files/package.json.hbs +3 -0
- package/lib/init/template/sample/index.js +16 -9
- package/lib/init/template/sqlite/index.js +4 -0
- package/lib/init/template/tiny-sample/files/nodejs/db/data/my.bookshop-Books.csv +3 -3
- package/lib/init/template/tiny-sample/files/nodejs/srv/cat-service.cds.hbs +1 -1
- package/lib/init/template/tiny-sample/index.js +4 -0
- package/lib/init/template/toggles/files/package.json.hbs +1 -1
- package/lib/init/template/toggles/index.js +4 -0
- package/lib/init/template/typer/index.js +4 -0
- package/lib/init/template/typescript/files/package.json +12 -0
- package/lib/init/template/typescript/files/tsconfig.json +13 -0
- package/lib/init/template/typescript/index.js +39 -0
- package/lib/init/template/workzone/index.js +5 -0
- package/lib/init/template/workzone-standard/files/manifest.json.hbs +6 -0
- package/lib/init/template/workzone-standard/index.js +30 -0
- package/lib/init/template/xsuaa/files/package.json.hbs +1 -1
- package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -2
- package/lib/init/template/xsuaa/index.js +11 -7
- package/lib/init/validate.js +27 -0
- package/lib/lint/generators.js +1 -1
- package/lib/lint/io.js +25 -7
- package/lib/mtx/auth_manager.js +64 -30
- package/lib/mtx/download_legacy.js +2 -2
- package/lib/mtx/index.js +0 -4
- package/lib/mtx/params.js +32 -38
- package/lib/mtx/pull.js +151 -43
- package/lib/mtx/push.js +3 -3
- package/lib/mtx/settings_manager.js +75 -35
- package/lib/mtx/tenant_action.js +1 -1
- package/lib/mtx/util/cf.js +1 -1
- package/lib/mtx/util/fs.js +26 -1
- package/lib/mtx/util/logging.js +7 -3
- package/lib/util/command.js +0 -2
- package/lib/util/fs.js +2 -3
- package/lib/util/question.js +28 -0
- package/lib/util/term.js +5 -3
- package/npm-shrinkwrap.json +231 -1089
- package/package.json +13 -8
- package/bin/activate.js +0 -77
- package/lib/compile/asyncapi/channels.js +0 -22
- package/lib/compile/asyncapi/components/messageTraits/index.js +0 -89
- package/lib/compile/asyncapi/components/messages/index.js +0 -173
- package/lib/compile/asyncapi/components/schemas/annotations.js +0 -33
- package/lib/compile/asyncapi/components/schemas/array.js +0 -8
- package/lib/compile/asyncapi/components/schemas/cache.js +0 -14
- package/lib/compile/asyncapi/components/schemas/definition.js +0 -187
- package/lib/compile/asyncapi/components/schemas/enum.js +0 -16
- package/lib/compile/asyncapi/components/schemas/examples.js +0 -10
- package/lib/compile/asyncapi/components/schemas/index.js +0 -14
- package/lib/compile/asyncapi/components/schemas/localized.js +0 -29
- package/lib/compile/asyncapi/components/schemas/primitiveElement.js +0 -41
- package/lib/compile/asyncapi/components/schemas/ref.js +0 -45
- package/lib/compile/asyncapi/components/schemas/utils.js +0 -108
- package/lib/compile/asyncapi/index.js +0 -247
- package/lib/compile/asyncapi/message.js +0 -13
- package/lib/compile/asyncapi/utils.js +0 -27
- package/lib/compile/openapi/csdl2openapi.js +0 -2448
- package/lib/compile/openapi/index.js +0 -68
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +0 -14
- package/lib/init/template/helm/files/chart/templates/_helpers.tpl +0 -28
- package/lib/init/template/helm/files/chart/values.root.schema.json +0 -61
- package/lib/init/template/helm/files/chart/values.schema.json +0 -366
- package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +0 -10
- package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +0 -90
- package/lib/init/template/helm-unified-runtime/files/templates/_helpers.tpl +0 -28
- package/lib/init/template/helm-unified-runtime/files/values.root.schema.json +0 -61
- package/lib/init/template/helm-unified-runtime/files/values.schema.json +0 -366
- package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +0 -26
- package/lib/init/template/helm-unified-runtime/package.json +0 -4
- package/lib/init/template/multitenancy/files/mtxs-configmap-java-approuter.yaml +0 -20
- package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +0 -18
- package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs-approuter.yaml +0 -12
- package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +0 -12
- package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +0 -9
- package/lib/init/template/nodejs/files/eslint.config.js +0 -13
- package/lib/init/template/notebook/index.js +0 -11
- package/lib/init/template/samples/index.js +0 -9
- package/lib/mtx/activate.js +0 -238
- package/lib/mtx/extend.js +0 -173
- package/lib/util/exec.d.ts +0 -54
- package/lib/util/exec.js +0 -211
- /package/lib/{init/template/approuter/files → build/plugins/helm/files/plugins/approuter}/approuter-configmap.yaml +0 -0
- /package/lib/{init/template/connectivity/files → build/plugins/helm/files/plugins/connectivity}/connectivity-proxy-info.yaml +0 -0
- /package/lib/{init/template/html5-repo/files → build/plugins/helm/files/plugins/html5-repo}/html5-apps-deployer-configmap.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/_helpers.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/job.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/secret.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-account.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-binding.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.schema.json +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/NOTES.txt +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_api.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_helpers.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/api-rule.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/network-policy.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/rbac.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/secret.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-account.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-binding.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/virtual-service.yaml +0 -0
- /package/lib/{init/template/helm-unified-runtime → build/plugins/helm}/files/templates/NOTES.txt +0 -0
- /package/lib/init/template/{nodejs/files → java}/.cdsrc.json +0 -0
- /package/lib/init/template/tiny-sample/files/nodejs/db/{data-model.cds → schema.cds} +0 -0
package/bin/extend.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
module.exports = Object.assign(extend, {
|
|
2
2
|
options: ['--directory', '--subdomain', '--passcode', '--username', '--clientid', '--tagRule', '--defaultTag'],
|
|
3
|
-
flags: ['--
|
|
3
|
+
flags: ['--download-migrated-projects'],
|
|
4
4
|
shortcuts: ['-d', '-s', '-p', '-u', '-c'],
|
|
5
5
|
help: `
|
|
6
6
|
# SYNOPSIS
|
|
7
7
|
|
|
8
|
-
*cds extend* <app-url>
|
|
8
|
+
*cds extend* --download-migrated-projects <app-url>
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Create an extension project from an extensible SaaS app.
|
|
13
|
-
Obtain the app URL from the SaaS application provider.
|
|
14
|
-
|
|
15
|
-
To facilitate running this multiple times against the same app, refer to the
|
|
16
|
-
*cds login* command.
|
|
10
|
+
Download extension project after migration to @sap/cds-mtxs.
|
|
17
11
|
|
|
18
12
|
# OPTIONS
|
|
19
13
|
|
|
@@ -40,20 +34,6 @@ module.exports = Object.assign(extend, {
|
|
|
40
34
|
Client ID for authentication. This will override the default Client ID
|
|
41
35
|
from environment.
|
|
42
36
|
|
|
43
|
-
*--force*
|
|
44
|
-
|
|
45
|
-
Overwrite existing content. Make sure you are using a version control
|
|
46
|
-
system (like git) to avoid data loss.
|
|
47
|
-
|
|
48
|
-
*--templates*
|
|
49
|
-
|
|
50
|
-
Download only the templates provided by the SaaS application you want to
|
|
51
|
-
extend.
|
|
52
|
-
|
|
53
|
-
*--download-migrated-projects*
|
|
54
|
-
|
|
55
|
-
To be used only after change to @sap/cds-mtxs. Allows to download migrated extension projects.
|
|
56
|
-
|
|
57
37
|
*--tagRule*
|
|
58
38
|
|
|
59
39
|
Rule used to split up migrated extension projects into separate projects (please check migration documentation for more).
|
|
@@ -64,42 +44,31 @@ module.exports = Object.assign(extend, {
|
|
|
64
44
|
|
|
65
45
|
# SEE ALSO
|
|
66
46
|
|
|
67
|
-
*cds
|
|
68
|
-
|
|
69
|
-
*cds pull* to get the CDS model of a SaaS app based on current MTX Services
|
|
70
|
-
(@sap/cds-mtxs).
|
|
47
|
+
*cds pull* to get the CDS model of a SaaS app based on current MTX Services (@sap/cds-mtxs).
|
|
71
48
|
|
|
72
|
-
https://cap.cloud.sap/docs/guides/multitenancy/mtxs for information on
|
|
73
|
-
@sap/cds-mtxs.
|
|
49
|
+
https://cap.cloud.sap/docs/guides/multitenancy/mtxs for information on @sap/cds-mtxs.
|
|
74
50
|
|
|
51
|
+
https://cap.cloud.sap/docs/guides/multitenancy/old-mtx-migration for information on migrating
|
|
52
|
+
from the old MTX Services to @sap/cds-mtxs.
|
|
75
53
|
`})
|
|
76
54
|
|
|
77
55
|
|
|
78
56
|
async function extend ([url], options = {}) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
delete options.user;
|
|
83
|
-
|
|
84
|
-
await require('../lib/mtx/download_legacy').run({
|
|
85
|
-
...options,
|
|
86
|
-
url,
|
|
87
|
-
username,
|
|
88
|
-
password
|
|
89
|
-
});
|
|
90
|
-
return
|
|
57
|
+
if (!options['download-migrated-projects']) {
|
|
58
|
+
console.log('Please provide the --download-migrated-projects flag to enable this command.');
|
|
59
|
+
return;
|
|
91
60
|
}
|
|
92
61
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return
|
|
97
|
-
}
|
|
98
|
-
}
|
|
62
|
+
delete options['download-migrated-projects'];
|
|
63
|
+
const [username, password] = options.username?.split(':') ?? [];
|
|
64
|
+
delete options.user;
|
|
99
65
|
|
|
100
|
-
|
|
101
|
-
|
|
66
|
+
await require('../lib/mtx/download_legacy').run({
|
|
67
|
+
...options,
|
|
68
|
+
url,
|
|
69
|
+
username,
|
|
70
|
+
password
|
|
71
|
+
});
|
|
102
72
|
}
|
|
103
73
|
|
|
104
|
-
|
|
105
74
|
/* eslint no-console: off */
|
package/bin/help.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const cds = require('../lib/cds')
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
module.exports = exports = Object.assign (help, {formatHelp, handleCompletion, help:`
|
|
5
5
|
# USAGE
|
|
6
6
|
|
|
@@ -30,7 +30,7 @@ module.exports = exports = Object.assign (help, {formatHelp, handleCompletion, h
|
|
|
30
30
|
* * | *logout* logout from extensible multitenant SaaS app
|
|
31
31
|
* * | *pull* pull base model of extensible SaaS app
|
|
32
32
|
* * | *push* push extension to extensible SaaS app
|
|
33
|
-
*t* | *lint* run linter for env or model checks
|
|
33
|
+
*t* | *lint* run linter for env or model checks
|
|
34
34
|
*v* | *version* get detailed version information
|
|
35
35
|
* * | *completion* add/remove cli completion for cds commands
|
|
36
36
|
*?* | *help* get detailed usage information
|
package/bin/init.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { join } = require('path')
|
|
2
|
+
const { URLS } = require('../lib/init/constants')
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
'--srv-memory', '--srv-technology']
|
|
4
|
+
// REVISIT: necessary because module is loaded too early -> shouldn't be necessary
|
|
5
|
+
const cds = require('../lib/cds')
|
|
6
|
+
cds.root = join(process.cwd(), process.argv[3]?.startsWith('--') ? '.' : process.argv[3] ?? '')
|
|
7
7
|
|
|
8
8
|
module.exports = Object.assign(init, {
|
|
9
9
|
handleCompletion,
|
|
10
|
-
options: [
|
|
11
|
-
shortcuts: [],
|
|
10
|
+
options: ['--add', '--java:mvn', '--java:package', '--lint:custom', '--lint:custom:example'],
|
|
11
|
+
shortcuts: ['-a'],
|
|
12
12
|
flags: ['--force', '--verbose'],
|
|
13
13
|
help: `
|
|
14
14
|
# SYNOPSIS
|
|
@@ -25,55 +25,7 @@ module.exports = Object.assign(init, {
|
|
|
25
25
|
Add one or more features while creating the project.
|
|
26
26
|
<feature> can be one of the following:
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*java* - creates as a Java-based project
|
|
31
|
-
|
|
32
|
-
*hana* - add support for SAP HANA
|
|
33
|
-
|
|
34
|
-
*sqlite* - add support for SQLite
|
|
35
|
-
|
|
36
|
-
*postgres* - add support for PostgreSQL
|
|
37
|
-
|
|
38
|
-
*liquibase* - add support for Liquibase
|
|
39
|
-
|
|
40
|
-
*xsuaa* - add support for authentication via XSUAA
|
|
41
|
-
|
|
42
|
-
*multitenancy* - add support for multitenancy
|
|
43
|
-
|
|
44
|
-
*toggles* - add support for feature toggles
|
|
45
|
-
|
|
46
|
-
*extensibility* - add support for extensibility
|
|
47
|
-
|
|
48
|
-
*approuter* - add support for application routing
|
|
49
|
-
|
|
50
|
-
*local-messaging* - add support for local messaging
|
|
51
|
-
|
|
52
|
-
*enterprise-messaging* - add support for SAP Event Mesh
|
|
53
|
-
|
|
54
|
-
*file-based-messaging* - add support for file-based messaging
|
|
55
|
-
|
|
56
|
-
*redis-messaging* - add support for Redis messaging
|
|
57
|
-
|
|
58
|
-
*mta* - add support for MTA-based deployment
|
|
59
|
-
|
|
60
|
-
*cf-manifest* - add support for CF-native deployment
|
|
61
|
-
|
|
62
|
-
*helm* - add support for Helm-based Kyma deployment
|
|
63
|
-
|
|
64
|
-
*html5-repo* - add support for the HTML5 repository
|
|
65
|
-
|
|
66
|
-
*pipeline* - add files for CI/CD pipeline integration
|
|
67
|
-
|
|
68
|
-
*tiny-sample* - add minimal sample files
|
|
69
|
-
|
|
70
|
-
*sample* - add sample files including Fiori UI
|
|
71
|
-
|
|
72
|
-
*data* - add CSV headers for modeled entities
|
|
73
|
-
|
|
74
|
-
*typer* - add type generation for CDS models
|
|
75
|
-
|
|
76
|
-
*lint* - add support for CDS Lint
|
|
28
|
+
${require('../lib/init').help()}
|
|
77
29
|
|
|
78
30
|
*--java:mvn* <Comma separated maven archetype specific parameters>
|
|
79
31
|
|
|
@@ -101,7 +53,7 @@ module.exports = Object.assign(init, {
|
|
|
101
53
|
|
|
102
54
|
async function handleCompletion(currentWord, previousWord, argv, util) {
|
|
103
55
|
const allOptionsFlags = [
|
|
104
|
-
...
|
|
56
|
+
...init.options ?? [],
|
|
105
57
|
...init.flags ?? []
|
|
106
58
|
].filter(e => !argv.includes(e));
|
|
107
59
|
|
|
@@ -127,26 +79,7 @@ async function handleCompletion(currentWord, previousWord, argv, util) {
|
|
|
127
79
|
}
|
|
128
80
|
|
|
129
81
|
async function init(args) {
|
|
130
|
-
if (process.argv.some(a => legacyOptions.includes(a))) return _showWarningMessage()
|
|
131
82
|
const CDSGenerator = require('../lib/init')
|
|
132
83
|
const generator = new CDSGenerator()
|
|
133
|
-
await generator.
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
function _showWarningMessage() {
|
|
138
|
-
|
|
139
|
-
const message = `
|
|
140
|
-
************************************************
|
|
141
|
-
You are using 'cds init' with older parameters.
|
|
142
|
-
To find out more about the current parameters use
|
|
143
|
-
|
|
144
|
-
cds help init
|
|
145
|
-
|
|
146
|
-
************************************************
|
|
147
|
-
`
|
|
148
|
-
|
|
149
|
-
const { warn } = require('../lib/util/term');
|
|
150
|
-
|
|
151
|
-
console.log(warn(message))
|
|
84
|
+
await generator.init(args[0])
|
|
152
85
|
}
|
package/bin/login.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = Object.assign(login, {
|
|
2
2
|
options: ['--subdomain', '--directory', '--passcode', '--user', '--client', '--mtls'],
|
|
3
3
|
shortcuts: ['-s', '-d', '-p', '-u', '-c', '-m'],
|
|
4
|
-
flags: ['--plain'],
|
|
4
|
+
flags: ['--plain', '--save-refresh-token'],
|
|
5
5
|
get help() {
|
|
6
6
|
const config = require('../lib/mtx/settings_manager').SettingsManager.config
|
|
7
7
|
return `
|
|
@@ -11,7 +11,7 @@ module.exports = Object.assign(login, {
|
|
|
11
11
|
|
|
12
12
|
Simplifies usage of multitenancy-related commands (e.g. *cds subscribe* and
|
|
13
13
|
*cds push*) by providing them with automatic authentication: fetches and
|
|
14
|
-
saves
|
|
14
|
+
saves Access Tokens and provides relevant tokens to those commands.
|
|
15
15
|
Alternatively saves username for apps running locally.
|
|
16
16
|
|
|
17
17
|
Saves further settings for the current project (<app-url>,
|
|
@@ -33,8 +33,9 @@ module.exports = Object.assign(login, {
|
|
|
33
33
|
|
|
34
34
|
*Token Expiration*
|
|
35
35
|
|
|
36
|
-
If a
|
|
37
|
-
original token has expired, it will be
|
|
36
|
+
If a Refresh Token has been saved with the original token (see option
|
|
37
|
+
--save-refresh-token) and the original token has expired, it will be
|
|
38
|
+
automatically renewed.
|
|
38
39
|
|
|
39
40
|
*Storing Authentication Data*
|
|
40
41
|
|
|
@@ -113,6 +114,11 @@ module.exports = Object.assign(login, {
|
|
|
113
114
|
Note: Productive secrets should not be specified on a command line,
|
|
114
115
|
since this might expose them to unauthorized users on the same machine!
|
|
115
116
|
|
|
117
|
+
*--save-refresh-token*
|
|
118
|
+
|
|
119
|
+
Also store the Refresh Token (if provided) for automatic renewal of the
|
|
120
|
+
Access Token upon expiration.
|
|
121
|
+
|
|
116
122
|
*--plain*
|
|
117
123
|
|
|
118
124
|
Instead of saving authentication data for this login to the desktop
|
|
@@ -165,9 +171,11 @@ async function login ([url], options = {}) {
|
|
|
165
171
|
password,
|
|
166
172
|
tokenStorage: options.plain ? 'plain' : 'keyring',
|
|
167
173
|
renewLogin: true,
|
|
168
|
-
saveData: true
|
|
174
|
+
saveData: true,
|
|
175
|
+
saveRefreshToken: options['save-refresh-token'] ?? false
|
|
169
176
|
});
|
|
170
177
|
delete options.plain;
|
|
178
|
+
delete options['save-refresh-token'];
|
|
171
179
|
|
|
172
180
|
await require('../lib/mtx/auth_manager').login(options);
|
|
173
181
|
}
|
package/bin/migrate.js
CHANGED
package/bin/pull.js
CHANGED
|
@@ -10,6 +10,17 @@ module.exports = Object.assign(pull, {
|
|
|
10
10
|
Pull the base model for your SaaS app extension.
|
|
11
11
|
If the app URL is omitted, it is determined from the current user's active
|
|
12
12
|
CDS or Cloud Foundry login.
|
|
13
|
+
|
|
14
|
+
Before running this command, prepare your extension project from a template
|
|
15
|
+
obtained from the SaaS application provider. It must contain a package.json
|
|
16
|
+
file for the project metadata, including the 'extends' field, which
|
|
17
|
+
specifies the base-model name.
|
|
18
|
+
|
|
19
|
+
The base model is saved in a sub-folder named '.base' (may be renamed after
|
|
20
|
+
the first pull). This folder is automatically included in package.json as a
|
|
21
|
+
workspace. Thus, any subsequent *npm install* will install the base model
|
|
22
|
+
into node_modules, in a sub-folder named after the base-model name. You can
|
|
23
|
+
thus refer to the base model in your extension by this name.
|
|
13
24
|
|
|
14
25
|
Authentication data will not be saved.
|
|
15
26
|
|
package/bin/repl.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
module.exports = Object.assign (repl, { options: [], help: `
|
|
2
3
|
# SYNOPSIS
|
|
3
4
|
|
|
@@ -32,8 +33,10 @@ async function repl (_, options={}) {
|
|
|
32
33
|
|
|
33
34
|
Object.defineProperty (cds,'repl',{value:repl})
|
|
34
35
|
cds.lazify (Object.assign (repl.context,{ cds,
|
|
36
|
+
|
|
35
37
|
Foo: lazy => new cds.entity ({name:'Foo'}),
|
|
36
38
|
Bar: lazy => new cds.entity ({name:'Bar'}),
|
|
39
|
+
expect: lazy => cds.test.expect,
|
|
37
40
|
}))
|
|
38
41
|
|
|
39
42
|
repl.history = new Array(222)
|
package/bin/test.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const {resolve} = require, _local = id => resolve (id, { paths: [ process.cwd(), __dirname ] })
|
|
2
|
+
const require = id => module.require (_local(id)) // overwrite require so that navigation in VS Code works below
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line cds-dk/use-api-require, cds-dk/use-relative-require
|
|
5
|
+
module.exports = require('@sap/cds/bin/test')
|
package/bin/version.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
const { join, resolve } = require ('path')
|
|
3
2
|
const { execSync, spawnSync } = require('child_process')
|
|
4
3
|
module.exports = Object.assign(list_versions, {
|
|
@@ -35,7 +34,7 @@ module.exports = Object.assign(list_versions, {
|
|
|
35
34
|
const MISSING = '-- missing --'
|
|
36
35
|
|
|
37
36
|
function list_versions(args, options) {
|
|
38
|
-
const
|
|
37
|
+
const {colors} = require('../lib/util/term')
|
|
39
38
|
|
|
40
39
|
if (options['npm-list'] || options['npm-tree']) {
|
|
41
40
|
let [pattern] = args, re = pattern ? RegExp(pattern) : /@sap\/cd[rs]|@sap\/eslint-plugin-cds/
|
|
@@ -43,7 +42,7 @@ function list_versions(args, options) {
|
|
|
43
42
|
console.log (cmd,'| grep', re.source)
|
|
44
43
|
return require('child_process').exec(cmd, (e,stdout)=>{
|
|
45
44
|
// if (e) console.error(e)
|
|
46
|
-
const replacement = (
|
|
45
|
+
const replacement = (!colors ? '$1 $2$3$4' : '\x1b[91m$1 \x1b[32m$2\x1b[0m\x1b[2m$3\x1b[32m$4\x1b[0m');
|
|
47
46
|
for (let line of stdout.split(/\n/)) if (line.match(re)) console.log(
|
|
48
47
|
line.replace(/(@sap[^@]*)@([\S]+)( -> [\S]+)?(deduped)?/,replacement)
|
|
49
48
|
)
|
|
@@ -55,7 +54,7 @@ function list_versions(args, options) {
|
|
|
55
54
|
if (options.markdown || options.info) {
|
|
56
55
|
_markdown (versions)
|
|
57
56
|
} else {
|
|
58
|
-
const mark =
|
|
57
|
+
const mark = !colors ? s => s : require('../lib/util/term').info
|
|
59
58
|
for (let each of Object.keys(versions)) console.log(`${mark(each)}: ${versions[each]}`)
|
|
60
59
|
}
|
|
61
60
|
process.stdout.isTTY && console.log()
|
|
@@ -63,8 +62,9 @@ function list_versions(args, options) {
|
|
|
63
62
|
|
|
64
63
|
function info({ root:cwd=process.cwd() }) {
|
|
65
64
|
const env = require('../lib').env.for('cds', cwd)
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
env.cli ??= {}; env.cli.version ??= {}
|
|
66
|
+
const javaInfo = !env.cli.version.skipjava && env['project-nature'] === 'java'
|
|
67
|
+
if (javaInfo && process.stderr.isTTY) {
|
|
68
68
|
console.error('\x1b[2m'+'This takes a while. Collecting Java versions...', '\x1b[0m')
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -82,7 +82,7 @@ function info({ root:cwd=process.cwd() }) {
|
|
|
82
82
|
// sort Node entries
|
|
83
83
|
versions = Object.keys(versions).sort().reduce((all, key) => { all[key] = versions[key]; return all }, {})
|
|
84
84
|
|
|
85
|
-
if (
|
|
85
|
+
if (javaInfo) {
|
|
86
86
|
Object.assign(versions, capJavaVersion(cwd))
|
|
87
87
|
}
|
|
88
88
|
return versions
|
package/bin/watch.js
CHANGED
|
@@ -51,21 +51,12 @@ module.exports = Object.assign ( watch, {
|
|
|
51
51
|
const cds = require('../lib/cds')
|
|
52
52
|
const DEBUG = cds.debug('cli|watch')
|
|
53
53
|
const {delimiter,dirname,relative,resolve,sep} = require ('path')
|
|
54
|
+
const {codes} = require('../lib/util/term'), t = codes
|
|
54
55
|
const fs = require ('fs')
|
|
55
56
|
|
|
56
|
-
const colors = !!process.stdout.isTTY && !!process.stderr.isTTY
|
|
57
|
-
const t = module.exports.codes = {
|
|
58
|
-
reset: colors ? '\x1b[0m' : '', // Default
|
|
59
|
-
bold: colors ? '\x1b[1m' : '', // Bold/Bright
|
|
60
|
-
link: colors ? '\x1b[4m' : '', // underline
|
|
61
|
-
red: colors ? '\x1b[91m' : '', // Bright Foreground Red
|
|
62
|
-
green: colors ? '\x1b[32m' : '', // Foreground Green
|
|
63
|
-
yellow: colors ? '\x1b[33m' : '', // Foreground Green
|
|
64
|
-
orange: colors ? '\x1b[38;2;255;140;0m' : '' // darker orange, works with bright and dark background
|
|
65
|
-
}
|
|
66
57
|
const extDefaults = 'cds,csn,csv,ts,mjs,cjs,js,json,properties,edmx,xml,env'
|
|
67
58
|
const ignore = RegExp(
|
|
68
|
-
`(node_modules|_out|@types|@cds-models)\\${sep}` +
|
|
59
|
+
`(.git|node_modules|_out|@types|@cds-models)\\${sep}` +
|
|
69
60
|
`|app(\\${sep}.+)?\\${sep}(` +
|
|
70
61
|
`(webapp|dist|target)\\${sep}|` +
|
|
71
62
|
`tsconfig\\.json$|` +
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const yaml = require('
|
|
2
|
-
const {
|
|
1
|
+
const { yaml } = require('../cds').utils
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
3
|
const { bold } = require('../util/term');
|
|
4
4
|
|
|
5
5
|
class KubernetesApiAccessor {
|
|
@@ -7,7 +7,7 @@ class KubernetesApiAccessor {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
|
|
9
9
|
this.config = once( async() => {
|
|
10
|
-
const configString =
|
|
10
|
+
const configString = execSync('kubectl config view --raw').toString();
|
|
11
11
|
const config = yaml.parse(configString);
|
|
12
12
|
|
|
13
13
|
const currentContextName = config['current-context'];
|
|
@@ -56,12 +56,13 @@ class KubernetesApiAccessor {
|
|
|
56
56
|
|
|
57
57
|
async get(options) {
|
|
58
58
|
const {context, namespace, kind, name} = options;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
try {
|
|
60
|
+
return JSON.parse(execSync(`kubectl --output json --context ${context} --namespace ${namespace} get ${kind} ${name}`).toString());
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error.status === 1) return null
|
|
64
|
+
else throw error
|
|
65
|
+
}
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -71,7 +71,7 @@ class BuildTaskEngine {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Plugin#prepare has been deprecated and was never part of the public API.
|
|
75
75
|
* Currently only used by internal FioriBuildPlugin.
|
|
76
76
|
* @deprecated
|
|
77
77
|
* @param {*} plugins
|
|
@@ -208,11 +208,15 @@ class BuildTaskEngine {
|
|
|
208
208
|
const plugin = this.taskFactory.createPlugin(task)
|
|
209
209
|
plugin.init()
|
|
210
210
|
|
|
211
|
-
if (!(plugin instanceof InternalBuildPlugin) && plugin.priority
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
if (!(plugin instanceof InternalBuildPlugin) && plugin.priority >= 0 && plugin.priority <= 512) {
|
|
212
|
+
throw new Error(
|
|
213
|
+
`Invalid priority value for ${plugin.constructor.name}.
|
|
214
|
+
The valid priority value range for custom plugins is -1024..-1 and 512..1024.
|
|
215
|
+
Range 0..512 is blocked for internal plugins.
|
|
216
|
+
The higher the value the earlier the plugin is run.`
|
|
217
|
+
)
|
|
215
218
|
}
|
|
219
|
+
|
|
216
220
|
this._logTaskHandler(plugin)
|
|
217
221
|
return plugin
|
|
218
222
|
}
|
|
@@ -262,7 +266,7 @@ class BuildTaskEngine {
|
|
|
262
266
|
|
|
263
267
|
_logTaskHandler(plugin) {
|
|
264
268
|
DEBUG?.(`plugin ${plugin.constructor.name}`)
|
|
265
|
-
DEBUG?.(`details src [${relativePaths(cds.root, plugin.task.src)}], dest [${relativePaths(cds.root, plugin.task.dest)}],
|
|
269
|
+
DEBUG?.(`details src [${relativePaths(cds.root, plugin.task.src)}], dest [${relativePaths(cds.root, plugin.task.dest)}], options [${JSON.stringify(plugin.task.options)}]`)
|
|
266
270
|
}
|
|
267
271
|
|
|
268
272
|
_logMessages(messages) {
|
|
@@ -312,7 +316,7 @@ class BuildTaskEngine {
|
|
|
312
316
|
|
|
313
317
|
/**
|
|
314
318
|
* Returns compiler messages and validation messages issued by plugins.
|
|
315
|
-
* @param {Array
|
|
319
|
+
* @param {Array} plugins
|
|
316
320
|
*/
|
|
317
321
|
static _getMessages(plugins) {
|
|
318
322
|
return plugins.reduce((acc, plugin) => acc.concat(plugin.messages), [])
|
|
@@ -2,8 +2,8 @@ const fs = require('fs')
|
|
|
2
2
|
const path = require('path')
|
|
3
3
|
const cds = require('../cds')
|
|
4
4
|
const BuildTaskProviderFactory = require('./buildTaskProviderFactory')
|
|
5
|
-
const { hasJavaNature, getProperty,
|
|
6
|
-
const { FILE_EXT_CDS,
|
|
5
|
+
const { hasJavaNature, getProperty, getDefaultModelOptions, hasOptionValue, BuildError } = require('./util')
|
|
6
|
+
const { FILE_EXT_CDS, OPTION_WS } = require("./constants")
|
|
7
7
|
const term = require('../util/term')
|
|
8
8
|
const DEBUG = cds.debug('cli|build')
|
|
9
9
|
|
|
@@ -48,17 +48,13 @@ class BuildTaskFactory {
|
|
|
48
48
|
async _createTasks() {
|
|
49
49
|
DEBUG?.(`determining build tasks for project [${cds.root}].`)
|
|
50
50
|
|
|
51
|
-
// clearing model cache (details https://github.tools.sap/cap/cds/pull/181) is no longer required
|
|
52
|
-
// because of changes https://github.tools.sap/cap/cds/pull/1121
|
|
53
|
-
// cds.resolve.cache = {}
|
|
54
|
-
|
|
55
51
|
let tasks = BuildTaskFactory._getExistingTasks()
|
|
56
52
|
if (tasks.length === 0) {
|
|
57
53
|
tasks = await this.providerFactory.lookupTasks()
|
|
58
54
|
this._applyCliOptions(tasks)
|
|
59
55
|
} else {
|
|
60
56
|
this._applyCliOptions(tasks)
|
|
61
|
-
// 1. apply default values including task.for and
|
|
57
|
+
// 1. apply default values including task.for and ensure that for all tasks a provider exists - throwing error otherwise
|
|
62
58
|
await this.providerFactory.applyTaskDefaults(tasks)
|
|
63
59
|
// ensure that dependencies get wired up before filtering
|
|
64
60
|
await this.providerFactory.lookupTasks(tasks, true)
|
|
@@ -84,7 +80,7 @@ class BuildTaskFactory {
|
|
|
84
80
|
// obligatory task defaults shared by all tasks
|
|
85
81
|
await BuildTaskFactory._applyCommonTaskDefaults(tasks)
|
|
86
82
|
|
|
87
|
-
|
|
83
|
+
BuildTaskFactory._setDefaultBuildTargetFolder(tasks)
|
|
88
84
|
return tasks
|
|
89
85
|
}
|
|
90
86
|
|
|
@@ -106,24 +102,21 @@ class BuildTaskFactory {
|
|
|
106
102
|
const modelPaths = await getDefaultModelOptions()
|
|
107
103
|
let wsModelPaths
|
|
108
104
|
// calculate only once
|
|
109
|
-
if (cds.cli.options?.
|
|
105
|
+
if (cds.cli.options?.[OPTION_WS] || tasks.some(task => hasOptionValue(task.options?.[OPTION_WS], true))) {
|
|
110
106
|
wsModelPaths = await getDefaultModelOptions(true)
|
|
111
107
|
}
|
|
112
108
|
// set default model options
|
|
113
109
|
tasks.forEach(task => {
|
|
114
|
-
this._setTaskModelOptions(task, cds.cli.options?.
|
|
110
|
+
this._setTaskModelOptions(task, cds.cli.options?.[OPTION_WS] || hasOptionValue(task.options?.[OPTION_WS], true) ? wsModelPaths : modelPaths)
|
|
115
111
|
if (!task.src) {
|
|
116
|
-
throw new
|
|
112
|
+
throw new BuildError(`Mandatory property 'src' not defined for build task '${task.for}'.`)
|
|
117
113
|
}
|
|
118
114
|
})
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
_setDefaultBuildTargetFolder(
|
|
122
|
-
const task = tasks.find(task => task.for === BUILD_TASK_JAVA_CF || task.for === BUILD_TASK_JAVA)
|
|
123
|
-
const srv = task ? task.src : BuildTaskFactory._getModuleFolder(flatten([cds.env.folders.srv])) || "srv"
|
|
124
|
-
|
|
117
|
+
static _setDefaultBuildTargetFolder() {
|
|
125
118
|
// Java projects use "." as the default build target folder
|
|
126
|
-
if (hasJavaNature(
|
|
119
|
+
if (hasJavaNature() && this._adaptBuildTargetSettingForJava()) {
|
|
127
120
|
DEBUG?.("using inplace build for java project instead of default staging build")
|
|
128
121
|
}
|
|
129
122
|
}
|
|
@@ -150,13 +143,12 @@ class BuildTaskFactory {
|
|
|
150
143
|
const options = this.options
|
|
151
144
|
// filter tasks using either option for, use, src
|
|
152
145
|
let resultTasks = tasks.filter(task => {
|
|
153
|
-
return (!options.
|
|
154
|
-
&& (!options.for || options.for === task.for)
|
|
146
|
+
return (!options.for || options.for === task.for)
|
|
155
147
|
&& (!options.src || options.src === task.src)
|
|
156
148
|
})
|
|
157
149
|
if (resultTasks.length === 0) {
|
|
158
|
-
if (options.for
|
|
159
|
-
const task = this.providerFactory.getTask(
|
|
150
|
+
if (options.for) {
|
|
151
|
+
const task = this.providerFactory.getTask({ for: options.for })
|
|
160
152
|
if (options.src) {
|
|
161
153
|
task.src = options.src
|
|
162
154
|
}
|
|
@@ -180,9 +172,9 @@ class BuildTaskFactory {
|
|
|
180
172
|
if (options.dest) {
|
|
181
173
|
task.dest = options.dest
|
|
182
174
|
}
|
|
183
|
-
if (options.
|
|
184
|
-
const
|
|
185
|
-
task.options = task.options ? Object.assign(task.options,
|
|
175
|
+
if (options.taskOptions) {
|
|
176
|
+
const taskOptions = JSON.parse(JSON.stringify(options.taskOptions))
|
|
177
|
+
task.options = task.options ? Object.assign(task.options, taskOptions) : taskOptions
|
|
186
178
|
}
|
|
187
179
|
})
|
|
188
180
|
}
|
|
@@ -233,26 +225,6 @@ class BuildTaskFactory {
|
|
|
233
225
|
}, '{') + '}'
|
|
234
226
|
}
|
|
235
227
|
|
|
236
|
-
static _scanTaskOptionParams(optsParams) {
|
|
237
|
-
// need to create new regex every call since a constant would keep the match state
|
|
238
|
-
const quoteRegex = /([\w-]+)=([\w/.-]+|\[([\w/,.-]+)\])/g
|
|
239
|
-
|
|
240
|
-
// captures a=1 => a:1
|
|
241
|
-
// a=[x,y,z] => a:[x,y,z]
|
|
242
|
-
// a=1,b=[x,y,z] => a:1 b=[x,y,z]
|
|
243
|
-
let match = quoteRegex.exec(optsParams)
|
|
244
|
-
const taskOptions = {}
|
|
245
|
-
|
|
246
|
-
while (match != null) {
|
|
247
|
-
const key = match[1]
|
|
248
|
-
const value = match[3] || match[2]
|
|
249
|
-
const valueArray = value.split(",")
|
|
250
|
-
taskOptions[key] = valueArray.length > 1 ? valueArray.map((entry) => entry.trim()) : value
|
|
251
|
-
match = quoteRegex.exec(optsParams)
|
|
252
|
-
}
|
|
253
|
-
return taskOptions
|
|
254
|
-
}
|
|
255
|
-
|
|
256
228
|
/**
|
|
257
229
|
* Determines the module folder from the past list that may represent files or folders w or w/o .cds file extension.
|
|
258
230
|
* @param {Array} filesOrFolders
|