@sap/cds-dk 7.9.6 → 8.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/CHANGELOG.md +2136 -0
  2. package/bin/add.js +18 -52
  3. package/bin/bind.js +2 -2
  4. package/bin/build.js +29 -4
  5. package/bin/cds.js +31 -14
  6. package/bin/compile/index.js +7 -6
  7. package/bin/completion/index.js +70 -46
  8. package/bin/completion/scripts/cds-bash.sh +4 -1
  9. package/bin/completion/scripts/cds-fish.fish +13 -0
  10. package/bin/completion/scripts/cds-ps.ps1 +2 -1
  11. package/bin/completion/scripts/cds-zsh.sh +2 -1
  12. package/bin/deploy/index.js +6 -5
  13. package/bin/deploy/to-sqlite.js +2 -2
  14. package/bin/extend.js +19 -50
  15. package/bin/help.js +2 -2
  16. package/bin/init.js +10 -77
  17. package/bin/login.js +13 -5
  18. package/bin/migrate.js +1 -1
  19. package/bin/pull.js +11 -0
  20. package/bin/repl.js +3 -0
  21. package/bin/test.js +5 -0
  22. package/bin/version.js +7 -7
  23. package/bin/watch.js +13 -14
  24. package/lib/bind/KubernetesApiAccessor.js +10 -9
  25. package/lib/build/buildTaskEngine.js +11 -7
  26. package/lib/build/buildTaskFactory.js +15 -43
  27. package/lib/build/buildTaskProviderFactory.js +16 -44
  28. package/lib/build/constants.js +4 -3
  29. package/lib/build/index.js +2 -2
  30. package/lib/build/{buildPlugin.js → plugin.js} +65 -46
  31. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/Chart.yaml +1 -1
  32. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.yaml +1 -1
  33. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/Chart.yaml +1 -1
  34. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/_helpers.tpl +7 -0
  35. package/lib/build/plugins/helm/files/subcharts/service-instance/templates/servicebinding.yaml +32 -0
  36. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/serviceinstance.yaml +3 -0
  37. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.schema.json +63 -0
  38. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.yaml +23 -1
  39. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/Chart.yaml +1 -1
  40. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/deployment.yaml +2 -0
  41. package/lib/build/plugins/helm/files/subcharts/web-application/templates/hpa.yaml +22 -0
  42. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/pod-disruption-budget.yaml +1 -0
  43. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.schema.json +49 -0
  44. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.yaml +8 -2
  45. package/lib/{init/template/helm/files/chart → build/plugins/helm/files}/templates/_deployment_helpers.tpl +5 -0
  46. package/lib/build/plugins/helm/files/templates/_helpers.tpl +13 -0
  47. package/lib/build/plugins/helm/index.js +81 -0
  48. package/lib/build/plugins.js +12 -15
  49. package/lib/build/provider/featureToggleBuildPlugin.js +7 -39
  50. package/lib/build/provider/hana/2migration.js +168 -124
  51. package/lib/build/provider/hana/index.js +69 -56
  52. package/lib/build/provider/hana/template/package.json +4 -3
  53. package/lib/build/provider/internalBuildPlugin.js +32 -97
  54. package/lib/build/provider/internalBuildTaskProvider.js +12 -48
  55. package/lib/build/provider/java/index.js +2 -3
  56. package/lib/build/provider/mtx/index.js +5 -4
  57. package/lib/build/provider/mtx-extension/index.js +5 -2
  58. package/lib/build/provider/mtx-sidecar/index.js +2 -2
  59. package/lib/build/provider/nodejs/index.js +4 -3
  60. package/lib/build/util.js +83 -12
  61. package/lib/compile/to-mermaid.js +108 -0
  62. package/lib/compile/to_asyncapi.js +7 -0
  63. package/lib/compile/to_openapi.js +7 -0
  64. package/lib/deploy/to-hana/hana.js +37 -34
  65. package/lib/deploy/to-hana/hdiDeployUtil.js +8 -6
  66. package/lib/env/schemas/cds-rc.js +1 -1
  67. package/lib/import/common.js +2 -2
  68. package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -4
  69. package/lib/import/odata/v2parser.js +83 -197
  70. package/lib/import/odata/v4parser.js +1 -38
  71. package/lib/import/openapi/importOpenAPI.js +164 -42
  72. package/lib/index.js +10 -12
  73. package/lib/init/bas.js +91 -0
  74. package/lib/init/constants.js +21 -11
  75. package/lib/init/index.js +72 -150
  76. package/lib/init/merge.js +12 -20
  77. package/lib/init/mvn.js +103 -150
  78. package/lib/init/plugin.js +11 -7
  79. package/lib/init/projectReader.js +53 -20
  80. package/lib/init/registries/mta.js +51 -6
  81. package/lib/init/template/application-logging/files/package.json.hbs +7 -0
  82. package/lib/init/template/application-logging/index.js +13 -1
  83. package/lib/init/template/approuter/files/containerize.yaml.hbs +10 -0
  84. package/lib/init/template/approuter/files/mta.yaml.hbs +1 -2
  85. package/lib/init/template/approuter/files/values.yaml.hbs +19 -4
  86. package/lib/init/template/approuter/files/xs-app.json.hbs +12 -3
  87. package/lib/init/template/approuter/index.js +29 -25
  88. package/lib/init/template/attachments/files/mta.yaml.hbs +14 -0
  89. package/lib/init/template/attachments/files/package.json.hbs +5 -0
  90. package/lib/init/template/attachments/files/values.yaml +7 -0
  91. package/lib/init/template/attachments/index.js +53 -0
  92. package/lib/init/template/{redis-messaging → audit-logging}/files/mta.yaml.hbs +4 -4
  93. package/lib/init/template/audit-logging/files/package.json.hbs +7 -0
  94. package/lib/init/template/audit-logging/index.js +66 -0
  95. package/lib/init/template/cf-manifest/index.js +4 -0
  96. package/lib/init/template/completion/completionSetup.js +54 -33
  97. package/lib/init/template/completion/index.js +7 -1
  98. package/lib/init/template/connectivity/index.js +4 -4
  99. package/lib/init/template/containerize/files/containerize.yaml.hbs +26 -0
  100. package/lib/init/template/containerize/index.js +24 -0
  101. package/lib/init/template/data/index.js +4 -0
  102. package/lib/init/template/destination/files/mta.yaml.hbs +31 -1
  103. package/lib/init/template/destination/files/package.sidecar.json +7 -0
  104. package/lib/init/template/destination/index.js +22 -2
  105. package/lib/init/template/enterprise-messaging/index.js +6 -3
  106. package/lib/init/template/enterprise-messaging-shared/index.js +5 -1
  107. package/lib/init/template/extensibility/files/package.json.hbs +1 -1
  108. package/lib/init/template/extensibility/files/xs-security.json.hbs +2 -8
  109. package/lib/init/template/extensibility/index.js +3 -1
  110. package/lib/init/template/file-based-messaging/index.js +4 -0
  111. package/lib/init/template/h2/index.js +4 -0
  112. package/lib/init/template/hana/files/containerize.yaml.hbs +10 -0
  113. package/lib/init/template/hana/files/db/package.json +3 -2
  114. package/lib/init/template/hana/files/package.json.hbs +4 -7
  115. package/lib/init/template/hana/files/values.yaml.hbs +1 -2
  116. package/lib/init/template/hana/index.js +15 -7
  117. package/lib/init/template/helm/files/Chart.yaml.hbs +2 -3
  118. package/lib/init/template/helm/files/values.schema.json +2173 -0
  119. package/lib/init/template/helm/files/values.yaml.hbs +11 -6
  120. package/lib/init/template/helm/index.js +77 -18
  121. package/lib/init/template/helm-unified-runtime/index.js +19 -56
  122. package/lib/init/template/html5-repo/files/app-package.json.hbs +11 -7
  123. package/lib/init/template/html5-repo/files/manifest.json +13 -0
  124. package/lib/init/template/html5-repo/files/mta.yaml.hbs +14 -33
  125. package/lib/init/template/html5-repo/files/package.sidecar.json +7 -0
  126. package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +21 -0
  127. package/lib/init/template/html5-repo/files/ui5.yaml.hbs +2 -29
  128. package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -2
  129. package/lib/init/template/html5-repo/files/xs-app.json.hbs +6 -7
  130. package/lib/init/template/html5-repo/index.js +41 -35
  131. package/lib/init/template/http/index.js +36 -12
  132. package/lib/init/template/java/index.js +18 -12
  133. package/lib/init/template/kafka/index.js +4 -0
  134. package/lib/init/template/lint/index.js +7 -2
  135. package/lib/init/template/liquibase/index.js +4 -0
  136. package/lib/init/template/local-messaging/index.js +4 -0
  137. package/lib/init/template/malware-scanner/files/mta.yaml.hbs +14 -0
  138. package/lib/init/template/malware-scanner/files/package.json.hbs +17 -0
  139. package/lib/init/template/malware-scanner/files/values.yaml +7 -0
  140. package/lib/init/template/malware-scanner/index.js +47 -0
  141. package/lib/init/template/mta/files/mta.yaml.hbs +3 -3
  142. package/lib/init/template/mta/files/package.json +1 -1
  143. package/lib/init/template/mta/index.js +4 -0
  144. package/lib/init/template/mtx/index.js +4 -0
  145. package/lib/init/template/multitenancy/files/containerize.yaml.hbs +10 -0
  146. package/lib/init/template/multitenancy/files/mta.yaml.hbs +0 -1
  147. package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
  148. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +6 -5
  149. package/lib/init/template/multitenancy/files/values.yaml.hbs +14 -24
  150. package/lib/init/template/multitenancy/index.js +50 -28
  151. package/lib/init/template/nodejs/files/eslint.config.mjs +2 -0
  152. package/lib/init/template/nodejs/files/package.json.hbs +2 -3
  153. package/lib/init/template/nodejs/index.js +4 -0
  154. package/lib/init/template/notifications/files/mta.yaml.hbs +2 -2
  155. package/lib/init/template/notifications/index.js +4 -0
  156. package/lib/init/template/pipeline/files/.pipeline/config.yml +1 -1
  157. package/lib/init/template/pipeline/files/Jenkinsfile +1 -1
  158. package/lib/init/template/pipeline/index.js +4 -0
  159. package/lib/init/template/portal/files/mta.yaml.hbs +52 -0
  160. package/lib/init/template/portal/files/package.json.hbs +11 -0
  161. package/lib/init/template/portal/files/package.sidecar.json +7 -0
  162. package/lib/init/template/portal/files/portal-site/CommonDataModel.json.hbs +97 -0
  163. package/lib/init/template/portal/files/portal-site/i18n/catalog.properties +1 -0
  164. package/lib/init/template/portal/files/portal-site/i18n/catalog_de.properties +1 -0
  165. package/lib/init/template/portal/files/portal-site/i18n/group.properties +1 -0
  166. package/lib/init/template/portal/files/portal-site/i18n/group_de.properties +1 -0
  167. package/lib/init/template/portal/index.js +84 -0
  168. package/lib/init/template/postgres/index.js +5 -1
  169. package/lib/init/template/redis/files/mta.yaml.hbs +25 -0
  170. package/lib/init/template/redis/files/package.json.hbs +5 -0
  171. package/lib/init/template/redis/index.js +44 -0
  172. package/lib/init/template/redis-messaging/files/package.json.hbs +0 -3
  173. package/lib/init/template/redis-messaging/index.js +8 -18
  174. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -0
  175. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -0
  176. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +13 -1
  177. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +2 -2
  178. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -0
  179. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +4 -0
  180. package/lib/init/template/sample/files/app/browse/webapp/manifest.json +3 -3
  181. package/lib/init/template/sample/files/app/index.html +1 -1
  182. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -5
  183. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -6
  184. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -5
  185. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -16
  186. package/lib/init/template/sample/files/nodejs/cat-service.js +2 -2
  187. package/lib/init/template/sample/files/package.json.hbs +3 -0
  188. package/lib/init/template/sample/index.js +16 -9
  189. package/lib/init/template/sqlite/index.js +4 -0
  190. package/lib/init/template/tiny-sample/files/nodejs/db/data/my.bookshop-Books.csv +3 -3
  191. package/lib/init/template/tiny-sample/files/nodejs/srv/cat-service.cds.hbs +1 -1
  192. package/lib/init/template/tiny-sample/index.js +4 -0
  193. package/lib/init/template/toggles/files/package.json.hbs +1 -1
  194. package/lib/init/template/toggles/index.js +4 -0
  195. package/lib/init/template/typer/index.js +4 -0
  196. package/lib/init/template/typescript/files/package.json +12 -0
  197. package/lib/init/template/typescript/files/tsconfig.json +13 -0
  198. package/lib/init/template/typescript/index.js +39 -0
  199. package/lib/init/template/workzone/index.js +9 -0
  200. package/lib/init/template/workzone-standard/files/manifest.json.hbs +6 -0
  201. package/lib/init/template/workzone-standard/files/mta.yaml.hbs +59 -0
  202. package/lib/init/template/workzone-standard/index.js +46 -0
  203. package/lib/init/template/xsuaa/files/package.json.hbs +1 -1
  204. package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -2
  205. package/lib/init/template/xsuaa/index.js +11 -7
  206. package/lib/init/validate.js +27 -0
  207. package/lib/lint/generators.js +1 -1
  208. package/lib/lint/io.js +25 -7
  209. package/lib/mtx/auth_manager.js +64 -30
  210. package/lib/mtx/download_legacy.js +2 -2
  211. package/lib/mtx/index.js +0 -4
  212. package/lib/mtx/params.js +32 -38
  213. package/lib/mtx/pull.js +151 -43
  214. package/lib/mtx/push.js +3 -3
  215. package/lib/mtx/settings_manager.js +75 -35
  216. package/lib/mtx/tenant_action.js +1 -1
  217. package/lib/mtx/util/cf.js +1 -1
  218. package/lib/mtx/util/fs.js +26 -1
  219. package/lib/mtx/util/logging.js +7 -3
  220. package/lib/util/command.js +0 -2
  221. package/lib/util/fs.js +2 -3
  222. package/lib/util/question.js +28 -0
  223. package/lib/util/term.js +5 -3
  224. package/npm-shrinkwrap.json +225 -1083
  225. package/package.json +13 -8
  226. package/bin/activate.js +0 -77
  227. package/lib/compile/asyncapi/channels.js +0 -22
  228. package/lib/compile/asyncapi/components/messageTraits/index.js +0 -89
  229. package/lib/compile/asyncapi/components/messages/index.js +0 -173
  230. package/lib/compile/asyncapi/components/schemas/annotations.js +0 -33
  231. package/lib/compile/asyncapi/components/schemas/array.js +0 -8
  232. package/lib/compile/asyncapi/components/schemas/cache.js +0 -14
  233. package/lib/compile/asyncapi/components/schemas/definition.js +0 -187
  234. package/lib/compile/asyncapi/components/schemas/enum.js +0 -16
  235. package/lib/compile/asyncapi/components/schemas/examples.js +0 -10
  236. package/lib/compile/asyncapi/components/schemas/index.js +0 -14
  237. package/lib/compile/asyncapi/components/schemas/localized.js +0 -29
  238. package/lib/compile/asyncapi/components/schemas/primitiveElement.js +0 -41
  239. package/lib/compile/asyncapi/components/schemas/ref.js +0 -45
  240. package/lib/compile/asyncapi/components/schemas/utils.js +0 -108
  241. package/lib/compile/asyncapi/index.js +0 -247
  242. package/lib/compile/asyncapi/message.js +0 -13
  243. package/lib/compile/asyncapi/utils.js +0 -27
  244. package/lib/compile/openapi/csdl2openapi.js +0 -2448
  245. package/lib/compile/openapi/index.js +0 -68
  246. package/lib/init/template/helm/files/chart/templates/NOTES.txt +0 -14
  247. package/lib/init/template/helm/files/chart/templates/_helpers.tpl +0 -28
  248. package/lib/init/template/helm/files/chart/values.root.schema.json +0 -61
  249. package/lib/init/template/helm/files/chart/values.schema.json +0 -366
  250. package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +0 -10
  251. package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +0 -90
  252. package/lib/init/template/helm-unified-runtime/files/templates/_helpers.tpl +0 -28
  253. package/lib/init/template/helm-unified-runtime/files/values.root.schema.json +0 -61
  254. package/lib/init/template/helm-unified-runtime/files/values.schema.json +0 -366
  255. package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +0 -26
  256. package/lib/init/template/helm-unified-runtime/package.json +0 -4
  257. package/lib/init/template/multitenancy/files/mtxs-configmap-java-approuter.yaml +0 -20
  258. package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +0 -18
  259. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs-approuter.yaml +0 -12
  260. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +0 -12
  261. package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +0 -9
  262. package/lib/init/template/nodejs/files/eslint.config.js +0 -13
  263. package/lib/init/template/notebook/index.js +0 -11
  264. package/lib/init/template/samples/index.js +0 -9
  265. package/lib/mtx/activate.js +0 -238
  266. package/lib/mtx/extend.js +0 -173
  267. package/lib/util/exec.d.ts +0 -54
  268. package/lib/util/exec.js +0 -211
  269. /package/lib/{init/template/approuter/files → build/plugins/helm/files/plugins/approuter}/approuter-configmap.yaml +0 -0
  270. /package/lib/{init/template/connectivity/files → build/plugins/helm/files/plugins/connectivity}/connectivity-proxy-info.yaml +0 -0
  271. /package/lib/{init/template/html5-repo/files → build/plugins/helm/files/plugins/html5-repo}/html5-apps-deployer-configmap.yaml +0 -0
  272. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/_helpers.tpl +0 -0
  273. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/job.yaml +0 -0
  274. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/secret.yaml +0 -0
  275. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-account.yaml +0 -0
  276. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-binding.yaml +0 -0
  277. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.schema.json +0 -0
  278. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/NOTES.txt +0 -0
  279. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_api.tpl +0 -0
  280. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_helpers.tpl +0 -0
  281. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/api-rule.yaml +0 -0
  282. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/network-policy.yaml +0 -0
  283. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/rbac.yaml +0 -0
  284. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/secret.yaml +0 -0
  285. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-account.yaml +0 -0
  286. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-binding.yaml +0 -0
  287. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service.yaml +0 -0
  288. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/virtual-service.yaml +0 -0
  289. /package/lib/{init/template/helm-unified-runtime → build/plugins/helm}/files/templates/NOTES.txt +0 -0
  290. /package/lib/init/template/{nodejs/files → java}/.cdsrc.json +0 -0
  291. /package/lib/init/template/tiny-sample/files/nodejs/db/{data-model.cds → schema.cds} +0 -0
