zudojs-cli 2.0.1 → 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.
Files changed (248) hide show
  1. package/README.md +59 -7
  2. package/dist/src/adapters/frontend/angular.adapter.d.ts +0 -1
  3. package/dist/src/adapters/frontend/angular.adapter.js +14 -97
  4. package/dist/src/adapters/frontend/astro.adapter.d.ts +0 -1
  5. package/dist/src/adapters/frontend/astro.adapter.js +4 -64
  6. package/dist/src/adapters/frontend/fallback/fallback.helper.d.ts +41 -0
  7. package/dist/src/adapters/frontend/fallback/fallback.helper.js +57 -0
  8. package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.d.ts +18 -0
  9. package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.js +107 -0
  10. package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.d.ts +23 -0
  11. package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.js +125 -0
  12. package/dist/src/adapters/frontend/fallback/framework/angular/index.d.ts +8 -0
  13. package/dist/src/adapters/frontend/fallback/framework/angular/index.js +8 -0
  14. package/dist/src/adapters/frontend/fallback/framework/astro.fallback.d.ts +14 -0
  15. package/dist/src/adapters/frontend/fallback/framework/astro.fallback.js +76 -0
  16. package/dist/src/adapters/frontend/fallback/framework/index.d.ts +13 -0
  17. package/dist/src/adapters/frontend/fallback/framework/index.js +13 -0
  18. package/dist/src/adapters/frontend/fallback/framework/next.fallback.d.ts +13 -0
  19. package/dist/src/adapters/frontend/fallback/framework/next.fallback.js +105 -0
  20. package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.d.ts +14 -0
  21. package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.js +56 -0
  22. package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.d.ts +15 -0
  23. package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.js +94 -0
  24. package/dist/src/adapters/frontend/fallback/index.d.ts +12 -0
  25. package/dist/src/adapters/frontend/fallback/index.js +12 -0
  26. package/dist/src/adapters/frontend/fallback/vite/index.d.ts +11 -0
  27. package/dist/src/adapters/frontend/fallback/vite/index.js +11 -0
  28. package/dist/src/adapters/frontend/fallback/vite/react.fallback.d.ts +13 -0
  29. package/dist/src/adapters/frontend/fallback/vite/react.fallback.js +77 -0
  30. package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.d.ts +14 -0
  31. package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.js +95 -0
  32. package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.d.ts +13 -0
  33. package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.js +71 -0
  34. package/dist/src/adapters/frontend/fallback/vite/vue.fallback.d.ts +14 -0
  35. package/dist/src/adapters/frontend/fallback/vite/vue.fallback.js +78 -0
  36. package/dist/src/adapters/frontend/next.adapter.d.ts +0 -1
  37. package/dist/src/adapters/frontend/next.adapter.js +16 -95
  38. package/dist/src/adapters/frontend/nuxt.adapter.d.ts +1 -2
  39. package/dist/src/adapters/frontend/nuxt.adapter.js +32 -43
  40. package/dist/src/adapters/frontend/react-native.adapter.js +1 -1
  41. package/dist/src/adapters/frontend/react.adapter.d.ts +0 -1
  42. package/dist/src/adapters/frontend/react.adapter.js +7 -89
  43. package/dist/src/adapters/frontend/svelte.adapter.d.ts +0 -1
  44. package/dist/src/adapters/frontend/svelte.adapter.js +4 -86
  45. package/dist/src/adapters/frontend/sveltekit.adapter.d.ts +0 -1
  46. package/dist/src/adapters/frontend/sveltekit.adapter.js +4 -57
  47. package/dist/src/adapters/frontend/vanilla.adapter.d.ts +0 -1
  48. package/dist/src/adapters/frontend/vanilla.adapter.js +4 -47
  49. package/dist/src/adapters/frontend/vue.adapter.d.ts +0 -1
  50. package/dist/src/adapters/frontend/vue.adapter.js +4 -76
  51. package/dist/src/bin/bin.menu.d.ts +22 -0
  52. package/dist/src/bin/bin.menu.js +40 -0
  53. package/dist/src/bin/bin.runner.d.ts +38 -0
  54. package/dist/src/bin/bin.runner.js +51 -0
  55. package/dist/src/bin/index.d.ts +9 -0
  56. package/dist/src/bin/index.js +9 -0
  57. package/dist/src/bin/zudojs.js +15 -4
  58. package/dist/src/cliApplication/cliApplication.core.d.ts +4 -2
  59. package/dist/src/cliApplication/cliApplication.core.js +48 -36
  60. package/dist/src/cliApplication/cliApplication.logger.d.ts +5 -0
  61. package/dist/src/cliApplication/cliApplication.logger.js +5 -3
  62. package/dist/src/cliApplication/invocation/index.d.ts +12 -0
  63. package/dist/src/cliApplication/invocation/index.js +12 -0
  64. package/dist/src/cliApplication/invocation/invocation.hint.d.ts +30 -0
  65. package/dist/src/cliApplication/invocation/invocation.hint.js +74 -0
  66. package/dist/src/cliApplication/invocation/invocation.locate.d.ts +34 -0
  67. package/dist/src/cliApplication/invocation/invocation.locate.js +53 -0
  68. package/dist/src/cliApplication/invocation/invocation.name.d.ts +37 -0
  69. package/dist/src/cliApplication/invocation/invocation.name.js +69 -0
  70. package/dist/src/cliApplication/invocation/invocation.sanitize.d.ts +19 -0
  71. package/dist/src/cliApplication/invocation/invocation.sanitize.js +32 -0
  72. package/dist/src/cliParser/cliParser.core.js +3 -1
  73. package/dist/src/cliParser/cliParser.helper.d.ts +7 -0
  74. package/dist/src/cliParser/cliParser.helper.js +19 -2
  75. package/dist/src/cliParser/cliParser.longOption.js +2 -2
  76. package/dist/src/commands/add.command.d.ts +7 -3
  77. package/dist/src/commands/add.command.js +96 -57
  78. package/dist/src/commands/create.command.js +29 -42
  79. package/dist/src/commands/doctor.command.d.ts +2 -1
  80. package/dist/src/commands/doctor.command.js +52 -4
  81. package/dist/src/commands/generate.command.js +31 -16
  82. package/dist/src/commands/info.command.js +11 -1
  83. package/dist/src/constants/index.d.ts +21 -3
  84. package/dist/src/constants/index.js +40 -5
  85. package/dist/src/constants/zudojsVersions.generated.d.ts +9 -0
  86. package/dist/src/constants/zudojsVersions.generated.js +48 -0
  87. package/dist/src/constants/zudojsVersions.helper.d.ts +21 -0
  88. package/dist/src/constants/zudojsVersions.helper.js +29 -0
  89. package/dist/src/generators/frontend/frontendGenerator.core.js +9 -10
  90. package/dist/src/generators/frontend/frontendPipeline.d.ts +6 -1
  91. package/dist/src/generators/frontend/frontendPipeline.js +9 -1
  92. package/dist/src/generators/fullstack/fullstackComposer.core.js +7 -1
  93. package/dist/src/generators/index.d.ts +1 -2
  94. package/dist/src/generators/index.js +1 -2
  95. package/dist/src/generators/infrastructure/infrastructure.generator.js +13 -5
  96. package/dist/src/generators/integration/integrationGenerator.core.d.ts +2 -0
  97. package/dist/src/generators/integration/integrationGenerator.core.js +31 -2
  98. package/dist/src/generators/module/module.generator.js +36 -4
  99. package/dist/src/generators/resource/index.d.ts +8 -0
  100. package/dist/src/generators/resource/index.js +8 -0
  101. package/dist/src/generators/resource/resource.generator.d.ts +27 -0
  102. package/dist/src/generators/resource/resource.generator.js +87 -0
  103. package/dist/src/generators/resource/resource.layout.d.ts +26 -0
  104. package/dist/src/generators/resource/resource.layout.js +46 -0
  105. package/dist/src/generators/resource/resource.plan.d.ts +27 -0
  106. package/dist/src/generators/resource/resource.plan.js +46 -0
  107. package/dist/src/generators/resource/resource.run.d.ts +25 -0
  108. package/dist/src/generators/resource/resource.run.js +52 -0
  109. package/dist/src/prompts/cancel.prompt.d.ts +5 -1
  110. package/dist/src/prompts/cancel.prompt.js +4 -0
  111. package/dist/src/prompts/menu/index.d.ts +13 -0
  112. package/dist/src/prompts/menu/index.js +13 -0
  113. package/dist/src/prompts/menu/menu.adapter.d.ts +16 -0
  114. package/dist/src/prompts/menu/menu.adapter.js +56 -0
  115. package/dist/src/prompts/menu/menu.constant.d.ts +20 -0
  116. package/dist/src/prompts/menu/menu.constant.js +29 -0
  117. package/dist/src/prompts/menu/menu.flow.d.ts +18 -0
  118. package/dist/src/prompts/menu/menu.flow.js +82 -0
  119. package/dist/src/prompts/menu/menu.select.d.ts +26 -0
  120. package/dist/src/prompts/menu/menu.select.js +118 -0
  121. package/dist/src/prompts/menu/menu.type.d.ts +66 -0
  122. package/dist/src/prompts/menu/menu.type.js +8 -0
  123. package/dist/src/recipes/apply/index.d.ts +9 -0
  124. package/dist/src/recipes/apply/index.js +9 -0
  125. package/dist/src/recipes/apply/recipeApply.app.d.ts +20 -0
  126. package/dist/src/recipes/apply/recipeApply.app.js +79 -0
  127. package/dist/src/recipes/apply/recipeApply.context.d.ts +14 -0
  128. package/dist/src/recipes/apply/recipeApply.context.js +76 -0
  129. package/dist/src/recipes/apply/recipeApply.files.d.ts +39 -0
  130. package/dist/src/recipes/apply/recipeApply.files.js +84 -0
  131. package/dist/src/recipes/apply/recipeApply.project.d.ts +11 -0
  132. package/dist/src/recipes/apply/recipeApply.project.js +50 -0
  133. package/dist/src/recipes/apply/recipeApply.report.d.ts +20 -0
  134. package/dist/src/recipes/apply/recipeApply.report.js +51 -0
  135. package/dist/src/recipes/catalog/database/database.files.d.ts +15 -0
  136. package/dist/src/recipes/catalog/database/database.files.js +98 -0
  137. package/dist/src/recipes/catalog/database/database.recipe.d.ts +9 -0
  138. package/dist/src/recipes/catalog/database/database.recipe.js +50 -0
  139. package/dist/src/recipes/catalog/database/index.d.ts +6 -0
  140. package/dist/src/recipes/catalog/database/index.js +6 -0
  141. package/dist/src/recipes/catalog/email.recipe.d.ts +9 -0
  142. package/dist/src/recipes/catalog/email.recipe.js +122 -0
  143. package/dist/src/recipes/catalog/index.d.ts +11 -0
  144. package/dist/src/recipes/catalog/index.js +11 -0
  145. package/dist/src/recipes/catalog/openapi.recipe.d.ts +8 -0
  146. package/dist/src/recipes/catalog/openapi.recipe.js +25 -0
  147. package/dist/src/recipes/catalog/platform/cache.recipe.d.ts +7 -0
  148. package/dist/src/recipes/catalog/platform/cache.recipe.js +55 -0
  149. package/dist/src/recipes/catalog/platform/index.d.ts +9 -0
  150. package/dist/src/recipes/catalog/platform/index.js +9 -0
  151. package/dist/src/recipes/catalog/platform/messaging.recipe.d.ts +7 -0
  152. package/dist/src/recipes/catalog/platform/messaging.recipe.js +46 -0
  153. package/dist/src/recipes/catalog/platform/observability.recipe.d.ts +8 -0
  154. package/dist/src/recipes/catalog/platform/observability.recipe.js +49 -0
  155. package/dist/src/recipes/catalog/platform/queue.recipe.d.ts +7 -0
  156. package/dist/src/recipes/catalog/platform/queue.recipe.js +61 -0
  157. package/dist/src/recipes/catalog/platform/scheduler.recipe.d.ts +7 -0
  158. package/dist/src/recipes/catalog/platform/scheduler.recipe.js +56 -0
  159. package/dist/src/recipes/catalog/redis.recipe.d.ts +8 -0
  160. package/dist/src/recipes/catalog/redis.recipe.js +79 -0
  161. package/dist/src/recipes/catalog/storage.recipe.d.ts +7 -0
  162. package/dist/src/recipes/catalog/storage.recipe.js +49 -0
  163. package/dist/src/recipes/catalog/websockets.recipe.d.ts +10 -0
  164. package/dist/src/recipes/catalog/websockets.recipe.js +84 -0
  165. package/dist/src/recipes/docker/docker.compose.d.ts +19 -0
  166. package/dist/src/recipes/docker/docker.compose.js +90 -0
  167. package/dist/src/recipes/docker/docker.recipe.d.ts +10 -0
  168. package/dist/src/recipes/docker/docker.recipe.js +51 -0
  169. package/dist/src/recipes/docker/docker.refresh.d.ts +13 -0
  170. package/dist/src/recipes/docker/docker.refresh.js +37 -0
  171. package/dist/src/recipes/docker/index.d.ts +7 -0
  172. package/dist/src/recipes/docker/index.js +7 -0
  173. package/dist/src/recipes/index.d.ts +8 -0
  174. package/dist/src/recipes/index.js +8 -0
  175. package/dist/src/recipes/recipe.registry.d.ts +17 -0
  176. package/dist/src/recipes/recipe.registry.js +46 -0
  177. package/dist/src/recipes/recipe.type.d.ts +93 -0
  178. package/dist/src/recipes/recipe.type.js +12 -0
  179. package/dist/src/resolvers/dependency/dependencyVersions.constant.d.ts +100 -5
  180. package/dist/src/resolvers/dependency/dependencyVersions.constant.js +103 -34
  181. package/dist/src/resolvers/dependency/index.d.ts +1 -1
  182. package/dist/src/resolvers/dependency/index.js +1 -1
  183. package/dist/src/resolvers/project.resolver.d.ts +14 -1
  184. package/dist/src/resolvers/project.resolver.js +11 -3
  185. package/dist/src/scaffolders/scaffolder.helper.js +12 -1
  186. package/dist/src/templates/backendApp/backendApp.core.d.ts +45 -0
  187. package/dist/src/templates/backendApp/backendApp.core.js +66 -0
  188. package/dist/src/templates/backendApp/backendApp.modules.d.ts +26 -0
  189. package/dist/src/templates/backendApp/backendApp.modules.js +25 -0
  190. package/dist/src/templates/backendApp/backendApp.project.d.ts +26 -0
  191. package/dist/src/templates/backendApp/backendApp.project.js +87 -0
  192. package/dist/src/templates/backendApp/index.d.ts +8 -0
  193. package/dist/src/templates/backendApp/index.js +8 -0
  194. package/dist/src/templates/backendApp/parts/config.template.d.ts +28 -0
  195. package/dist/src/templates/backendApp/parts/config.template.js +118 -0
  196. package/dist/src/templates/backendApp/parts/httpUtils.template.d.ts +10 -0
  197. package/dist/src/templates/backendApp/parts/httpUtils.template.js +103 -0
  198. package/dist/src/templates/backendApp/parts/index.d.ts +9 -0
  199. package/dist/src/templates/backendApp/parts/index.js +9 -0
  200. package/dist/src/templates/backendApp/parts/integrations.template.d.ts +16 -0
  201. package/dist/src/templates/backendApp/parts/integrations.template.js +115 -0
  202. package/dist/src/templates/backendApp/parts/wiring.template.d.ts +26 -0
  203. package/dist/src/templates/backendApp/parts/wiring.template.js +111 -0
  204. package/dist/src/templates/microservice/microservice.template.js +61 -87
  205. package/dist/src/templates/modular-monolith/modularMonolith.template.js +25 -77
  206. package/dist/src/templates/monolith/monolith.template.d.ts +11 -26
  207. package/dist/src/templates/monolith/monolith.template.js +49 -146
  208. package/dist/src/templates/resource/index.d.ts +9 -0
  209. package/dist/src/templates/resource/index.js +9 -0
  210. package/dist/src/templates/resource/layers/index.d.ts +9 -0
  211. package/dist/src/templates/resource/layers/index.js +9 -0
  212. package/dist/src/templates/resource/layers/resourceData.template.d.ts +9 -0
  213. package/dist/src/templates/resource/layers/resourceData.template.js +108 -0
  214. package/dist/src/templates/resource/layers/resourcePrisma.template.d.ts +15 -0
  215. package/dist/src/templates/resource/layers/resourcePrisma.template.js +89 -0
  216. package/dist/src/templates/resource/layers/resourceRoutes.template.d.ts +13 -0
  217. package/dist/src/templates/resource/layers/resourceRoutes.template.js +128 -0
  218. package/dist/src/templates/resource/layers/resourceService.template.d.ts +13 -0
  219. package/dist/src/templates/resource/layers/resourceService.template.js +95 -0
  220. package/dist/src/templates/resource/resource.files.d.ts +33 -0
  221. package/dist/src/templates/resource/resource.files.js +99 -0
  222. package/dist/src/templates/resource/resource.names.d.ts +38 -0
  223. package/dist/src/templates/resource/resource.names.js +60 -0
  224. package/dist/src/templates/resource/resource.type.d.ts +19 -0
  225. package/dist/src/templates/resource/resource.type.js +15 -0
  226. package/dist/src/templates/shared/appRuntime.template.js +28 -11
  227. package/dist/src/templates/shared/capability.template.d.ts +13 -4
  228. package/dist/src/templates/shared/capability.template.js +21 -5
  229. package/dist/src/templates/shared/dockerfile.template.d.ts +12 -4
  230. package/dist/src/templates/shared/dockerfile.template.js +68 -29
  231. package/dist/src/templates/shared/pnpm.template.d.ts +8 -2
  232. package/dist/src/templates/shared/pnpm.template.js +9 -1
  233. package/dist/src/templates/shared/server.template.d.ts +23 -22
  234. package/dist/src/templates/shared/server.template.js +79 -53
  235. package/dist/src/types/scaffold.type.d.ts +6 -0
  236. package/dist/src/types/scaffold.type.js +2 -1
  237. package/dist/src/utils/utils.name.js +6 -0
  238. package/dist/src/utils/utils.writeGuard.d.ts +5 -0
  239. package/dist/src/utils/utils.writeGuard.js +23 -0
  240. package/dist/src/wiring/index.d.ts +10 -0
  241. package/dist/src/wiring/index.js +10 -0
  242. package/dist/src/wiring/wiring.dependencies.d.ts +29 -0
  243. package/dist/src/wiring/wiring.dependencies.js +83 -0
  244. package/dist/src/wiring/wiring.edits.d.ts +51 -0
  245. package/dist/src/wiring/wiring.edits.js +90 -0
  246. package/dist/src/wiring/wiring.markers.d.ts +53 -0
  247. package/dist/src/wiring/wiring.markers.js +87 -0
  248. package/package.json +20 -15
