@geekmidas/cli 0.3.0 → 0.5.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 (309) hide show
  1. package/README.md +488 -71
  2. package/dist/CronGenerator-BPTqNYOR.d.cts +14 -0
  3. package/dist/{CronGenerator-Bh26MaNA.mjs → CronGenerator-CCRYptuT.mjs} +2 -2
  4. package/dist/{CronGenerator-Bh26MaNA.mjs.map → CronGenerator-CCRYptuT.mjs.map} +1 -1
  5. package/dist/{CronGenerator-C6MF8rlG.cjs → CronGenerator-D4TWXQbh.cjs} +2 -2
  6. package/dist/{CronGenerator-C6MF8rlG.cjs.map → CronGenerator-D4TWXQbh.cjs.map} +1 -1
  7. package/dist/CronGenerator-YAj59JUd.d.mts +14 -0
  8. package/dist/EndpointGenerator-ChAD1INz.d.cts +19 -0
  9. package/dist/EndpointGenerator-Cj3O1U8-.d.mts +19 -0
  10. package/dist/{EndpointGenerator-CWh18d92.mjs → EndpointGenerator-DGivkPLT.mjs} +77 -7
  11. package/dist/EndpointGenerator-DGivkPLT.mjs.map +1 -0
  12. package/dist/{EndpointGenerator-C73wNoih.cjs → EndpointGenerator-npWEDoK2.cjs} +77 -7
  13. package/dist/EndpointGenerator-npWEDoK2.cjs.map +1 -0
  14. package/dist/FunctionGenerator-429-9NER.d.cts +14 -0
  15. package/dist/FunctionGenerator-BQ4ehoID.d.mts +14 -0
  16. package/dist/{FunctionGenerator-BNE_GC7N.mjs → FunctionGenerator-CVk0h8tO.mjs} +2 -2
  17. package/dist/{FunctionGenerator-BNE_GC7N.mjs.map → FunctionGenerator-CVk0h8tO.mjs.map} +1 -1
  18. package/dist/{FunctionGenerator-FgZUTd8L.cjs → FunctionGenerator-DYTnyr4c.cjs} +2 -2
  19. package/dist/{FunctionGenerator-FgZUTd8L.cjs.map → FunctionGenerator-DYTnyr4c.cjs.map} +1 -1
  20. package/dist/Generator-BjHK_qce.d.mts +27 -0
  21. package/dist/{Generator-UanJW0_V.mjs → Generator-CDt4pB3W.mjs} +1 -1
  22. package/dist/{Generator-UanJW0_V.mjs.map → Generator-CDt4pB3W.mjs.map} +1 -1
  23. package/dist/{Generator-CDoEXCDg.cjs → Generator-CLVplqm2.cjs} +1 -1
  24. package/dist/{Generator-CDoEXCDg.cjs.map → Generator-CLVplqm2.cjs.map} +1 -1
  25. package/dist/Generator-DxQMCQp7.d.cts +27 -0
  26. package/dist/OpenApiTsGenerator-Be-sKGTT.cjs +501 -0
  27. package/dist/OpenApiTsGenerator-Be-sKGTT.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-C4mHHaku.mjs +495 -0
  29. package/dist/OpenApiTsGenerator-C4mHHaku.mjs.map +1 -0
  30. package/dist/SubscriberGenerator-7uX42xyG.d.mts +15 -0
  31. package/dist/{SubscriberGenerator-Dnlj_1FK.mjs → SubscriberGenerator-DABaJXML.mjs} +2 -2
  32. package/dist/{SubscriberGenerator-Dnlj_1FK.mjs.map → SubscriberGenerator-DABaJXML.mjs.map} +1 -1
  33. package/dist/{SubscriberGenerator-Bd-a7aiw.cjs → SubscriberGenerator-D_zpNGFr.cjs} +2 -2
  34. package/dist/{SubscriberGenerator-Bd-a7aiw.cjs.map → SubscriberGenerator-D_zpNGFr.cjs.map} +1 -1
  35. package/dist/SubscriberGenerator-Dtb3HS4i.d.cts +15 -0
  36. package/dist/api-B3SCEHPf.cjs +190 -0
  37. package/dist/api-B3SCEHPf.cjs.map +1 -0
  38. package/dist/api-BKIN0s0S.mjs +184 -0
  39. package/dist/api-BKIN0s0S.mjs.map +1 -0
  40. package/dist/build/index.cjs +11 -10
  41. package/dist/build/index.d.cts +7 -0
  42. package/dist/build/index.d.mts +7 -0
  43. package/dist/build/index.mjs +11 -10
  44. package/dist/build/manifests.cjs +1 -1
  45. package/dist/build/manifests.d.cts +13 -0
  46. package/dist/build/manifests.d.mts +13 -0
  47. package/dist/build/manifests.mjs +1 -1
  48. package/dist/build/providerResolver.cjs +1 -1
  49. package/dist/build/providerResolver.d.cts +23 -0
  50. package/dist/build/providerResolver.d.mts +23 -0
  51. package/dist/build/providerResolver.mjs +1 -1
  52. package/dist/build/types.d.cts +3 -0
  53. package/dist/build/types.d.mts +3 -0
  54. package/dist/{build-C6uEGRj8.mjs → build-B8C_qHir.mjs} +15 -13
  55. package/dist/build-B8C_qHir.mjs.map +1 -0
  56. package/dist/{build-CBYBPZpC.cjs → build-D0Wr49bf.cjs} +15 -13
  57. package/dist/build-D0Wr49bf.cjs.map +1 -0
  58. package/dist/config-Ba-Gbpbc.d.cts +11 -0
  59. package/dist/config-Bq72aj8e.mjs +75 -0
  60. package/dist/config-Bq72aj8e.mjs.map +1 -0
  61. package/dist/config-CFls09Ey.cjs +93 -0
  62. package/dist/config-CFls09Ey.cjs.map +1 -0
  63. package/dist/config-CLEDqKO3.cjs +157 -0
  64. package/dist/config-CLEDqKO3.cjs.map +1 -0
  65. package/dist/config-DBsmMDhf.d.mts +11 -0
  66. package/dist/config-Dp8RonV_.mjs +151 -0
  67. package/dist/config-Dp8RonV_.mjs.map +1 -0
  68. package/dist/config.cjs +4 -2
  69. package/dist/config.d.cts +48 -0
  70. package/dist/config.d.mts +48 -0
  71. package/dist/config.mjs +2 -2
  72. package/dist/dev/index.cjs +12 -10
  73. package/dist/dev/index.d.cts +36 -0
  74. package/dist/dev/index.d.mts +36 -0
  75. package/dist/dev/index.mjs +10 -10
  76. package/dist/dev-B734w3L1.mjs +343 -0
  77. package/dist/dev-B734w3L1.mjs.map +1 -0
  78. package/dist/{dev-DbtyToc7.cjs → dev-DHqYn8k4.cjs} +161 -47
  79. package/dist/dev-DHqYn8k4.cjs.map +1 -0
  80. package/dist/docker-5d8Yh5_X.cjs +119 -0
  81. package/dist/docker-5d8Yh5_X.cjs.map +1 -0
  82. package/dist/docker-DlUqdFle.mjs +113 -0
  83. package/dist/docker-DlUqdFle.mjs.map +1 -0
  84. package/dist/env-B-OKjgI4.cjs +144 -0
  85. package/dist/env-B-OKjgI4.cjs.map +1 -0
  86. package/dist/env-HfuJRlg5.d.cts +11 -0
  87. package/dist/env-nd-iQPYM.d.mts +11 -0
  88. package/dist/env-tv1HlZlw.mjs +138 -0
  89. package/dist/env-tv1HlZlw.mjs.map +1 -0
  90. package/dist/generators/CronGenerator.cjs +2 -2
  91. package/dist/generators/CronGenerator.d.cts +5 -0
  92. package/dist/generators/CronGenerator.d.mts +5 -0
  93. package/dist/generators/CronGenerator.mjs +2 -2
  94. package/dist/generators/EndpointGenerator.cjs +2 -2
  95. package/dist/generators/EndpointGenerator.d.cts +5 -0
  96. package/dist/generators/EndpointGenerator.d.mts +5 -0
  97. package/dist/generators/EndpointGenerator.mjs +2 -2
  98. package/dist/generators/FunctionGenerator.cjs +2 -2
  99. package/dist/generators/FunctionGenerator.d.cts +5 -0
  100. package/dist/generators/FunctionGenerator.d.mts +5 -0
  101. package/dist/generators/FunctionGenerator.mjs +2 -2
  102. package/dist/generators/Generator.cjs +1 -1
  103. package/dist/generators/Generator.d.cts +4 -0
  104. package/dist/generators/Generator.d.mts +4 -0
  105. package/dist/generators/Generator.mjs +1 -1
  106. package/dist/generators/OpenApiTsGenerator.cjs +3 -0
  107. package/dist/generators/OpenApiTsGenerator.d.cts +44 -0
  108. package/dist/generators/OpenApiTsGenerator.d.mts +44 -0
  109. package/dist/generators/OpenApiTsGenerator.mjs +3 -0
  110. package/dist/generators/SubscriberGenerator.cjs +2 -2
  111. package/dist/generators/SubscriberGenerator.d.cts +5 -0
  112. package/dist/generators/SubscriberGenerator.d.mts +5 -0
  113. package/dist/generators/SubscriberGenerator.mjs +2 -2
  114. package/dist/generators/index.cjs +6 -6
  115. package/dist/generators/index.d.cts +8 -0
  116. package/dist/generators/index.d.mts +8 -0
  117. package/dist/generators/index.mjs +6 -6
  118. package/dist/index-C523No_B.d.mts +64 -0
  119. package/dist/index-DrzN4xkQ.d.cts +64 -0
  120. package/dist/index.cjs +56 -18
  121. package/dist/index.cjs.map +1 -1
  122. package/dist/index.d.cts +1 -0
  123. package/dist/index.d.mts +1 -0
  124. package/dist/index.mjs +56 -18
  125. package/dist/index.mjs.map +1 -1
  126. package/dist/init/generators/config.cjs +3 -0
  127. package/dist/init/generators/config.d.cts +3 -0
  128. package/dist/init/generators/config.d.mts +3 -0
  129. package/dist/init/generators/config.mjs +3 -0
  130. package/dist/init/generators/docker.cjs +3 -0
  131. package/dist/init/generators/docker.d.cts +11 -0
  132. package/dist/init/generators/docker.d.mts +11 -0
  133. package/dist/init/generators/docker.mjs +3 -0
  134. package/dist/init/generators/env.cjs +3 -0
  135. package/dist/init/generators/env.d.cts +3 -0
  136. package/dist/init/generators/env.d.mts +3 -0
  137. package/dist/init/generators/env.mjs +3 -0
  138. package/dist/init/generators/index.cjs +9 -0
  139. package/dist/init/generators/index.d.cts +6 -0
  140. package/dist/init/generators/index.d.mts +6 -0
  141. package/dist/init/generators/index.mjs +6 -0
  142. package/dist/init/generators/models.cjs +3 -0
  143. package/dist/init/generators/models.d.cts +11 -0
  144. package/dist/init/generators/models.d.mts +11 -0
  145. package/dist/init/generators/models.mjs +3 -0
  146. package/dist/init/generators/monorepo.cjs +3 -0
  147. package/dist/init/generators/monorepo.d.cts +11 -0
  148. package/dist/init/generators/monorepo.d.mts +11 -0
  149. package/dist/init/generators/monorepo.mjs +3 -0
  150. package/dist/init/generators/package.cjs +3 -0
  151. package/dist/init/generators/package.d.cts +3 -0
  152. package/dist/init/generators/package.d.mts +3 -0
  153. package/dist/init/generators/package.mjs +3 -0
  154. package/dist/init/generators/source.cjs +3 -0
  155. package/dist/init/generators/source.d.cts +3 -0
  156. package/dist/init/generators/source.d.mts +3 -0
  157. package/dist/init/generators/source.mjs +3 -0
  158. package/dist/init/index.cjs +16 -0
  159. package/dist/init/index.d.cts +17 -0
  160. package/dist/init/index.d.mts +17 -0
  161. package/dist/init/index.mjs +16 -0
  162. package/dist/init/templates/api.cjs +3 -0
  163. package/dist/init/templates/api.d.cts +7 -0
  164. package/dist/init/templates/api.d.mts +7 -0
  165. package/dist/init/templates/api.mjs +3 -0
  166. package/dist/init/templates/index.cjs +10 -0
  167. package/dist/init/templates/index.d.cts +2 -0
  168. package/dist/init/templates/index.d.mts +2 -0
  169. package/dist/init/templates/index.mjs +7 -0
  170. package/dist/init/templates/minimal.cjs +3 -0
  171. package/dist/init/templates/minimal.d.cts +7 -0
  172. package/dist/init/templates/minimal.d.mts +7 -0
  173. package/dist/init/templates/minimal.mjs +3 -0
  174. package/dist/init/templates/serverless.cjs +3 -0
  175. package/dist/init/templates/serverless.d.cts +7 -0
  176. package/dist/init/templates/serverless.d.mts +7 -0
  177. package/dist/init/templates/serverless.mjs +3 -0
  178. package/dist/init/templates/worker.cjs +3 -0
  179. package/dist/init/templates/worker.d.cts +7 -0
  180. package/dist/init/templates/worker.d.mts +7 -0
  181. package/dist/init/templates/worker.mjs +3 -0
  182. package/dist/init/utils.cjs +7 -0
  183. package/dist/init/utils.d.cts +25 -0
  184. package/dist/init/utils.d.mts +25 -0
  185. package/dist/init/utils.mjs +3 -0
  186. package/dist/init-CtOnZn3G.mjs +145 -0
  187. package/dist/init-CtOnZn3G.mjs.map +1 -0
  188. package/dist/init-qLFsWR-R.cjs +151 -0
  189. package/dist/init-qLFsWR-R.cjs.map +1 -0
  190. package/dist/{manifests-C2eMoMUm.mjs → manifests-DIA_2QYd.mjs} +1 -1
  191. package/dist/{manifests-C2eMoMUm.mjs.map → manifests-DIA_2QYd.mjs.map} +1 -1
  192. package/dist/{manifests-CK1VV_pM.cjs → manifests-VJ9-2JpW.cjs} +1 -1
  193. package/dist/{manifests-CK1VV_pM.cjs.map → manifests-VJ9-2JpW.cjs.map} +1 -1
  194. package/dist/minimal-Bdhhpp7v.cjs +93 -0
  195. package/dist/minimal-Bdhhpp7v.cjs.map +1 -0
  196. package/dist/minimal-C4GsE45s.mjs +87 -0
  197. package/dist/minimal-C4GsE45s.mjs.map +1 -0
  198. package/dist/models-DyNwdOcz.cjs +121 -0
  199. package/dist/models-DyNwdOcz.cjs.map +1 -0
  200. package/dist/models-cvNg6Oea.mjs +115 -0
  201. package/dist/models-cvNg6Oea.mjs.map +1 -0
  202. package/dist/monorepo-Cknwzj5C.mjs +184 -0
  203. package/dist/monorepo-Cknwzj5C.mjs.map +1 -0
  204. package/dist/monorepo-sEK8gW59.cjs +190 -0
  205. package/dist/monorepo-sEK8gW59.cjs.map +1 -0
  206. package/dist/openapi-BQWPWyNB.cjs +56 -0
  207. package/dist/openapi-BQWPWyNB.cjs.map +1 -0
  208. package/dist/openapi-DBX8cJJ8.mjs +50 -0
  209. package/dist/openapi-DBX8cJJ8.mjs.map +1 -0
  210. package/dist/{openapi-react-query-D9Z7lh0p.cjs → openapi-react-query-DxHjXQvg.cjs} +1 -1
  211. package/dist/{openapi-react-query-D9Z7lh0p.cjs.map → openapi-react-query-DxHjXQvg.cjs.map} +1 -1
  212. package/dist/{openapi-react-query-MEBlYIM1.mjs → openapi-react-query-o7Mp1Jd5.mjs} +1 -1
  213. package/dist/{openapi-react-query-MEBlYIM1.mjs.map → openapi-react-query-o7Mp1Jd5.mjs.map} +1 -1
  214. package/dist/openapi-react-query.cjs +1 -1
  215. package/dist/openapi-react-query.d.cts +11 -0
  216. package/dist/openapi-react-query.d.mts +11 -0
  217. package/dist/openapi-react-query.mjs +1 -1
  218. package/dist/openapi.cjs +5 -4
  219. package/dist/openapi.d.cts +11 -0
  220. package/dist/openapi.d.mts +11 -0
  221. package/dist/openapi.mjs +5 -4
  222. package/dist/package-C7WhWU8m.d.mts +11 -0
  223. package/dist/package-CIfmeuSW.mjs +51 -0
  224. package/dist/package-CIfmeuSW.mjs.map +1 -0
  225. package/dist/package-DvWEMz6z.d.cts +11 -0
  226. package/dist/package-PP-o1nvq.cjs +57 -0
  227. package/dist/package-PP-o1nvq.cjs.map +1 -0
  228. package/dist/{providerResolver-B_TjNF0_.mjs → providerResolver-DEVKngbC.mjs} +1 -1
  229. package/dist/{providerResolver-B_TjNF0_.mjs.map → providerResolver-DEVKngbC.mjs.map} +1 -1
  230. package/dist/{providerResolver-DgvzNfP4.cjs → providerResolver-DOTbN9jo.cjs} +1 -1
  231. package/dist/{providerResolver-DgvzNfP4.cjs.map → providerResolver-DOTbN9jo.cjs.map} +1 -1
  232. package/dist/serverless-DkHBF2vC.mjs +108 -0
  233. package/dist/serverless-DkHBF2vC.mjs.map +1 -0
  234. package/dist/serverless-Yav3GRVz.cjs +114 -0
  235. package/dist/serverless-Yav3GRVz.cjs.map +1 -0
  236. package/dist/source-D6v2BnKT.d.mts +11 -0
  237. package/dist/source-D8fK9qRo.d.cts +11 -0
  238. package/dist/source-DT5Xhiob.cjs +17 -0
  239. package/dist/source-DT5Xhiob.cjs.map +1 -0
  240. package/dist/source-DnaH_MLA.mjs +11 -0
  241. package/dist/source-DnaH_MLA.mjs.map +1 -0
  242. package/dist/templates-CBFUwpBy.mjs +64 -0
  243. package/dist/templates-CBFUwpBy.mjs.map +1 -0
  244. package/dist/templates-DM_rtYYW.cjs +87 -0
  245. package/dist/templates-DM_rtYYW.cjs.map +1 -0
  246. package/dist/types-C4KITv-y.d.mts +51 -0
  247. package/dist/types-Cxl8-uwV.d.mts +129 -0
  248. package/dist/types-DB99_qIy.d.cts +129 -0
  249. package/dist/types-DLFN49M3.d.cts +51 -0
  250. package/dist/types.d.cts +2 -0
  251. package/dist/types.d.mts +2 -0
  252. package/dist/utils-BX3F4fT8.cjs +99 -0
  253. package/dist/utils-BX3F4fT8.cjs.map +1 -0
  254. package/dist/utils-C31-SWHP.mjs +69 -0
  255. package/dist/utils-C31-SWHP.mjs.map +1 -0
  256. package/dist/worker--8O5a3Hv.cjs +150 -0
  257. package/dist/worker--8O5a3Hv.cjs.map +1 -0
  258. package/dist/worker-Jme7uOOJ.mjs +144 -0
  259. package/dist/worker-Jme7uOOJ.mjs.map +1 -0
  260. package/docs/OPENAPI_TYPESCRIPT_DESIGN.md +408 -0
  261. package/package.json +19 -4
  262. package/src/__tests__/loadEnvFiles.spec.ts +131 -0
  263. package/src/__tests__/openapi.spec.ts +78 -63
  264. package/src/build/index.ts +14 -16
  265. package/src/build/types.ts +18 -2
  266. package/src/config.ts +61 -2
  267. package/src/dev/__tests__/index.spec.ts +98 -1
  268. package/src/dev/index.ts +229 -42
  269. package/src/generators/EndpointGenerator.ts +98 -5
  270. package/src/generators/OpenApiTsGenerator.ts +798 -0
  271. package/src/index.ts +32 -3
  272. package/src/init/__tests__/generators.spec.ts +366 -0
  273. package/src/init/__tests__/init.spec.ts +341 -0
  274. package/src/init/__tests__/utils.spec.ts +104 -0
  275. package/src/init/generators/config.ts +192 -0
  276. package/src/init/generators/docker.ts +134 -0
  277. package/src/init/generators/env.ts +182 -0
  278. package/src/init/generators/index.ts +4 -0
  279. package/src/init/generators/models.ts +129 -0
  280. package/src/init/generators/monorepo.ts +211 -0
  281. package/src/init/generators/package.ts +81 -0
  282. package/src/init/generators/source.ts +15 -0
  283. package/src/init/index.ts +206 -0
  284. package/src/init/templates/api.ts +218 -0
  285. package/src/init/templates/index.ts +108 -0
  286. package/src/init/templates/minimal.ts +102 -0
  287. package/src/init/templates/serverless.ts +129 -0
  288. package/src/init/templates/worker.ts +169 -0
  289. package/src/init/utils.ts +98 -0
  290. package/src/openapi.ts +36 -15
  291. package/src/types.ts +43 -0
  292. package/tsdown.config.ts +1 -1
  293. package/dist/EndpointGenerator-C73wNoih.cjs.map +0 -1
  294. package/dist/EndpointGenerator-CWh18d92.mjs.map +0 -1
  295. package/dist/build-C6uEGRj8.mjs.map +0 -1
  296. package/dist/build-CBYBPZpC.cjs.map +0 -1
  297. package/dist/config-D1EpSGk6.cjs +0 -36
  298. package/dist/config-D1EpSGk6.cjs.map +0 -1
  299. package/dist/config-U-mdW-7Y.mjs +0 -30
  300. package/dist/config-U-mdW-7Y.mjs.map +0 -1
  301. package/dist/dev-DbtyToc7.cjs.map +0 -1
  302. package/dist/dev-DnGYXuMn.mjs +0 -241
  303. package/dist/dev-DnGYXuMn.mjs.map +0 -1
  304. package/dist/openapi-BTHbPrxS.mjs +0 -36
  305. package/dist/openapi-BTHbPrxS.mjs.map +0 -1
  306. package/dist/openapi-CewcfoRH.cjs +0 -42
  307. package/dist/openapi-CewcfoRH.cjs.map +0 -1
  308. /package/dist/{generators-CEKtVh81.cjs → generators-3IemvCLk.cjs} +0 -0
  309. /package/dist/{generators-CsLujGXs.mjs → generators-FNpdfN6J.mjs} +0 -0
