@geekmidas/cli 0.6.1 → 0.7.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 (275) hide show
  1. package/README.md +119 -0
  2. package/dist/config-Bq72aj8e.mjs.map +1 -1
  3. package/dist/config-CFls09Ey.cjs.map +1 -1
  4. package/dist/config.d.cts +2 -2
  5. package/dist/config.d.mts +2 -2
  6. package/dist/index.cjs +2561 -34
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.mjs +2556 -29
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/openapi-Mwy2_R4W.mjs +957 -0
  11. package/dist/openapi-Mwy2_R4W.mjs.map +1 -0
  12. package/dist/{openapi-react-query-_-B3s8v_.mjs → openapi-react-query-CcciaVu5.mjs} +1 -1
  13. package/dist/{openapi-react-query-_-B3s8v_.mjs.map → openapi-react-query-CcciaVu5.mjs.map} +1 -1
  14. package/dist/{openapi-react-query-Cp-w8_05.cjs → openapi-react-query-o5iMi8tz.cjs} +1 -1
  15. package/dist/{openapi-react-query-Cp-w8_05.cjs.map → openapi-react-query-o5iMi8tz.cjs.map} +1 -1
  16. package/dist/openapi-react-query.cjs +1 -1
  17. package/dist/openapi-react-query.mjs +1 -1
  18. package/dist/openapi-tAIbJJU_.cjs +993 -0
  19. package/dist/openapi-tAIbJJU_.cjs.map +1 -0
  20. package/dist/openapi.cjs +1 -4
  21. package/dist/openapi.d.cts +1 -1
  22. package/dist/openapi.d.mts +1 -1
  23. package/dist/openapi.mjs +1 -4
  24. package/dist/{types-Bi7VzDUZ.d.mts → types-B3TXoj7v.d.mts} +21 -53
  25. package/dist/{types-KmjzMgu8.d.cts → types-C0hwnSjm.d.cts} +21 -53
  26. package/package.json +6 -6
  27. package/src/build/types.ts +13 -0
  28. package/src/config.ts +1 -0
  29. package/src/dev/index.ts +71 -8
  30. package/src/generators/EndpointGenerator.ts +46 -5
  31. package/src/generators/__tests__/EndpointGenerator.spec.ts +1 -1
  32. package/src/init/generators/config.ts +6 -1
  33. package/src/init/generators/package.ts +5 -1
  34. package/src/init/index.ts +9 -1
  35. package/src/init/templates/api.ts +31 -0
  36. package/src/init/templates/index.ts +1 -0
  37. package/src/init/templates/minimal.ts +83 -0
  38. package/src/types.ts +19 -0
  39. package/tsdown.config.ts +6 -0
  40. package/dist/CronGenerator-CCRYptuT.mjs +0 -55
  41. package/dist/CronGenerator-CCRYptuT.mjs.map +0 -1
  42. package/dist/CronGenerator-D4TWXQbh.cjs +0 -61
  43. package/dist/CronGenerator-D4TWXQbh.cjs.map +0 -1
  44. package/dist/CronGenerator-DWS3CCZt.d.cts +0 -14
  45. package/dist/CronGenerator-DZjdkEjI.d.mts +0 -14
  46. package/dist/EndpointGenerator-DGivkPLT.mjs +0 -335
  47. package/dist/EndpointGenerator-DGivkPLT.mjs.map +0 -1
  48. package/dist/EndpointGenerator-Dh7kMtuL.d.mts +0 -19
  49. package/dist/EndpointGenerator-npWEDoK2.cjs +0 -341
  50. package/dist/EndpointGenerator-npWEDoK2.cjs.map +0 -1
  51. package/dist/EndpointGenerator-zBsie_7s.d.cts +0 -19
  52. package/dist/FunctionGenerator-BmDHo27U.d.mts +0 -14
  53. package/dist/FunctionGenerator-CVk0h8tO.mjs +0 -54
  54. package/dist/FunctionGenerator-CVk0h8tO.mjs.map +0 -1
  55. package/dist/FunctionGenerator-DXjXBxUd.d.cts +0 -14
  56. package/dist/FunctionGenerator-DYTnyr4c.cjs +0 -60
  57. package/dist/FunctionGenerator-DYTnyr4c.cjs.map +0 -1
  58. package/dist/Generator-BGY-2dgI.d.cts +0 -27
  59. package/dist/Generator-CDt4pB3W.mjs +0 -41
  60. package/dist/Generator-CDt4pB3W.mjs.map +0 -1
  61. package/dist/Generator-CLVplqm2.cjs +0 -47
  62. package/dist/Generator-CLVplqm2.cjs.map +0 -1
  63. package/dist/Generator-yi9DH5TN.d.mts +0 -27
  64. package/dist/OpenApiTsGenerator-BVS4pOH7.mjs +0 -495
  65. package/dist/OpenApiTsGenerator-BVS4pOH7.mjs.map +0 -1
  66. package/dist/OpenApiTsGenerator-gPIIyppX.cjs +0 -501
  67. package/dist/OpenApiTsGenerator-gPIIyppX.cjs.map +0 -1
  68. package/dist/SubscriberGenerator-Bb-z3Kvx.d.cts +0 -15
  69. package/dist/SubscriberGenerator-CwsXqCpS.d.mts +0 -15
  70. package/dist/SubscriberGenerator-DABaJXML.mjs +0 -200
  71. package/dist/SubscriberGenerator-DABaJXML.mjs.map +0 -1
  72. package/dist/SubscriberGenerator-D_zpNGFr.cjs +0 -206
  73. package/dist/SubscriberGenerator-D_zpNGFr.cjs.map +0 -1
  74. package/dist/api-Bp5TIl1R.mjs +0 -167
  75. package/dist/api-Bp5TIl1R.mjs.map +0 -1
  76. package/dist/api-D4W9-tdZ.cjs +0 -173
  77. package/dist/api-D4W9-tdZ.cjs.map +0 -1
  78. package/dist/build/index.cjs +0 -15
  79. package/dist/build/index.d.cts +0 -7
  80. package/dist/build/index.d.mts +0 -7
  81. package/dist/build/index.mjs +0 -15
  82. package/dist/build/manifests.cjs +0 -4
  83. package/dist/build/manifests.d.cts +0 -13
  84. package/dist/build/manifests.d.mts +0 -13
  85. package/dist/build/manifests.mjs +0 -3
  86. package/dist/build/providerResolver.cjs +0 -5
  87. package/dist/build/providerResolver.d.cts +0 -23
  88. package/dist/build/providerResolver.d.mts +0 -23
  89. package/dist/build/providerResolver.mjs +0 -3
  90. package/dist/build/types.cjs +0 -0
  91. package/dist/build/types.d.cts +0 -3
  92. package/dist/build/types.d.mts +0 -3
  93. package/dist/build/types.mjs +0 -0
  94. package/dist/build-Cu6Mi0Lf.mjs +0 -87
  95. package/dist/build-Cu6Mi0Lf.mjs.map +0 -1
  96. package/dist/build-wmt8ZcmA.cjs +0 -93
  97. package/dist/build-wmt8ZcmA.cjs.map +0 -1
  98. package/dist/config-BP1IZynR.cjs +0 -168
  99. package/dist/config-BP1IZynR.cjs.map +0 -1
  100. package/dist/config-CIzRhm_D.d.mts +0 -11
  101. package/dist/config-CvehIYsb.d.cts +0 -11
  102. package/dist/config-UCK12Lrr.mjs +0 -162
  103. package/dist/config-UCK12Lrr.mjs.map +0 -1
  104. package/dist/dev/index.cjs +0 -17
  105. package/dist/dev/index.d.cts +0 -36
  106. package/dist/dev/index.d.mts +0 -36
  107. package/dist/dev/index.mjs +0 -13
  108. package/dist/dev-BBPWSllq.mjs +0 -348
  109. package/dist/dev-BBPWSllq.mjs.map +0 -1
  110. package/dist/dev-C2lCgE53.cjs +0 -378
  111. package/dist/dev-C2lCgE53.cjs.map +0 -1
  112. package/dist/docker-2-ipZDOJ.cjs +0 -119
  113. package/dist/docker-2-ipZDOJ.cjs.map +0 -1
  114. package/dist/docker-31GNwU3F.mjs +0 -113
  115. package/dist/docker-31GNwU3F.mjs.map +0 -1
  116. package/dist/env-CQ3hXAAW.d.mts +0 -11
  117. package/dist/env-CS0jvg7k.cjs +0 -144
  118. package/dist/env-CS0jvg7k.cjs.map +0 -1
  119. package/dist/env-D4YFgMqo.d.cts +0 -11
  120. package/dist/env-DEeVOvVu.mjs +0 -138
  121. package/dist/env-DEeVOvVu.mjs.map +0 -1
  122. package/dist/generators/CronGenerator.cjs +0 -4
  123. package/dist/generators/CronGenerator.d.cts +0 -5
  124. package/dist/generators/CronGenerator.d.mts +0 -5
  125. package/dist/generators/CronGenerator.mjs +0 -4
  126. package/dist/generators/EndpointGenerator.cjs +0 -4
  127. package/dist/generators/EndpointGenerator.d.cts +0 -5
  128. package/dist/generators/EndpointGenerator.d.mts +0 -5
  129. package/dist/generators/EndpointGenerator.mjs +0 -4
  130. package/dist/generators/FunctionGenerator.cjs +0 -4
  131. package/dist/generators/FunctionGenerator.d.cts +0 -5
  132. package/dist/generators/FunctionGenerator.d.mts +0 -5
  133. package/dist/generators/FunctionGenerator.mjs +0 -4
  134. package/dist/generators/Generator.cjs +0 -3
  135. package/dist/generators/Generator.d.cts +0 -4
  136. package/dist/generators/Generator.d.mts +0 -4
  137. package/dist/generators/Generator.mjs +0 -3
  138. package/dist/generators/OpenApiTsGenerator.cjs +0 -3
  139. package/dist/generators/OpenApiTsGenerator.d.cts +0 -44
  140. package/dist/generators/OpenApiTsGenerator.d.mts +0 -44
  141. package/dist/generators/OpenApiTsGenerator.mjs +0 -3
  142. package/dist/generators/SubscriberGenerator.cjs +0 -4
  143. package/dist/generators/SubscriberGenerator.d.cts +0 -5
  144. package/dist/generators/SubscriberGenerator.d.mts +0 -5
  145. package/dist/generators/SubscriberGenerator.mjs +0 -4
  146. package/dist/generators/index.cjs +0 -12
  147. package/dist/generators/index.d.cts +0 -8
  148. package/dist/generators/index.d.mts +0 -8
  149. package/dist/generators/index.mjs +0 -8
  150. package/dist/generators-3IemvCLk.cjs +0 -0
  151. package/dist/generators-FNpdfN6J.mjs +0 -0
  152. package/dist/index-DG6xNQMH.d.cts +0 -81
  153. package/dist/index-DZgrOOOW.d.mts +0 -81
  154. package/dist/init/generators/config.cjs +0 -3
  155. package/dist/init/generators/config.d.cts +0 -3
  156. package/dist/init/generators/config.d.mts +0 -3
  157. package/dist/init/generators/config.mjs +0 -3
  158. package/dist/init/generators/docker.cjs +0 -3
  159. package/dist/init/generators/docker.d.cts +0 -11
  160. package/dist/init/generators/docker.d.mts +0 -11
  161. package/dist/init/generators/docker.mjs +0 -3
  162. package/dist/init/generators/env.cjs +0 -3
  163. package/dist/init/generators/env.d.cts +0 -3
  164. package/dist/init/generators/env.d.mts +0 -3
  165. package/dist/init/generators/env.mjs +0 -3
  166. package/dist/init/generators/index.cjs +0 -14
  167. package/dist/init/generators/index.d.cts +0 -6
  168. package/dist/init/generators/index.d.mts +0 -6
  169. package/dist/init/generators/index.mjs +0 -11
  170. package/dist/init/generators/models.cjs +0 -3
  171. package/dist/init/generators/models.d.cts +0 -11
  172. package/dist/init/generators/models.d.mts +0 -11
  173. package/dist/init/generators/models.mjs +0 -3
  174. package/dist/init/generators/monorepo.cjs +0 -3
  175. package/dist/init/generators/monorepo.d.cts +0 -11
  176. package/dist/init/generators/monorepo.d.mts +0 -11
  177. package/dist/init/generators/monorepo.mjs +0 -3
  178. package/dist/init/generators/package.cjs +0 -8
  179. package/dist/init/generators/package.d.cts +0 -3
  180. package/dist/init/generators/package.d.mts +0 -3
  181. package/dist/init/generators/package.mjs +0 -8
  182. package/dist/init/generators/source.cjs +0 -3
  183. package/dist/init/generators/source.d.cts +0 -3
  184. package/dist/init/generators/source.d.mts +0 -3
  185. package/dist/init/generators/source.mjs +0 -3
  186. package/dist/init/index.cjs +0 -16
  187. package/dist/init/index.d.cts +0 -17
  188. package/dist/init/index.d.mts +0 -17
  189. package/dist/init/index.mjs +0 -16
  190. package/dist/init/templates/api.cjs +0 -3
  191. package/dist/init/templates/api.d.cts +0 -7
  192. package/dist/init/templates/api.d.mts +0 -7
  193. package/dist/init/templates/api.mjs +0 -3
  194. package/dist/init/templates/index.cjs +0 -12
  195. package/dist/init/templates/index.d.cts +0 -2
  196. package/dist/init/templates/index.d.mts +0 -2
  197. package/dist/init/templates/index.mjs +0 -7
  198. package/dist/init/templates/minimal.cjs +0 -3
  199. package/dist/init/templates/minimal.d.cts +0 -7
  200. package/dist/init/templates/minimal.d.mts +0 -7
  201. package/dist/init/templates/minimal.mjs +0 -3
  202. package/dist/init/templates/serverless.cjs +0 -3
  203. package/dist/init/templates/serverless.d.cts +0 -7
  204. package/dist/init/templates/serverless.d.mts +0 -7
  205. package/dist/init/templates/serverless.mjs +0 -3
  206. package/dist/init/templates/worker.cjs +0 -3
  207. package/dist/init/templates/worker.d.cts +0 -7
  208. package/dist/init/templates/worker.d.mts +0 -7
  209. package/dist/init/templates/worker.mjs +0 -3
  210. package/dist/init/utils.cjs +0 -7
  211. package/dist/init/utils.d.cts +0 -25
  212. package/dist/init/utils.d.mts +0 -25
  213. package/dist/init/utils.mjs +0 -3
  214. package/dist/init-BMA7xi8r.mjs +0 -161
  215. package/dist/init-BMA7xi8r.mjs.map +0 -1
  216. package/dist/init-D-7WEk-b.cjs +0 -167
  217. package/dist/init-D-7WEk-b.cjs.map +0 -1
  218. package/dist/manifests-BNKG6AXf.mjs +0 -68
  219. package/dist/manifests-BNKG6AXf.mjs.map +0 -1
  220. package/dist/manifests-D13Ej8AE.cjs +0 -80
  221. package/dist/manifests-D13Ej8AE.cjs.map +0 -1
  222. package/dist/minimal-BkyASH_C.mjs +0 -93
  223. package/dist/minimal-BkyASH_C.mjs.map +0 -1
  224. package/dist/minimal-CSFggzdH.cjs +0 -99
  225. package/dist/minimal-CSFggzdH.cjs.map +0 -1
  226. package/dist/models-BWlDfviw.mjs +0 -115
  227. package/dist/models-BWlDfviw.mjs.map +0 -1
  228. package/dist/models-BapGSoHC.cjs +0 -121
  229. package/dist/models-BapGSoHC.cjs.map +0 -1
  230. package/dist/monorepo-BBOWhkcd.mjs +0 -184
  231. package/dist/monorepo-BBOWhkcd.mjs.map +0 -1
  232. package/dist/monorepo-CFtxHeDh.cjs +0 -190
  233. package/dist/monorepo-CFtxHeDh.cjs.map +0 -1
  234. package/dist/openapi-DA9RkPJl.mjs +0 -74
  235. package/dist/openapi-DA9RkPJl.mjs.map +0 -1
  236. package/dist/openapi-DZH6RQHk.cjs +0 -98
  237. package/dist/openapi-DZH6RQHk.cjs.map +0 -1
  238. package/dist/package-6h-7QfJZ.d.cts +0 -11
  239. package/dist/package-BCe_KvGv.d.mts +0 -11
  240. package/dist/package-C3If80n1.mjs +0 -57
  241. package/dist/package-C3If80n1.mjs.map +0 -1
  242. package/dist/package-Dk8IMBOB.cjs +0 -62
  243. package/dist/package-Dk8IMBOB.cjs.map +0 -1
  244. package/dist/providerResolver-DEVKngbC.mjs +0 -96
  245. package/dist/providerResolver-DEVKngbC.mjs.map +0 -1
  246. package/dist/providerResolver-DOTbN9jo.cjs +0 -114
  247. package/dist/providerResolver-DOTbN9jo.cjs.map +0 -1
  248. package/dist/serverless-AGOS-l3G.cjs +0 -119
  249. package/dist/serverless-AGOS-l3G.cjs.map +0 -1
  250. package/dist/serverless-D5HjJByU.mjs +0 -113
  251. package/dist/serverless-D5HjJByU.mjs.map +0 -1
  252. package/dist/source-C1cyfHcF.cjs +0 -17
  253. package/dist/source-C1cyfHcF.cjs.map +0 -1
  254. package/dist/source-C3LiNUV9.d.mts +0 -11
  255. package/dist/source-CkQHBpwu.mjs +0 -11
  256. package/dist/source-CkQHBpwu.mjs.map +0 -1
  257. package/dist/source-Dtcjbokc.d.cts +0 -11
  258. package/dist/templates-C0EMmhwb.mjs +0 -88
  259. package/dist/templates-C0EMmhwb.mjs.map +0 -1
  260. package/dist/templates-CbgQ9dw0.cjs +0 -123
  261. package/dist/templates-CbgQ9dw0.cjs.map +0 -1
  262. package/dist/types-D2xYkOal.d.mts +0 -51
  263. package/dist/types-DA-r8HWZ.d.cts +0 -51
  264. package/dist/types.cjs +0 -0
  265. package/dist/types.d.cts +0 -2
  266. package/dist/types.d.mts +0 -2
  267. package/dist/types.mjs +0 -0
  268. package/dist/utils-CKEzCxc1.mjs +0 -69
  269. package/dist/utils-CKEzCxc1.mjs.map +0 -1
  270. package/dist/utils-DSdN2MTt.cjs +0 -99
  271. package/dist/utils-DSdN2MTt.cjs.map +0 -1
  272. package/dist/worker-CGhlqNH-.cjs +0 -156
  273. package/dist/worker-CGhlqNH-.cjs.map +0 -1
  274. package/dist/worker-CiP420As.mjs +0 -150
  275. package/dist/worker-CiP420As.mjs.map +0 -1
