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
@@ -6,6 +6,8 @@
6
6
  import { execCommand } from "../../utils/utils.exec.js";
7
7
  import { writeFileTree } from "../../utils/utils.fileSystem.js";
8
8
  import { scaffoldWithFallback } from "../../scaffolders/scaffolder.helper.js";
9
+ import { renderReactFallback, versionFromRange } from "./fallback/index.js";
10
+ import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
9
11
  /**
10
12
  * React adapter using Vite as the build tool.
11
13
  */
@@ -22,10 +24,10 @@ export class ReactAdapter {
22
24
  }
23
25
  }
24
26
  async getLatestVersion() {
25
- return "19.0.0";
27
+ return versionFromRange(V.react);
26
28
  }
27
29
  async scaffold(context) {
28
- const files = this.getBaseFiles(context);
30
+ const files = renderReactFallback(context);
29
31
  await scaffoldWithFallback({
30
32
  command: "npm",
31
33
  args: [
@@ -49,7 +51,9 @@ export class ReactAdapter {
49
51
  deps.push({ name: "zustand", type: "dependency" });
50
52
  }
51
53
  if (context.features.testing) {
52
- deps.push({ name: "vitest", type: "devDependency" }, { name: "@testing-library/react", type: "devDependency" }, { name: "@testing-library/jest-dom", type: "devDependency" }, { name: "@testing-library/user-event", type: "devDependency" }, { name: "jsdom", type: "devDependency" });
54
+ deps.push({ name: "vitest", type: "devDependency" }, { name: "@testing-library/react", type: "devDependency" },
55
+ // Peer dependency of @testing-library/react since v16.
56
+ { name: "@testing-library/dom", type: "devDependency" }, { name: "@testing-library/jest-dom", type: "devDependency" }, { name: "@testing-library/user-event", type: "devDependency" }, { name: "jsdom", type: "devDependency" });
53
57
  }
54
58
  if (context.features.linting) {
55
59
  deps.push({ name: "eslint", type: "devDependency" }, { name: "typescript-eslint", type: "devDependency" }, { name: "eslint-plugin-react-hooks", type: "devDependency" }, { name: "eslint-plugin-react-refresh", type: "devDependency" });
@@ -75,92 +79,6 @@ export class ReactAdapter {
75
79
  }
76
80
  return { valid: errors.length === 0, errors, warnings };
77
81
  }
78
- getBaseFiles(context) {
79
- const useTypeScript = context.language === "typescript";
80
- const ext = useTypeScript ? "tsx" : "jsx";
81
- return {
82
- "package.json": JSON.stringify({
83
- name: context.project.name,
84
- version: "0.1.0",
85
- private: true,
86
- type: "module",
87
- scripts: {
88
- dev: "vite",
89
- // Vite performs the build; tsc only typechecks (noEmit).
90
- build: useTypeScript ? "tsc --noEmit && vite build" : "vite build",
91
- preview: "vite preview",
92
- },
93
- dependencies: {
94
- react: "^19.0.0",
95
- "react-dom": "^19.0.0",
96
- },
97
- devDependencies: {
98
- vite: "^6.0.0",
99
- "@vitejs/plugin-react": "^4.3.0",
100
- ...(useTypeScript ? { typescript: "^5.0.0" } : {}),
101
- },
102
- }, null, 2),
103
- "vite.config.ts": `import { defineConfig } from "vite";
104
- import react from "@vitejs/plugin-react";
105
-
106
- export default defineConfig({
107
- plugins: [react()],
108
- });
109
- `,
110
- ...(useTypeScript
111
- ? {
112
- "tsconfig.json": JSON.stringify({
113
- compilerOptions: {
114
- target: "ES2020",
115
- useDefineForClassFields: true,
116
- lib: ["ES2020", "DOM", "DOM.Iterable"],
117
- module: "ESNext",
118
- skipLibCheck: true,
119
- moduleResolution: "bundler",
120
- allowImportingTsExtensions: true,
121
- resolveJsonModule: true,
122
- jsx: "react-jsx",
123
- noEmit: true,
124
- },
125
- }, null, 2),
126
- }
127
- : {}),
128
- "index.html": `<!DOCTYPE html>
129
- <html lang="en">
130
- <head>
131
- <meta charset="UTF-8" />
132
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
133
- <title>${context.project.name}</title>
134
- </head>
135
- <body>
136
- <div id="root"></div>
137
- <script type="module" src="/src/main.${ext}"></script>
138
- </body>
139
- </html>
140
- `,
141
- [`src/main.${ext}`]: `import { StrictMode } from "react";
142
- import { createRoot } from "react-dom/client";
143
- import App from "./App";
144
-
145
- createRoot(document.getElementById("root")${useTypeScript ? "!" : ""}).render(
146
- <StrictMode>
147
- <App />
148
- </StrictMode>,
149
- );
150
- `,
151
- [`src/App.${ext}`]: `export default function App() {
152
- return (
153
- <div>
154
- <h1>Hello from Zudojs</h1>
155
- </div>
156
- );
157
- }
158
- `,
159
- ...(useTypeScript
160
- ? { "src/vite-env.d.ts": `/// <reference types="vite/client" />\n` }
161
- : {}),
162
- };
163
- }
164
82
  getStructure(context) {
165
83
  const srcDir = "src";
166
84
  if (context.architecture === "feature-based") {
@@ -17,7 +17,6 @@ export declare class SvelteAdapter 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 getZudojsStandardStructure;
23
22
  private getFeatureBasedStructure;
@@ -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 { renderSvelteFallback, versionFromRange } from "./fallback/index.js";
9
+ import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
8
10
  /**
9
11
  * Svelte adapter using Vite as the build tool.
10
12
  */
@@ -15,10 +17,10 @@ export class SvelteAdapter {
15
17
  return true;
16
18
  }
17
19
  async getLatestVersion() {
18
- return "5.0.0";
20
+ return versionFromRange(V.svelte);
19
21
  }
20
22
  async scaffold(context) {
21
- const files = this.getBaseFiles(context);
23
+ const files = renderSvelteFallback(context);
22
24
  await scaffoldWithFallback({
23
25
  command: "npm",
24
26
  args: [
@@ -65,90 +67,6 @@ export class SvelteAdapter {
65
67
  }
66
68
  return { valid: errors.length === 0, errors, warnings };
67
69
  }
68
- getBaseFiles(context) {
69
- const useTypeScript = context.language === "typescript";
70
- return {
71
- "package.json": JSON.stringify({
72
- name: context.project.name,
73
- version: "0.1.0",
74
- private: true,
75
- type: "module",
76
- scripts: {
77
- dev: "vite dev",
78
- build: "vite build",
79
- preview: "vite preview",
80
- },
81
- dependencies: {
82
- svelte: "^5.0.0",
83
- },
84
- devDependencies: {
85
- vite: "^6.0.0",
86
- "@sveltejs/vite-plugin-svelte": "^4.0.0",
87
- ...(useTypeScript ? { typescript: "^5.0.0" } : {}),
88
- },
89
- }, null, 2),
90
- "vite.config.ts": `import { defineConfig } from "vite";
91
- import { svelte } from "@sveltejs/vite-plugin-svelte";
92
-
93
- export default defineConfig({
94
- plugins: [svelte()],
95
- });
96
- `,
97
- "tsconfig.json": JSON.stringify({
98
- compilerOptions: {
99
- target: "ES2020",
100
- lib: ["ES2020", "DOM", "DOM.Iterable"],
101
- module: "ESNext",
102
- skipLibCheck: true,
103
- moduleResolution: "bundler",
104
- allowImportingTsExtensions: true,
105
- resolveJsonModule: true,
106
- strict: true,
107
- },
108
- }, null, 2),
109
- "index.html": `<!DOCTYPE html>
110
- <html lang="en">
111
- <head>
112
- <meta charset="UTF-8" />
113
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
114
- <title>${context.project.name}</title>
115
- </head>
116
- <body>
117
- <div id="app"></div>
118
- <script type="module" src="/src/main.ts"></script>
119
- </body>
120
- </html>
121
- `,
122
- "src/main.ts": `import App from "./App.svelte";
123
-
124
- const app = new App({
125
- target: document.getElementById("app")!,
126
- });
127
-
128
- export default app;
129
- `,
130
- "src/App.svelte": `<script${useTypeScript ? ' lang="ts"' : ""}>
131
- </script>
132
-
133
- <template>
134
- <div>
135
- <h1>Hello from Zudojs</h1>
136
- </div>
137
- </template>
138
-
139
- <style>
140
- div {
141
- font-family: system-ui, -apple-system, sans-serif;
142
- }
143
- </style>
144
- `,
145
- ...(useTypeScript
146
- ? {
147
- "src/vite-env.d.ts": `/// <reference types="svelte" />\n/// <reference types="vite/client" />\n`,
148
- }
149
- : {}),
150
- };
151
- }
152
70
  getStructure(context) {
153
71
  const srcDir = "src";
154
72
  if (context.architecture === "feature-based") {
@@ -17,7 +17,6 @@ export declare class SvelteKitAdapter 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 { renderSvelteKitFallback, versionFromRange } from "./fallback/index.js";
9
+ import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
8
10
  /**
9
11
  * SvelteKit adapter with SSR support.
10
12
  */
@@ -15,10 +17,10 @@ export class SvelteKitAdapter {
15
17
  return true;
16
18
  }
17
19
  async getLatestVersion() {
18
- return "2.15.0";
20
+ return versionFromRange(V["@sveltejs/kit"]);
19
21
  }
20
22
  async scaffold(context) {
21
- const files = this.getBaseFiles(context);
23
+ const files = renderSvelteKitFallback(context);
22
24
  await scaffoldWithFallback({
23
25
  command: "npx",
24
26
  args: [
@@ -59,61 +61,6 @@ export class SvelteKitAdapter {
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: "vite dev",
71
- build: "vite build",
72
- preview: "vite preview",
73
- },
74
- dependencies: {
75
- "@sveltejs/kit": "^2.15.0",
76
- svelte: "^5.0.0",
77
- },
78
- devDependencies: {
79
- "@sveltejs/vite-plugin-svelte": "^4.0.0",
80
- vite: "^6.0.0",
81
- },
82
- }, null, 2),
83
- "svelte.config.js": `import adapter from "@sveltejs/adapter-auto";
84
-
85
- export default {
86
- kit: {
87
- adapter: adapter(),
88
- },
89
- };
90
- `,
91
- "vite.config.ts": `import { sveltekit } from "@sveltejs/kit/vite";
92
- import { defineConfig } from "vite";
93
-
94
- export default defineConfig({
95
- plugins: [sveltekit()],
96
- });
97
- `,
98
- "src/routes/+page.svelte": `<h1>Hello from Zudojs</h1>
99
- `,
100
- "src/routes/+layout.svelte": `<slot />
101
- `,
102
- "src/app.html": `<!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>${context.project.name}</title>
108
- </head>
109
- <body>
110
- <div id="root"></div>
111
- {% include 'src/app.html' %}
112
- </body>
113
- </html>
114
- `,
115
- };
116
- }
117
64
  getStructure(context) {
118
65
  return {
119
66
  "src/lib/.gitkeep": "",
@@ -17,7 +17,6 @@ export declare class VanillaAdapter 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 { renderVanillaFallback, versionFromRange } from "./fallback/index.js";
9
+ import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
8
10
  /**
9
11
  * Vanilla HTML/CSS/JS adapter with no framework.
10
12
  */
@@ -15,10 +17,10 @@ export class VanillaAdapter {
15
17
  return true;
16
18
  }
17
19
  async getLatestVersion() {
18
- return "1.0.0";
20
+ return versionFromRange(V.vite);
19
21
  }
20
22
  async scaffold(context) {
21
- const files = this.getBaseFiles(context);
23
+ const files = renderVanillaFallback(context);
22
24
  await scaffoldWithFallback({
23
25
  command: "npm",
24
26
  args: ["create", "vite@latest", ".", "--", "--template", "vanilla-ts"],
@@ -55,51 +57,6 @@ export class VanillaAdapter {
55
57
  }
56
58
  return { valid: errors.length === 0, errors, warnings };
57
59
  }
58
- getBaseFiles(context) {
59
- return {
60
- "index.html": `<!DOCTYPE html>
61
- <html lang="en">
62
- <head>
63
- <meta charset="UTF-8">
64
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
65
- <title>${context.project.name}</title>
66
- <link rel="stylesheet" href="/src/styles/main.css">
67
- </head>
68
- <body>
69
- <div id="app"></div>
70
- <script type="module" src="/src/main.js"></script>
71
- </body>
72
- </html>
73
- `,
74
- "src/main.js": `import { createApp } from "./app.js";
75
-
76
- const app = createApp();
77
- app.mount("#app");
78
- `,
79
- "src/app.js": `export function createApp() {
80
- return {
81
- mount(selector) {
82
- const root = document.querySelector(selector);
83
- if (root) {
84
- root.innerHTML = "<h1>Hello from Zudojs</h1>";
85
- }
86
- },
87
- };
88
- }
89
- `,
90
- "src/styles/main.css": `* {
91
- margin: 0;
92
- padding: 0;
93
- box-sizing: border-box;
94
- }
95
-
96
- body {
97
- font-family: system-ui, -apple-system, sans-serif;
98
- line-height: 1.6;
99
- }
100
- `,
101
- };
102
- }
103
60
  getStructure(context) {
104
61
  return {
105
62
  "src/components/.gitkeep": "",
@@ -17,7 +17,6 @@ export declare class VueAdapter 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 getZudojsStandardStructure;
23
22
  private getFeatureBasedStructure;
@@ -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 { renderVueFallback, versionFromRange } from "./fallback/index.js";
9
+ import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
8
10
  /**
9
11
  * Vue adapter using Vite as the build tool.
10
12
  */
@@ -15,10 +17,10 @@ export class VueAdapter {
15
17
  return true;
16
18
  }
17
19
  async getLatestVersion() {
18
- return "3.5.0";
20
+ return versionFromRange(V.vue);
19
21
  }
20
22
  async scaffold(context) {
21
- const files = this.getBaseFiles(context);
23
+ const files = renderVueFallback(context);
22
24
  await scaffoldWithFallback({
23
25
  command: "npm",
24
26
  args: [
@@ -62,80 +64,6 @@ export class VueAdapter {
62
64
  }
63
65
  return { valid: errors.length === 0, errors, warnings };
64
66
  }
65
- getBaseFiles(context) {
66
- const useTypeScript = context.language === "typescript";
67
- return {
68
- "package.json": JSON.stringify({
69
- name: context.project.name,
70
- version: "0.1.0",
71
- private: true,
72
- type: "module",
73
- scripts: {
74
- dev: "vite",
75
- build: "vite build",
76
- preview: "vite preview",
77
- },
78
- dependencies: {
79
- vue: "^3.5.0",
80
- },
81
- devDependencies: {
82
- vite: "^6.0.0",
83
- "@vitejs/plugin-vue": "^4.5.0",
84
- ...(useTypeScript ? { typescript: "^5.0.0" } : {}),
85
- },
86
- }, null, 2),
87
- "vite.config.ts": `import { defineConfig } from "vite";
88
- import vue from "@vitejs/plugin-vue";
89
-
90
- export default defineConfig({
91
- plugins: [vue()],
92
- });
93
- `,
94
- "tsconfig.json": JSON.stringify({
95
- compilerOptions: {
96
- target: "ES2020",
97
- useDefineForClassFields: true,
98
- lib: ["ES2020", "DOM", "DOM.Iterable"],
99
- module: "ESNext",
100
- skipLibCheck: true,
101
- moduleResolution: "bundler",
102
- allowImportingTsExtensions: true,
103
- resolveJsonModule: true,
104
- strict: true,
105
- },
106
- }, null, 2),
107
- "index.html": `<!DOCTYPE html>
108
- <html lang="en">
109
- <head>
110
- <meta charset="UTF-8" />
111
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
112
- <title>${context.project.name}</title>
113
- </head>
114
- <body>
115
- <div id="app"></div>
116
- <script type="module" src="/src/main.ts"></script>
117
- </body>
118
- </html>
119
- `,
120
- "src/main.ts": `import { createApp } from "vue";
121
- import App from "./App.vue";
122
-
123
- createApp(App).mount("#app");
124
- `,
125
- "src/App.vue": `<template>
126
- <div>
127
- <h1>Hello from Zudojs</h1>
128
- </div>
129
- </template>
130
-
131
- <script setup lang="ts">
132
- </script>
133
- `,
134
- ...(useTypeScript
135
- ? { "src/vite-env.d.ts": `/// <reference types="vite/client" />\n` }
136
- : {}),
137
- };
138
- }
139
67
  getStructure(context) {
140
68
  const srcDir = "src";
141
69
  if (context.architecture === "feature-based") {
@@ -0,0 +1,22 @@
1
+ /**
2
+ * zudojs-cli — Binary Menu
3
+ *
4
+ * Opens the interactive menu with the real terminal, project detection
5
+ * and the schematic and feature lists `generate` and `add` accept.
6
+ */
7
+ import { type MenuOutcome, type MenuProjectScope } from "../prompts/menu/index.js";
8
+ /**
9
+ * Detects a project the way the entry's command will.
10
+ *
11
+ * `dev` and `add` read only the current directory; `build` and `generate`
12
+ * walk up to the nearest project root.
13
+ */
14
+ export declare function isZudojsProject(cwd: string, scope: MenuProjectScope): boolean;
15
+ /**
16
+ * Shows the menu on the process's terminal.
17
+ *
18
+ * @param name - The executable name the user typed.
19
+ * @param cwd - The directory commands will run in.
20
+ */
21
+ export declare function openMainMenu(name: string, cwd: string): Promise<MenuOutcome>;
22
+ //# sourceMappingURL=bin.menu.d.ts.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * zudojs-cli — Binary Menu
3
+ *
4
+ * Opens the interactive menu with the real terminal, project detection
5
+ * and the schematic and feature lists `generate` and `add` accept.
6
+ */
7
+ import * as p from "@clack/prompts";
8
+ import { CLI_VERSION, FEATURE_CHOICES, SCHEMA_CHOICES, } from "../constants/index.js";
9
+ import { createTerminalMenuPrompter, runMenuFlow, } from "../prompts/menu/index.js";
10
+ import { findProjectRoot } from "../resolvers/project.resolver.js";
11
+ import { resolveProjectLayout } from "../resolvers/layout/projectLayout.core.js";
12
+ /**
13
+ * Detects a project the way the entry's command will.
14
+ *
15
+ * `dev` and `add` read only the current directory; `build` and `generate`
16
+ * walk up to the nearest project root.
17
+ */
18
+ export function isZudojsProject(cwd, scope) {
19
+ return scope === "cwd"
20
+ ? resolveProjectLayout(cwd) !== null
21
+ : findProjectRoot(cwd) !== null;
22
+ }
23
+ /**
24
+ * Shows the menu on the process's terminal.
25
+ *
26
+ * @param name - The executable name the user typed.
27
+ * @param cwd - The directory commands will run in.
28
+ */
29
+ export async function openMainMenu(name, cwd) {
30
+ p.intro(`${name} v${CLI_VERSION}`);
31
+ return runMenuFlow({
32
+ prompter: createTerminalMenuPrompter(),
33
+ cwd,
34
+ name,
35
+ isProject: isZudojsProject,
36
+ schematics: SCHEMA_CHOICES,
37
+ features: FEATURE_CHOICES,
38
+ });
39
+ }
40
+ //# sourceMappingURL=bin.menu.js.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * zudojs-cli — Binary Runner
3
+ *
4
+ * What the `zudojs` / `zudo` executable does with its arguments: open the
5
+ * interactive menu for a bare invocation on a terminal, otherwise hand the
6
+ * arguments straight to the application.
7
+ */
8
+ import type { CLIApplication } from "../cliType/cliType.type.js";
9
+ import type { MenuOutcome } from "../prompts/menu/index.js";
10
+ /** The parts of the process the runner looks at, injectable for tests. */
11
+ export interface BinaryEnvironment {
12
+ /** Arguments after the script path (`process.argv.slice(2)`). */
13
+ readonly argv: readonly string[];
14
+ readonly stdin: {
15
+ readonly isTTY?: boolean;
16
+ };
17
+ readonly stdout: {
18
+ readonly isTTY?: boolean;
19
+ };
20
+ readonly env: Readonly<Record<string, string | undefined>>;
21
+ }
22
+ /**
23
+ * Whether a bare invocation should open the interactive menu.
24
+ *
25
+ * Only with no arguments at all, both stdin and stdout attached to a
26
+ * terminal, and not under CI. Piped, redirected and CI runs keep printing
27
+ * the help text and exiting 0, so scripts that call `zudojs` are unchanged.
28
+ */
29
+ export declare function shouldShowMenu(environment: BinaryEnvironment): boolean;
30
+ /**
31
+ * Runs the binary and resolves with the process exit code.
32
+ *
33
+ * @param app - The application with every command registered.
34
+ * @param environment - The process's arguments, streams and variables.
35
+ * @param openMenu - Shows the menu; only called when `shouldShowMenu`.
36
+ */
37
+ export declare function runBinary(app: Pick<CLIApplication, "run">, environment: BinaryEnvironment, openMenu: () => Promise<MenuOutcome>): Promise<number>;
38
+ //# sourceMappingURL=bin.runner.d.ts.map