@@ -0,0 +1,151 @@
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const require_config = require('./config-CLEDqKO3.cjs');
3
+ const require_docker = require('./docker-5d8Yh5_X.cjs');
4
+ const require_env = require('./env-B-OKjgI4.cjs');
5
+ const require_models = require('./models-DyNwdOcz.cjs');
6
+ const require_monorepo = require('./monorepo-sEK8gW59.cjs');
7
+ const require_package = require('./package-PP-o1nvq.cjs');
8
+ const require_source = require('./source-DT5Xhiob.cjs');
9
+ const require_templates = require('./templates-DM_rtYYW.cjs');
10
+ const require_utils = require('./utils-BX3F4fT8.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: "routeStyle",
63
+ message: "Route organization:",
64
+ choices: require_templates.routeStyleChoices,
65
+ initial: 0
66
+ },
67
+ {
68
+ type: options.yes || options.monorepo !== void 0 ? null : "confirm",
69
+ name: "monorepo",
70
+ message: "Setup as monorepo?",
71
+ initial: false
72
+ },
73
+ {
74
+ type: (prev) => (prev === true || options.monorepo) && !options.apiPath ? "text" : null,
75
+ name: "apiPath",
76
+ message: "API app path:",
77
+ initial: "apps/api"
78
+ }
79
+ ], { onCancel });
80
+ const name = projectName || answers.name;
81
+ if (!name) {
82
+ console.error(" Error: Project name is required\n");
83
+ process.exit(1);
84
+ }
85
+ if (projectName) {
86
+ const nameValid = require_utils.validateProjectName(projectName);
87
+ if (nameValid !== true) {
88
+ console.error(` Error: ${nameValid}\n`);
89
+ process.exit(1);
90
+ }
91
+ const dirValid = require_utils.checkDirectoryExists(projectName, cwd);
92
+ if (dirValid !== true) {
93
+ console.error(` Error: ${dirValid}\n`);
94
+ process.exit(1);
95
+ }
96
+ }
97
+ const monorepo = options.monorepo ?? (options.yes ? false : answers.monorepo ?? false);
98
+ const templateOptions = {
99
+ name,
100
+ template: options.template || answers.template || "minimal",
101
+ telescope: options.yes ? true : answers.telescope ?? true,
102
+ database: options.yes ? true : answers.database ?? true,
103
+ routeStyle: options.yes ? "file-based" : answers.routeStyle ?? "file-based",
104
+ monorepo,
105
+ apiPath: monorepo ? options.apiPath ?? answers.apiPath ?? "apps/api" : ""
106
+ };
107
+ const targetDir = (0, node_path.join)(cwd, name);
108
+ const template = require_templates.getTemplate(templateOptions.template);
109
+ const isMonorepo = templateOptions.monorepo;
110
+ const apiPath = templateOptions.apiPath;
111
+ await (0, node_fs_promises.mkdir)(targetDir, { recursive: true });
112
+ const appDir = isMonorepo ? (0, node_path.join)(targetDir, apiPath) : targetDir;
113
+ if (isMonorepo) await (0, node_fs_promises.mkdir)(appDir, { recursive: true });
114
+ const appFiles = [
115
+ ...require_package.generatePackageJson(templateOptions, template),
116
+ ...require_config.generateConfigFiles(templateOptions, template),
117
+ ...require_env.generateEnvFiles(templateOptions, template),
118
+ ...require_source.generateSourceFiles(templateOptions, template),
119
+ ...require_docker.generateDockerFiles(templateOptions, template)
120
+ ];
121
+ const rootFiles = [...require_monorepo.generateMonorepoFiles(templateOptions, template), ...require_models.generateModelsPackage(templateOptions)];
122
+ for (const { path, content } of rootFiles) {
123
+ const fullPath = (0, node_path.join)(targetDir, path);
124
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(fullPath), { recursive: true });
125
+ await (0, node_fs_promises.writeFile)(fullPath, content);
126
+ }
127
+ for (const { path, content } of appFiles) {
128
+ const fullPath = (0, node_path.join)(appDir, path);
129
+ const displayPath = isMonorepo ? `${apiPath}/${path}` : path;
130
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(fullPath), { recursive: true });
131
+ await (0, node_fs_promises.writeFile)(fullPath, content);
132
+ }
133
+ if (!options.skipInstall) try {
134
+ (0, node_child_process.execSync)(require_utils.getInstallCommand(pkgManager), {
135
+ cwd: targetDir,
136
+ stdio: "inherit"
137
+ });
138
+ } catch {
139
+ console.error("\n Warning: Failed to install dependencies.");
140
+ }
141
+ const devCommand = require_utils.getRunCommand(pkgManager, "dev");
142
+ }
143
+
144
+ //#endregion
145
+ Object.defineProperty(exports, 'initCommand', {
146
+ enumerable: true,
147
+ get: function () {
148
+ return initCommand;
149
+ }
150
+ });
151
+ //# sourceMappingURL=init-qLFsWR-R.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-qLFsWR-R.cjs","names":["projectName?: string","options: InitOptions","value: string","templateChoices","routeStyleChoices","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 routeStyleChoices,\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: 'routeStyle',\n message: 'Route organization:',\n choices: routeStyleChoices,\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 routeStyle: options.yes\n ? 'file-based'\n : (answers.routeStyle ?? 'file-based'),\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\n // Print next steps\n const devCommand = getRunCommand(pkgManager, 'dev');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,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,OAAO,QAAQ,sBAAyB,OAAO;GAC7D,MAAM;GACN,SAAS;GACT,SAAS;EACV;EACD;GACE,MAAM,CAAC,UACJ,SAAS,QAAQ,QAAQ,cAAc,QAAQ,UAC5C,SACA;GACN,MAAM;GACN,SAAS;GACT,SAAS;EACV;CACF,GACD,EAAE,SAAU,EACb;CAGD,MAAM,OAAO,eAAe,QAAQ;AACpC,MAAK,MAAM;AACT,UAAQ,MAAM,sCAAsC;AACpD,UAAQ,KAAK,EAAE;CAChB;AAGD,KAAI,aAAa;EACf,MAAM,YAAY,kCAAoB,YAAY;AAClD,MAAI,cAAc,MAAM;AACtB,WAAQ,OAAO,WAAW,UAAU,IAAI;AACxC,WAAQ,KAAK,EAAE;EAChB;EACD,MAAM,WAAW,mCAAqB,aAAa,IAAI;AACvD,MAAI,aAAa,MAAM;AACrB,WAAQ,OAAO,WAAW,SAAS,IAAI;AACvC,WAAQ,KAAK,EAAE;EAChB;CACF;CAED,MAAM,WACJ,QAAQ,aAAa,QAAQ,MAAM,QAAS,QAAQ,YAAY;CAClE,MAAMC,kBAAmC;EACvC;EACA,UAAU,QAAQ,YAAY,QAAQ,YAAY;EAClD,WAAW,QAAQ,MAAM,OAAQ,QAAQ,aAAa;EACtD,UAAU,QAAQ,MAAM,OAAQ,QAAQ,YAAY;EACpD,YAAY,QAAQ,MAChB,eACC,QAAQ,cAAc;EAC3B;EACA,SAAS,WAAY,QAAQ,WAAW,QAAQ,WAAW,aAAc;CAC1E;CAED,MAAM,YAAY,oBAAK,KAAK,KAAK;CACjC,MAAM,WAAW,8BAAY,gBAAgB,SAAS;CAEtD,MAAM,aAAa,gBAAgB;CACnC,MAAM,UAAU,gBAAgB;AAGhC,OAAM,4BAAM,WAAW,EAAE,WAAW,KAAM,EAAC;CAG3C,MAAM,SAAS,aAAa,oBAAK,WAAW,QAAQ,GAAG;AACvD,KAAI,WACF,OAAM,4BAAM,QAAQ,EAAE,WAAW,KAAM,EAAC;CAI1C,MAAM,WAAW;EACf,GAAG,oCAAoB,iBAAiB,SAAS;EACjD,GAAG,mCAAoB,iBAAiB,SAAS;EACjD,GAAG,6BAAiB,iBAAiB,SAAS;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,YACX,KAAI;AACF,mCAAS,gCAAkB,WAAW,EAAE;GACtC,KAAK;GACL,OAAO;EACR,EAAC;CACH,QAAO;AACN,UAAQ,MAAM,+CAA+C;CAC9D;CAIH,MAAM,aAAa,4BAAc,YAAY,MAAM;AACpD"}
@@ -65,4 +65,4 @@ export type RoutePath = Route['path'];
65
65
 