@@ -1,25 +0,0 @@
1
- //#region src/init/utils.d.ts
2
- type PackageManager = 'pnpm' | 'npm' | 'yarn' | 'bun';
3
- /**
4
- * Detect the package manager being used based on lockfiles or npm_config_user_agent
5
- */
6
- declare function detectPackageManager(cwd?: string): PackageManager;
7
- /**
8
- * Validate project name for npm package naming conventions
9
- */
10
- declare function validateProjectName(name: string): boolean | string;
11
- /**
12
- * Check if a directory already exists at the target path
13
- */
14
- declare function checkDirectoryExists(name: string, cwd?: string): boolean | string;
15
- /**
16
- * Get the install command for a package manager
17
- */
18
- declare function getInstallCommand(pkgManager: PackageManager): string;
19
- /**
20
- * Get the dev command for a package manager
21
- */
22
- declare function getRunCommand(pkgManager: PackageManager, script: string): string;
23
- //#endregion
24
- export { PackageManager, checkDirectoryExists, detectPackageManager, getInstallCommand, getRunCommand, validateProjectName };
25
- //# sourceMappingURL=utils.d.cts.map
@@ -1,25 +0,0 @@
1
- //#region src/init/utils.d.ts
2
- type PackageManager = 'pnpm' | 'npm' | 'yarn' | 'bun';
3
- /**
4
- * Detect the package manager being used based on lockfiles or npm_config_user_agent
5
- */
6
- declare function detectPackageManager(cwd?: string): PackageManager;
7
- /**
8
- * Validate project name for npm package naming conventions
9
- */
10
- declare function validateProjectName(name: string): boolean | string;
11
- /**
12
- * Check if a directory already exists at the target path
13
- */
14
- declare function checkDirectoryExists(name: string, cwd?: string): boolean | string;
15
- /**
16
- * Get the install command for a package manager
17
- */
18
- declare function getInstallCommand(pkgManager: PackageManager): string;
19
- /**
20
- * Get the dev command for a package manager
21
- */
22
- declare function getRunCommand(pkgManager: PackageManager, script: string): string;
23
- //#endregion
24
- export { PackageManager, checkDirectoryExists, detectPackageManager, getInstallCommand, getRunCommand, validateProjectName };
25
- //# sourceMappingURL=utils.d.mts.map
@@ -1,3 +0,0 @@
1
- import { checkDirectoryExists, detectPackageManager, getInstallCommand, getRunCommand, validateProjectName } from "../utils-CKEzCxc1.mjs";
2
-
3
- export { checkDirectoryExists, detectPackageManager, getInstallCommand, getRunCommand, validateProjectName };
@@ -1,161 +0,0 @@
1
- import { generateConfigFiles } from "./config-UCK12Lrr.mjs";
2
- import { generateDockerFiles } from "./docker-31GNwU3F.mjs";
3
- import { generateEnvFiles } from "./env-DEeVOvVu.mjs";
4
- import { generateModelsPackage } from "./models-BWlDfviw.mjs";
5
- import { generateMonorepoFiles } from "./monorepo-BBOWhkcd.mjs";
6
- import { getTemplate, loggerTypeChoices, routesStructureChoices, templateChoices } from "./templates-C0EMmhwb.mjs";
7
- import { generatePackageJson } from "./package-C3If80n1.mjs";
8
- import { generateSourceFiles } from "./source-CkQHBpwu.mjs";
9
- import { checkDirectoryExists, detectPackageManager, getInstallCommand, getRunCommand, validateProjectName } from "./utils-CKEzCxc1.mjs";
10
- import { mkdir, writeFile } from "node:fs/promises";
11
- import { dirname, join } from "node:path";
12
- import { execSync } from "node:child_process";
13
- import prompts from "prompts";
14
-
15
- //#region src/init/index.ts
16
- /**
17
- * Main init command - scaffolds a new project
18
- */
19
- async function initCommand(projectName, options = {}) {
20
- const cwd = process.cwd();
21
- const pkgManager = detectPackageManager(cwd);
22
- prompts.override({});
23
- const onCancel = () => {
24
- process.exit(0);
25
- };
26
- const answers = await prompts([
27
- {
28
- type: projectName ? null : "text",
29
- name: "name",
30
- message: "Project name:",
31
- initial: "my-api",
32
- validate: (value) => {
33
- const nameValid = validateProjectName(value);
34
- if (nameValid !== true) return nameValid;
35
- const dirValid = checkDirectoryExists(value, cwd);
36
- if (dirValid !== true) return dirValid;
37
- return true;
38
- }
39
- },
40
- {
41
- type: options.template || options.yes ? null : "select",
42
- name: "template",
43
- message: "Template:",
44
- choices: templateChoices,
45
- initial: 0
46
- },
47
- {
48
- type: options.yes ? null : "confirm",
49
- name: "telescope",
50
- message: "Include Telescope (debugging dashboard)?",
51
- initial: true
52
- },
53
- {
54
- type: options.yes ? null : "confirm",
55
- name: "database",
56
- message: "Include database support (Kysely)?",
57
- initial: true
58
- },
59
- {
60
- type: options.yes ? null : "select",
61
- name: "loggerType",
62
- message: "Logger:",
63
- choices: loggerTypeChoices,
64
- initial: 0
65
- },
66
- {
67
- type: options.yes ? null : "select",
68
- name: "routesStructure",
69
- message: "Routes structure:",
70
- choices: routesStructureChoices,
71
- initial: 0
72
- },
73
- {
74
- type: options.yes || options.monorepo !== void 0 ? null : "confirm",
75
- name: "monorepo",
76
- message: "Setup as monorepo?",
77
- initial: false
78
- },
79
- {
80
- type: (prev) => (prev === true || options.monorepo) && !options.apiPath ? "text" : null,
81
- name: "apiPath",
82
- message: "API app path:",
83
- initial: "apps/api"
84
- }
85
- ], { onCancel });
86
- const name = projectName || answers.name;
87
- if (!name) {
88
- console.error(" Error: Project name is required\n");
89
- process.exit(1);
90
- }
91
- if (projectName) {
92
- const nameValid = validateProjectName(projectName);
93
- if (nameValid !== true) {
94
- console.error(` Error: ${nameValid}\n`);
95
- process.exit(1);
96
- }
97
- const dirValid = checkDirectoryExists(projectName, cwd);
98
- if (dirValid !== true) {
99
- console.error(` Error: ${dirValid}\n`);
100
- process.exit(1);
101
- }
102
- }
103
- const monorepo = options.monorepo ?? (options.yes ? false : answers.monorepo ?? false);
104
- const templateOptions = {
105
- name,
106
- template: options.template || answers.template || "minimal",
107
- telescope: options.yes ? true : answers.telescope ?? true,
108
- database: options.yes ? true : answers.database ?? true,
109
- loggerType: options.yes ? "pino" : answers.loggerType ?? "pino",
110
- routesStructure: options.yes ? "centralized-endpoints" : answers.routesStructure ?? "centralized-endpoints",
111
- monorepo,
112
- apiPath: monorepo ? options.apiPath ?? answers.apiPath ?? "apps/api" : ""
113
- };
114
- const targetDir = join(cwd, name);
115
- const template = getTemplate(templateOptions.template);
116
- const isMonorepo = templateOptions.monorepo;
117
- const apiPath = templateOptions.apiPath;
118
- await mkdir(targetDir, { recursive: true });
119
- const appDir = isMonorepo ? join(targetDir, apiPath) : targetDir;
120
- if (isMonorepo) await mkdir(appDir, { recursive: true });
121
- const appFiles = [
122
- ...generatePackageJson(templateOptions, template),
123
- ...generateConfigFiles(templateOptions, template),
124
- ...generateEnvFiles(templateOptions, template),
125
- ...generateSourceFiles(templateOptions, template),
126
- ...generateDockerFiles(templateOptions, template)
127
- ];
128
- const rootFiles = [...generateMonorepoFiles(templateOptions, template), ...generateModelsPackage(templateOptions)];
129
- for (const { path, content } of rootFiles) {
130
- const fullPath = join(targetDir, path);
131
- await mkdir(dirname(fullPath), { recursive: true });
132
- await writeFile(fullPath, content);
133
- }
134
- for (const { path, content } of appFiles) {
135
- const fullPath = join(appDir, path);
136
- const displayPath = isMonorepo ? `${apiPath}/${path}` : path;
137
- await mkdir(dirname(fullPath), { recursive: true });
138
- await writeFile(fullPath, content);
139
- }
140
- if (!options.skipInstall) {
141
- try {
142
- execSync(getInstallCommand(pkgManager), {
143
- cwd: targetDir,
144
- stdio: "inherit"
145
- });
146
- } catch {
147
- console.error("\n Warning: Failed to install dependencies.");
148
- }
149
- try {
150
- execSync("npx @biomejs/biome format --write --unsafe .", {
151
- cwd: targetDir,
152
- stdio: "inherit"
153
- });
154
- } catch {}
155
- }
156
- const devCommand = getRunCommand(pkgManager, "dev");
157
- }
158
-
159
- //#endregion
160
- export { initCommand };
161
- //# sourceMappingURL=init-BMA7xi8r.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-BMA7xi8r.mjs","names":["projectName?: string","options: InitOptions","value: string","templateOptions: TemplateOptions"],"sources":["../src/init/index.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport prompts from 'prompts';\nimport { generateConfigFiles } from './generators/config.js';\nimport { generateDockerFiles } from './generators/docker.js';\nimport { generateEnvFiles } from './generators/env.js';\nimport { generateModelsPackage } from './generators/models.js';\nimport { generateMonorepoFiles } from './generators/monorepo.js';\nimport { generatePackageJson } from './generators/package.js';\nimport { generateSourceFiles } from './generators/source.js';\nimport {\n type TemplateName,\n type TemplateOptions,\n getTemplate,\n loggerTypeChoices,\n routesStructureChoices,\n templateChoices,\n} from './templates/index.js';\nimport {\n checkDirectoryExists,\n detectPackageManager,\n getInstallCommand,\n getRunCommand,\n validateProjectName,\n} from './utils.js';\n\nexport interface InitOptions {\n template?: TemplateName;\n skipInstall?: boolean;\n yes?: boolean;\n monorepo?: boolean;\n apiPath?: string;\n}\n\n/**\n * Main init command - scaffolds a new project\n */\nexport async function initCommand(\n projectName?: string,\n options: InitOptions = {},\n): Promise<void> {\n const cwd = process.cwd();\n const pkgManager = detectPackageManager(cwd);\n\n // Handle Ctrl+C gracefully\n prompts.override({});\n const onCancel = () => {\n process.exit(0);\n };\n\n // Gather answers via prompts\n const answers = await prompts(\n [\n {\n type: projectName ? null : 'text',\n name: 'name',\n message: 'Project name:',\n initial: 'my-api',\n validate: (value: string) => {\n const nameValid = validateProjectName(value);\n if (nameValid !== true) return nameValid;\n const dirValid = checkDirectoryExists(value, cwd);\n if (dirValid !== true) return dirValid;\n return true;\n },\n },\n {\n type: options.template || options.yes ? null : 'select',\n name: 'template',\n message: 'Template:',\n choices: templateChoices,\n initial: 0,\n },\n {\n type: options.yes ? null : 'confirm',\n name: 'telescope',\n message: 'Include Telescope (debugging dashboard)?',\n initial: true,\n },\n {\n type: options.yes ? null : 'confirm',\n name: 'database',\n message: 'Include database support (Kysely)?',\n initial: true,\n },\n {\n type: options.yes ? null : 'select',\n name: 'loggerType',\n message: 'Logger:',\n choices: loggerTypeChoices,\n initial: 0,\n },\n {\n type: options.yes ? null : 'select',\n name: 'routesStructure',\n message: 'Routes structure:',\n choices: routesStructureChoices,\n initial: 0,\n },\n {\n type: options.yes || options.monorepo !== undefined ? null : 'confirm',\n name: 'monorepo',\n message: 'Setup as monorepo?',\n initial: false,\n },\n {\n type: (prev) =>\n (prev === true || options.monorepo) && !options.apiPath\n ? 'text'\n : null,\n name: 'apiPath',\n message: 'API app path:',\n initial: 'apps/api',\n },\n ],\n { onCancel },\n );\n\n // Build final options\n const name = projectName || answers.name;\n if (!name) {\n console.error(' Error: Project name is required\\n');\n process.exit(1);\n }\n\n // Validate name if provided via argument\n if (projectName) {\n const nameValid = validateProjectName(projectName);\n if (nameValid !== true) {\n console.error(` Error: ${nameValid}\\n`);\n process.exit(1);\n }\n const dirValid = checkDirectoryExists(projectName, cwd);\n if (dirValid !== true) {\n console.error(` Error: ${dirValid}\\n`);\n process.exit(1);\n }\n }\n\n const monorepo =\n options.monorepo ?? (options.yes ? false : (answers.monorepo ?? false));\n const templateOptions: TemplateOptions = {\n name,\n template: options.template || answers.template || 'minimal',\n telescope: options.yes ? true : (answers.telescope ?? true),\n database: options.yes ? true : (answers.database ?? true),\n loggerType: options.yes ? 'pino' : (answers.loggerType ?? 'pino'),\n routesStructure: options.yes\n ? 'centralized-endpoints'\n : (answers.routesStructure ?? 'centralized-endpoints'),\n monorepo,\n apiPath: monorepo ? (options.apiPath ?? answers.apiPath ?? 'apps/api') : '',\n };\n\n const targetDir = join(cwd, name);\n const template = getTemplate(templateOptions.template);\n\n const isMonorepo = templateOptions.monorepo;\n const apiPath = templateOptions.apiPath;\n\n // Create project directory\n await mkdir(targetDir, { recursive: true });\n\n // For monorepo, app files go in the specified apiPath (e.g., apps/api)\n const appDir = isMonorepo ? join(targetDir, apiPath) : targetDir;\n if (isMonorepo) {\n await mkdir(appDir, { recursive: true });\n }\n\n // Collect app files\n const appFiles = [\n ...generatePackageJson(templateOptions, template),\n ...generateConfigFiles(templateOptions, template),\n ...generateEnvFiles(templateOptions, template),\n ...generateSourceFiles(templateOptions, template),\n ...generateDockerFiles(templateOptions, template),\n ];\n\n // Collect root monorepo files (includes packages/models)\n const rootFiles = [\n ...generateMonorepoFiles(templateOptions, template),\n ...generateModelsPackage(templateOptions),\n ];\n\n // Write root files (for monorepo)\n for (const { path, content } of rootFiles) {\n const fullPath = join(targetDir, path);\n await mkdir(dirname(fullPath), { recursive: true });\n await writeFile(fullPath, content);\n }\n\n // Write app files\n for (const { path, content } of appFiles) {\n const fullPath = join(appDir, path);\n const displayPath = isMonorepo ? `${apiPath}/${path}` : path;\n await mkdir(dirname(fullPath), { recursive: true });\n await writeFile(fullPath, content);\n }\n\n // Install dependencies\n if (!options.skipInstall) {\n try {\n execSync(getInstallCommand(pkgManager), {\n cwd: targetDir,\n stdio: 'inherit',\n });\n } catch {\n console.error('\\n Warning: Failed to install dependencies.');\n }\n\n // Format generated files with biome\n try {\n execSync('npx @biomejs/biome format --write --unsafe .', {\n cwd: targetDir,\n stdio: 'inherit',\n });\n } catch {\n // Silently ignore format errors\n }\n }\n\n // Print next steps\n const devCommand = getRunCommand(pkgManager, 'dev');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA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AAM,EAAE,MAAM,SAAS,IAAI,WAAW;EACzC,MAAM,WAAW,KAAK,WAAW,KAAK;AACtC,QAAM,MAAM,QAAQ,SAAS,EAAE,EAAE,WAAW,KAAM,EAAC;AACnD,QAAM,UAAU,UAAU,QAAQ;CACnC;AAGD,MAAK,MAAM,EAAE,MAAM,SAAS,IAAI,UAAU;EACxC,MAAM,WAAW,KAAK,QAAQ,KAAK;EACnC,MAAM,cAAc,cAAc,EAAE,QAAQ,GAAG,KAAK,IAAI;AACxD,QAAM,MAAM,QAAQ,SAAS,EAAE,EAAE,WAAW,KAAM,EAAC;AACnD,QAAM,UAAU,UAAU,QAAQ;CACnC;AAGD,MAAK,QAAQ,aAAa;AACxB,MAAI;AACF,YAAS,kBAAkB,WAAW,EAAE;IACtC,KAAK;IACL,OAAO;GACR,EAAC;EACH,QAAO;AACN,WAAQ,MAAM,+CAA+C;EAC9D;AAGD,MAAI;AACF,YAAS,gDAAgD;IACvD,KAAK;IACL,OAAO;GACR,EAAC;EACH,QAAO,CAEP;CACF;CAGD,MAAM,aAAa,cAAc,YAAY,MAAM;AACpD"}
@@ -1,167 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_config = require('./config-BP1IZynR.cjs');
3
- const require_docker = require('./docker-2-ipZDOJ.cjs');
4
- const require_env = require('./env-CS0jvg7k.cjs');
5
- const require_models = require('./models-BapGSoHC.cjs');
6
- const require_monorepo = require('./monorepo-CFtxHeDh.cjs');
7
- const require_templates = require('./templates-CbgQ9dw0.cjs');
8
- const require_package = require('./package-Dk8IMBOB.cjs');
9
- const require_source = require('./source-C1cyfHcF.cjs');
10
- const require_utils = require('./utils-DSdN2MTt.cjs');
11
- const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
12
- const node_path = require_chunk.__toESM(require("node:path"));
13
- const node_child_process = require_chunk.__toESM(require("node:child_process"));
14
- const prompts = require_chunk.__toESM(require("prompts"));
15
-
16
- //#region src/init/index.ts
17
- /**
18
- * Main init command - scaffolds a new project
19
- */
20
- async function initCommand(projectName, options = {}) {
21
- const cwd = process.cwd();
22
- const pkgManager = require_utils.detectPackageManager(cwd);
23
- prompts.default.override({});
24
- const onCancel = () => {
25
- process.exit(0);
26
- };
27
- const answers = await (0, prompts.default)([
28
- {
29
- type: projectName ? null : "text",
30
- name: "name",
31
- message: "Project name:",
32
- initial: "my-api",
33
- validate: (value) => {
34
- const nameValid = require_utils.validateProjectName(value);
35
- if (nameValid !== true) return nameValid;
36
- const dirValid = require_utils.checkDirectoryExists(value, cwd);
37
- if (dirValid !== true) return dirValid;
38
- return true;
39
- }
40
- },
41
- {
42
- type: options.template || options.yes ? null : "select",
43
- name: "template",
44
- message: "Template:",
45
- choices: require_templates.templateChoices,
46
- initial: 0
47
- },
48
- {
49
- type: options.yes ? null : "confirm",
50
- name: "telescope",
51
- message: "Include Telescope (debugging dashboard)?",
52
- initial: true
53
- },
54
- {
55
- type: options.yes ? null : "confirm",
56
- name: "database",
57
- message: "Include database support (Kysely)?",
58
- initial: true
59
- },
60
- {
61
- type: options.yes ? null : "select",
62
- name: "loggerType",
63
- message: "Logger:",
64
- choices: require_templates.loggerTypeChoices,
65
- initial: 0
66
- },
67
- {
68
- type: options.yes ? null : "select",
69
- name: "routesStructure",
70
- message: "Routes structure:",
71
- choices: require_templates.routesStructureChoices,
72
- initial: 0
73
- },
74
- {
75
- type: options.yes || options.monorepo !== void 0 ? null : "confirm",
76
- name: "monorepo",
77
- message: "Setup as monorepo?",
78
- initial: false
79
- },
80
- {
81
- type: (prev) => (prev === true || options.monorepo) && !options.apiPath ? "text" : null,
82
- name: "apiPath",
83
- message: "API app path:",
84
- initial: "apps/api"
85
- }
86
- ], { onCancel });
87
- const name = projectName || answers.name;
88
- if (!name) {
89
- console.error(" Error: Project name is required\n");
90
- process.exit(1);
91
- }
92
- if (projectName) {
93
- const nameValid = require_utils.validateProjectName(projectName);
94
- if (nameValid !== true) {
95
- console.error(` Error: ${nameValid}\n`);
96
- process.exit(1);
97
- }
98
- const dirValid = require_utils.checkDirectoryExists(projectName, cwd);
99
- if (dirValid !== true) {
100
- console.error(` Error: ${dirValid}\n`);
101
- process.exit(1);
102
- }
103
- }
104
- const monorepo = options.monorepo ?? (options.yes ? false : answers.monorepo ?? false);
105
- const templateOptions = {
106
- name,
107
- template: options.template || answers.template || "minimal",
108
- telescope: options.yes ? true : answers.telescope ?? true,
109
- database: options.yes ? true : answers.database ?? true,
110
- loggerType: options.yes ? "pino" : answers.loggerType ?? "pino",
111
- routesStructure: options.yes ? "centralized-endpoints" : answers.routesStructure ?? "centralized-endpoints",
112
- monorepo,
113
- apiPath: monorepo ? options.apiPath ?? answers.apiPath ?? "apps/api" : ""
114
- };
115
- const targetDir = (0, node_path.join)(cwd, name);
116
- const template = require_templates.getTemplate(templateOptions.template);
117
- const isMonorepo = templateOptions.monorepo;
118
- const apiPath = templateOptions.apiPath;
119
- await (0, node_fs_promises.mkdir)(targetDir, { recursive: true });
120
- const appDir = isMonorepo ? (0, node_path.join)(targetDir, apiPath) : targetDir;
121
- if (isMonorepo) await (0, node_fs_promises.mkdir)(appDir, { recursive: true });
122
- const appFiles = [
123
- ...require_package.generatePackageJson(templateOptions, template),
124
- ...require_config.generateConfigFiles(templateOptions, template),
125
- ...require_env.generateEnvFiles(templateOptions, template),
126
- ...require_source.generateSourceFiles(templateOptions, template),
127
- ...require_docker.generateDockerFiles(templateOptions, template)
128
- ];
129
- const rootFiles = [...require_monorepo.generateMonorepoFiles(templateOptions, template), ...require_models.generateModelsPackage(templateOptions)];
130
- for (const { path, content } of rootFiles) {
131
- const fullPath = (0, node_path.join)(targetDir, path);
132
- await (0, node_fs_promises.mkdir)((0, node_path.dirname)(fullPath), { recursive: true });
133
- await (0, node_fs_promises.writeFile)(fullPath, content);
134
- }
135
- for (const { path, content } of appFiles) {
136
- const fullPath = (0, node_path.join)(appDir, path);
137
- const displayPath = isMonorepo ? `${apiPath}/${path}` : path;
138
- await (0, node_fs_promises.mkdir)((0, node_path.dirname)(fullPath), { recursive: true });
139
- await (0, node_fs_promises.writeFile)(fullPath, content);
140
- }
141
- if (!options.skipInstall) {
142
- try {
143
- (0, node_child_process.execSync)(require_utils.getInstallCommand(pkgManager), {
144
- cwd: targetDir,
145
- stdio: "inherit"
146
- });
147
- } catch {
148
- console.error("\n Warning: Failed to install dependencies.");
149
- }
150
- try {
151
- (0, node_child_process.execSync)("npx @biomejs/biome format --write --unsafe .", {
152
- cwd: targetDir,
153
- stdio: "inherit"
154
- });
155
- } catch {}
156
- }
157
- const devCommand = require_utils.getRunCommand(pkgManager, "dev");
158
- }
159
-
160
- //#endregion
161
- Object.defineProperty(exports, 'initCommand', {
162
- enumerable: true,
163
- get: function () {
164
- return initCommand;
165
- }
166
- });
167
- //# sourceMappingURL=init-D-7WEk-b.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-D-7WEk-b.cjs","names":["projectName?: string","options: InitOptions","value: string","templateChoices","loggerTypeChoices","routesStructureChoices","templateOptions: TemplateOptions"],"sources":["../src/init/index.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport prompts from 'prompts';\nimport { generateConfigFiles } from './generators/config.js';\nimport { generateDockerFiles } from './generators/docker.js';\nimport { generateEnvFiles } from './generators/env.js';\nimport { generateModelsPackage } from './generators/models.js';\nimport { generateMonorepoFiles } from './generators/monorepo.js';\nimport { generatePackageJson } from './generators/package.js';\nimport { generateSourceFiles } from './generators/source.js';\nimport {\n type TemplateName,\n type TemplateOptions,\n getTemplate,\n loggerTypeChoices,\n routesStructureChoices,\n templateChoices,\n} from './templates/index.js';\nimport {\n checkDirectoryExists,\n detectPackageManager,\n getInstallCommand,\n getRunCommand,\n validateProjectName,\n} from './utils.js';\n\nexport interface InitOptions {\n template?: TemplateName;\n skipInstall?: boolean;\n yes?: boolean;\n monorepo?: boolean;\n apiPath?: string;\n}\n\n/**\n * Main init command - scaffolds a new project\n */\nexport async function initCommand(\n projectName?: string,\n options: InitOptions = {},\n): Promise<void> {\n const cwd = process.cwd();\n const pkgManager = detectPackageManager(cwd);\n\n // Handle Ctrl+C gracefully\n prompts.override({});\n const onCancel = () => {\n process.exit(0);\n };\n\n // Gather answers via prompts\n const answers = await prompts(\n [\n {\n type: projectName ? null : 'text',\n name: 'name',\n message: 'Project name:',\n initial: 'my-api',\n validate: (value: string) => {\n const nameValid = validateProjectName(value);\n if (nameValid !== true) return nameValid;\n const dirValid = checkDirectoryExists(value, cwd);\n if (dirValid !== true) return dirValid;\n return true;\n },\n },\n {\n type: options.template || options.yes ? null : 'select',\n name: 'template',\n message: 'Template:',\n choices: templateChoices,\n initial: 0,\n },\n {\n type: options.yes ? null : 'confirm',\n name: 'telescope',\n message: 'Include Telescope (debugging dashboard)?',\n initial: true,\n },\n {\n type: options.yes ? null : 'confirm',\n name: 'database',\n message: 'Include database support (Kysely)?',\n initial: true,\n },\n {\n type: options.yes ? null : 'select',\n name: 'loggerType',\n message: 'Logger:',\n choices: loggerTypeChoices,\n initial: 0,\n },\n {\n type: options.yes ? null : 'select',\n name: 'routesStructure',\n message: 'Routes structure:',\n choices: routesStructureChoices,\n initial: 0,\n },\n {\n type: options.yes || options.monorepo !== undefined ? null : 'confirm',\n name: 'monorepo',\n message: 'Setup as monorepo?',\n initial: false,\n },\n {\n type: (prev) =>\n (prev === true || options.monorepo) && !options.apiPath\n ? 'text'\n : null,\n name: 'apiPath',\n message: 'API app path:',\n initial: 'apps/api',\n },\n ],\n { onCancel },\n );\n\n // Build final options\n const name = projectName || answers.name;\n if (!name) {\n console.error(' Error: Project name is required\\n');\n process.exit(1);\n }\n\n // Validate name if provided via argument\n if (projectName) {\n const nameValid = validateProjectName(projectName);\n if (nameValid !== true) {\n console.error(` Error: ${nameValid}\\n`);\n process.exit(1);\n }\n const dirValid = checkDirectoryExists(projectName, cwd);\n if (dirValid !== true) {\n console.error(` Error: ${dirValid}\\n`);\n process.exit(1);\n }\n }\n\n const monorepo =\n options.monorepo ?? (options.yes ? false : (answers.monorepo ?? false));\n const templateOptions: TemplateOptions = {\n name,\n template: options.template || answers.template || 'minimal',\n telescope: options.yes ? true : (answers.telescope ?? true),\n database: options.yes ? true : (answers.database ?? true),\n loggerType: options.yes ? 'pino' : (answers.loggerType ?? 'pino'),\n routesStructure: options.yes\n ? 'centralized-endpoints'\n : (answers.routesStructure ?? 'centralized-endpoints'),\n monorepo,\n apiPath: monorepo ? (options.apiPath ?? answers.apiPath ?? 'apps/api') : '',\n };\n\n const targetDir = join(cwd, name);\n const template = getTemplate(templateOptions.template);\n\n const isMonorepo = templateOptions.monorepo;\n const apiPath = templateOptions.apiPath;\n\n // Create project directory\n await mkdir(targetDir, { recursive: true });\n\n // For monorepo, app files go in the specified apiPath (e.g., apps/api)\n const appDir = isMonorepo ? join(targetDir, apiPath) : targetDir;\n if (isMonorepo) {\n await mkdir(appDir, { recursive: true });\n }\n\n // Collect app files\n const appFiles = [\n ...generatePackageJson(templateOptions, template),\n ...generateConfigFiles(templateOptions, template),\n ...generateEnvFiles(templateOptions, template),\n ...generateSourceFiles(templateOptions, template),\n ...generateDockerFiles(templateOptions, template),\n ];\n\n // Collect root monorepo files (includes packages/models)\n const rootFiles = [\n ...generateMonorepoFiles(templateOptions, template),\n ...generateModelsPackage(templateOptions),\n ];\n\n // Write root files (for monorepo)\n for (const { path, content } of rootFiles) {\n const fullPath = join(targetDir, path);\n await mkdir(dirname(fullPath), { recursive: true });\n await writeFile(fullPath, content);\n }\n\n // Write app files\n for (const { path, content } of appFiles) {\n const fullPath = join(appDir, path);\n const displayPath = isMonorepo ? `${apiPath}/${path}` : path;\n await mkdir(dirname(fullPath), { recursive: true });\n await writeFile(fullPath, content);\n }\n\n // Install dependencies\n if (!options.skipInstall) {\n try {\n execSync(getInstallCommand(pkgManager), {\n cwd: targetDir,\n stdio: 'inherit',\n });\n } catch {\n console.error('\\n Warning: Failed to install dependencies.');\n }\n\n // Format generated files with biome\n try {\n execSync('npx @biomejs/biome format --write --unsafe .', {\n cwd: targetDir,\n stdio: 'inherit',\n });\n } catch {\n // Silently ignore format errors\n }\n }\n\n // Print next steps\n const devCommand = getRunCommand(pkgManager, 'dev');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,eAAsB,YACpBA,aACAC,UAAuB,CAAE,GACV;CACf,MAAM,MAAM,QAAQ,KAAK;CACzB,MAAM,aAAa,mCAAqB,IAAI;AAG5C,iBAAQ,SAAS,CAAE,EAAC;CACpB,MAAM,WAAW,MAAM;AACrB,UAAQ,KAAK,EAAE;CAChB;CAGD,MAAM,UAAU,MAAM,qBACpB;EACE;GACE,MAAM,cAAc,OAAO;GAC3B,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU,CAACC,UAAkB;IAC3B,MAAM,YAAY,kCAAoB,MAAM;AAC5C,QAAI,cAAc,KAAM,QAAO;IAC/B,MAAM,WAAW,mCAAqB,OAAO,IAAI;AACjD,QAAI,aAAa,KAAM,QAAO;AAC9B,WAAO;GACR;EACF;EACD;GACE,MAAM,QAAQ,YAAY,QAAQ,MAAM,OAAO;GAC/C,MAAM;GACN,SAAS;GACT,SAASC;GACT,SAAS;EACV;EACD;GACE,MAAM,QAAQ,MAAM,OAAO;GAC3B,MAAM;GACN,SAAS;GACT,SAAS;EACV;EACD;GACE,MAAM,QAAQ,MAAM,OAAO;GAC3B,MAAM;GACN,SAAS;GACT,SAAS;EACV;EACD;GACE,MAAM,QAAQ,MAAM,OAAO;GAC3B,MAAM;GACN,SAAS;GACT,SAASC;GACT,SAAS;EACV;EACD;GACE,MAAM,QAAQ,MAAM,OAAO;GAC3B,MAAM;GACN,SAAS;GACT,SAASC;GACT,SAAS;EACV;EACD;GACE,MAAM,QAAQ,OAAO,QAAQ,sBAAyB,OAAO;GAC7D,MAAM;GACN,SAAS;GACT,SAAS;EACV;EACD;GACE,MAAM,CAAC,UACJ,SAAS,QAAQ,QAAQ,cAAc,QAAQ,UAC5C,SACA;GACN,MA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;EAC9C,GAAG,mCAAoB,iBAAiB,SAAS;EACjD,GAAG,mCAAoB,iBAAiB,SAAS;CAClD;CAGD,MAAM,YAAY,CAChB,GAAG,uCAAsB,iBAAiB,SAAS,EACnD,GAAG,qCAAsB,gBAAgB,AAC1C;AAGD,MAAK,MAAM,EAAE,MAAM,SAAS,IAAI,WAAW;EACzC,MAAM,WAAW,oBAAK,WAAW,KAAK;AACtC,QAAM,4BAAM,uBAAQ,SAAS,EAAE,EAAE,WAAW,KAAM,EAAC;AACnD,QAAM,gCAAU,UAAU,QAAQ;CACnC;AAGD,MAAK,MAAM,EAAE,MAAM,SAAS,IAAI,UAAU;EACxC,MAAM,WAAW,oBAAK,QAAQ,KAAK;EACnC,MAAM,cAAc,cAAc,EAAE,QAAQ,GAAG,KAAK,IAAI;AACxD,QAAM,4BAAM,uBAAQ,SAAS,EAAE,EAAE,WAAW,KAAM,EAAC;AACnD,QAAM,gCAAU,UAAU,QAAQ;CACnC;AAGD,MAAK,QAAQ,aAAa;AACxB,MAAI;AACF,oCAAS,gCAAkB,WAAW,EAAE;IACtC,KAAK;IACL,OAAO;GACR,EAAC;EACH,QAAO;AACN,WAAQ,MAAM,+CAA+C;EAC9D;AAGD,MAAI;AACF,oCAAS,gDAAgD;IACvD,KAAK;IACL,OAAO;GACR,EAAC;EACH,QAAO,CAEP;CACF;CAGD,MAAM,aAAa,4BAAc,YAAY,MAAM;AACpD"}
@@ -1,68 +0,0 @@
1
- import { join, relative } from "path";
2
- import { mkdir, writeFile } from "node:fs/promises";
3
-
4
- //#region src/build/manifests.ts
5
- const logger = console;
6
- async function generateAwsManifest(outputDir, routes, functions, crons, subscribers) {
7
- const manifestDir = join(outputDir, "manifest");
8
- await mkdir(manifestDir, { recursive: true });
9
- const awsRoutes = routes.filter((r) => r.method !== "ALL");
10
- const content = `export const manifest = {
11
- routes: ${JSON.stringify(awsRoutes, null, 2)},
12
- functions: ${JSON.stringify(functions, null, 2)},
13
- crons: ${JSON.stringify(crons, null, 2)},
14
- subscribers: ${JSON.stringify(subscribers, null, 2)},
15
- } as const;
16
-
17
- // Derived types
18
- export type Route = (typeof manifest.routes)[number];
19
- export type Function = (typeof manifest.functions)[number];
20
- export type Cron = (typeof manifest.crons)[number];
21
- export type Subscriber = (typeof manifest.subscribers)[number];
22
-
23
- // Useful union types
24
- export type Authorizer = Route['authorizer'];
25
- export type HttpMethod = Route['method'];
26
- export type RoutePath = Route['path'];
27
- `;
28
- const manifestPath = join(manifestDir, "aws.ts");
29
- await writeFile(manifestPath, content);
30
- logger.log(`Generated AWS manifest with ${awsRoutes.length} routes, ${functions.length} functions, ${crons.length} crons, ${subscribers.length} subscribers`);
31
- logger.log(`Manifest: ${relative(process.cwd(), manifestPath)}`);
32
- }
33
- async function generateServerManifest(outputDir, appInfo, routes, subscribers) {
34
- const manifestDir = join(outputDir, "manifest");
35
- await mkdir(manifestDir, { recursive: true });
36
- const serverRoutes = routes.filter((r) => r.method !== "ALL").map((r) => ({
37
- path: r.path,
38
- method: r.method,
39
- authorizer: r.authorizer
40
- }));
41
- const serverSubscribers = subscribers.map((s) => ({
42
- name: s.name,
43
- subscribedEvents: s.subscribedEvents
44
- }));
45
- const content = `export const manifest = {
46
- app: ${JSON.stringify(appInfo, null, 2)},
47
- routes: ${JSON.stringify(serverRoutes, null, 2)},
48
- subscribers: ${JSON.stringify(serverSubscribers, null, 2)},
49
- } as const;
50
-
51
- // Derived types
52
- export type Route = (typeof manifest.routes)[number];
53
- export type Subscriber = (typeof manifest.subscribers)[number];
54
-
55
- // Useful union types
56
- export type Authorizer = Route['authorizer'];
57
- export type HttpMethod = Route['method'];
58
- export type RoutePath = Route['path'];
59
- `;
60
- const manifestPath = join(manifestDir, "server.ts");
61
- await writeFile(manifestPath, content);
62
- logger.log(`Generated server manifest with ${serverRoutes.length} routes, ${serverSubscribers.length} subscribers`);
63
- logger.log(`Manifest: ${relative(process.cwd(), manifestPath)}`);
64
- }
65
-
66
- //#endregion
67
- export { generateAwsManifest, generateServerManifest };
68
- //# sourceMappingURL=manifests-BNKG6AXf.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manifests-BNKG6AXf.mjs","names":["outputDir: string","routes: RouteInfo[]","functions: FunctionInfo[]","crons: CronInfo[]","subscribers: SubscriberInfo[]","appInfo: ServerAppInfo"],"sources":["../src/build/manifests.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { join, relative } from 'path';\nimport type {\n CronInfo,\n FunctionInfo,\n RouteInfo,\n SubscriberInfo,\n} from '../types';\n\nconst logger = console;\n\nexport type ManifestProvider = 'aws' | 'server';\n\nexport interface ServerAppInfo {\n handler: string;\n endpoints: string;\n}\n\nexport async function generateAwsManifest(\n outputDir: string,\n routes: RouteInfo[],\n functions: FunctionInfo[],\n crons: CronInfo[],\n subscribers: SubscriberInfo[],\n): Promise<void> {\n const manifestDir = join(outputDir, 'manifest');\n await mkdir(manifestDir, { recursive: true });\n\n // Filter out 'ALL' method routes (server-specific)\n const awsRoutes = routes.filter((r) => r.method !== 'ALL');\n\n const content = `export const manifest = {\n routes: ${JSON.stringify(awsRoutes, null, 2)},\n functions: ${JSON.stringify(functions, null, 2)},\n crons: ${JSON.stringify(crons, null, 2)},\n subscribers: ${JSON.stringify(subscribers, null, 2)},\n} as const;\n\n// Derived types\nexport type Route = (typeof manifest.routes)[number];\nexport type Function = (typeof manifest.functions)[number];\nexport type Cron = (typeof manifest.crons)[number];\nexport type Subscriber = (typeof manifest.subscribers)[number];\n\n// Useful union types\nexport type Authorizer = Route['authorizer'];\nexport type HttpMethod = Route['method'];\nexport type RoutePath = Route['path'];\n`;\n\n const manifestPath = join(manifestDir, 'aws.ts');\n await writeFile(manifestPath, content);\n\n logger.log(\n `Generated AWS manifest with ${awsRoutes.length} routes, ${functions.length} functions, ${crons.length} crons, ${subscribers.length} subscribers`,\n );\n logger.log(`Manifest: ${relative(process.cwd(), manifestPath)}`);\n}\n\nexport async function generateServerManifest(\n outputDir: string,\n appInfo: ServerAppInfo,\n routes: RouteInfo[],\n subscribers: SubscriberInfo[],\n): Promise<void> {\n const manifestDir = join(outputDir, 'manifest');\n await mkdir(manifestDir, { recursive: true });\n\n // For server, extract route metadata (path, method, authorizer)\n const serverRoutes = routes\n .filter((r) => r.method !== 'ALL')\n .map((r) => ({\n path: r.path,\n method: r.method,\n authorizer: r.authorizer,\n }));\n\n // Server subscribers only need name and events\n const serverSubscribers = subscribers.map((s) => ({\n name: s.name,\n subscribedEvents: s.subscribedEvents,\n }));\n\n const content = `export const manifest = {\n app: ${JSON.stringify(appInfo, null, 2)},\n routes: ${JSON.stringify(serverRoutes, null, 2)},\n subscribers: ${JSON.stringify(serverSubscribers, null, 2)},\n} as const;\n\n// Derived types\nexport type Route = (typeof manifest.routes)[number];\nexport type Subscriber = (typeof manifest.subscribers)[number];\n\n// Useful union types\nexport type Authorizer = Route['authorizer'];\nexport type HttpMethod = Route['method'];\nexport type RoutePath = Route['path'];\n`;\n\n const manifestPath = join(manifestDir, 'server.ts');\n await writeFile(manifestPath, content);\n\n logger.log(\n `Generated server manifest with ${serverRoutes.length} routes, ${serverSubscribers.length} subscribers`,\n );\n logger.log(`Manifest: ${relative(process.cwd(), manifestPath)}`);\n}\n"],"mappings":";;;;AASA,MAAM,SAAS;AASf,eAAsB,oBACpBA,WACAC,QACAC,WACAC,OACAC,aACe;CACf,MAAM,cAAc,KAAK,WAAW,WAAW;AAC/C,OAAM,MAAM,aAAa,EAAE,WAAW,KAAM,EAAC;CAG7C,MAAM,YAAY,OAAO,OAAO,CAAC,MAAM,EAAE,WAAW,MAAM;CAE1D,MAAM,WAAW;YACP,KAAK,UAAU,WAAW,MAAM,EAAE,CAAC;eAChC,KAAK,UAAU,WAAW,MAAM,EAAE,CAAC;WACvC,KAAK,UAAU,OAAO,MAAM,EAAE,CAAC;iBACzB,KAAK,UAAU,aAAa,MAAM,EAAE,CAAC;;;;;;;;;;;;;;CAepD,MAAM,eAAe,KAAK,aAAa,SAAS;AAChD,OAAM,UAAU,cAAc,QAAQ;AAEtC,QAAO,KACJ,8BAA8B,UAAU,OAAO,WAAW,UAAU,OAAO,cAAc,MAAM,OAAO,UAAU,YAAY,OAAO,cACrI;AACD,QAAO,KAAK,YAAY,SAAS,QAAQ,KAAK,EAAE,aAAa,CAAC,EAAE;AACjE;AAED,eAAsB,uBACpBJ,WACAK,SACAJ,QACAG,aACe;CACf,MAAM,cAAc,KAAK,WAAW,WAAW;AAC/C,OAAM,MAAM,aAAa,EAAE,WAAW,KAAM,EAAC;CAG7C,MAAM,eAAe,OAClB,OAAO,CAAC,MAAM,EAAE,WAAW,MAAM,CACjC,IAAI,CAAC,OAAO;EACX,MAAM,EAAE;EACR,QAAQ,EAAE;EACV,YAAY,EAAE;CACf,GAAE;CAGL,MAAM,oBAAoB,YAAY,IAAI,CAAC,OAAO;EAChD,MAAM,EAAE;EACR,kBAAkB,EAAE;CACrB,GAAE;CAEH,MAAM,WAAW;SACV,KAAK,UAAU,SAAS,MAAM,EAAE,CAAC;YAC9B,KAAK,UAAU,cAAc,MAAM,EAAE,CAAC;iBACjC,KAAK,UAAU,mBAAmB,MAAM,EAAE,CAAC;;;;;;;;;;;;CAa1D,MAAM,eAAe,KAAK,aAAa,YAAY;AACnD,OAAM,UAAU,cAAc,QAAQ;AAEtC,QAAO,KACJ,iCAAiC,aAAa,OAAO,WAAW,kBAAkB,OAAO,cAC3F;AACD,QAAO,KAAK,YAAY,SAAS,QAAQ,KAAK,EAAE,aAAa,CAAC,EAAE;AACjE"}
@@ -1,80 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const path = require_chunk.__toESM(require("path"));
3
- const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
4
-
5
- //#region src/build/manifests.ts
6
- const logger = console;
7
- async function generateAwsManifest(outputDir, routes, functions, crons, subscribers) {
8
- const manifestDir = (0, path.join)(outputDir, "manifest");
9
- await (0, node_fs_promises.mkdir)(manifestDir, { recursive: true });
10
- const awsRoutes = routes.filter((r) => r.method !== "ALL");
11
- const content = `export const manifest = {
12
- routes: ${JSON.stringify(awsRoutes, null, 2)},
13
- functions: ${JSON.stringify(functions, null, 2)},
14
- crons: ${JSON.stringify(crons, null, 2)},
15
- subscribers: ${JSON.stringify(subscribers, null, 2)},
16
- } as const;
17
-
18
- // Derived types
19
- export type Route = (typeof manifest.routes)[number];
20
- export type Function = (typeof manifest.functions)[number];
21
- export type Cron = (typeof manifest.crons)[number];
22
- export type Subscriber = (typeof manifest.subscribers)[number];
23
-
24
- // Useful union types
25
- export type Authorizer = Route['authorizer'];
26
- export type HttpMethod = Route['method'];
27
- export type RoutePath = Route['path'];
28
- `;
29
- const manifestPath = (0, path.join)(manifestDir, "aws.ts");
30
- await (0, node_fs_promises.writeFile)(manifestPath, content);
31
- logger.log(`Generated AWS manifest with ${awsRoutes.length} routes, ${functions.length} functions, ${crons.length} crons, ${subscribers.length} subscribers`);
32
- logger.log(`Manifest: ${(0, path.relative)(process.cwd(), manifestPath)}`);
33
- }
34
- async function generateServerManifest(outputDir, appInfo, routes, subscribers) {
35
- const manifestDir = (0, path.join)(outputDir, "manifest");
36
- await (0, node_fs_promises.mkdir)(manifestDir, { recursive: true });
37
- const serverRoutes = routes.filter((r) => r.method !== "ALL").map((r) => ({
38
- path: r.path,
39
- method: r.method,
40
- authorizer: r.authorizer
41
- }));
42
- const serverSubscribers = subscribers.map((s) => ({
43
- name: s.name,
44
- subscribedEvents: s.subscribedEvents
45
- }));
46
- const content = `export const manifest = {
47
- app: ${JSON.stringify(appInfo, null, 2)},
48
- routes: ${JSON.stringify(serverRoutes, null, 2)},
49
- subscribers: ${JSON.stringify(serverSubscribers, null, 2)},
50
- } as const;
51
-
52
- // Derived types
53
- export type Route = (typeof manifest.routes)[number];
54
- export type Subscriber = (typeof manifest.subscribers)[number];
55
-
56
- // Useful union types
57
- export type Authorizer = Route['authorizer'];
58
- export type HttpMethod = Route['method'];
59
- export type RoutePath = Route['path'];
60
- `;
61
- const manifestPath = (0, path.join)(manifestDir, "server.ts");
62
- await (0, node_fs_promises.writeFile)(manifestPath, content);
63
- logger.log(`Generated server manifest with ${serverRoutes.length} routes, ${serverSubscribers.length} subscribers`);
64
- logger.log(`Manifest: ${(0, path.relative)(process.cwd(), manifestPath)}`);
65
- }
66
-
67
- //#endregion
68
- Object.defineProperty(exports, 'generateAwsManifest', {
69
- enumerable: true,
70
- get: function () {
71
- return generateAwsManifest;
72
- }
73
- });
74
- Object.defineProperty(exports, 'generateServerManifest', {
75
- enumerable: true,
76
- get: function () {
77
- return generateServerManifest;
78
- }
79
- });
80
- //# sourceMappingURL=manifests-D13Ej8AE.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manifests-D13Ej8AE.cjs","names":["outputDir: string","routes: RouteInfo[]","functions: FunctionInfo[]","crons: CronInfo[]","subscribers: SubscriberInfo[]","appInfo: ServerAppInfo"],"sources":["../src/build/manifests.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { join, relative } from 'path';\nimport type {\n CronInfo,\n FunctionInfo,\n RouteInfo,\n SubscriberInfo,\n} from '../types';\n\nconst logger = console;\n\nexport type ManifestProvider = 'aws' | 'server';\n\nexport interface ServerAppInfo {\n handler: string;\n endpoints: string;\n}\n\nexport async function generateAwsManifest(\n outputDir: string,\n routes: RouteInfo[],\n functions: FunctionInfo[],\n crons: CronInfo[],\n subscribers: SubscriberInfo[],\n): Promise<void> {\n const manifestDir = join(outputDir, 'manifest');\n await mkdir(manifestDir, { recursive: true });\n\n // Filter out 'ALL' method routes (server-specific)\n const awsRoutes = routes.filter((r) => r.method !== 'ALL');\n\n const content = `export const manifest = {\n routes: ${JSON.stringify(awsRoutes, null, 2)},\n functions: ${JSON.stringify(functions, null, 2)},\n crons: ${JSON.stringify(crons, null, 2)},\n subscribers: ${JSON.stringify(subscribers, null, 2)},\n} as const;\n\n// Derived types\nexport type Route = (typeof manifest.routes)[number];\nexport type Function = (typeof manifest.functions)[number];\nexport type Cron = (typeof manifest.crons)[number];\nexport type Subscriber = (typeof manifest.subscribers)[number];\n\n// Useful union types\nexport type Authorizer = Route['authorizer'];\nexport type HttpMethod = Route['method'];\nexport type RoutePath = Route['path'];\n`;\n\n const manifestPath = join(manifestDir, 'aws.ts');\n await writeFile(manifestPath, content);\n\n logger.log(\n `Generated AWS manifest with ${awsRoutes.length} routes, ${functions.length} functions, ${crons.length} crons, ${subscribers.length} subscribers`,\n );\n logger.log(`Manifest: ${relative(process.cwd(), manifestPath)}`);\n}\n\nexport async function generateServerManifest(\n outputDir: string,\n appInfo: ServerAppInfo,\n routes: RouteInfo[],\n subscribers: SubscriberInfo[],\n): Promise<void> {\n const manifestDir = join(outputDir, 'manifest');\n await mkdir(manifestDir, { recursive: true });\n\n // For server, extract route metadata (path, method, authorizer)\n const serverRoutes = routes\n .filter((r) => r.method !== 'ALL')\n .map((r) => ({\n path: r.path,\n method: r.method,\n authorizer: r.authorizer,\n }));\n\n // Server subscribers only need name and events\n const serverSubscribers = subscribers.map((s) => ({\n name: s.name,\n subscribedEvents: s.subscribedEvents,\n }));\n\n const content = `export const manifest = {\n app: ${JSON.stringify(appInfo, null, 2)},\n routes: ${JSON.stringify(serverRoutes, null, 2)},\n subscribers: ${JSON.stringify(serverSubscribers, null, 2)},\n} as const;\n\n// Derived types\nexport type Route = (typeof manifest.routes)[number];\nexport type Subscriber = (typeof manifest.subscribers)[number];\n\n// Useful union types\nexport type Authorizer = Route['authorizer'];\nexport type HttpMethod = Route['method'];\nexport type RoutePath = Route['path'];\n`;\n\n const manifestPath = join(manifestDir, 'server.ts');\n await writeFile(manifestPath, content);\n\n logger.log(\n `Generated server manifest with ${serverRoutes.length} routes, ${serverSubscribers.length} subscribers`,\n );\n logger.log(`Manifest: ${relative(process.cwd(), manifestPath)}`);\n}\n"],"mappings":";;;;;AASA,MAAM,SAAS;AASf,eAAsB,oBACpBA,WACAC,QACAC,WACAC,OACAC,aACe;CACf,MAAM,cAAc,eAAK,WAAW,WAAW;AAC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