package/README.md CHANGED
@@ -13,9 +13,14 @@ Command-line interface for scaffolding, generating, and managing Zudojs framewor
13
13
  ### First time
14
14
 
15
15
  ```bash
16
- npm install -g zudojs-cli
16
+ npm install -g zudojs # or: npm install -g zudojs-cli
17
17
  ```
18
18
 
19
+ Both packages install the same CLI under two names, `zudojs` and the short
20
+ alias `zudo`; use whichever you prefer. `zudojs` is a thin wrapper that runs
21
+ `zudojs-cli`, so the two can never disagree. Help, usage lines and error
22
+ messages repeat the name you typed (`zudo create …` or `zudojs create …`).
23
+
19
24
  ### Upgrading from an old version?
20
25
 
21
26
  If `zudojs -v` doesn't match the latest npm version, clear the cache:
@@ -40,8 +45,8 @@ npm install -g zudojs-cli@latest
40
45
  ## Quick Start
41
46
 
42
47
  ```bash
43
- # Create a new backend project
44
- zudojs create my-api
48
+ # Create a new backend project (`new` is an alias of `create`)
49
+ zudo new my-api
45
50
 
46
51
  # Create a frontend project
47
52
  zudojs create my-web --type frontend --frontend react
@@ -65,6 +70,53 @@ zudojs build
65
70
  `zudojs build` and `zudojs doctor` exit with a non-zero status when they fail,
66
71
  so they can be used as CI gates.
67
72
 
73
+ ### Interactive menu
74
+
75
+ Run `zudo` (or `zudojs`) with no arguments in a terminal to get a numbered
76
+ menu:
77
+
78
+ ```text
79
+ ◆ What would you like to do?
80
+ │ ● 1. Create a new project
81
+ │ ○ 2. Start dev server
82
+ │ ○ 3. Generate code
83
+ │ ○ 4. Add a feature
84
+ │ ○ 5. Build
85
+ │ ○ 6. Doctor
86
+ │ ○ 7. Info
87
+ │ ○ 8. Help
88
+ │ ○ 0. Exit
89
+ └ ↑/↓ move · 0-8 pick · Enter select · Esc exit
90
+ ```
91
+
92
+ Press a digit to pick an entry at once, or move with ↑/↓ and press Enter.
93
+ The entry runs the ordinary command and asks for anything it needs:
94
+ "Create" runs the usual `create` prompts, "Generate code" asks for the
95
+ schematic and name, and "Add a feature" asks which feature. "Start dev
96
+ server", "Generate code", "Add a feature" and "Build" need a Zudojs project;
97
+ outside one, the menu says so and shows itself again. `0` exits with status 0;
98
+ Esc or Ctrl+C prints "Operation cancelled." and exits with status 130, like
99
+ every other prompt.
100
+
101
+ The menu only opens when both stdin and stdout are terminals and `CI` is not
102
+ set. Piped, redirected and CI runs (`zudo | cat`) print the help text and exit
103
+ 0, and `--help` / `--version` never open it.
104
+
105
+ ### Exit codes and usage errors
106
+
107
+ | Status | Meaning |
108
+ | ------ | ------- |
109
+ | `0` | Success (also `--help`, `--version`, and "Exit" from the menu) |
110
+ | `1` | The command ran and failed (build error, not in a project, …) |
111
+ | `2` | Usage error: missing argument, unknown or malformed option, option before the command |
112
+ | `3` | Unknown command (with a "Did you mean …?" suggestion when one is close) |
113
+ | `130` | Cancelled with Ctrl+C or Esc |
114
+
115
+ Options go after the command name (`zudo dev --port 4000`); an option placed
116
+ before it is reported instead of being dropped. Only the first word can be the
117
+ command, so a typo such as `zudo creat my-api` is an error rather than a
118
+ different command.
119
+
68
120
  ### Update check
69
121
 
70
122
  `zudojs info` asks npm whether a newer `zudojs-cli` exists and prints the
@@ -148,11 +200,11 @@ add domain logic to an existing app with
148
200
 
149
201
  | Command | Description |
150
202
  | ---------- | ------------------------------------------------------------------------ |
151
- | `create` | Scaffold a new project (backend, frontend, or fullstack) |
152
- | `generate` | Generate files — see the schematics below |
203
+ | `create` (`new`) | Scaffold a new project (backend, frontend, or fullstack) |
204
+ | `generate` (`g`) | Generate files — see the schematics below |
153
205
  | `add` | Add feature packages (database, queue, messaging, etc.); `--service` targets one microservice app |
154
- | `dev` | Start development servers through the project's package manager (`pnpm run dev`, …) |
155
- | `build` | Build the project with its detected package manager |
206
+ | `dev` (`d`) | Start development servers through the project's package manager (`pnpm run dev`, …) |
207
+ | `build` (`b`) | Build the project with its detected package manager |
156
208
  | `doctor` | Run project diagnostics |
157
209
  | `info` | Show project information |
158
210
 
@@ -17,7 +17,6 @@ export declare class AngularAdapter implements FrontendAdapter {
17
17
  applyZudojsStructure(context: FrontendGenerationContext): Promise<void>;
18
18
  generateIntegration(context: FrontendGenerationContext): Promise<void>;
19
19
  validate(context: FrontendGenerationContext): Promise<ValidationResult>;
20
- private getBaseFiles;
21
20
  private getStructure;
22
21
  private getIntegrationFiles;
23
22
  }
@@ -6,6 +6,8 @@
6
6
  import { writeFileTree } from "../../utils/utils.fileSystem.js";
7
7
  import { normalizeName } from "../../utils/utils.name.js";
8
8
  import { scaffoldWithFallback } from "../../scaffolders/scaffolder.helper.js";
9
+ import { renderAngularFallback, versionFromRange } from "./fallback/index.js";
10
+ import { ANGULAR_VITEST_VERSION_RANGE, DEPENDENCY_VERSION_RANGES as V, } from "../../resolvers/dependency/dependencyVersions.constant.js";
9
11
  /**
10
12
  * Angular adapter with standalone support.
11
13
  */
@@ -16,10 +18,9 @@ export class AngularAdapter {
16
18
  return true;
17
19
  }
18
20
  async getLatestVersion() {
19
- return "19.0.0";
21
+ return versionFromRange(V["@angular/core"]);
20
22
  }
21
23
  async scaffold(context) {
22
- const files = this.getBaseFiles(context);
23
24
  // Angular CLI requires a valid project name; "." is not one. Pass the
24
25
  // real name and scaffold into the current directory via --directory.
25
26
  const projectName = normalizeName(context.project.name) || "zudojs-app";
@@ -36,10 +37,11 @@ export class AngularAdapter {
36
37
  "--routing",
37
38
  "--style",
38
39
  "css",
39
- "--standalone",
40
+ "--package-manager",
41
+ context.packageManager,
40
42
  ],
41
43
  targetPath: context.projectPath,
42
- fallbackFiles: files,
44
+ fallbackFiles: renderAngularFallback(context, projectName),
43
45
  });
44
46
  }
45
47
  getDependencies(context) {
@@ -48,7 +50,14 @@ export class AngularAdapter {
48
50
  deps.push({ name: "@ngrx/store", type: "dependency" });
49
51
  }
50
52
  if (context.features.testing) {
51
- deps.push({ name: "@angular/core", type: "dependency" }, { name: "@angular/common", type: "dependency" }, { name: "jest", type: "devDependency" }, { name: "@angular-builders/jest", type: "devDependency" });
53
+ // Angular 22 runs unit tests through @angular/build:unit-test with
54
+ // Vitest, whose peer range is ^4 (not the ^5 other frameworks use).
55
+ // Jest via @angular-builders/jest fought the scaffolded builder.
56
+ deps.push({
57
+ name: "vitest",
58
+ version: ANGULAR_VITEST_VERSION_RANGE,
59
+ type: "devDependency",
60
+ }, { name: "jsdom", type: "devDependency" });
52
61
  }
53
62
  return deps;
54
63
  }
@@ -68,98 +77,6 @@ export class AngularAdapter {
68
77
  }
69
78
  return { valid: errors.length === 0, errors, warnings };
70
79
  }
71
- getBaseFiles(context) {
72
- return {
73
- "package.json": JSON.stringify({
74
- name: context.project.name,
75
- version: "0.0.0",
76
- private: true,
77
- scripts: {
78
- start: "ng serve",
79
- build: "ng build",
80
- test: "ng test",
81
- },
82
- dependencies: {
83
- "@angular/animations": "^19.0.0",
84
- "@angular/common": "^19.0.0",
85
- "@angular/compiler": "^19.0.0",
86
- "@angular/core": "^19.0.0",
87
- "@angular/forms": "^19.0.0",
88
- "@angular/platform-browser": "^19.0.0",
89
- "@angular/platform-browser-dynamic": "^19.0.0",
90
- "@angular/router": "^19.0.0",
91
- rxjs: "~7.8.0",
92
- tslib: "^2.3.0",
93
- "zone.js": "~0.15.0",
94
- },
95
- devDependencies: {
96
- "@angular-devkit/build-angular": "^19.0.0",
97
- "@angular/cli": "^19.0.0",
98
- "@angular/compiler-cli": "^19.0.0",
99
- "@types/jasmine": "~5.1.0",
100
- "jasmine-core": "~5.1.0",
101
- karma: "~6.4.0",
102
- typescript: "~5.6.0",
103
- },
104
- }, null, 2),
105
- "tsconfig.json": JSON.stringify({
106
- compileOnSave: false,
107
- compilerOptions: {
108
- outDir: "./dist/out-tsc",
109
- strict: true,
110
- noImplicitOverride: true,
111
- noPropertyAccessFromIndexSignature: true,
112
- noImplicitReturns: true,
113
- noFallthroughCasesInSwitch: true,
114
- esModuleInterop: true,
115
- sourceMap: true,
116
- declaration: false,
117
- downlevelIteration: true,
118
- experimentalDecorators: true,
119
- moduleResolution: "bundler",
120
- importHelpers: true,
121
- target: "ES2022",
122
- module: "ES2022",
123
- lib: ["ES2022", "dom"],
124
- useDefineForClassFields: true,
125
- },
126
- angularCompilerOptions: {
127
- enableI18nLegacyMessageIdFormat: false,
128
- strictInjectionParameters: true,
129
- strictInputAccessModifiers: true,
130
- strictTemplates: true,
131
- },
132
- }, null, 2),
133
- "src/main.ts": `import { bootstrapApplication } from "@angular/platform-browser";
134
- import { AppComponent } from "./app/app.component";
135
-
136
- bootstrapApplication(AppComponent);
137
- `,
138
- "src/index.html": `<!DOCTYPE html>
139
- <html lang="en">
140
- <head>
141
- <meta charset="utf-8" />
142
- <title>${context.project.name}</title>
143
- <base href="/" />
144
- <meta name="viewport" content="width=device-width, initial-scale=1" />
145
- <link rel="icon" type="image/x-icon" href="/favicon.ico" />
146
- </head>
147
- <body>
148
- <app-root></app-root>
149
- </body>
150
- </html>
151
- `,
152
- "src/app/app.component.ts": `import { Component } from "@angular/core";
153
-
154
- @Component({
155
- selector: "app-root",
156
- standalone: true,
157
- template: "<h1>Hello from Zudojs</h1>",
158
- })
159
- export class AppComponent {}
160
- `,
161
- };
162
- }
163
80
  getStructure(context) {
164
81
  return {
165
82
  "src/app/components/.gitkeep": "",
@@ -17,7 +17,6 @@ export declare class AstroAdapter implements FrontendAdapter {
17
17
  applyZudojsStructure(context: FrontendGenerationContext): Promise<void>;
18
18
  generateIntegration(context: FrontendGenerationContext): Promise<void>;
19
19
  validate(context: FrontendGenerationContext): Promise<ValidationResult>;
20
- private getBaseFiles;
21
20
  private getStructure;
22
21
  private getIntegrationFiles;
23
22
  }
@@ -5,6 +5,8 @@
5
5
  */
6
6
  import { writeFileTree } from "../../utils/utils.fileSystem.js";
7
7
  import { scaffoldWithFallback } from "../../scaffolders/scaffolder.helper.js";
8
+ import { renderAstroFallback, versionFromRange } from "./fallback/index.js";
9
+ import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
8
10
  /**
9
11
  * Astro adapter with island architecture support.
10
12
  */
@@ -15,10 +17,10 @@ export class AstroAdapter {
15
17
  return true;
16
18
  }
17
19
  async getLatestVersion() {
18
- return "5.0.0";
20
+ return versionFromRange(V.astro);
19
21
  }
20
22
  async scaffold(context) {
21
- const files = this.getBaseFiles(context);
23
+ const files = renderAstroFallback(context);
22
24
  await scaffoldWithFallback({
23
25
  command: "npm",
24
26
  args: [
@@ -59,68 +61,6 @@ export class AstroAdapter {
59
61
  }
60
62
  return { valid: errors.length === 0, errors, warnings };
61
63
  }
62
- getBaseFiles(context) {
63
- return {
64
- "package.json": JSON.stringify({
65
- name: context.project.name,
66
- version: "0.1.0",
67
- private: true,
68
- type: "module",
69
- scripts: {
70
- dev: "astro dev",
71
- build: "astro build",
72
- preview: "astro preview",
73
- },
74
- dependencies: {
75
- astro: "^5.0.0",
76
- },
77
- devDependencies: {
78
- "@astrojs/check": "^0.9.0",
79
- typescript: "^5.0.0",
80
- },
81
- }, null, 2),
82
- "astro.config.mjs": `import { defineConfig } from "astro/config";
83
-
84
- export default defineConfig({
85
- output: "static",
86
- });
87
- `,
88
- "tsconfig.json": JSON.stringify({
89
- extends: "astro/tsconfigs/strict",
90
- compilerOptions: {
91
- strict: true,
92
- },
93
- }, null, 2),
94
- "src/layouts/Layout.astro": `---
95
- interface Props {
96
- title: string;
97
- }
98
-
99
- const { title } = Astro.props;
100
- ---
101
-
102
- <!DOCTYPE html>
103
- <html lang="en">
104
- <head>
105
- <meta charset="utf-8" />
106
- <meta name="viewport" content="width=device-width, initial-scale=1" />
107
- <title>\${title}</title>
108
- </head>
109
- <body>
110
- <slot />
111
- </body>
112
- </html>
113
- `,
114
- "src/pages/index.astro": `---
115
- import Layout from "../layouts/Layout.astro";
116
- ---
117
-
118
- <Layout title="${context.project.name}">
119
- <h1>Hello from Zudojs</h1>
120
- </Layout>
121
- `,
122
- };
123
- }
124
64
  getStructure(context) {
125
65
  return {
126
66
  "src/components/.gitkeep": "",
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Shared pieces of the built-in fallback templates.
3
+ *
4
+ * @module adapters/frontend/fallback/helper
5
+ */
6
+ /** A generated file tree: project-relative path to file contents. */
7
+ export type FallbackFileTree = Record<string, string>;
8
+ /** Serialises a JSON config file the way the official scaffolders do. */
9
+ export declare function renderJsonFile(value: unknown): string;
10
+ /**
11
+ * Renders the `index.html` entry page Vite serves and builds from.
12
+ *
13
+ * @param title - The document title (the project name).
14
+ * @param mountId - The id of the element the app mounts into.
15
+ * @param entry - The root-relative module script, e.g. `/src/main.ts`.
16
+ */
17
+ export declare function renderViteIndexHtml(title: string, mountId: string, entry: string): string;
18
+ /**
19
+ * Compiler options shared by the Vite fallbacks, mirroring the
20
+ * `tsconfig.app.json` that `create-vite` 9 writes.
21
+ */
22
+ export declare const VITE_TSCONFIG_COMPILER_OPTIONS: Readonly<{
23
+ target: "ES2023";
24
+ lib: string[];
25
+ module: "ESNext";
26
+ types: string[];
27
+ skipLibCheck: true;
28
+ moduleResolution: "bundler";
29
+ allowImportingTsExtensions: true;
30
+ verbatimModuleSyntax: true;
31
+ moduleDetection: "force";
32
+ noEmit: true;
33
+ strict: true;
34
+ noFallthroughCasesInSwitch: true;
35
+ }>;
36
+ /**
37
+ * Returns the lowest version a caret or tilde range admits, which is the
38
+ * release the range was written against (`"^8.3.0"` → `"8.3.0"`).
39
+ */
40
+ export declare function versionFromRange(range: string): string;
41
+ //# sourceMappingURL=fallback.helper.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Shared pieces of the built-in fallback templates.
3
+ *
4
+ * @module adapters/frontend/fallback/helper
5
+ */
6
+ /** Serialises a JSON config file the way the official scaffolders do. */
7
+ export function renderJsonFile(value) {
8
+ return JSON.stringify(value, null, 2) + "\n";
9
+ }
10
+ /**
11
+ * Renders the `index.html` entry page Vite serves and builds from.
12
+ *
13
+ * @param title - The document title (the project name).
14
+ * @param mountId - The id of the element the app mounts into.
15
+ * @param entry - The root-relative module script, e.g. `/src/main.ts`.
16
+ */
17
+ export function renderViteIndexHtml(title, mountId, entry) {
18
+ return `<!doctype html>
19
+ <html lang="en">
20
+ <head>
21
+ <meta charset="UTF-8" />
22
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
23
+ <title>${title}</title>
24
+ </head>
25
+ <body>
26
+ <div id="${mountId}"></div>
27
+ <script type="module" src="${entry}"></script>
28
+ </body>
29
+ </html>
30
+ `;
31
+ }
32
+ /**
33
+ * Compiler options shared by the Vite fallbacks, mirroring the
34
+ * `tsconfig.app.json` that `create-vite` 9 writes.
35
+ */
36
+ export const VITE_TSCONFIG_COMPILER_OPTIONS = Object.freeze({
37
+ target: "ES2023",
38
+ lib: ["ES2023", "DOM", "DOM.Iterable"],
39
+ module: "ESNext",
40
+ types: ["vite/client"],
41
+ skipLibCheck: true,
42
+ moduleResolution: "bundler",
43
+ allowImportingTsExtensions: true,
44
+ verbatimModuleSyntax: true,
45
+ moduleDetection: "force",
46
+ noEmit: true,
47
+ strict: true,
48
+ noFallthroughCasesInSwitch: true,
49
+ });
50
+ /**
51
+ * Returns the lowest version a caret or tilde range admits, which is the
52
+ * release the range was written against (`"^8.3.0"` → `"8.3.0"`).
53
+ */
54
+ export function versionFromRange(range) {
55
+ return range.replace(/^[\^~]/, "");
56
+ }
57
+ //# sourceMappingURL=fallback.helper.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Built-in Angular template, written when `ng new` cannot run.
3
+ *
4
+ * @module adapters/frontend/fallback/framework/angular
5
+ */
6
+ import type { FrontendGenerationContext } from "../../../frontendAdapter.type.js";
7
+ import { type FallbackFileTree } from "../../fallback.helper.js";
8
+ /**
9
+ * Renders the Angular 22 fallback project, matching `ng new --routing
10
+ * --style css`: a zoneless standalone app built by `@angular/build` and
11
+ * tested with Vitest. The previous fallback had no `angular.json`, so
12
+ * `ng build` could not run in it.
13
+ *
14
+ * @param context - The generation context.
15
+ * @param projectName - The normalised name `ng new` would receive.
16
+ */
17
+ export declare function renderAngularFallback(context: FrontendGenerationContext, projectName: string): FallbackFileTree;
18
+ //# sourceMappingURL=angular.fallback.d.ts.map
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Built-in Angular template, written when `ng new` cannot run.
3
+ *
4
+ * @module adapters/frontend/fallback/framework/angular
5
+ */
6
+ import { ANGULAR_VITEST_VERSION_RANGE, DEPENDENCY_VERSION_RANGES as V, TYPESCRIPT_VERSION_RANGES, } from "../../../../../resolvers/dependency/dependencyVersions.constant.js";
7
+ import { renderJsonFile } from "../../fallback.helper.js";
8
+ import { renderAngularTsconfigs, renderAngularWorkspace, } from "./angularWorkspace.fallback.js";
9
+ /**
10
+ * Renders the Angular 22 fallback project, matching `ng new --routing
11
+ * --style css`: a zoneless standalone app built by `@angular/build` and
12
+ * tested with Vitest. The previous fallback had no `angular.json`, so
13
+ * `ng build` could not run in it.
14
+ *
15
+ * @param context - The generation context.
16
+ * @param projectName - The normalised name `ng new` would receive.
17
+ */
18
+ export function renderAngularFallback(context, projectName) {
19
+ return {
20
+ "package.json": renderJsonFile({
21
+ name: context.project.name,
22
+ version: "0.0.0",
23
+ private: true,
24
+ scripts: {
25
+ ng: "ng",
26
+ start: "ng serve",
27
+ build: "ng build",
28
+ watch: "ng build --watch --configuration development",
29
+ test: "ng test",
30
+ },
31
+ dependencies: {
32
+ "@angular/common": V["@angular/common"],
33
+ "@angular/compiler": V["@angular/compiler"],
34
+ "@angular/core": V["@angular/core"],
35
+ "@angular/forms": V["@angular/forms"],
36
+ "@angular/platform-browser": V["@angular/platform-browser"],
37
+ "@angular/router": V["@angular/router"],
38
+ rxjs: V.rxjs,
39
+ tslib: V.tslib,
40
+ },
41
+ devDependencies: {
42
+ "@angular/build": V["@angular/build"],
43
+ "@angular/cli": V["@angular/cli"],
44
+ "@angular/compiler-cli": V["@angular/compiler-cli"],
45
+ jsdom: V.jsdom,
46
+ typescript: TYPESCRIPT_VERSION_RANGES.frontend,
47
+ vitest: ANGULAR_VITEST_VERSION_RANGE,
48
+ },
49
+ }),
50
+ "angular.json": renderAngularWorkspace(projectName, context.packageManager),
51
+ ...renderAngularTsconfigs(),
52
+ "public/.gitkeep": "",
53
+ "src/styles.css": "",
54
+ "src/index.html": `<!doctype html>
55
+ <html lang="en">
56
+ <head>
57
+ <meta charset="utf-8">
58
+ <title>${context.project.name}</title>
59
+ <base href="/">
60
+ <meta name="viewport" content="width=device-width, initial-scale=1">
61
+ </head>
62
+ <body>
63
+ <app-root></app-root>
64
+ </body>
65
+ </html>
66
+ `,
67
+ "src/main.ts": `import { bootstrapApplication } from "@angular/platform-browser";
68
+ import { appConfig } from "./app/app.config";
69
+ import { App } from "./app/app";
70
+
71
+ bootstrapApplication(App, appConfig).catch((err) => console.error(err));
72
+ `,
73
+ "src/app/app.config.ts": `import { type ApplicationConfig, provideBrowserGlobalErrorListeners } from "@angular/core";
74
+ import { provideRouter } from "@angular/router";
75
+ import { routes } from "./app.routes";
76
+
77
+ export const appConfig: ApplicationConfig = {
78
+ providers: [provideBrowserGlobalErrorListeners(), provideRouter(routes)],
79
+ };
80
+ `,
81
+ "src/app/app.routes.ts": `import type { Routes } from "@angular/router";
82
+
83
+ export const routes: Routes = [];
84
+ `,
85
+ "src/app/app.ts": `import { Component } from "@angular/core";
86
+ import { RouterOutlet } from "@angular/router";
87
+
88
+ @Component({
89
+ selector: "app-root",
90
+ imports: [RouterOutlet],
91
+ template: "<h1>Hello from Zudojs</h1><router-outlet />",
92
+ })
93
+ export class App {}
94
+ `,
95
+ "src/app/app.spec.ts": `import { TestBed } from "@angular/core/testing";
96
+ import { App } from "./app";
97
+
98
+ describe("App", () => {
99
+ it("creates the app", async () => {
100
+ await TestBed.configureTestingModule({ imports: [App] }).compileComponents();
101
+ expect(TestBed.createComponent(App).componentInstance).toBeTruthy();
102
+ });
103
+ });
104
+ `,
105
+ };
106
+ }
107
+ //# sourceMappingURL=angular.fallback.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Workspace configuration (`angular.json`, tsconfigs) for the built-in
3
+ * Angular fallback.
4
+ *
5
+ * @module adapters/frontend/fallback/framework/angular/workspace
6
+ */
7
+ import { type FallbackFileTree } from "../../fallback.helper.js";
8
+ /**
9
+ * Renders the Angular CLI workspace file `ng new` 22 writes. Builds, the dev
10
+ * server and unit tests all go through `@angular/build`; the deprecated
11
+ * `@angular-devkit/build-angular` and its Karma/Jasmine test runner are no
12
+ * longer used.
13
+ *
14
+ * @param projectName - The normalised project name used as the project key.
15
+ * @param packageManager - Recorded as the CLI's package manager.
16
+ */
17
+ export declare function renderAngularWorkspace(projectName: string, packageManager: string): string;
18
+ /**
19
+ * Renders the solution-style tsconfigs `ng new` 22 writes: a base config
20
+ * referencing an app config and a Vitest spec config.
21
+ */
22
+ export declare function renderAngularTsconfigs(): FallbackFileTree;
23
+ //# sourceMappingURL=angularWorkspace.fallback.d.ts.map