66
66
  //#endregion
67
67
  export { generateAwsManifest, generateServerManifest };
68
- //# sourceMappingURL=manifests-C2eMoMUm.mjs.map
68
+ //# sourceMappingURL=manifests-DIA_2QYd.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifests-C2eMoMUm.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
+ {"version":3,"file":"manifests-DIA_2QYd.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"}
@@ -77,4 +77,4 @@ Object.defineProperty(exports, 'generateServerManifest', {
77
77
  return generateServerManifest;
78
78
  }
79
79
  });
80
- //# sourceMappingURL=manifests-CK1VV_pM.cjs.map
80
+ //# sourceMappingURL=manifests-VJ9-2JpW.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifests-CK1VV_pM.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/C,OAAM,4BAAM,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,eAAK,aAAa,SAAS;AAChD,OAAM,gCAAU,cAAc,QAAQ;AAEtC,QAAO,KACJ,8BAA8B,UAAU,OAAO,WAAW,UAAU,OAAO,cAAc,MAAM,OAAO,UAAU,YAAY,OAAO,cACrI;AACD,QAAO,KAAK,YAAY,mBAAS,QAAQ,KAAK,EAAE,aAAa,CAAC,EAAE;AACjE;AAED,eAAsB,uBACpBJ,WACAK,SACAJ,QACAG,aACe;CACf,MAAM,cAAc,eAAK,WAAW,WAAW;AAC/C,OAAM,4BAAM,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,eAAK,aAAa,YAAY;AACnD,OAAM,gCAAU,cAAc,QAAQ;AAEtC,QAAO,KACJ,iCAAiC,aAAa,OAAO,WAAW,kBAAkB,OAAO,cAC3F;AACD,QAAO,KAAK,YAAY,mBAAS,QAAQ,KAAK,EAAE,aAAa,CAAC,EAAE;AACjE"}
1
+ {"version":3,"file":"manifests-VJ9-2JpW.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/C,OAAM,4BAAM,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,eAAK,aAAa,SAAS;AAChD,OAAM,gCAAU,cAAc,QAAQ;AAEtC,QAAO,KACJ,8BAA8B,UAAU,OAAO,WAAW,UAAU,OAAO,cAAc,MAAM,OAAO,UAAU,YAAY,OAAO,cACrI;AACD,QAAO,KAAK,YAAY,mBAAS,QAAQ,KAAK,EAAE,aAAa,CAAC,EAAE;AACjE;AAED,eAAsB,uBACpBJ,WACAK,SACAJ,QACAG,aACe;CACf,MAAM,cAAc,eAAK,WAAW,WAAW;AAC/C,OAAM,4BAAM,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,eAAK,aAAa,YAAY;AACnD,OAAM,gCAAU,cAAc,QAAQ;AAEtC,QAAO,KACJ,iCAAiC,aAAa,OAAO,WAAW,kBAAkB,OAAO,cAC3F;AACD,QAAO,KAAK,YAAY,mBAAS,QAAQ,KAAK,EAAE,aAAa,CAAC,EAAE;AACjE"}
@@ -0,0 +1,93 @@
1
+
2
+ //#region src/init/templates/minimal.ts
3
+ const minimalTemplate = {
4
+ name: "minimal",
5
+ description: "Basic health endpoint",
6
+ dependencies: {
7
+ "@geekmidas/constructs": "workspace:*",
8
+ "@geekmidas/envkit": "workspace:*",
9
+ "@geekmidas/logger": "workspace:*",
10
+ hono: "~4.8.2",
11
+ pino: "~9.6.0"
12
+ },
13
+ devDependencies: {
14
+ "@biomejs/biome": "~1.9.4",
15
+ "@geekmidas/cli": "workspace:*",
16
+ "@types/node": "~22.0.0",
17
+ tsx: "~4.20.0",
18
+ turbo: "~2.3.0",
19
+ typescript: "~5.8.2",
20
+ vitest: "~4.0.0"
21
+ },
22
+ scripts: {
23
+ dev: "gkm dev",
24
+ build: "gkm build",
25
+ test: "vitest",
26
+ "test:once": "vitest run",
27
+ typecheck: "tsc --noEmit",
28
+ lint: "biome lint .",
29
+ fmt: "biome format . --write",
30
+ "fmt:check": "biome format ."
31
+ },
32
+ files: (options) => {
33
+ const files = [
34
+ {
35
+ path: "src/config/env.ts",
36
+ content: `import { EnvironmentParser } from '@geekmidas/envkit';
37
+
38
+ export const envParser = new EnvironmentParser(process.env);
39
+
40
+ export const config = envParser
41
+ .create((get) => ({
42
+ port: get('PORT').string().transform(Number).default(3000),
43
+ nodeEnv: get('NODE_ENV').string().default('development'),
44
+ }))
45
+ .parse();
46
+ `
47
+ },
48
+ {
49
+ path: "src/config/logger.ts",
50
+ content: `import { PinoLogger } from '@geekmidas/logger/pino';
51
+
52
+ export const logger = new PinoLogger({
53
+ app: '${options.name}',
54
+ level: process.env.LOG_LEVEL || 'info',
55
+ });
56
+ `
57
+ },
58
+ {
59
+ path: "src/endpoints/health.ts",
60
+ content: `import { e } from '@geekmidas/constructs/endpoints';
61
+
62
+ export default e
63
+ .get('/health')
64
+ .handle(async () => ({
65
+ status: 'ok',
66
+ timestamp: new Date().toISOString(),
67
+ }));
68
+ `
69
+ }
70
+ ];
71
+ if (options.telescope) files.push({
72
+ path: "src/config/telescope.ts",
73
+ content: `import { Telescope } from '@geekmidas/telescope';
74
+ import { InMemoryStorage } from '@geekmidas/telescope/storage/memory';
75
+
76
+ export const telescope = new Telescope({
77
+ storage: new InMemoryStorage({ maxEntries: 100 }),
78
+ enabled: process.env.NODE_ENV === 'development',
79
+ });
80
+ `
81
+ });
82
+ return files;
83
+ }
84
+ };
85
+
86
+ //#endregion
87
+ Object.defineProperty(exports, 'minimalTemplate', {
88
+ enumerable: true,
89
+ get: function () {
90
+ return minimalTemplate;
91
+ }
92
+ });
93
+ //# sourceMappingURL=minimal-Bdhhpp7v.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimal-Bdhhpp7v.cjs","names":["minimalTemplate: TemplateConfig","options: TemplateOptions","files: GeneratedFile[]"],"sources":["../src/init/templates/minimal.ts"],"sourcesContent":["import type {\n GeneratedFile,\n TemplateConfig,\n TemplateOptions,\n} from './index.js';\n\nexport const minimalTemplate: TemplateConfig = {\n name: 'minimal',\n description: 'Basic health endpoint',\n\n dependencies: {\n '@geekmidas/constructs': 'workspace:*',\n '@geekmidas/envkit': 'workspace:*',\n '@geekmidas/logger': 'workspace:*',\n hono: '~4.8.2',\n pino: '~9.6.0',\n },\n\n devDependencies: {\n '@biomejs/biome': '~1.9.4',\n '@geekmidas/cli': 'workspace:*',\n '@types/node': '~22.0.0',\n tsx: '~4.20.0',\n turbo: '~2.3.0',\n typescript: '~5.8.2',\n vitest: '~4.0.0',\n },\n\n scripts: {\n dev: 'gkm dev',\n build: 'gkm build',\n test: 'vitest',\n 'test:once': 'vitest run',\n typecheck: 'tsc --noEmit',\n lint: 'biome lint .',\n fmt: 'biome format . --write',\n 'fmt:check': 'biome format .',\n },\n\n files: (options: TemplateOptions): GeneratedFile[] => {\n const files: GeneratedFile[] = [\n // src/config/env.ts\n {\n path: 'src/config/env.ts',\n content: `import { EnvironmentParser } from '@geekmidas/envkit';\n\nexport const envParser = new EnvironmentParser(process.env);\n\nexport const config = envParser\n .create((get) => ({\n port: get('PORT').string().transform(Number).default(3000),\n nodeEnv: get('NODE_ENV').string().default('development'),\n }))\n .parse();\n`,\n },\n\n // src/config/logger.ts - using pino\n {\n path: 'src/config/logger.ts',\n content: `import { PinoLogger } from '@geekmidas/logger/pino';\n\nexport const logger = new PinoLogger({\n app: '${options.name}',\n level: process.env.LOG_LEVEL || 'info',\n});\n`,\n },\n\n // src/endpoints/health.ts\n {\n path: 'src/endpoints/health.ts',\n content: `import { e } from '@geekmidas/constructs/endpoints';\n\nexport default e\n .get('/health')\n .handle(async () => ({\n status: 'ok',\n timestamp: new Date().toISOString(),\n }));\n`,\n },\n ];\n\n // Add Telescope config if enabled\n if (options.telescope) {\n files.push({\n path: 'src/config/telescope.ts',\n content: `import { Telescope } from '@geekmidas/telescope';\nimport { InMemoryStorage } from '@geekmidas/telescope/storage/memory';\n\nexport const telescope = new Telescope({\n storage: new InMemoryStorage({ maxEntries: 100 }),\n enabled: process.env.NODE_ENV === 'development',\n});\n`,\n });\n }\n\n return files;\n },\n};\n"],"mappings":";;AAMA,MAAaA,kBAAkC;CAC7C,MAAM;CACN,aAAa;CAEb,cAAc;EACZ,yBAAyB;EACzB,qBAAqB;EACrB,qBAAqB;EACrB,MAAM;EACN,MAAM;CACP;CAED,iBAAiB;EACf,kBAAkB;EAClB,kBAAkB;EAClB,eAAe;EACf,KAAK;EACL,OAAO;EACP,YAAY;EACZ,QAAQ;CACT;CAED,SAAS;EACP,KAAK;EACL,OAAO;EACP,MAAM;EACN,aAAa;EACb,WAAW;EACX,MAAM;EACN,KAAK;EACL,aAAa;CACd;CAED,OAAO,CAACC,YAA8C;EACpD,MAAMC,QAAyB;GAE7B;IACE,MAAM;IACN,UAAU;;;;;;;;;;;GAWX;GAGD;IACE,MAAM;IACN,UAAU;;;UAGR,QAAQ,KAAK;;;;GAIhB;GAGD;IACE,MAAM;IACN,UAAU;;;;;;;;;GASX;EACF;AAGD,MAAI,QAAQ,UACV,OAAM,KAAK;GACT,MAAM;GACN,UAAU;;;;;;;;EAQX,EAAC;AAGJ,SAAO;CACR;AACF"}
@@ -0,0 +1,87 @@
1
+ //#region src/init/templates/minimal.ts
2
+ const minimalTemplate = {
3
+ name: "minimal",
4
+ description: "Basic health endpoint",
5
+ dependencies: {
6
+ "@geekmidas/constructs": "workspace:*",
7
+ "@geekmidas/envkit": "workspace:*",
8
+ "@geekmidas/logger": "workspace:*",
9
+ hono: "~4.8.2",
10
+ pino: "~9.6.0"
11
+ },
12
+ devDependencies: {
13
+ "@biomejs/biome": "~1.9.4",
14
+ "@geekmidas/cli": "workspace:*",
15
+ "@types/node": "~22.0.0",
16
+ tsx: "~4.20.0",
17
+ turbo: "~2.3.0",
18
+ typescript: "~5.8.2",
19
+ vitest: "~4.0.0"
20
+ },
21
+ scripts: {
22
+ dev: "gkm dev",
23
+ build: "gkm build",
24
+ test: "vitest",
25
+ "test:once": "vitest run",
26
+ typecheck: "tsc --noEmit",
27
+ lint: "biome lint .",
28
+ fmt: "biome format . --write",
29
+ "fmt:check": "biome format ."
30
+ },
31
+ files: (options) => {
32
+ const files = [
33
+ {
34
+ path: "src/config/env.ts",
35
+ content: `import { EnvironmentParser } from '@geekmidas/envkit';
36
+
37
+ export const envParser = new EnvironmentParser(process.env);
38
+
39
+ export const config = envParser
40
+ .create((get) => ({
41
+ port: get('PORT').string().transform(Number).default(3000),
42
+ nodeEnv: get('NODE_ENV').string().default('development'),
43
+ }))
44
+ .parse();
45
+ `
46
+ },
47
+ {
48
+ path: "src/config/logger.ts",
49
+ content: `import { PinoLogger } from '@geekmidas/logger/pino';
50
+
51
+ export const logger = new PinoLogger({
52
+ app: '${options.name}',
53
+ level: process.env.LOG_LEVEL || 'info',
54
+ });
55
+ `
56
+ },
57
+ {
58
+ path: "src/endpoints/health.ts",
59
+ content: `import { e } from '@geekmidas/constructs/endpoints';
60
+
61
+ export default e
62
+ .get('/health')
63
+ .handle(async () => ({
64
+ status: 'ok',
65
+ timestamp: new Date().toISOString(),
66
+ }));
67
+ `
68
+ }
69
+ ];
70
+ if (options.telescope) files.push({
71
+ path: "src/config/telescope.ts",
72
+ content: `import { Telescope } from '@geekmidas/telescope';
73
+ import { InMemoryStorage } from '@geekmidas/telescope/storage/memory';
74
+
75
+ export const telescope = new Telescope({
76
+ storage: new InMemoryStorage({ maxEntries: 100 }),
77
+ enabled: process.env.NODE_ENV === 'development',
78
+ });
79
+ `
80
+ });
81
+ return files;
82
+ }
83
+ };
84
+
85
+ //#endregion
86
+ export { minimalTemplate };
87
+ //# sourceMappingURL=minimal-C4GsE45s.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimal-C4GsE45s.mjs","names":["minimalTemplate: TemplateConfig","options: TemplateOptions","files: GeneratedFile[]"],"sources":["../src/init/templates/minimal.ts"],"sourcesContent":["import type {\n GeneratedFile,\n TemplateConfig,\n TemplateOptions,\n} from './index.js';\n\nexport const minimalTemplate: TemplateConfig = {\n name: 'minimal',\n description: 'Basic health endpoint',\n\n dependencies: {\n '@geekmidas/constructs': 'workspace:*',\n '@geekmidas/envkit': 'workspace:*',\n '@geekmidas/logger': 'workspace:*',\n hono: '~4.8.2',\n pino: '~9.6.0',\n },\n\n devDependencies: {\n '@biomejs/biome': '~1.9.4',\n '@geekmidas/cli': 'workspace:*',\n '@types/node': '~22.0.0',\n tsx: '~4.20.0',\n turbo: '~2.3.0',\n typescript: '~5.8.2',\n vitest: '~4.0.0',\n },\n\n scripts: {\n dev: 'gkm dev',\n build: 'gkm build',\n test: 'vitest',\n 'test:once': 'vitest run',\n typecheck: 'tsc --noEmit',\n lint: 'biome lint .',\n fmt: 'biome format . --write',\n 'fmt:check': 'biome format .',\n },\n\n files: (options: TemplateOptions): GeneratedFile[] => {\n const files: GeneratedFile[] = [\n // src/config/env.ts\n {\n path: 'src/config/env.ts',\n content: `import { EnvironmentParser } from '@geekmidas/envkit';\n\nexport const envParser = new EnvironmentParser(process.env);\n\nexport const config = envParser\n .create((get) => ({\n port: get('PORT').string().transform(Number).default(3000),\n nodeEnv: get('NODE_ENV').string().default('development'),\n }))\n .parse();\n`,\n },\n\n // src/config/logger.ts - using pino\n {\n path: 'src/config/logger.ts',\n content: `import { PinoLogger } from '@geekmidas/logger/pino';\n\nexport const logger = new PinoLogger({\n app: '${options.name}',\n level: process.env.LOG_LEVEL || 'info',\n});\n`,\n },\n\n // src/endpoints/health.ts\n {\n path: 'src/endpoints/health.ts',\n content: `import { e } from '@geekmidas/constructs/endpoints';\n\nexport default e\n .get('/health')\n .handle(async () => ({\n status: 'ok',\n timestamp: new Date().toISOString(),\n }));\n`,\n },\n ];\n\n // Add Telescope config if enabled\n if (options.telescope) {\n files.push({\n path: 'src/config/telescope.ts',\n content: `import { Telescope } from '@geekmidas/telescope';\nimport { InMemoryStorage } from '@geekmidas/telescope/storage/memory';\n\nexport const telescope = new Telescope({\n storage: new InMemoryStorage({ maxEntries: 100 }),\n enabled: process.env.NODE_ENV === 'development',\n});\n`,\n });\n }\n\n return files;\n },\n};\n"],"mappings":";AAMA,MAAaA,kBAAkC;CAC7C,MAAM;CACN,aAAa;CAEb,cAAc;EACZ,yBAAyB;EACzB,qBAAqB;EACrB,qBAAqB;EACrB,MAAM;EACN,MAAM;CACP;CAED,iBAAiB;EACf,kBAAkB;EAClB,kBAAkB;EAClB,eAAe;EACf,KAAK;EACL,OAAO;EACP,YAAY;EACZ,QAAQ;CACT;CAED,SAAS;EACP,KAAK;EACL,OAAO;EACP,MAAM;EACN,aAAa;EACb,WAAW;EACX,MAAM;EACN,KAAK;EACL,aAAa;CACd;CAED,OAAO,CAACC,YAA8C;EACpD,MAAMC,QAAyB;GAE7B;IACE,MAAM;IACN,UAAU;;;;;;;;;;;GAWX;GAGD;IACE,MAAM;IACN,UAAU;;;UAGR,QAAQ,KAAK;;;;GAIhB;GAGD;IACE,MAAM;IACN,UAAU;;;;;;;;;GASX;EACF;AAGD,MAAI,QAAQ,UACV,OAAM,KAAK;GACT,MAAM;GACN,UAAU;;;;;;;;EAQX,EAAC;AAGJ,SAAO;CACR;AACF"}
@@ -0,0 +1,121 @@
1
+
2
+ //#region src/init/generators/models.ts
3
+ /**
4
+ * Generate packages/models for shared Zod schemas (monorepo only)
5
+ */
6
+ function generateModelsPackage(options) {
7
+ if (!options.monorepo) return [];
8
+ const packageName = `@${options.name}/models`;
9
+ const packageJson = {
10
+ name: packageName,
11
+ version: "0.0.1",
12
+ private: true,
13
+ type: "module",
14
+ exports: {
15
+ ".": {
16
+ types: "./dist/index.d.ts",
17
+ import: "./dist/index.js"
18
+ },
19
+ "./*": {
20
+ types: "./dist/*.d.ts",
21
+ import: "./dist/*.js"
22
+ }
23
+ },
24
+ scripts: {
25
+ build: "tsc",
26
+ "build:watch": "tsc --watch",
27
+ typecheck: "tsc --noEmit"
28
+ },
29
+ dependencies: { zod: "~4.1.0" },
30
+ devDependencies: { typescript: "~5.8.2" }
31
+ };
32
+ const tsConfig = {
33
+ extends: "../../tsconfig.json",
34
+ compilerOptions: {
35
+ outDir: "./dist",
36
+ rootDir: "./src"
37
+ },
38
+ include: ["src/**/*.ts"],
39
+ exclude: ["node_modules", "dist"]
40
+ };
41
+ const indexTs = `import { z } from 'zod';
42
+
43
+ // ============================================
44
+ // Common Schemas
45
+ // ============================================
46
+
47
+ export const idSchema = z.string().uuid();
48
+
49
+ export const timestampsSchema = z.object({
50
+ createdAt: z.coerce.date(),
51
+ updatedAt: z.coerce.date(),
52
+ });
53
+
54
+ export const paginationSchema = z.object({
55
+ page: z.coerce.number().int().positive().default(1),
56
+ limit: z.coerce.number().int().positive().max(100).default(20),
57
+ });
58
+
59
+ export const paginatedResponseSchema = <T extends z.ZodTypeAny>(itemSchema: T) =>
60
+ z.object({
61
+ items: z.array(itemSchema),
62
+ total: z.number(),
63
+ page: z.number(),
64
+ limit: z.number(),
65
+ totalPages: z.number(),
66
+ });
67
+
68
+ // ============================================
69
+ // User Schemas
70
+ // ============================================
71
+
72
+ export const userSchema = z.object({
73
+ id: idSchema,
74
+ email: z.string().email(),
75
+ name: z.string().min(1).max(100),
76
+ ...timestampsSchema.shape,
77
+ });
78
+
79
+ export const createUserSchema = userSchema.omit({
80
+ id: true,
81
+ createdAt: true,
82
+ updatedAt: true,
83
+ });
84
+
85
+ export const updateUserSchema = createUserSchema.partial();
86
+
87
+ // ============================================
88
+ // Type Exports
89
+ // ============================================
90
+
91
+ export type Id = z.infer<typeof idSchema>;
92
+ export type Timestamps = z.infer<typeof timestampsSchema>;
93
+ export type Pagination = z.infer<typeof paginationSchema>;
94
+ export type User = z.infer<typeof userSchema>;
95
+ export type CreateUser = z.infer<typeof createUserSchema>;
96
+ export type UpdateUser = z.infer<typeof updateUserSchema>;
97
+ `;
98
+ return [
99
+ {
100
+ path: "packages/models/package.json",
101
+ content: JSON.stringify(packageJson, null, 2) + "\n"
102
+ },
103
+ {
104
+ path: "packages/models/tsconfig.json",
105
+ content: JSON.stringify(tsConfig, null, 2) + "\n"
106
+ },
107
+ {
108
+ path: "packages/models/src/index.ts",
109
+ content: indexTs
110
+ }
111
+ ];
112
+ }
113
+
114
+ //#endregion
115
+ Object.defineProperty(exports, 'generateModelsPackage', {
116
+ enumerable: true,
117
+ get: function () {
118
+ return generateModelsPackage;
119
+ }
120
+ });
121
+ //# sourceMappingURL=models-DyNwdOcz.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models-DyNwdOcz.cjs","names":["options: TemplateOptions"],"sources":["../src/init/generators/models.ts"],"sourcesContent":["import type { GeneratedFile, TemplateOptions } from '../templates/index.js';\n\n/**\n * Generate packages/models for shared Zod schemas (monorepo only)\n */\nexport function generateModelsPackage(\n options: TemplateOptions,\n): GeneratedFile[] {\n if (!options.monorepo) {\n return [];\n }\n\n // Package name based on project name\n const packageName = `@${options.name}/models`;\n\n // package.json for models\n const packageJson = {\n name: packageName,\n version: '0.0.1',\n private: true,\n type: 'module',\n exports: {\n '.': {\n types: './dist/index.d.ts',\n import: './dist/index.js',\n },\n './*': {\n types: './dist/*.d.ts',\n import: './dist/*.js',\n },\n },\n scripts: {\n build: 'tsc',\n 'build:watch': 'tsc --watch',\n typecheck: 'tsc --noEmit',\n },\n dependencies: {\n zod: '~4.1.0',\n },\n devDependencies: {\n typescript: '~5.8.2',\n },\n };\n\n // tsconfig.json for models - extends root\n const tsConfig = {\n extends: '../../tsconfig.json',\n compilerOptions: {\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*.ts'],\n exclude: ['node_modules', 'dist'],\n };\n\n // Main index.ts with example schemas\n const indexTs = `import { z } from 'zod';\n\n// ============================================\n// Common Schemas\n// ============================================\n\nexport const idSchema = z.string().uuid();\n\nexport const timestampsSchema = z.object({\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n});\n\nexport const paginationSchema = z.object({\n page: z.coerce.number().int().positive().default(1),\n limit: z.coerce.number().int().positive().max(100).default(20),\n});\n\nexport const paginatedResponseSchema = <T extends z.ZodTypeAny>(itemSchema: T) =>\n z.object({\n items: z.array(itemSchema),\n total: z.number(),\n page: z.number(),\n limit: z.number(),\n totalPages: z.number(),\n });\n\n// ============================================\n// User Schemas\n// ============================================\n\nexport const userSchema = z.object({\n id: idSchema,\n email: z.string().email(),\n name: z.string().min(1).max(100),\n ...timestampsSchema.shape,\n});\n\nexport const createUserSchema = userSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n});\n\nexport const updateUserSchema = createUserSchema.partial();\n\n// ============================================\n// Type Exports\n// ============================================\n\nexport type Id = z.infer<typeof idSchema>;\nexport type Timestamps = z.infer<typeof timestampsSchema>;\nexport type Pagination = z.infer<typeof paginationSchema>;\nexport type User = z.infer<typeof userSchema>;\nexport type CreateUser = z.infer<typeof createUserSchema>;\nexport type UpdateUser = z.infer<typeof updateUserSchema>;\n`;\n\n return [\n {\n path: 'packages/models/package.json',\n content: JSON.stringify(packageJson, null, 2) + '\\n',\n },\n {\n path: 'packages/models/tsconfig.json',\n content: JSON.stringify(tsConfig, null, 2) + '\\n',\n },\n {\n path: 'packages/models/src/index.ts',\n content: indexTs,\n },\n ];\n}\n"],"mappings":";;;;;AAKA,SAAgB,sBACdA,SACiB;AACjB,MAAK,QAAQ,SACX,QAAO,CAAE;CAIX,MAAM,eAAe,GAAG,QAAQ,KAAK;CAGrC,MAAM,cAAc;EAClB,MAAM;EACN,SAAS;EACT,SAAS;EACT,MAAM;EACN,SAAS;GACP,KAAK;IACH,OAAO;IACP,QAAQ;GACT;GACD,OAAO;IACL,OAAO;IACP,QAAQ;GACT;EACF;EACD,SAAS;GACP,OAAO;GACP,eAAe;GACf,WAAW;EACZ;EACD,cAAc,EACZ,KAAK,SACN;EACD,iBAAiB,EACf,YAAY,SACb;CACF;CAGD,MAAM,WAAW;EACf,SAAS;EACT,iBAAiB;GACf,QAAQ;GACR,SAAS;EACV;EACD,SAAS,CAAC,aAAc;EACxB,SAAS,CAAC,gBAAgB,MAAO;CAClC;CAGD,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DjB,QAAO;EACL;GACE,MAAM;GACN,SAAS,KAAK,UAAU,aAAa,MAAM,EAAE,GAAG;EACjD;EACD;GACE,MAAM;GACN,SAAS,KAAK,UAAU,UAAU,MAAM,EAAE,GAAG;EAC9C;EACD;GACE,MAAM;GACN,SAAS;EACV;CACF;AACF"}