zudojs-cli 2.0.0 → 2.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/README.md +69 -9
- package/dist/src/adapters/frontend/angular.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/angular.adapter.js +14 -97
- package/dist/src/adapters/frontend/astro.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/astro.adapter.js +4 -64
- package/dist/src/adapters/frontend/fallback/fallback.helper.d.ts +41 -0
- package/dist/src/adapters/frontend/fallback/fallback.helper.js +57 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.d.ts +18 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.js +107 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.d.ts +23 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.js +125 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/index.d.ts +8 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/index.js +8 -0
- package/dist/src/adapters/frontend/fallback/framework/astro.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/framework/astro.fallback.js +76 -0
- package/dist/src/adapters/frontend/fallback/framework/index.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/framework/index.js +13 -0
- package/dist/src/adapters/frontend/fallback/framework/next.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/framework/next.fallback.js +105 -0
- package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.js +56 -0
- package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.d.ts +15 -0
- package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.js +94 -0
- package/dist/src/adapters/frontend/fallback/index.d.ts +12 -0
- package/dist/src/adapters/frontend/fallback/index.js +12 -0
- package/dist/src/adapters/frontend/fallback/vite/index.d.ts +11 -0
- package/dist/src/adapters/frontend/fallback/vite/index.js +11 -0
- package/dist/src/adapters/frontend/fallback/vite/react.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/vite/react.fallback.js +77 -0
- package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.js +95 -0
- package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.js +71 -0
- package/dist/src/adapters/frontend/fallback/vite/vue.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/vite/vue.fallback.js +78 -0
- package/dist/src/adapters/frontend/next.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/next.adapter.js +16 -95
- package/dist/src/adapters/frontend/nuxt.adapter.d.ts +1 -2
- package/dist/src/adapters/frontend/nuxt.adapter.js +32 -43
- package/dist/src/adapters/frontend/react-native.adapter.js +1 -1
- package/dist/src/adapters/frontend/react.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/react.adapter.js +7 -89
- package/dist/src/adapters/frontend/svelte.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/svelte.adapter.js +4 -86
- package/dist/src/adapters/frontend/sveltekit.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/sveltekit.adapter.js +4 -57
- package/dist/src/adapters/frontend/vanilla.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/vanilla.adapter.js +4 -47
- package/dist/src/adapters/frontend/vue.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/vue.adapter.js +4 -76
- package/dist/src/bin/bin.menu.d.ts +22 -0
- package/dist/src/bin/bin.menu.js +40 -0
- package/dist/src/bin/bin.runner.d.ts +38 -0
- package/dist/src/bin/bin.runner.js +51 -0
- package/dist/src/bin/index.d.ts +9 -0
- package/dist/src/bin/index.js +9 -0
- package/dist/src/bin/zudojs.js +15 -4
- package/dist/src/cliApplication/cliApplication.core.d.ts +4 -2
- package/dist/src/cliApplication/cliApplication.core.js +48 -36
- package/dist/src/cliApplication/cliApplication.logger.d.ts +5 -0
- package/dist/src/cliApplication/cliApplication.logger.js +5 -3
- package/dist/src/cliApplication/invocation/index.d.ts +12 -0
- package/dist/src/cliApplication/invocation/index.js +12 -0
- package/dist/src/cliApplication/invocation/invocation.hint.d.ts +30 -0
- package/dist/src/cliApplication/invocation/invocation.hint.js +74 -0
- package/dist/src/cliApplication/invocation/invocation.locate.d.ts +34 -0
- package/dist/src/cliApplication/invocation/invocation.locate.js +53 -0
- package/dist/src/cliApplication/invocation/invocation.name.d.ts +37 -0
- package/dist/src/cliApplication/invocation/invocation.name.js +69 -0
- package/dist/src/cliApplication/invocation/invocation.sanitize.d.ts +19 -0
- package/dist/src/cliApplication/invocation/invocation.sanitize.js +32 -0
- package/dist/src/cliParser/cliParser.core.js +3 -1
- package/dist/src/cliParser/cliParser.helper.d.ts +7 -0
- package/dist/src/cliParser/cliParser.helper.js +19 -2
- package/dist/src/cliParser/cliParser.longOption.js +2 -2
- package/dist/src/commands/add.command.d.ts +7 -3
- package/dist/src/commands/add.command.js +96 -57
- package/dist/src/commands/create.command.js +29 -42
- package/dist/src/commands/doctor.command.d.ts +2 -1
- package/dist/src/commands/doctor.command.js +52 -4
- package/dist/src/commands/generate.command.js +31 -16
- package/dist/src/commands/info.command.js +11 -1
- package/dist/src/constants/index.d.ts +21 -3
- package/dist/src/constants/index.js +40 -5
- package/dist/src/constants/zudojsVersions.generated.d.ts +9 -0
- package/dist/src/constants/zudojsVersions.generated.js +48 -0
- package/dist/src/constants/zudojsVersions.helper.d.ts +21 -0
- package/dist/src/constants/zudojsVersions.helper.js +29 -0
- package/dist/src/generators/frontend/frontendGenerator.core.js +9 -10
- package/dist/src/generators/frontend/frontendPipeline.d.ts +6 -1
- package/dist/src/generators/frontend/frontendPipeline.js +9 -1
- package/dist/src/generators/fullstack/fullstackComposer.core.js +7 -1
- package/dist/src/generators/index.d.ts +1 -2
- package/dist/src/generators/index.js +1 -2
- package/dist/src/generators/infrastructure/infrastructure.generator.js +13 -5
- package/dist/src/generators/integration/integrationGenerator.core.d.ts +2 -0
- package/dist/src/generators/integration/integrationGenerator.core.js +31 -2
- package/dist/src/generators/module/module.generator.js +36 -4
- package/dist/src/generators/resource/index.d.ts +8 -0
- package/dist/src/generators/resource/index.js +8 -0
- package/dist/src/generators/resource/resource.generator.d.ts +27 -0
- package/dist/src/generators/resource/resource.generator.js +87 -0
- package/dist/src/generators/resource/resource.layout.d.ts +26 -0
- package/dist/src/generators/resource/resource.layout.js +46 -0
- package/dist/src/generators/resource/resource.plan.d.ts +27 -0
- package/dist/src/generators/resource/resource.plan.js +46 -0
- package/dist/src/generators/resource/resource.run.d.ts +25 -0
- package/dist/src/generators/resource/resource.run.js +52 -0
- package/dist/src/prompts/cancel.prompt.d.ts +5 -1
- package/dist/src/prompts/cancel.prompt.js +4 -0
- package/dist/src/prompts/menu/index.d.ts +13 -0
- package/dist/src/prompts/menu/index.js +13 -0
- package/dist/src/prompts/menu/menu.adapter.d.ts +16 -0
- package/dist/src/prompts/menu/menu.adapter.js +56 -0
- package/dist/src/prompts/menu/menu.constant.d.ts +20 -0
- package/dist/src/prompts/menu/menu.constant.js +29 -0
- package/dist/src/prompts/menu/menu.flow.d.ts +18 -0
- package/dist/src/prompts/menu/menu.flow.js +82 -0
- package/dist/src/prompts/menu/menu.select.d.ts +26 -0
- package/dist/src/prompts/menu/menu.select.js +118 -0
- package/dist/src/prompts/menu/menu.type.d.ts +66 -0
- package/dist/src/prompts/menu/menu.type.js +8 -0
- package/dist/src/recipes/apply/index.d.ts +9 -0
- package/dist/src/recipes/apply/index.js +9 -0
- package/dist/src/recipes/apply/recipeApply.app.d.ts +20 -0
- package/dist/src/recipes/apply/recipeApply.app.js +79 -0
- package/dist/src/recipes/apply/recipeApply.context.d.ts +14 -0
- package/dist/src/recipes/apply/recipeApply.context.js +76 -0
- package/dist/src/recipes/apply/recipeApply.files.d.ts +39 -0
- package/dist/src/recipes/apply/recipeApply.files.js +84 -0
- package/dist/src/recipes/apply/recipeApply.project.d.ts +11 -0
- package/dist/src/recipes/apply/recipeApply.project.js +50 -0
- package/dist/src/recipes/apply/recipeApply.report.d.ts +20 -0
- package/dist/src/recipes/apply/recipeApply.report.js +51 -0
- package/dist/src/recipes/catalog/database/database.files.d.ts +15 -0
- package/dist/src/recipes/catalog/database/database.files.js +98 -0
- package/dist/src/recipes/catalog/database/database.recipe.d.ts +9 -0
- package/dist/src/recipes/catalog/database/database.recipe.js +50 -0
- package/dist/src/recipes/catalog/database/index.d.ts +6 -0
- package/dist/src/recipes/catalog/database/index.js +6 -0
- package/dist/src/recipes/catalog/email.recipe.d.ts +9 -0
- package/dist/src/recipes/catalog/email.recipe.js +122 -0
- package/dist/src/recipes/catalog/index.d.ts +11 -0
- package/dist/src/recipes/catalog/index.js +11 -0
- package/dist/src/recipes/catalog/openapi.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/openapi.recipe.js +25 -0
- package/dist/src/recipes/catalog/platform/cache.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/cache.recipe.js +55 -0
- package/dist/src/recipes/catalog/platform/index.d.ts +9 -0
- package/dist/src/recipes/catalog/platform/index.js +9 -0
- package/dist/src/recipes/catalog/platform/messaging.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/messaging.recipe.js +46 -0
- package/dist/src/recipes/catalog/platform/observability.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/platform/observability.recipe.js +49 -0
- package/dist/src/recipes/catalog/platform/queue.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/queue.recipe.js +61 -0
- package/dist/src/recipes/catalog/platform/scheduler.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/scheduler.recipe.js +56 -0
- package/dist/src/recipes/catalog/redis.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/redis.recipe.js +79 -0
- package/dist/src/recipes/catalog/storage.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/storage.recipe.js +49 -0
- package/dist/src/recipes/catalog/websockets.recipe.d.ts +10 -0
- package/dist/src/recipes/catalog/websockets.recipe.js +84 -0
- package/dist/src/recipes/docker/docker.compose.d.ts +19 -0
- package/dist/src/recipes/docker/docker.compose.js +90 -0
- package/dist/src/recipes/docker/docker.recipe.d.ts +10 -0
- package/dist/src/recipes/docker/docker.recipe.js +51 -0
- package/dist/src/recipes/docker/docker.refresh.d.ts +13 -0
- package/dist/src/recipes/docker/docker.refresh.js +37 -0
- package/dist/src/recipes/docker/index.d.ts +7 -0
- package/dist/src/recipes/docker/index.js +7 -0
- package/dist/src/recipes/index.d.ts +8 -0
- package/dist/src/recipes/index.js +8 -0
- package/dist/src/recipes/recipe.registry.d.ts +17 -0
- package/dist/src/recipes/recipe.registry.js +46 -0
- package/dist/src/recipes/recipe.type.d.ts +93 -0
- package/dist/src/recipes/recipe.type.js +12 -0
- package/dist/src/resolvers/dependency/dependencyVersions.constant.d.ts +100 -5
- package/dist/src/resolvers/dependency/dependencyVersions.constant.js +103 -34
- package/dist/src/resolvers/dependency/index.d.ts +1 -1
- package/dist/src/resolvers/dependency/index.js +1 -1
- package/dist/src/resolvers/project.resolver.d.ts +14 -1
- package/dist/src/resolvers/project.resolver.js +11 -3
- package/dist/src/scaffolders/scaffolder.helper.js +12 -1
- package/dist/src/templates/backendApp/backendApp.core.d.ts +45 -0
- package/dist/src/templates/backendApp/backendApp.core.js +66 -0
- package/dist/src/templates/backendApp/backendApp.modules.d.ts +26 -0
- package/dist/src/templates/backendApp/backendApp.modules.js +25 -0
- package/dist/src/templates/backendApp/backendApp.project.d.ts +26 -0
- package/dist/src/templates/backendApp/backendApp.project.js +87 -0
- package/dist/src/templates/backendApp/index.d.ts +8 -0
- package/dist/src/templates/backendApp/index.js +8 -0
- package/dist/src/templates/backendApp/parts/config.template.d.ts +28 -0
- package/dist/src/templates/backendApp/parts/config.template.js +118 -0
- package/dist/src/templates/backendApp/parts/httpUtils.template.d.ts +10 -0
- package/dist/src/templates/backendApp/parts/httpUtils.template.js +103 -0
- package/dist/src/templates/backendApp/parts/index.d.ts +9 -0
- package/dist/src/templates/backendApp/parts/index.js +9 -0
- package/dist/src/templates/backendApp/parts/integrations.template.d.ts +16 -0
- package/dist/src/templates/backendApp/parts/integrations.template.js +115 -0
- package/dist/src/templates/backendApp/parts/wiring.template.d.ts +26 -0
- package/dist/src/templates/backendApp/parts/wiring.template.js +111 -0
- package/dist/src/templates/microservice/microservice.template.d.ts +4 -1
- package/dist/src/templates/microservice/microservice.template.js +74 -90
- package/dist/src/templates/modular-monolith/modularMonolith.template.js +25 -77
- package/dist/src/templates/monolith/monolith.template.d.ts +11 -26
- package/dist/src/templates/monolith/monolith.template.js +49 -146
- package/dist/src/templates/resource/index.d.ts +9 -0
- package/dist/src/templates/resource/index.js +9 -0
- package/dist/src/templates/resource/layers/index.d.ts +9 -0
- package/dist/src/templates/resource/layers/index.js +9 -0
- package/dist/src/templates/resource/layers/resourceData.template.d.ts +9 -0
- package/dist/src/templates/resource/layers/resourceData.template.js +108 -0
- package/dist/src/templates/resource/layers/resourcePrisma.template.d.ts +15 -0
- package/dist/src/templates/resource/layers/resourcePrisma.template.js +89 -0
- package/dist/src/templates/resource/layers/resourceRoutes.template.d.ts +13 -0
- package/dist/src/templates/resource/layers/resourceRoutes.template.js +128 -0
- package/dist/src/templates/resource/layers/resourceService.template.d.ts +13 -0
- package/dist/src/templates/resource/layers/resourceService.template.js +95 -0
- package/dist/src/templates/resource/resource.files.d.ts +33 -0
- package/dist/src/templates/resource/resource.files.js +99 -0
- package/dist/src/templates/resource/resource.names.d.ts +38 -0
- package/dist/src/templates/resource/resource.names.js +60 -0
- package/dist/src/templates/resource/resource.type.d.ts +19 -0
- package/dist/src/templates/resource/resource.type.js +15 -0
- package/dist/src/templates/shared/appRuntime.template.js +28 -11
- package/dist/src/templates/shared/capability.template.d.ts +13 -4
- package/dist/src/templates/shared/capability.template.js +21 -5
- package/dist/src/templates/shared/dockerfile.template.d.ts +12 -4
- package/dist/src/templates/shared/dockerfile.template.js +68 -29
- package/dist/src/templates/shared/pnpm.template.d.ts +8 -2
- package/dist/src/templates/shared/pnpm.template.js +9 -1
- package/dist/src/templates/shared/server.template.d.ts +23 -22
- package/dist/src/templates/shared/server.template.js +79 -53
- package/dist/src/types/scaffold.type.d.ts +6 -0
- package/dist/src/types/scaffold.type.js +2 -1
- package/dist/src/utils/utils.name.js +6 -0
- package/dist/src/utils/utils.writeGuard.d.ts +5 -0
- package/dist/src/utils/utils.writeGuard.js +23 -0
- package/dist/src/wiring/index.d.ts +10 -0
- package/dist/src/wiring/index.js +10 -0
- package/dist/src/wiring/wiring.dependencies.d.ts +29 -0
- package/dist/src/wiring/wiring.dependencies.js +83 -0
- package/dist/src/wiring/wiring.edits.d.ts +51 -0
- package/dist/src/wiring/wiring.edits.js +90 -0
- package/dist/src/wiring/wiring.markers.d.ts +53 -0
- package/dist/src/wiring/wiring.markers.js +87 -0
- package/package.json +20 -15
|
@@ -1,40 +1,109 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* without a version
|
|
2
|
+
* Version ranges for every third-party package a generated project depends
|
|
3
|
+
* on: the ranges adapters request without a version, the framework
|
|
4
|
+
* toolchains the built-in fallback templates write, and the backend
|
|
5
|
+
* templates' dev tooling.
|
|
4
6
|
*
|
|
5
7
|
* Unpinned requirements used to be written as `"latest"`, so the same
|
|
6
|
-
* scaffold produced a different dependency set every day
|
|
7
|
-
*
|
|
8
|
+
* scaffold produced a different dependency set every day, and the fallback
|
|
9
|
+
* templates carried their own literals that went stale independently (Vite
|
|
10
|
+
* 6, Next 15, Nuxt 3, Angular 19 and TypeScript 5 long after newer majors
|
|
11
|
+
* shipped). Every range now lives here. Every name a built-in adapter
|
|
12
|
+
* requests unpinned must have an entry (checked by
|
|
8
13
|
* `tests/cli.round10.*.test.ts`). Ranges were taken from the npm registry on
|
|
9
|
-
* 2026-09-
|
|
14
|
+
* 2026-09-23; pre-releases (for example Prisma 8 RCs or `@nuxt/devtools`
|
|
15
|
+
* betas tagged `latest`) are never used.
|
|
10
16
|
*/
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
export const DEPENDENCY_VERSION_RANGES = Object.freeze({
|
|
18
|
+
"@angular/build": "^22.1.8",
|
|
19
|
+
"@angular/cli": "^22.1.8",
|
|
20
|
+
"@angular/common": "^22.1.7",
|
|
21
|
+
"@angular/compiler": "^22.1.7",
|
|
22
|
+
"@angular/compiler-cli": "^22.1.7",
|
|
23
|
+
"@angular/core": "^22.1.7",
|
|
24
|
+
"@angular/forms": "^22.1.7",
|
|
25
|
+
"@angular/platform-browser": "^22.1.7",
|
|
26
|
+
"@angular/router": "^22.1.7",
|
|
27
|
+
"@astrojs/check": "^0.9.10",
|
|
28
|
+
"@ngrx/store": "^22.0.1",
|
|
29
|
+
"@prisma/adapter-pg": "^7.10.0",
|
|
30
|
+
"@prisma/client": "^7.10.0",
|
|
31
|
+
"@sveltejs/adapter-auto": "^7.0.1",
|
|
32
|
+
"@sveltejs/kit": "^2.70.3",
|
|
33
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
34
|
+
"@testing-library/dom": "^10.4.2",
|
|
35
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
36
|
+
"@testing-library/react": "^16.3.3",
|
|
37
|
+
"@testing-library/react-native": "^14.0.1",
|
|
38
|
+
"@testing-library/svelte": "^5.4.2",
|
|
39
|
+
"@testing-library/user-event": "^14.6.7",
|
|
40
|
+
"@tsconfig/svelte": "^5.0.8",
|
|
41
|
+
"@types/node": "^26.6.2",
|
|
42
|
+
"@types/react": "^19.3.0",
|
|
43
|
+
"@types/react-dom": "^19.3.0",
|
|
44
|
+
"@types/ws": "^8.18.1",
|
|
45
|
+
"@vitejs/plugin-react": "^6.1.1",
|
|
46
|
+
"@vitejs/plugin-vue": "^6.0.9",
|
|
47
|
+
"@vue/test-utils": "^2.5.1",
|
|
48
|
+
"@vue/tsconfig": "^0.9.1",
|
|
49
|
+
astro: "^7.3.4",
|
|
50
|
+
eslint: "^10.11.0",
|
|
51
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
52
|
+
"eslint-plugin-react-refresh": "^0.5.7",
|
|
53
|
+
"eslint-plugin-svelte": "^3.23.0",
|
|
54
|
+
"eslint-plugin-vue": "^10.11.0",
|
|
55
|
+
jest: "^30.5.2",
|
|
56
|
+
jsdom: "^30.1.1",
|
|
57
|
+
next: "^16.3.6",
|
|
58
|
+
nodemailer: "^10.0.10",
|
|
59
|
+
nuxt: "^4.5.2",
|
|
60
|
+
pinia: "^4.0.3",
|
|
61
|
+
prettier: "^3.9.9",
|
|
62
|
+
// Prisma 7 stable. npm's `latest` tag points at an 8.0 release
|
|
63
|
+
// candidate; a caret range never selects a pre-release.
|
|
64
|
+
prisma: "^7.10.0",
|
|
65
|
+
"prettier-plugin-svelte": "^4.1.1",
|
|
66
|
+
react: "^19.3.0",
|
|
67
|
+
"react-dom": "^19.3.0",
|
|
68
|
+
redis: "^6.2.1",
|
|
69
|
+
rxjs: "~7.8.2",
|
|
70
|
+
svelte: "^5.57.1",
|
|
71
|
+
"svelte-check": "^4.7.6",
|
|
72
|
+
tslib: "^2.8.1",
|
|
73
|
+
tsx: "^4.23.15",
|
|
74
|
+
"typescript-eslint": "^8.70.1",
|
|
75
|
+
vite: "^8.3.0",
|
|
76
|
+
vitest: "^5.0.1",
|
|
77
|
+
vue: "^3.5.43",
|
|
78
|
+
"vue-router": "^5.3.1",
|
|
79
|
+
"vue-tsc": "^3.3.11",
|
|
80
|
+
ws: "^8.21.3",
|
|
81
|
+
zustand: "^5.0.15",
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* TypeScript ranges, split by where the compiler runs.
|
|
85
|
+
*
|
|
86
|
+
* Backend templates only run `tsc` and `tsx`, so they get TypeScript 7.
|
|
87
|
+
* Frontend toolchains call the TypeScript 6 JavaScript API and declare it
|
|
88
|
+
* as a peer: `@angular/compiler-cli` and `@angular/build` need
|
|
89
|
+
* `>=6.0 <6.1`, `typescript-eslint` needs `<6.1.0`, and `@sveltejs/kit`,
|
|
90
|
+
* `svelte-check` and `@astrojs/check` need `^5 || ^6`. The frontend range is
|
|
91
|
+
* therefore a tilde range on 6.0 — do not raise it to 7 until those peer
|
|
92
|
+
* ranges admit it.
|
|
93
|
+
*/
|
|
94
|
+
export const TYPESCRIPT_VERSION_RANGES = Object.freeze({
|
|
95
|
+
backend: "^7.0.2",
|
|
96
|
+
frontend: "~6.0.3",
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Vitest range for Angular projects. `@angular/build:unit-test` declares
|
|
100
|
+
* `vitest` `^4.0.8` as a peer, so Angular cannot take the Vitest 5 range the
|
|
101
|
+
* other frameworks use.
|
|
102
|
+
*/
|
|
103
|
+
export const ANGULAR_VITEST_VERSION_RANGE = "^4.1.11";
|
|
104
|
+
/**
|
|
105
|
+
* Default ranges the dependency resolver applies to requirements that carry
|
|
106
|
+
* no version of their own.
|
|
107
|
+
*/
|
|
108
|
+
export const DEFAULT_DEPENDENCY_VERSIONS = new Map(Object.entries(DEPENDENCY_VERSION_RANGES));
|
|
40
109
|
//# sourceMappingURL=dependencyVersions.constant.js.map
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @module resolvers/dependency
|
|
5
5
|
*/
|
|
6
6
|
export { DependencyResolver, type DependencyResolutionResult, type ResolvedDependency, type DependencyConflict, } from "./dependencyResolver.core.js";
|
|
7
|
-
export { DEFAULT_DEPENDENCY_VERSIONS } from "./dependencyVersions.constant.js";
|
|
7
|
+
export { ANGULAR_VITEST_VERSION_RANGE, DEFAULT_DEPENDENCY_VERSIONS, DEPENDENCY_VERSION_RANGES, TYPESCRIPT_VERSION_RANGES, } from "./dependencyVersions.constant.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @module resolvers/dependency
|
|
5
5
|
*/
|
|
6
6
|
export { DependencyResolver, } from "./dependencyResolver.core.js";
|
|
7
|
-
export { DEFAULT_DEPENDENCY_VERSIONS } from "./dependencyVersions.constant.js";
|
|
7
|
+
export { ANGULAR_VITEST_VERSION_RANGE, DEFAULT_DEPENDENCY_VERSIONS, DEPENDENCY_VERSION_RANGES, TYPESCRIPT_VERSION_RANGES, } from "./dependencyVersions.constant.js";
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/** Options for {@link findProjectRoot}. */
|
|
2
|
+
export interface FindProjectRootOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Resolve an app inside a workspace to the workspace itself. Every
|
|
5
|
+
* microservice app and a fullstack `apps/api` carries a `zudojs` block in
|
|
6
|
+
* its own package.json, so the plain walk stops there and reports the app
|
|
7
|
+
* as a stand-alone monolith with no manifest. With this set, an ancestor
|
|
8
|
+
* holding `.zudojs/manifest.json` (or a legacy `zudojs.config.*`) wins.
|
|
9
|
+
* `add`, `doctor` and `info` describe the whole project and use it;
|
|
10
|
+
* `generate` and `build` keep working on the app they were run in.
|
|
11
|
+
*/
|
|
12
|
+
readonly workspace?: boolean;
|
|
13
|
+
}
|
|
1
14
|
/**
|
|
2
15
|
* Walks upward from `startDir` to the nearest directory that really is a
|
|
3
16
|
* Zudojs project — one `resolveProjectLayout` recognizes: a
|
|
@@ -9,6 +22,6 @@
|
|
|
9
22
|
* directory with no Zudojs project anywhere, `zudojs build` climbed to an
|
|
10
23
|
* unrelated ancestor `package.json` and ran its `scripts.build`.
|
|
11
24
|
*/
|
|
12
|
-
export declare function findProjectRoot(startDir?: string): string | null;
|
|
25
|
+
export declare function findProjectRoot(startDir?: string, options?: FindProjectRootOptions): string | null;
|
|
13
26
|
export declare function resolveProjectPath(cwd: string, name: string): string;
|
|
14
27
|
//# sourceMappingURL=project.resolver.d.ts.map
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
import { dirname, join } from "node:path";
|
|
2
3
|
import { resolveProjectLayout } from "./layout/projectLayout.core.js";
|
|
4
|
+
/** Whether `dir` holds the project's own record rather than an app's block. */
|
|
5
|
+
function holdsProjectRecord(dir) {
|
|
6
|
+
return ["zudojs.config.ts", "zudojs.config.js", join(".zudojs", "manifest.json")].some((name) => existsSync(join(dir, name)));
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Walks upward from `startDir` to the nearest directory that really is a
|
|
5
10
|
* Zudojs project — one `resolveProjectLayout` recognizes: a
|
|
@@ -11,15 +16,18 @@ import { resolveProjectLayout } from "./layout/projectLayout.core.js";
|
|
|
11
16
|
* directory with no Zudojs project anywhere, `zudojs build` climbed to an
|
|
12
17
|
* unrelated ancestor `package.json` and ran its `scripts.build`.
|
|
13
18
|
*/
|
|
14
|
-
export function findProjectRoot(startDir = process.cwd()) {
|
|
19
|
+
export function findProjectRoot(startDir = process.cwd(), options = {}) {
|
|
15
20
|
let dir = startDir;
|
|
21
|
+
let nearest = null;
|
|
16
22
|
while (true) {
|
|
17
23
|
if (resolveProjectLayout(dir) !== null) {
|
|
18
|
-
|
|
24
|
+
if (options.workspace !== true || holdsProjectRecord(dir))
|
|
25
|
+
return dir;
|
|
26
|
+
nearest ??= dir;
|
|
19
27
|
}
|
|
20
28
|
const parent = dirname(dir);
|
|
21
29
|
if (parent === dir) {
|
|
22
|
-
return
|
|
30
|
+
return nearest;
|
|
23
31
|
}
|
|
24
32
|
dir = parent;
|
|
25
33
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Utilities for invoking official framework scaffolders.
|
|
5
5
|
*/
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
6
8
|
import { execCommand } from "../utils/utils.exec.js";
|
|
7
9
|
import { writeFileTree } from "../utils/utils.fileSystem.js";
|
|
8
10
|
/**
|
|
@@ -35,12 +37,21 @@ export async function scaffoldWithFallback(options) {
|
|
|
35
37
|
env: { ...process.env, CI: "1" },
|
|
36
38
|
timeout: SCAFFOLD_TIMEOUT_MS,
|
|
37
39
|
});
|
|
38
|
-
return true;
|
|
39
40
|
}
|
|
40
41
|
catch (error) {
|
|
41
42
|
console.warn(`Warning: official scaffolder "${options.command} ${options.args.join(" ")}" ${describeFailure(error)}. Using built-in fallback template.`);
|
|
42
43
|
await writeFileTree(options.targetPath, options.fallbackFiles);
|
|
43
44
|
return false;
|
|
44
45
|
}
|
|
46
|
+
// Some scaffolders exit 0 without writing anything: `create-vite` prints
|
|
47
|
+
// "Operation cancelled" when the directory is not empty. Treat a missing
|
|
48
|
+
// package.json as a failure whenever the fallback would have written one.
|
|
49
|
+
if (options.fallbackFiles["package.json"] !== undefined &&
|
|
50
|
+
!existsSync(join(options.targetPath, "package.json"))) {
|
|
51
|
+
console.warn(`Warning: official scaffolder "${options.command} ${options.args.join(" ")}" exited without creating package.json. Using built-in fallback template.`);
|
|
52
|
+
await writeFileTree(options.targetPath, options.fallbackFiles);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
45
56
|
}
|
|
46
57
|
//# sourceMappingURL=scaffolder.helper.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — The source tree of one backend app.
|
|
3
|
+
*
|
|
4
|
+
* Monolith, modular monolith and every microservice app (gateway and
|
|
5
|
+
* services) share this layout, so `generate` and `add` work the same way
|
|
6
|
+
* in all of them:
|
|
7
|
+
*
|
|
8
|
+
* ```
|
|
9
|
+
* src/app.ts runtime assembly (modules + integrations)
|
|
10
|
+
* src/server.ts config → router → registerRoutes → HTTP server
|
|
11
|
+
* src/container.ts composition root (controllers, services, repositories)
|
|
12
|
+
* src/configs/index.ts typed configuration from the environment
|
|
13
|
+
* src/routes/index.ts registerRoutes(router, deps)
|
|
14
|
+
* src/routes/health.routes.ts
|
|
15
|
+
* src/integrations/ lifecycle-managed clients (zudojs add)
|
|
16
|
+
* src/utils/http.ts response and body helpers, security headers
|
|
17
|
+
* src/{dtos,repositories,services,controllers,routes}/examples.* example resource
|
|
18
|
+
* tests/examples.test.ts HTTP test through createHttpTestClient
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import { type RuntimeModuleSpec } from "../shared/index.js";
|
|
22
|
+
/** Options for {@link renderBackendAppSource}. */
|
|
23
|
+
export interface BackendAppOptions {
|
|
24
|
+
/** Runtime and logger name. */
|
|
25
|
+
readonly applicationName: string;
|
|
26
|
+
/** OpenAPI document title. */
|
|
27
|
+
readonly title: string;
|
|
28
|
+
readonly defaultPort: number;
|
|
29
|
+
/** Mount /openapi.json and /docs. */
|
|
30
|
+
readonly openapi: boolean;
|
|
31
|
+
/** Runtime modules registered in app.ts. */
|
|
32
|
+
readonly modules: readonly RuntimeModuleSpec[];
|
|
33
|
+
/** Modules whose `routes/index.ts` is generated and registered. */
|
|
34
|
+
readonly routedModules?: readonly string[];
|
|
35
|
+
/** Port recorded as runtime metadata (microservice apps). */
|
|
36
|
+
readonly port?: number;
|
|
37
|
+
}
|
|
38
|
+
/** The example resource every new app ships with. */
|
|
39
|
+
export declare const EXAMPLE_RESOURCE = "examples";
|
|
40
|
+
/**
|
|
41
|
+
* Renders the app's files, keyed by path relative to the app root. The
|
|
42
|
+
* caller adds package.json, tsconfig.json and the empty folder barrels.
|
|
43
|
+
*/
|
|
44
|
+
export declare function renderBackendAppSource(options: BackendAppOptions): Record<string, string>;
|
|
45
|
+
//# sourceMappingURL=backendApp.core.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — The source tree of one backend app.
|
|
3
|
+
*
|
|
4
|
+
* Monolith, modular monolith and every microservice app (gateway and
|
|
5
|
+
* services) share this layout, so `generate` and `add` work the same way
|
|
6
|
+
* in all of them:
|
|
7
|
+
*
|
|
8
|
+
* ```
|
|
9
|
+
* src/app.ts runtime assembly (modules + integrations)
|
|
10
|
+
* src/server.ts config → router → registerRoutes → HTTP server
|
|
11
|
+
* src/container.ts composition root (controllers, services, repositories)
|
|
12
|
+
* src/configs/index.ts typed configuration from the environment
|
|
13
|
+
* src/routes/index.ts registerRoutes(router, deps)
|
|
14
|
+
* src/routes/health.routes.ts
|
|
15
|
+
* src/integrations/ lifecycle-managed clients (zudojs add)
|
|
16
|
+
* src/utils/http.ts response and body helpers, security headers
|
|
17
|
+
* src/{dtos,repositories,services,controllers,routes}/examples.* example resource
|
|
18
|
+
* tests/examples.test.ts HTTP test through createHttpTestClient
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import { renderAppFile, renderServerFile, } from "../shared/index.js";
|
|
22
|
+
import { renderResourceLayers, resourceNames, resourceWiring, RESOURCE_LAYERS, } from "../resource/index.js";
|
|
23
|
+
import { baseEnvVariables, renderConfigFile, renderContainer, renderEnvVariables, renderHealthRoutes, renderHttpUtils, renderIntegrationContract, renderIntegrationsIndex, renderModuleRoutesIndex, renderRoutesIndex, } from "./parts/index.js";
|
|
24
|
+
import { moduleRoutesWiring } from "./backendApp.modules.js";
|
|
25
|
+
/** The example resource every new app ships with. */
|
|
26
|
+
export const EXAMPLE_RESOURCE = "examples";
|
|
27
|
+
/**
|
|
28
|
+
* Renders the app's files, keyed by path relative to the app root. The
|
|
29
|
+
* caller adds package.json, tsconfig.json and the empty folder barrels.
|
|
30
|
+
*/
|
|
31
|
+
export function renderBackendAppSource(options) {
|
|
32
|
+
const names = resourceNames(EXAMPLE_RESOURCE);
|
|
33
|
+
const layout = { base: "src", appSrc: "src", appRoot: "", prisma: false };
|
|
34
|
+
const example = resourceWiring(names, layout);
|
|
35
|
+
const modules = (options.routedModules ?? []).map(moduleRoutesWiring);
|
|
36
|
+
const files = {
|
|
37
|
+
"src/index.ts": `export { createApp } from "./app.js";\n`,
|
|
38
|
+
"src/app.ts": renderAppFile({
|
|
39
|
+
applicationName: options.applicationName,
|
|
40
|
+
modules: options.modules,
|
|
41
|
+
...(options.port === undefined ? {} : { port: options.port }),
|
|
42
|
+
}),
|
|
43
|
+
"src/server.ts": renderServerFile({ title: options.title, openapi: options.openapi }),
|
|
44
|
+
"src/configs/index.ts": renderConfigFile({ defaultPort: options.defaultPort, sections: [] }),
|
|
45
|
+
"src/container.ts": renderContainer({
|
|
46
|
+
imports: example.containerImports,
|
|
47
|
+
entries: [example.containerEntry],
|
|
48
|
+
}),
|
|
49
|
+
"src/routes/index.ts": renderRoutesIndex({
|
|
50
|
+
imports: [example.routeImport, ...modules.map((m) => m.importLine)],
|
|
51
|
+
entries: [example.routeEntry, ...modules.map((m) => m.entryLine)],
|
|
52
|
+
}),
|
|
53
|
+
"src/routes/health.routes.ts": renderHealthRoutes(),
|
|
54
|
+
"src/integrations/index.ts": renderIntegrationsIndex({ imports: [], entries: [] }),
|
|
55
|
+
"src/integrations/integration.ts": renderIntegrationContract(),
|
|
56
|
+
"src/utils/http.ts": renderHttpUtils(),
|
|
57
|
+
"src/utils/index.ts": `export * from "./http.js";\n`,
|
|
58
|
+
".env.example": `${renderEnvVariables(baseEnvVariables(options.defaultPort))}\n`,
|
|
59
|
+
...renderResourceLayers(names, layout, RESOURCE_LAYERS),
|
|
60
|
+
};
|
|
61
|
+
for (const module of modules) {
|
|
62
|
+
files[module.indexPath] = renderModuleRoutesIndex(module.functionName, "../../../container.js");
|
|
63
|
+
}
|
|
64
|
+
return files;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=backendApp.core.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — How a module's routes are registered with its app.
|
|
3
|
+
*
|
|
4
|
+
* A module `billing` owns `src/modules/billing/routes/index.ts`, which
|
|
5
|
+
* exports `registerBillingModuleRoutes(router, deps)`. The app's
|
|
6
|
+
* `src/routes/index.ts` imports and calls it between its markers.
|
|
7
|
+
*
|
|
8
|
+
* The `Module` infix keeps it apart from a resource's
|
|
9
|
+
* `registerBillingRoutes`: both used to be imported into the same
|
|
10
|
+
* `src/routes/index.ts` after `generate module billing` and
|
|
11
|
+
* `generate route billing`, and the app failed on the duplicate identifier.
|
|
12
|
+
*/
|
|
13
|
+
/** The registration of one module's routes. */
|
|
14
|
+
export interface ModuleRoutesWiring {
|
|
15
|
+
readonly module: string;
|
|
16
|
+
readonly functionName: string;
|
|
17
|
+
/** The module's routes index, relative to the app root. */
|
|
18
|
+
readonly indexPath: string;
|
|
19
|
+
/** Import line for the app's src/routes/index.ts. */
|
|
20
|
+
readonly importLine: string;
|
|
21
|
+
/** Call for the app's src/routes/index.ts. */
|
|
22
|
+
readonly entryLine: string;
|
|
23
|
+
}
|
|
24
|
+
/** Describes the routes wiring of module `name`. */
|
|
25
|
+
export declare function moduleRoutesWiring(name: string): ModuleRoutesWiring;
|
|
26
|
+
//# sourceMappingURL=backendApp.modules.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — How a module's routes are registered with its app.
|
|
3
|
+
*
|
|
4
|
+
* A module `billing` owns `src/modules/billing/routes/index.ts`, which
|
|
5
|
+
* exports `registerBillingModuleRoutes(router, deps)`. The app's
|
|
6
|
+
* `src/routes/index.ts` imports and calls it between its markers.
|
|
7
|
+
*
|
|
8
|
+
* The `Module` infix keeps it apart from a resource's
|
|
9
|
+
* `registerBillingRoutes`: both used to be imported into the same
|
|
10
|
+
* `src/routes/index.ts` after `generate module billing` and
|
|
11
|
+
* `generate route billing`, and the app failed on the duplicate identifier.
|
|
12
|
+
*/
|
|
13
|
+
import { toPascalCase } from "../../utils/utils.name.js";
|
|
14
|
+
/** Describes the routes wiring of module `name`. */
|
|
15
|
+
export function moduleRoutesWiring(name) {
|
|
16
|
+
const functionName = `register${toPascalCase(name)}ModuleRoutes`;
|
|
17
|
+
return {
|
|
18
|
+
module: name,
|
|
19
|
+
functionName,
|
|
20
|
+
indexPath: `src/modules/${name}/routes/index.ts`,
|
|
21
|
+
importLine: `import { ${functionName} } from "../modules/${name}/routes/index.js";`,
|
|
22
|
+
entryLine: `${functionName}(router, deps);`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=backendApp.modules.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Project files shared by every backend architecture:
|
|
3
|
+
* dependency lists, dev tooling, tsconfig, folder barrels and the database
|
|
4
|
+
* setting every app records.
|
|
5
|
+
*/
|
|
6
|
+
/** `@zudojs/*` packages the shared app source imports. */
|
|
7
|
+
export declare const APP_SOURCE_DEPENDENCIES: readonly string[];
|
|
8
|
+
/** `@zudojs/*` packages the generated tests import. */
|
|
9
|
+
export declare const APP_TEST_DEPENDENCIES: readonly string[];
|
|
10
|
+
/** Third-party dev tooling of a backend app. */
|
|
11
|
+
export declare function backendDevDependencies(): Record<string, string>;
|
|
12
|
+
/** tsconfig.json of a backend app (tests are compiled by Vitest, not tsc). */
|
|
13
|
+
export declare function backendTsconfig(): string;
|
|
14
|
+
/** `src/<folder>/index.ts` barrels for {@link APP_FOLDERS}. */
|
|
15
|
+
export declare function emptyBarrels(): Record<string, string>;
|
|
16
|
+
/** The config entry for the database URL. */
|
|
17
|
+
export declare const DATABASE_CONFIG_SECTION = "database: Object.freeze({ url: text(config, \"database_url\", \"\") }),";
|
|
18
|
+
/**
|
|
19
|
+
* Records the project's database URL: in `.env.example` (`envLines`, e.g.
|
|
20
|
+
* `DATABASE_URL=postgresql://localhost:5432/shop`) and as the `database`
|
|
21
|
+
* section of `src/configs/index.ts`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function applyDatabaseSetting(files: Record<string, string>, envLines: string): Record<string, string>;
|
|
24
|
+
/** `<pm> run <script>` for a package manager. */
|
|
25
|
+
export declare function runCommand(packageManager: string, script: string): string;
|
|
26
|
+
//# sourceMappingURL=backendApp.project.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Project files shared by every backend architecture:
|
|
3
|
+
* dependency lists, dev tooling, tsconfig, folder barrels and the database
|
|
4
|
+
* setting every app records.
|
|
5
|
+
*/
|
|
6
|
+
import { DEPENDENCY_VERSION_RANGES, TYPESCRIPT_VERSION_RANGES, } from "../../resolvers/dependency/dependencyVersions.constant.js";
|
|
7
|
+
import { MARKERS, insertBetweenMarkers } from "../../wiring/index.js";
|
|
8
|
+
/** `@zudojs/*` packages the shared app source imports. */
|
|
9
|
+
export const APP_SOURCE_DEPENDENCIES = [
|
|
10
|
+
"@zudojs/config",
|
|
11
|
+
"@zudojs/errors",
|
|
12
|
+
"@zudojs/http",
|
|
13
|
+
"@zudojs/schema",
|
|
14
|
+
"@zudojs/security",
|
|
15
|
+
];
|
|
16
|
+
/** `@zudojs/*` packages the generated tests import. */
|
|
17
|
+
export const APP_TEST_DEPENDENCIES = ["@zudojs/testing"];
|
|
18
|
+
/** Third-party dev tooling of a backend app. */
|
|
19
|
+
export function backendDevDependencies() {
|
|
20
|
+
return {
|
|
21
|
+
tsx: DEPENDENCY_VERSION_RANGES.tsx,
|
|
22
|
+
typescript: TYPESCRIPT_VERSION_RANGES.backend,
|
|
23
|
+
"@types/node": DEPENDENCY_VERSION_RANGES["@types/node"],
|
|
24
|
+
vitest: DEPENDENCY_VERSION_RANGES.vitest,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** tsconfig.json of a backend app (tests are compiled by Vitest, not tsc). */
|
|
28
|
+
export function backendTsconfig() {
|
|
29
|
+
return `{
|
|
30
|
+
"compilerOptions": {
|
|
31
|
+
"target": "ES2024",
|
|
32
|
+
"module": "Node16",
|
|
33
|
+
"moduleResolution": "Node16",
|
|
34
|
+
"outDir": "dist",
|
|
35
|
+
"rootDir": "src",
|
|
36
|
+
"strict": true,
|
|
37
|
+
"skipLibCheck": true,
|
|
38
|
+
"esModuleInterop": true,
|
|
39
|
+
"resolveJsonModule": true,
|
|
40
|
+
"lib": ["ES2024"],
|
|
41
|
+
"types": ["node"]
|
|
42
|
+
},
|
|
43
|
+
"include": ["src/**/*"],
|
|
44
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
/** Folders every app has, each with an (initially empty) barrel. */
|
|
49
|
+
const APP_FOLDERS = [
|
|
50
|
+
"constants", "controllers", "databases", "dtos", "enums", "errors", "events",
|
|
51
|
+
"interfaces", "jobs", "loaders", "loggers", "middlewares", "models",
|
|
52
|
+
"repositories", "services", "types", "validators",
|
|
53
|
+
];
|
|
54
|
+
/** `src/<folder>/index.ts` barrels for {@link APP_FOLDERS}. */
|
|
55
|
+
export function emptyBarrels() {
|
|
56
|
+
return Object.fromEntries(APP_FOLDERS.map((dir) => [`src/${dir}/index.ts`, ""]));
|
|
57
|
+
}
|
|
58
|
+
/** The config entry for the database URL. */
|
|
59
|
+
export const DATABASE_CONFIG_SECTION = `database: Object.freeze({ url: text(config, "database_url", "") }),`;
|
|
60
|
+
/**
|
|
61
|
+
* Records the project's database URL: in `.env.example` (`envLines`, e.g.
|
|
62
|
+
* `DATABASE_URL=postgresql://localhost:5432/shop`) and as the `database`
|
|
63
|
+
* section of `src/configs/index.ts`.
|
|
64
|
+
*/
|
|
65
|
+
export function applyDatabaseSetting(files, envLines) {
|
|
66
|
+
const config = files["src/configs/index.ts"];
|
|
67
|
+
if (config !== undefined) {
|
|
68
|
+
files["src/configs/index.ts"] = insertBetweenMarkers(config, MARKERS.config, DATABASE_CONFIG_SECTION).source;
|
|
69
|
+
}
|
|
70
|
+
const env = files[".env.example"] ?? "";
|
|
71
|
+
files[".env.example"] = `${env}${envLines}\n`;
|
|
72
|
+
return files;
|
|
73
|
+
}
|
|
74
|
+
/** `<pm> run <script>` for a package manager. */
|
|
75
|
+
export function runCommand(packageManager, script) {
|
|
76
|
+
switch (packageManager) {
|
|
77
|
+
case "npm":
|
|
78
|
+
return `npm run ${script}`;
|
|
79
|
+
case "yarn":
|
|
80
|
+
return `yarn ${script}`;
|
|
81
|
+
case "bun":
|
|
82
|
+
return `bun run ${script}`;
|
|
83
|
+
default:
|
|
84
|
+
return `pnpm run ${script}`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=backendApp.project.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Backend app source tree shared by every architecture.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./backendApp.core.js";
|
|
5
|
+
export * from "./backendApp.modules.js";
|
|
6
|
+
export * from "./backendApp.project.js";
|
|
7
|
+
export * from "./parts/index.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Backend app source tree shared by every architecture.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./backendApp.core.js";
|
|
5
|
+
export * from "./backendApp.modules.js";
|
|
6
|
+
export * from "./backendApp.project.js";
|
|
7
|
+
export * from "./parts/index.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Generated `src/configs/index.ts` and `.env.example`.
|
|
3
|
+
*
|
|
4
|
+
* Configuration is read from the environment through @zudojs/config and
|
|
5
|
+
* returned as one frozen, typed object. `zudojs add <feature>` inserts that
|
|
6
|
+
* feature's section between the `config` markers and its variables into
|
|
7
|
+
* `.env.example`, so the two stay in sync.
|
|
8
|
+
*/
|
|
9
|
+
/** One environment variable documented in `.env.example`. */
|
|
10
|
+
export interface EnvVariable {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly value: string;
|
|
13
|
+
readonly comment?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Variables every generated app reads. */
|
|
16
|
+
export declare function baseEnvVariables(port: number): readonly EnvVariable[];
|
|
17
|
+
/** Renders `.env.example` lines for `variables`. */
|
|
18
|
+
export declare function renderEnvVariables(variables: readonly EnvVariable[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Renders `src/configs/index.ts`. `sections` are single-line object entries
|
|
21
|
+
* (for example `redis: Object.freeze({ url: text(config, "redis_url", "...") }),`)
|
|
22
|
+
* placed between the config markers.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderConfigFile(options: {
|
|
25
|
+
readonly defaultPort: number;
|
|
26
|
+
readonly sections: readonly string[];
|
|
27
|
+
}): string;
|
|
28
|
+
//# sourceMappingURL=config.template.d.ts.map
|