@@ -23,7 +23,7 @@ module.exports = class TenantAction {
23
23
  */
24
24
  constructor(command) {
25
25
  if (!(command in COMMANDS)) {
26
- throw new Error(`invalid command: ${command}`);
26
+ throw `invalid command: ${command}`;
27
27
  }
28
28
  this.command = command;
29
29
  this.gerund = command.replace(/e$/, 'ing');
@@ -9,7 +9,7 @@ const { schemaRegex } = require('./urls');
9
9
  const DEBUG = cds.debug('cli');
10
10
 
11
11
  function runCf(args, callback) {
12
- const env = Object.assign({}, process.env, { LC_ALL: 'en_US.UTF-8' }); // enforce English headings
12
+ const env = { ...process.env, LC_ALL: 'en_US.UTF-8' }; // enforce English headings
13
13
  return execFile('cf', args, { env }, callback);
14
14
  }
15
15
 
@@ -72,11 +72,36 @@ function isParent(maybeParent, maybeChild) {
72
72
  return ! path.relative(maybeParent, maybeChild).startsWith('..');
73
73
  }
74
74
 
75
+ /**
76
+ * Searches for a regular expression in a directory tree
77
+ * @param folder directory to search in
78
+ * @param extensions file extensions to search for (use lower-case strings)
79
+ * @param regex regular expression to search for
80
+ * @return {boolean} true if the regular expression was found in a file
81
+ */
82
+ function grepQR(folder, extensions, regex) {
83
+ for (const dirent of fs.readdirSync(folder, { withFileTypes: true })) {
84
+ if (dirent.isFile() &&
85
+ extensions.some(x => dirent.name.toLowerCase().endsWith(x))) {
86
+ try {
87
+ if (regex.test(fs.readFileSync(path.join(folder, dirent.name), { encoding: 'utf-8' }))) {
88
+ return true;
89
+ }
90
+ } catch (error) { /* ignore */ }
91
+ }
92
+ if (dirent.isDirectory() && grepQR(path.join(folder, dirent.name), extensions, regex)) {
93
+ return true;
94
+ }
95
+ }
96
+ return false;
97
+ }
98
+
75
99
 
76
100
  module.exports = {
77
101
  collectFileContent,
78
102
  collectFiles,
79
103
  toUnixPath,
80
104
  normalizePath,
81
- isParent
105
+ isParent,
106
+ grepQR
82
107
  };
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-console */
1
+
2
2
 
3
3
  function getMessage(errorText, { error, command, help = command && getCommandHelp(command) } = {}) {
4
4
  let message = errorText ? errorText.trim() : '';
@@ -16,8 +16,12 @@ function getMessage(errorText, { error, command, help = command && getCommandHel
16
16
  if (includeStack) {
17
17
  message += (oriMsg ? '\n' : '') + error.stack;
18
18
  }
19
- if (debug && error.cause) {
20
- message += '\nCaused by: ' + getMessage('', { error: error.cause }).replace(/^(?= *at)/gm, ' ');
19
+ if (error.cause) {
20
+ if (debug) {
21
+ message += '\nCaused by: ' + getMessage('', { error: error.cause }).replace(/^(?= *at)/gm, ' ');
22
+ } else if (error.cause.status) {
23
+ message += `\nHTTP status: ${error.cause.status}`;
24
+ }
21
25
  }
22
26
  }
23
27
  if (typeof help === 'string') {
@@ -1,5 +1,3 @@
1
- // REVISIT: Consolidate with lib/util/exec.js
2
-
3
1
  const cp = require('child_process');
4
2
  const os = require('os');
5
3
  const cds = require('../cds');
package/lib/util/fs.js CHANGED
@@ -1,6 +1,5 @@
1
- const { yaml: YAML } = require('@sap/cds-foss')
1
+ const { read, write, yaml: YAML } = require('../cds').utils
2
2
  const JSONC = require('./jsonc');
3
- const { read, write } = require('../cds').utils;
4
3
 
5
4
  // REVISIT: Consider merging with template util
6
5
 
@@ -28,7 +27,7 @@ module.exports = new class FsUtil {
28
27
  }
29
28
 
30
29
  async writeYAML(dst, yaml) {
31
- const content = YAML.stringify(yaml, { collectionStyle: 'block', lineWidth: 120 })
30
+ const content = YAML.stringify(yaml, { collectionStyle: 'block', lineWidth: 150 })
32
31
  await write(content).to(dst)
33
32
  }
34
33
 
@@ -0,0 +1,28 @@
1
+ const readline = require('readline')
2
+ async function ask4(...args) {
3
+ const answers = []
4
+ const rl = readline.createInterface({
5
+ input: process.stdin,
6
+ output: process.stdout
7
+ })
8
+
9
+ async function askQuestion(questionParam) {
10
+ return new Promise(function (resolve) {
11
+ rl.question(`${questionParam}`, function (answer) {
12
+ answers.push(answer);
13
+ resolve();
14
+ });
15
+ });
16
+ }
17
+
18
+ for (const idx in args) {
19
+ await askQuestion(args[idx])
20
+ }
21
+
22
+ rl.close()
23
+ return answers
24
+ }
25
+
26
+ module.exports = {
27
+ ask4
28
+ }
package/lib/util/term.js CHANGED
@@ -9,13 +9,15 @@ const t = module.exports.codes = {
9
9
  red: '\x1b[91m', // Bright Foreground Red
10
10
  green: '\x1b[32m', // Foreground Green
11
11
  blue: '\x1b[34m', // Foreground Blue
12
+ yellow:'\x1b[33m', // Foreground Yellow
12
13
  orange: '\x1b[38;2;255;140;0m' // darker orange, works with bright and dark background
13
14
  }
14
15
 
15
- Object.defineProperty(module.exports, 'isTTY', { get: () => process.stdin.isTTY && process.stderr.isTTY })
16
-
16
+ Object.defineProperty(module.exports, 'isTTY', { get: () => process.stdout.isTTY && process.stderr.isTTY })
17
+ const useColor = module.exports.isTTY && process.env.NO_COLOR !== 'true' || (process.env.FORCE_COLOR && process.env.FORCE_COLOR !== 'false')
18
+ module.exports.colors = useColor
17
19
  const as = module.exports.as = (codes, o) => {
18
- return module.exports.isTTY && !process.env.NO_COLOR ? (codes + o + t.reset) : ('' + o)
20
+ return useColor ? (codes + o + t.reset) : ('' + o)
19
21
  }
20
22
 
21
23
  const asErr = module.exports.error = o => DEBUG ? o : as(t.red + t.bold, o)