@sap/cds-dk 10.0.6 → 10.1.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/CHANGELOG.md +107 -0
- package/bin/add.js +7 -23
- package/bin/bind.js +10 -0
- package/bin/build.js +20 -34
- package/bin/cds.js +1 -1
- package/bin/compile/index.js +15 -41
- package/bin/completion/completionFs.js +11 -8
- package/bin/completion/index.js +592 -80
- package/bin/completion/scripts/cds.fish +568 -0
- package/bin/completion/scripts/cds.ps1 +329 -0
- package/bin/completion/scripts/cds.sh +261 -0
- package/bin/completion/scripts/cds.zsh +230 -0
- package/bin/completion/templates/cds-tmpl.fish +65 -0
- package/bin/completion/templates/cds-tmpl.ps1 +208 -0
- package/bin/completion/templates/cds-tmpl.sh +93 -0
- package/bin/completion/templates/cds-tmpl.zsh +74 -0
- package/bin/deploy/index.js +7 -1
- package/bin/deploy/options.js +25 -0
- package/{lib → bin}/deploy/to-hana/hana.js +8 -8
- package/{lib → bin}/deploy/to-hana/hdiDeployUtil.js +1 -1
- package/bin/deploy/{to-hana.js → to-hana/index.js} +1 -1
- package/{lib → bin}/deploy/to-hana/mtaUtil.js +1 -1
- package/bin/deploy/to-sql.js +0 -2
- package/bin/export.js +35 -5
- package/bin/help/export.md +3 -0
- package/bin/help.js +1 -5
- package/bin/import.js +6 -0
- package/bin/init.js +5 -24
- package/bin/inspect.js +6 -0
- package/bin/login.js +26 -20
- package/bin/pull.js +19 -6
- package/bin/push.js +19 -6
- package/bin/up.js +14 -11
- package/{lib → bin}/upgrade/constants.js +1 -1
- package/bin/{upgrade.js → upgrade/index.js} +2 -2
- package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
- package/{lib → bin}/upgrade/preflight/index.js +1 -1
- package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
- package/{lib → bin}/upgrade/steps/install.js +1 -1
- package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/removals.js +1 -1
- package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/verify.js +1 -1
- package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
- package/{lib → bin}/upgrade/util/pom.js +2 -2
- package/{lib → bin}/upgrade/util/prompt.js +1 -1
- package/bin/util/containerize.js +8 -4
- package/bin/version.js +10 -1
- package/{lib → bin}/watch/hot-reload.js +1 -1
- package/bin/{watch.js → watch/index.js} +17 -9
- package/{lib → bin}/watch/livereload-connect.js +1 -1
- package/{lib → bin}/watch/vite-watch.js +1 -1
- package/{lib → bin}/watch/watched.js +2 -2
- package/lib/build/constants.js +1 -1
- package/lib/build/plugins/fiori/index.js +31 -2
- package/lib/build/plugins/internal.js +4 -2
- package/lib/build/plugins/mtx-sidecar/index.js +7 -8
- package/lib/build/plugins/nodejs/index.js +64 -7
- package/lib/compile/to_asyncapi.js +1 -1
- package/lib/env/schema.js +16 -0
- package/lib/env/schemas/cds-rc.js +1 -76
- package/lib/import/importapi.js +2 -3
- package/lib/import/message.js +0 -2
- package/lib/init/constants.js +2 -1
- package/lib/init/index.js +2 -2
- package/lib/init/merge.js +123 -280
- package/lib/init/plugin.js +3 -1
- package/lib/init/projectReader.js +22 -6
- package/lib/init/registries/xs-app.js +3 -5
- package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
- package/lib/init/template/ai/index.js +14 -2
- package/lib/init/template/ams/index.js +2 -2
- package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/app-frontend/index.js +4 -4
- package/lib/init/template/application-logging/index.js +2 -2
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/index.js +8 -3
- package/lib/init/template/attachments/files/package.json.hbs +1 -1
- package/lib/init/template/attachments/index.js +2 -2
- package/lib/init/template/audit-logging/index.js +2 -2
- package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
- package/lib/init/template/cloud-logging/index.js +2 -2
- package/lib/init/template/completion/completionSetup.js +36 -39
- package/lib/init/template/connectivity/index.js +2 -2
- package/lib/init/template/data/as-csv.js +15 -5
- package/lib/init/template/data/as-json.js +114 -42
- package/lib/init/template/data/index.js +16 -2
- package/lib/init/template/destination/index.js +2 -2
- package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
- package/lib/init/template/dynatrace/index.js +2 -2
- package/lib/init/template/enterprise-messaging/index.js +2 -2
- package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
- package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
- package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
- package/lib/init/template/extensibility/index.js +3 -3
- package/lib/init/template/github-actions/index.js +2 -2
- package/lib/init/template/hana/index.js +3 -2
- package/lib/init/template/hana-serverless/files/db/package.json +14 -0
- package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
- package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
- package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
- package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
- package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
- package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
- package/lib/init/template/hana-serverless/index.js +184 -0
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
- package/lib/init/template/html5-repo/index.js +18 -14
- package/lib/init/template/http/index.js +123 -26
- package/lib/init/template/ias/index.js +2 -2
- package/lib/init/template/kafka/index.js +2 -2
- package/lib/init/template/kyma/index.js +7 -5
- package/lib/init/template/malware-scanner/index.js +2 -2
- package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +18 -3
- package/lib/init/template/nodejs/index.js +4 -2
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
- package/lib/init/template/portal/index.js +13 -8
- package/lib/init/template/postgres/index.js +2 -2
- package/lib/init/template/redis/index.js +2 -2
- package/lib/init/template/sample/files/db/currencies.cds +2 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
- package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
- package/lib/init/template/workzone-standard/index.js +5 -5
- package/lib/init/template/xsuaa/index.js +20 -2
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/mtx/auth_manager.js +103 -37
- package/lib/mtx/params.js +3 -2
- package/lib/mtx/settings_manager.js +45 -28
- package/lib/mtx/tenant_action.js +0 -1
- package/lib/mtx/util/credentials.js +62 -0
- package/node_modules/@cap-js/openapi/lib/compile/csdl.js +3 -3
- package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
- package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
- package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
- package/node_modules/@cap-js/openapi/package.json +3 -3
- package/node_modules/@sap/cds/CHANGELOG.md +64 -0
- package/node_modules/@sap/cds/app/index.js +5 -4
- package/node_modules/@sap/cds/eslint.config.mjs +1 -0
- package/node_modules/@sap/cds/lib/compile/for/nodejs.js +1 -0
- package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
- package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
- package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
- package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
- package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
- package/node_modules/@sap/cds/lib/plugins.js +9 -5
- package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
- package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
- package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
- package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
- package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +3 -2
- package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
- package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
- package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
- package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
- package/node_modules/@sap/cds/libx/http/location.js +3 -3
- package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
- package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
- package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
- package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
- package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
- package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
- package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
- package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
- package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
- package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
- package/node_modules/@sap/cds/package.json +1 -1
- package/node_modules/@sap/cds-compiler/CHANGELOG.md +60 -8
- package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
- package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
- package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
- package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
- package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
- package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
- package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
- package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
- package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
- package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
- package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +41 -15
- package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
- package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
- package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
- package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
- package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
- package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
- package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
- package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
- package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
- package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
- package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
- package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
- package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
- package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
- package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
- package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +3 -0
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
- package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +51 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +35 -16
- package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
- package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
- package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +6 -7
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +34 -35
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +19 -4
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +6 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +18 -21
- package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
- package/node_modules/@sap/xsenv/package.json +10 -7
- package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/hdb/cfg/VERSION +1 -1
- package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
- package/node_modules/hdb/lib/protocol/Connection.js +1 -0
- package/node_modules/hdb/package.json +3 -2
- package/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/negotiator/package.json +16 -10
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +192 -3
- package/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/qs/test/utils.js +12 -0
- package/node_modules/sax/lib/sax.js +27 -9
- package/node_modules/sax/package.json +1 -1
- package/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/package.json +5 -5
- package/bin/completion/scripts/cds-bash.sh +0 -20
- package/bin/completion/scripts/cds-fish.fish +0 -13
- package/bin/completion/scripts/cds-ps.ps1 +0 -19
- package/bin/completion/scripts/cds-zsh.sh +0 -13
- package/lib/deploy/index.js +0 -25
- package/lib/import/asyncapi/importAsyncAPI.js +0 -33
- package/lib/import/asyncapi/index.js +0 -18
- package/lib/import/asyncapi/parserContext.js +0 -372
- package/lib/import/asyncapi/utils.js +0 -49
- package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
- package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
- package/node_modules/@sap/cds-mtxs/lib/migration/mtx-adapter.js +0 -230
- package/node_modules/negotiator/HISTORY.md +0 -114
- /package/{lib → bin}/upgrade/context.js +0 -0
- /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
- /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
- /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
- /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
- /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
- /package/{lib → bin}/watch/livereload-server.js +0 -0
- /package/{lib → bin}/watch/node-watch.js +0 -0
- /package/{lib → bin}/watch/open.js +0 -0
- /package/{lib → bin}/watch/watcher.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
// Thin redirect wrapper for smart routing
|
|
4
|
-
const upgradeTenant = require('
|
|
4
|
+
const upgradeTenant = require('../upgrade-tenant')
|
|
5
5
|
|
|
6
6
|
module.exports = Object.assign(upgrade, {
|
|
7
7
|
_name: 'upgrade',
|
|
@@ -75,6 +75,6 @@ async function upgrade(args, options = {}) {
|
|
|
75
75
|
return upgradeTenant(args, options)
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const versionUpgrade = require('
|
|
78
|
+
const versionUpgrade = require('./upgrade')
|
|
79
79
|
return versionUpgrade(options)
|
|
80
80
|
}
|
|
@@ -47,7 +47,7 @@ function collectJava(ctx, cds) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function printListing(occurrences) {
|
|
50
|
-
const { bold, error } = require('
|
|
50
|
+
const { bold, error } = require('../../../lib/util/term');
|
|
51
51
|
console.log(error('✗ Inconsistent cds versions detected'));
|
|
52
52
|
console.log();
|
|
53
53
|
const byFile = new Map();
|
|
@@ -15,7 +15,7 @@ function deriveTarget() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async function runPreflight(ctx, cds) {
|
|
18
|
-
const { info, error, bold } = require('
|
|
18
|
+
const { info, error, bold } = require('../../../lib/util/term');
|
|
19
19
|
|
|
20
20
|
ctx.target = deriveTarget();
|
|
21
21
|
console.log(`${bold(`Upgrading project to cds ${ctx.target}`)}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { info, warn, bold, dim, error } = require('
|
|
3
|
+
const { info, warn, bold, dim, error } = require('../../../../lib/util/term');
|
|
4
4
|
const { UPGRADE_DIR, REPORT_FILE } = require('../../constants');
|
|
5
5
|
|
|
6
6
|
const { setup } = require('./setup');
|
|
@@ -62,7 +62,7 @@ async function runNpmInstalls(ctx, cds) {
|
|
|
62
62
|
|
|
63
63
|
async function runInstall(ctx, cds) {
|
|
64
64
|
const { askYesNo, NonTTYError } = require('../util/prompt');
|
|
65
|
-
const { error } = require('
|
|
65
|
+
const { error } = require('../../../lib/util/term');
|
|
66
66
|
let nodeRan = false, javaRan = false, aborted = false;
|
|
67
67
|
|
|
68
68
|
const mismatches = ctx.verifyMismatches || [];
|
|
@@ -7,7 +7,7 @@ const { execFile, execSync } = require('child_process');
|
|
|
7
7
|
const { promisify } = require('util');
|
|
8
8
|
const cds = require('@sap/cds');
|
|
9
9
|
|
|
10
|
-
const { info, warn, dim } = require('
|
|
10
|
+
const { info, warn, dim } = require('../../../lib/util/term');
|
|
11
11
|
|
|
12
12
|
const execFileAsync = promisify(execFile);
|
|
13
13
|
const TIMEOUT_MS = 120_000;
|
|
@@ -18,7 +18,7 @@ const REMOVAL_COPY = {
|
|
|
18
18
|
|
|
19
19
|
async function runRemovals(ctx, cds) {
|
|
20
20
|
const { askYesNo, NonTTYError } = require('../util/prompt');
|
|
21
|
-
const { info, bold, dim } = require('
|
|
21
|
+
const { info, bold, dim } = require('../../../lib/util/term');
|
|
22
22
|
|
|
23
23
|
const removals = ctx.proposal?.removals || [];
|
|
24
24
|
if (removals.length === 0) return;
|
|
@@ -81,7 +81,7 @@ function buildProposal(ctx, cds) {
|
|
|
81
81
|
async function runRewrite(ctx, cds) {
|
|
82
82
|
const { askYesNo, NonTTYError } = require('../util/prompt');
|
|
83
83
|
const path = require('node:path');
|
|
84
|
-
const { info, bold, dim } = require('
|
|
84
|
+
const { info, bold, dim } = require('../../../lib/util/term');
|
|
85
85
|
|
|
86
86
|
const { updates, removals } = buildProposal(ctx, cds);
|
|
87
87
|
ctx.proposal = { updates, removals };
|
|
@@ -76,7 +76,7 @@ function verifyJava(ctx, cds) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
async function runVerify(ctx, cds) {
|
|
79
|
-
const { error, bold, dim } = require('
|
|
79
|
+
const { error, bold, dim } = require('../../../lib/util/term');
|
|
80
80
|
const mismatches = [
|
|
81
81
|
...(ctx.project.isNode ? await verifyNode(ctx, cds) : []),
|
|
82
82
|
...(ctx.project.isJava ? verifyJava(ctx, cds) : []),
|
|
@@ -13,8 +13,8 @@ const { runOpenRewrite } = require('./steps/openrewrite');
|
|
|
13
13
|
const { generate } = require('./steps/analyze/reporter');
|
|
14
14
|
|
|
15
15
|
async function upgrade(options = {}) {
|
|
16
|
-
const cds = require('
|
|
17
|
-
const { error } = require('
|
|
16
|
+
const cds = require('../../lib/cds');
|
|
17
|
+
const { error } = require('../../lib/util/term');
|
|
18
18
|
|
|
19
19
|
console.log();
|
|
20
20
|
try {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { parseXml } = require('
|
|
3
|
+
const { parseXml } = require('../../../lib/init/xml')
|
|
4
4
|
|
|
5
5
|
function parsePomXml(filePath) {
|
|
6
6
|
return parseXml(filePath)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function updatePomPropertyInFile(filePath, propertyName, newValue) {
|
|
10
|
-
const cds = require('
|
|
10
|
+
const cds = require('../../../lib/cds')
|
|
11
11
|
const { fs } = cds.utils
|
|
12
12
|
|
|
13
13
|
const content = fs.readFileSync(filePath, 'utf8')
|
package/bin/util/containerize.js
CHANGED
|
@@ -57,17 +57,19 @@ function processDockerfile(bp, name, tag) {
|
|
|
57
57
|
function processCommands(bp) {
|
|
58
58
|
return bp.commands ? bp.commands.map(c => c.trim().split(' ')) : []
|
|
59
59
|
}
|
|
60
|
-
function processBuildpack(bp, name, tag, clearCache = false) {
|
|
60
|
+
function processBuildpack(bp, name, tag, clearCache = false, image, publish = false) {
|
|
61
61
|
let { type, path, env, builder } = bp.buildpack
|
|
62
62
|
type = type ? type.split(',').map(t => buildpacks.has(t.trim()) ? `paketo-buildpacks/${t.trim()}` : t.trim()) : []
|
|
63
63
|
if (builders.has(builder)) builder = `paketobuildpacks/${builder}`
|
|
64
64
|
const cacheArgs = clearCache ? ['--clear-cache'] : []
|
|
65
|
+
const target = publish ? image : `${name}:${tag}`
|
|
65
66
|
return [['pack',
|
|
66
|
-
...appendSubcommand(
|
|
67
|
+
...appendSubcommand(target, 'build'),
|
|
67
68
|
...appendSubcommand(path, '--path'),
|
|
68
69
|
...type.flatMap(t => appendSubcommand(t, '--buildpack')),
|
|
69
70
|
...appendSubcommand(builder, '--builder'),
|
|
70
71
|
...appendSubcommand(env, '--env'),
|
|
72
|
+
...(publish ? ['--publish'] : []),
|
|
71
73
|
...cacheArgs
|
|
72
74
|
]]
|
|
73
75
|
}
|
|
@@ -107,14 +109,16 @@ async function parseYAML(filename, repoOpt = '', options) {
|
|
|
107
109
|
const buildType = keyProcessorMap[key]
|
|
108
110
|
|
|
109
111
|
if (!buildType) throw `'build-parameters' ${Object.keys(bp)} in ${filename} is invalid`
|
|
112
|
+
const publish = key === 'buildpack' && options.push
|
|
110
113
|
return {
|
|
111
114
|
name,
|
|
112
115
|
tag,
|
|
113
|
-
buildCmd: buildType(bp, name, tag, key === 'buildpack' && options.clearCache),
|
|
116
|
+
buildCmd: buildType(bp, name, tag, key === 'buildpack' && options.clearCache, repoImg, publish),
|
|
114
117
|
pushCmd: ['docker', 'push', repoImg],
|
|
115
118
|
tagCmd: [['docker', 'tag', source, repoImg]],
|
|
116
119
|
image: rawImg,
|
|
117
120
|
source,
|
|
121
|
+
publish,
|
|
118
122
|
path: bp.buildpack?.path
|
|
119
123
|
}
|
|
120
124
|
}))
|
|
@@ -137,7 +141,7 @@ async function executeModules(modules, options) {
|
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
for (const cmd of m.buildCmd) run(cmd)
|
|
140
|
-
if (options.push) {
|
|
144
|
+
if (options.push && !m.publish) {
|
|
141
145
|
for (const cmd of m.tagCmd) run(cmd)
|
|
142
146
|
run(m.pushCmd)
|
|
143
147
|
}
|
package/bin/version.js
CHANGED
|
@@ -20,6 +20,9 @@ module.exports = exports = async function cds_version (pattern, options) {
|
|
|
20
20
|
console.log()
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
exports.staticCompletions = () => ({
|
|
24
|
+
'--omit': ['dev', 'optional', 'peer'],
|
|
25
|
+
})
|
|
23
26
|
exports.options = [ '--depth', '--omit' ]
|
|
24
27
|
exports.flags = [ '--info', '--markdown', '--abs', '--all', '--json' ]
|
|
25
28
|
exports.shortcuts = [ '-d', '-o', '-i', '-m', '-a' ]
|
|
@@ -79,7 +82,9 @@ function canonic_options4 ([pattern], options) {
|
|
|
79
82
|
async function node_versions(o) {
|
|
80
83
|
|
|
81
84
|
// Call npm root and npm ls in parallel...
|
|
82
|
-
const [ [npm_root_g],[npm_root_l], lines ] = await Promise.all ([
|
|
85
|
+
const [ [npm_version], [npm_exec], [npm_root_g],[npm_root_l], lines ] = await Promise.all ([
|
|
86
|
+
$`npm --version`,
|
|
87
|
+
process.platform === 'win32' ? $`where npm.cmd` : $`which npm`,
|
|
83
88
|
$`npm root --global`,
|
|
84
89
|
$`npm root --local`,
|
|
85
90
|
$`npm ls -lp ${
|
|
@@ -118,6 +123,9 @@ async function node_versions(o) {
|
|
|
118
123
|
if (name.match(_pkg)) return [ name, version, location ]
|
|
119
124
|
}) .filter (x => x)
|
|
120
125
|
|
|
126
|
+
// windows adds \r at the end of line
|
|
127
|
+
const _npm_exec = npm_exec.trim()
|
|
128
|
+
|
|
121
129
|
// Sort SAP packages and CAP packages on top
|
|
122
130
|
const entries = deps.sort (function sap_then_cap_on_top ([a],[b]) {
|
|
123
131
|
let a_is_cdk = a === '@sap/cds-dk'
|
|
@@ -151,6 +159,7 @@ async function node_versions(o) {
|
|
|
151
159
|
[ 'npm root -l', null, npm_root_l ],
|
|
152
160
|
[ 'npm root -g', null, npm_root_g ],
|
|
153
161
|
[ 'Node.js', process.version.slice(1), process.execPath ],
|
|
162
|
+
[ 'npm', npm_version, _npm_exec ]
|
|
154
163
|
)
|
|
155
164
|
|
|
156
165
|
return entries
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
const watchOnlyOptions = ['--ext', '--livereload', '--experimental-hot-reload', '--open', '--debug', '--inspect', '--inspect-brk', '--include', '--exclude']
|
|
2
|
+
const { DIR } = require('../completion')
|
|
2
3
|
|
|
3
4
|
module.exports = Object.assign ( watch, {
|
|
5
|
+
staticCompletions: () => ({
|
|
6
|
+
'--experimental-hot-reload': ['true', 'false'],
|
|
7
|
+
'--livereload': ['false'],
|
|
8
|
+
'--include': DIR(),
|
|
9
|
+
'--exclude': DIR(),
|
|
10
|
+
}),
|
|
4
11
|
flags: [ '--in-memory', '--in-memory?', '--with-mocks', '--with-mtx' ],
|
|
5
12
|
options: [ '--port', ...watchOnlyOptions ],
|
|
6
13
|
help: `
|
|
@@ -78,14 +85,15 @@ module.exports = Object.assign ( watch, {
|
|
|
78
85
|
`})
|
|
79
86
|
|
|
80
87
|
const fs = require ('node:fs')
|
|
81
|
-
const cds = require('
|
|
88
|
+
const cds = require('../../lib/cds')
|
|
82
89
|
const DEBUG = /\b(y|all|cli|watch)\b/.test (process.env.DEBUG) ? ((..._) => console.debug ('[cli] -', ..._)) : undefined
|
|
83
90
|
const {delimiter,relative,resolve,sep} = require ('path')
|
|
84
|
-
const {codes} = require('
|
|
91
|
+
const {codes} = require('../../lib/util/term'), t = codes
|
|
85
92
|
|
|
86
93
|
const escapedSep = sep === '\\' ? '\\\\' : sep // escape backslash for windows
|
|
87
94
|
const ignoreDefaults = [
|
|
88
95
|
/\.git/,
|
|
96
|
+
new RegExp(`${escapedSep}\\.cds(${escapedSep}|$)`), // .cds folder — but not .cds model files or .cdsrc.json
|
|
89
97
|
/node_modules/,
|
|
90
98
|
/_out/,
|
|
91
99
|
/@types/,
|
|
@@ -148,7 +156,7 @@ async function watch ([cwd], {
|
|
|
148
156
|
// if sap/cds is not installed locally, run with cds-dk's deps. (sap/cds, sqlite etc)
|
|
149
157
|
if (!installed('@sap/cds', cwd)) {
|
|
150
158
|
env.NODE_PATH = [...paths(cwd), ...paths(__dirname)].join(delimiter)
|
|
151
|
-
env.NODE_OPTIONS = [env.NODE_OPTIONS, `--import ${require.resolve('
|
|
159
|
+
env.NODE_OPTIONS = [env.NODE_OPTIONS, `--import ${require.resolve('./esm-resolve-registration.js')}`].filter(Boolean).join(' ')
|
|
152
160
|
}
|
|
153
161
|
|
|
154
162
|
const delay = parseInt(process.env.CDS_WATCH_DELAY) || 200
|
|
@@ -163,8 +171,8 @@ async function watch ([cwd], {
|
|
|
163
171
|
let liveReload //= ...
|
|
164
172
|
if (!/false|no/.test(options.livereload)) {
|
|
165
173
|
log ('( live reload enabled for browsers )')
|
|
166
|
-
liveReload = new (require ('
|
|
167
|
-
env.CDS_LIVERELOAD_PATH = require.resolve ('
|
|
174
|
+
liveReload = new (require ('./livereload-server'))
|
|
175
|
+
env.CDS_LIVERELOAD_PATH = require.resolve ('./livereload-connect')
|
|
168
176
|
env.CDS_LIVERELOAD_URL = await liveReload.start (options['livereload'], cwd, delay)
|
|
169
177
|
.catch(err => { console.log(`Error starting live reload: ${err.message}`); liveReload = null })
|
|
170
178
|
}
|
|
@@ -177,7 +185,7 @@ async function watch ([cwd], {
|
|
|
177
185
|
})
|
|
178
186
|
|
|
179
187
|
if (process.argv.includes('--profile') || process.env.CDS_ENV) {
|
|
180
|
-
const bind = require('
|
|
188
|
+
const bind = require('../../lib/bind/shared')
|
|
181
189
|
Object.assign(env, await bind.env({cwd}))
|
|
182
190
|
}
|
|
183
191
|
|
|
@@ -192,9 +200,9 @@ async function watch ([cwd], {
|
|
|
192
200
|
// return
|
|
193
201
|
// }
|
|
194
202
|
|
|
195
|
-
const nodemon = require('
|
|
203
|
+
const nodemon = require('./node-watch')
|
|
196
204
|
const watcher = nodemon ({
|
|
197
|
-
script: resolve(__dirname,'
|
|
205
|
+
script: resolve(__dirname,'./watched'), cwd, env, ext, ignore, watched,
|
|
198
206
|
delay,
|
|
199
207
|
options
|
|
200
208
|
}).on('restart', (files)=>{
|
|
@@ -203,7 +211,7 @@ async function watch ([cwd], {
|
|
|
203
211
|
}).on('message', async (msg) => { switch (msg.code) { // messages from child process
|
|
204
212
|
case 'listening':
|
|
205
213
|
env.PORT = msg.address?.port || msg.port
|
|
206
|
-
if (options.open) require('
|
|
214
|
+
if (options.open) require('./open').openURL (options.open, env.PORT)
|
|
207
215
|
else liveReload?.reload()
|
|
208
216
|
delete options.open
|
|
209
217
|
break
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Child process impl launched by cds watch
|
|
3
|
-
// Extracted from watch.js to avoid cds.env loaded too eagerly
|
|
3
|
+
// Extracted from watch/index.js to avoid cds.env loaded too eagerly
|
|
4
4
|
//
|
|
5
5
|
|
|
6
6
|
(async () => {
|
|
7
7
|
|
|
8
8
|
// run through cli in order to use its error handling
|
|
9
9
|
const args = JSON.parse(process.env._args)
|
|
10
|
-
const cds = require('
|
|
10
|
+
const cds = require('../../lib/cds'); cds.watched = true
|
|
11
11
|
require('./vite-watch')
|
|
12
12
|
const bootstrap = require('../../bin/cds')(...args)
|
|
13
13
|
|
package/lib/build/constants.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.CONTENT_PACKAGE_JSON = "contentPackageJson" // create packag
|
|
|
21
21
|
exports.CONTENT_PACKAGELOCK_JSON = "contentPackageLockJson" // copy package-lock.json file into deployment folder - ENABLED by default
|
|
22
22
|
exports.CONTENT_HDBTABLEDATA = "contentHdbtabledata" // create .hdbtabledata files for .csv files if not already existing - ENABLED by default
|
|
23
23
|
exports.CONTENT_NPMRC = "contentNpmrc" // copy .npmrc file into deployment folder - ENABLED by default
|
|
24
|
-
exports.
|
|
24
|
+
exports.CONTENT_CDSRC = "contentCdsrc" // copy .cdsrc.* config files into deployment folder - ENABLED by default
|
|
25
25
|
exports.CONTENT_NODE_MODULES = "contentNodeModules" // copy node_modules folder into deployment folder - DISABLED by default
|
|
26
26
|
exports.CONTENT_ENV = "contentEnv" // copy .env file into deployment folder - DISABLED by default
|
|
27
27
|
exports.CONTENT_DEFAULT_ENV_JSON = "contentDefaultEnvJson" // copy default-env.json file into deployment folder - DISABLED by default
|
|
@@ -3,6 +3,7 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { normalizePath } = require('../../util')
|
|
4
4
|
const { BUILD_TASK_FIORI, CDS_CONFIG_PATH_SEP } = require('../../constants')
|
|
5
5
|
const DEBUG = cds.debug('cli|build')
|
|
6
|
+
const { exists } = cds.utils
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* With cds 4 service metadata for the UI service binding is no longer created by default.
|
|
@@ -86,7 +87,8 @@ module.exports = class FioriBuildPlugin extends require('../edmx') {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
async _writeEdmxToWebapp(src, dest) {
|
|
89
|
-
const
|
|
90
|
+
const subfolder = this._resolveAppFolder(src)
|
|
91
|
+
const manifestPath = path.join(src, subfolder, 'manifest.json')
|
|
90
92
|
let manifest
|
|
91
93
|
|
|
92
94
|
try {
|
|
@@ -124,10 +126,37 @@ module.exports = class FioriBuildPlugin extends require('../edmx') {
|
|
|
124
126
|
return
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
const edmxPath = path.resolve(path.join(dest,
|
|
129
|
+
const edmxPath = path.resolve(path.join(dest, subfolder), this._strippedUrlPath(localUri))
|
|
128
130
|
return this.write(edmx).to(edmxPath)
|
|
129
131
|
}
|
|
130
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Folder holding manifest.json relative to the UI module root.
|
|
135
|
+
* Defaults: `webapp` (UI5 v4 application), `src` (UI5 v5 component/library);
|
|
136
|
+
* overridable via ui5.yaml path mapping, see https://ui5.github.io/cli/v4/pages/Configuration/#path-mapping
|
|
137
|
+
*/
|
|
138
|
+
_resolveAppFolder(src) {
|
|
139
|
+
for (const yamlFile of ['ui5.yaml', 'ui5-build.yaml']) {
|
|
140
|
+
const yamlPath = path.join(src, yamlFile)
|
|
141
|
+
if (!exists(yamlPath)) {
|
|
142
|
+
continue
|
|
143
|
+
}
|
|
144
|
+
let paths
|
|
145
|
+
try {
|
|
146
|
+
paths = cds.load.yaml(yamlPath)?.resources?.configuration?.paths
|
|
147
|
+
} catch (e) {
|
|
148
|
+
if (e.name !== 'YAMLParseError') throw e // only tolerate malformed yaml
|
|
149
|
+
DEBUG?.(`ignoring malformed [${path.relative(cds.root, yamlPath)}]: ${e.code}`)
|
|
150
|
+
continue
|
|
151
|
+
}
|
|
152
|
+
const mapped = paths?.webapp ?? paths?.src
|
|
153
|
+
if (mapped) {
|
|
154
|
+
return mapped
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return exists(path.join(src, 'src', 'manifest.json')) ? 'src' : 'webapp'
|
|
158
|
+
}
|
|
159
|
+
|
|
131
160
|
_getEdmxForUri(model, appFolder, uri) {
|
|
132
161
|
const uriSegments = this._strippedUrlPath(uri).split('/')
|
|
133
162
|
|
|
@@ -142,10 +142,12 @@ module.exports = class InternalBuildPlugin extends require('./plugin') {
|
|
|
142
142
|
/**
|
|
143
143
|
* Collect and write message bundles from CAP plugins into messages.properties files.
|
|
144
144
|
* @param {string} bundleDest
|
|
145
|
-
* @param {Object} model -
|
|
145
|
+
* @param {Object} model - passed for signature consistency with subclass overrides; not used here
|
|
146
|
+
* as Java does not require neighborhood resolution of plugin i18n files.
|
|
146
147
|
*/
|
|
148
|
+
// eslint-disable-next-line no-unused-vars
|
|
147
149
|
async collectMessageBundles(bundleDest, model) {
|
|
148
|
-
const messageBundle = cds.i18n.bundle4('messages'
|
|
150
|
+
const messageBundle = cds.i18n.bundle4('messages')
|
|
149
151
|
const messagesData = messageBundle.translations4?.(cds.env.i18n.languages) ?? {}
|
|
150
152
|
|
|
151
153
|
// Write messages.properties files for each locale
|
|
@@ -122,14 +122,13 @@ module.exports = class MtxSidecarBuildPlugin extends require('../nodejs') {
|
|
|
122
122
|
// resources are determined based on available database build task, SQLite as fallback
|
|
123
123
|
promises.push(new ResourcesTarBuilder(this).createTar(destMain, model))
|
|
124
124
|
|
|
125
|
-
// copy package.json and .cdsrc.json from project root
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
promises.push(this.copy(cdsrcJson).to(path.join(destMain, '.cdsrc.json')))
|
|
125
|
+
// copy package.json and .cdsrc.json/.cdsrc.yaml from project root
|
|
126
|
+
for (const file of ['package.json', '.cdsrc.json', '.cdsrc.yaml']) {
|
|
127
|
+
if (exists(file)) {
|
|
128
|
+
promises.push(this
|
|
129
|
+
.copy(path.join(cds.root, file))
|
|
130
|
+
.to(path.join(destMain, file)))
|
|
131
|
+
}
|
|
133
132
|
}
|
|
134
133
|
return Promise.all(promises)
|
|
135
134
|
}
|
|
@@ -3,7 +3,7 @@ const { path, exists, rimraf, isdir, read, write } = cds.utils
|
|
|
3
3
|
const cmd = require('../../../util/command')
|
|
4
4
|
const { BuildError, getWorkspaces, findWorkspaceRoot, normalizePath } = require('../../util')
|
|
5
5
|
const { ODATA_VERSION_V2, FOLDER_GEN, CONTENT_EDMX, CONTENT_PACKAGELOCK_JSON,
|
|
6
|
-
CONTENT_NPMRC,
|
|
6
|
+
CONTENT_NPMRC, CONTENT_CDSRC, CONTENT_ENV, CONTENT_DEFAULT_ENV_JSON, FLAVOR_LOCALIZED_EDMX,
|
|
7
7
|
OPTION_WS_PACK, SEVERITY_WARNING } = require('../../constants');
|
|
8
8
|
const LOG = cds.log('cli|build')
|
|
9
9
|
const DEBUG = cds.debug('cli|build')
|
|
@@ -68,6 +68,7 @@ module.exports = class NodejsBuildPlugin extends require('../edmx') {
|
|
|
68
68
|
if (this.isStagingBuild()) {
|
|
69
69
|
const srcSrv = this.task.src === cds.root ? path.resolve(this.task.src, cds.env.folders.srv) : this.task.src
|
|
70
70
|
await this._copyNativeContent(cds.root, srcSrv, destRoot, destSrv)
|
|
71
|
+
await this.#copyWorkspaceLock(destRoot)
|
|
71
72
|
try {
|
|
72
73
|
// add minimal node engine to effective package.json.
|
|
73
74
|
// CloudFoundry uses this entry to choose the node engine in buildpack and may
|
|
@@ -146,6 +147,18 @@ module.exports = class NodejsBuildPlugin extends require('../edmx') {
|
|
|
146
147
|
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
// copy the workspace root lock into gen/srv when the module has none, so monorepo deployments install frozen dependencies
|
|
151
|
+
async #copyWorkspaceLock(destRoot) {
|
|
152
|
+
if (this.hasBuildOption(CONTENT_PACKAGELOCK_JSON, false)) return
|
|
153
|
+
if (exists(path.join(destRoot, 'package-lock.json'))) return
|
|
154
|
+
const wsRoot = findWorkspaceRoot(cds.root)
|
|
155
|
+
if (!wsRoot || wsRoot === cds.root) return
|
|
156
|
+
const rootLock = path.join(wsRoot, 'package-lock.json')
|
|
157
|
+
if (!exists(rootLock)) return
|
|
158
|
+
DEBUG?.(`Copying workspace root package-lock.json from '${wsRoot}' into build destination`)
|
|
159
|
+
await this.copy(rootLock).to(path.join(destRoot, 'package-lock.json'))
|
|
160
|
+
}
|
|
161
|
+
|
|
149
162
|
async clean() {
|
|
150
163
|
// staging build content is deleted by default
|
|
151
164
|
if (cds.env.build.target === '.') {
|
|
@@ -175,7 +188,7 @@ module.exports = class NodejsBuildPlugin extends require('../edmx') {
|
|
|
175
188
|
* @returns the list of files that have been copied
|
|
176
189
|
*/
|
|
177
190
|
async copySrvContent(src, destRoot, destSrv) {
|
|
178
|
-
const srvRootBlockList = RegExp('package\\.json$|package-lock\\.json$|\\.npmrc$|\\.cdsrc\\.json$')
|
|
191
|
+
const srvRootBlockList = RegExp('package\\.json$|package-lock\\.json$|\\.npmrc$|\\.cdsrc\\.json$|\\.cdsrc\\.yaml$')
|
|
179
192
|
const srvBlockList = RegExp('\\.cds$|csn\\.json$|\\.csn$|manifest\\.y.?ml$|\\.env($|\\..*$)|default-env\\.json$|\\.cdsrc-private.json$')
|
|
180
193
|
const srvRootFileNames = []
|
|
181
194
|
|
|
@@ -201,7 +214,7 @@ module.exports = class NodejsBuildPlugin extends require('../edmx') {
|
|
|
201
214
|
let srvAllowList = "package\\.json$" // always copy package.json, modify only if CONTENT_PACKAGE_JSON is true
|
|
202
215
|
srvAllowList += !this.hasBuildOption(CONTENT_PACKAGELOCK_JSON, false) ? "|package-lock\\.json$" : ""
|
|
203
216
|
srvAllowList += !this.hasBuildOption(CONTENT_NPMRC, false) ? "|\\.npmrc$" : ""
|
|
204
|
-
srvAllowList += !this.hasBuildOption(
|
|
217
|
+
srvAllowList += !this.hasBuildOption(CONTENT_CDSRC, false) ? "|\\.cdsrc\\.json$|\\.cdsrc\\.yaml$" : ""
|
|
205
218
|
srvAllowList += this.hasBuildOption(CONTENT_ENV, true) ? "|\\.env($|\\..*$)" : ""
|
|
206
219
|
srvAllowList += this.hasBuildOption(CONTENT_DEFAULT_ENV_JSON, true) ? "|default-env\\.json$" : ""
|
|
207
220
|
srvAllowList = new RegExp(srvAllowList)
|
|
@@ -228,7 +241,7 @@ module.exports = class NodejsBuildPlugin extends require('../edmx') {
|
|
|
228
241
|
let srvAllowList = "package\\.json$" // always copy package.json, modify only if CONTENT_PACKAGE_JSON is true
|
|
229
242
|
srvAllowList += !this.hasBuildOption(CONTENT_PACKAGELOCK_JSON, false) ? "|package-lock\\.json$" : ""
|
|
230
243
|
srvAllowList += !this.hasBuildOption(CONTENT_NPMRC, false) ? "|\\.npmrc$" : ""
|
|
231
|
-
srvAllowList += !this.hasBuildOption(
|
|
244
|
+
srvAllowList += !this.hasBuildOption(CONTENT_CDSRC, false) ? "|\\.cdsrc\\.json$|\\.cdsrc\\.yaml$" : ""
|
|
232
245
|
srvAllowList += this.hasBuildOption(CONTENT_ENV, true) ? "|\\.env($|\\..*$)" : ""
|
|
233
246
|
srvAllowList += this.hasBuildOption(CONTENT_DEFAULT_ENV_JSON, true) ? "|default-env\\.json$" : ""
|
|
234
247
|
srvAllowList = new RegExp(srvAllowList)
|
|
@@ -290,18 +303,48 @@ module.exports = class NodejsBuildPlugin extends require('../edmx') {
|
|
|
290
303
|
}
|
|
291
304
|
}
|
|
292
305
|
}
|
|
306
|
+
await this._packWorkspaceRoot(dest, wsRoot, appPkg)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
async _packWorkspaceRoot(dest, wsRoot, appPkg) {
|
|
310
|
+
if (!wsRoot || wsRoot === cds.root) return
|
|
311
|
+
// The workspace root package is not a member of its own `workspaces` globs, so
|
|
312
|
+
// `getWorkspaces` never returns it. Pack it explicitly when the app depends on it
|
|
313
|
+
// via a `file:` spec that resolves to the workspace root.
|
|
314
|
+
const rootName = require(path.join(wsRoot, 'package.json')).name
|
|
315
|
+
const spec = appPkg.dependencies?.[rootName]
|
|
316
|
+
if (!spec?.startsWith('file:')) return
|
|
317
|
+
if (path.resolve(cds.root, spec.slice('file:'.length)) !== path.resolve(wsRoot)) return
|
|
318
|
+
let pkgDescriptors
|
|
319
|
+
try {
|
|
320
|
+
pkgDescriptors = await NodejsBuildPlugin._execNpmPack(dest, wsRoot)
|
|
321
|
+
} catch (e) {
|
|
322
|
+
DEBUG?.(e)
|
|
323
|
+
throw new BuildError(`Failed to package npm workspace root\n${e.message}`)
|
|
324
|
+
}
|
|
325
|
+
const pkgDescriptor = pkgDescriptors?.find(d => d.name === rootName)
|
|
326
|
+
if (!pkgDescriptor) return
|
|
327
|
+
const { filename: fileName } = pkgDescriptor
|
|
328
|
+
appPkg.dependencies[rootName] = `file:${fileName}`
|
|
329
|
+
this.pushFile(path.join(dest, fileName))
|
|
330
|
+
await this.write(JSON.stringify(appPkg, 0, 2)).to(path.join(dest, 'package.json'))
|
|
293
331
|
}
|
|
294
332
|
|
|
295
333
|
/**
|
|
296
334
|
* @param {import('fs').PathLike} dest - destination folder
|
|
297
335
|
* @param {import('fs').PathLike} wsRoot - workspace root folder
|
|
298
|
-
* @param {string[]} workspaces - list of workspace names
|
|
336
|
+
* @param {string[]} [workspaces] - list of workspace names; when omitted, the workspace root package itself is packed
|
|
299
337
|
* @returns {Promise<object[]>} - array of pack descriptors ({ name, filename, ... })
|
|
300
338
|
* @private
|
|
301
339
|
*/
|
|
302
340
|
static async _execNpmPack(dest, wsRoot, workspaces) {
|
|
303
|
-
const args = ['pack', '--
|
|
304
|
-
workspaces
|
|
341
|
+
const args = ['pack', '--json', `--pack-destination=${dest}`]
|
|
342
|
+
if (workspaces) {
|
|
343
|
+
args.push('--ws')
|
|
344
|
+
workspaces.forEach(w => args.push(`-w=${w}`))
|
|
345
|
+
} else {
|
|
346
|
+
args.push(wsRoot)
|
|
347
|
+
}
|
|
305
348
|
const result = await cmd.spawnCommand('npm', args, { cwd: wsRoot }, true, !!LOG._debug)
|
|
306
349
|
DEBUG?.(result)
|
|
307
350
|
const parsed = JSON.parse(result)
|
|
@@ -309,4 +352,18 @@ module.exports = class NodejsBuildPlugin extends require('../edmx') {
|
|
|
309
352
|
// package name as of npm 12 — normalize to an array of descriptors.
|
|
310
353
|
return Array.isArray(parsed) ? parsed : Object.values(parsed)
|
|
311
354
|
}
|
|
355
|
+
|
|
356
|
+
// Override to pass model for neighborhood resolution of plugin i18n files.
|
|
357
|
+
// Cannot be done in InternalBuildPlugin because Java relies on the model-less behaviour.
|
|
358
|
+
async collectMessageBundles(bundleDest, model) {
|
|
359
|
+
const messageBundle = cds.i18n.bundle4('messages', { model })
|
|
360
|
+
const messagesData = messageBundle.translations4?.(cds.env.i18n.languages) ?? {}
|
|
361
|
+
for (const [locale, messages] of Object.entries(messagesData)) {
|
|
362
|
+
if (Object.keys(messages).length > 0) {
|
|
363
|
+
const fileName = locale ? `messages_${locale}.properties` : 'messages.properties'
|
|
364
|
+
const content = Object.entries(messages).map(([k, v]) => `${k}=${v}`).join('\n') + '\n'
|
|
365
|
+
await this.write(content).to(path.join(bundleDest, fileName))
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
312
369
|
}
|
package/lib/env/schema.js
CHANGED
|
@@ -26,6 +26,22 @@ function mergePluginSchema(pluginSchema) {
|
|
|
26
26
|
targetSchema._cds_schema_overlays.push('root')
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
if (pluginSchema.export) {
|
|
31
|
+
const exp = targetSchema.$defs?.cdsRoot?.properties?.export?.properties
|
|
32
|
+
if (exp) {
|
|
33
|
+
Object.assign(exp, pluginSchema.export)
|
|
34
|
+
targetSchema._cds_schema_overlays.push('export')
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (pluginSchema.importFrom) {
|
|
39
|
+
const oneOf = targetSchema.$defs?.importOptions?.from?.oneOf
|
|
40
|
+
if (oneOf) {
|
|
41
|
+
oneOf.push(pluginSchema.importFrom)
|
|
42
|
+
targetSchema._cds_schema_overlays.push('importFrom')
|
|
43
|
+
}
|
|
44
|
+
}
|
|
29
45
|
}
|
|
30
46
|
}
|
|
31
47
|
}
|