@geekmidas/cli 9.0.2 → 10.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -120
- package/dist/{CachedStateProvider-BdX7klRc.cjs → CachedStateProvider-BLo7zv7S.cjs} +1 -1
- package/dist/CachedStateProvider-BxoAm-B2.mjs +3 -0
- package/dist/{CachedStateProvider-klLWZXWF.cjs → CachedStateProvider-CqPdW7CB.cjs} +1 -1
- package/dist/{CachedStateProvider-klLWZXWF.cjs.map → CachedStateProvider-CqPdW7CB.cjs.map} +1 -1
- package/dist/{CachedStateProvider-CzyFct42.mjs → CachedStateProvider-DTniehMP.mjs} +1 -1
- package/dist/{CachedStateProvider-CzyFct42.mjs.map → CachedStateProvider-DTniehMP.mjs.map} +1 -1
- package/dist/{HostingerProvider-B2ZYz7Yc.mjs → HostingerProvider-Cft7lEYr.mjs} +4 -3
- package/dist/HostingerProvider-Cft7lEYr.mjs.map +1 -0
- package/dist/{HostingerProvider-CrHfsgz9.cjs → HostingerProvider-h3EbEp-Z.cjs} +4 -3
- package/dist/HostingerProvider-h3EbEp-Z.cjs.map +1 -0
- package/dist/{LocalStateProvider-CP49rjzt.mjs → LocalStateProvider-Bn6tS-oL.mjs} +1 -1
- package/dist/{LocalStateProvider-CP49rjzt.mjs.map → LocalStateProvider-Bn6tS-oL.mjs.map} +1 -1
- package/dist/{LocalStateProvider-CalzNfNA.cjs → LocalStateProvider-Db9SEjyH.cjs} +1 -1
- package/dist/{LocalStateProvider-CalzNfNA.cjs.map → LocalStateProvider-Db9SEjyH.cjs.map} +1 -1
- package/dist/{Route53Provider-tlgBzrRQ.mjs → Route53Provider-RdpUDJQk.mjs} +1 -1
- package/dist/{Route53Provider-tlgBzrRQ.mjs.map → Route53Provider-RdpUDJQk.mjs.map} +1 -1
- package/dist/{Route53Provider-DwgXiLxt.cjs → Route53Provider-di2fMM5N.cjs} +1 -1
- package/dist/{Route53Provider-DwgXiLxt.cjs.map → Route53Provider-di2fMM5N.cjs.map} +1 -1
- package/dist/{SSMStateProvider-BlrTiV5m.mjs → SSMStateProvider-BRt2py-A.mjs} +1 -1
- package/dist/{SSMStateProvider-BlrTiV5m.mjs.map → SSMStateProvider-BRt2py-A.mjs.map} +1 -1
- package/dist/{SSMStateProvider-Bt6r8CTL.cjs → SSMStateProvider-DyX8s9HI.cjs} +1 -1
- package/dist/{SSMStateProvider-Bt6r8CTL.cjs.map → SSMStateProvider-DyX8s9HI.cjs.map} +1 -1
- package/dist/{backup-provisioner-Xunq-p_8.mjs → backup-provisioner-Bgj5Vi_L.mjs} +2 -2
- package/dist/{backup-provisioner-Xunq-p_8.mjs.map → backup-provisioner-Bgj5Vi_L.mjs.map} +1 -1
- package/dist/{backup-provisioner-B3HBN-2k.cjs → backup-provisioner-BrsHwYG0.cjs} +2 -2
- package/dist/{backup-provisioner-B3HBN-2k.cjs.map → backup-provisioner-BrsHwYG0.cjs.map} +1 -1
- package/dist/{bundler-Dufq3uvI.cjs → bundler-BY1OmV1e.cjs} +44 -14
- package/dist/bundler-BY1OmV1e.cjs.map +1 -0
- package/dist/{bundler-DkA4qzUD.mjs → bundler-Be8Zg4Wd.mjs} +45 -15
- package/dist/bundler-Be8Zg4Wd.mjs.map +1 -0
- package/dist/config-D8o6I_7Z.mjs +469 -0
- package/dist/config-D8o6I_7Z.mjs.map +1 -0
- package/dist/config-DbPE1KXF.cjs +535 -0
- package/dist/config-DbPE1KXF.cjs.map +1 -0
- package/dist/config.cjs +3 -2
- package/dist/config.d.cts +2 -2
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +3 -2
- package/dist/{credentials-s1kLcIzK.mjs → credentials-B5zRHdAl.mjs} +21 -6
- package/dist/credentials-B5zRHdAl.mjs.map +1 -0
- package/dist/{credentials-C8DWtnMY.cjs → credentials-BapzjyV5.cjs} +26 -5
- package/dist/credentials-BapzjyV5.cjs.map +1 -0
- package/dist/credentials-Dh0Q6HzY.mjs +2548 -0
- package/dist/credentials-Dh0Q6HzY.mjs.map +1 -0
- package/dist/credentials-K961ThG3.cjs +2680 -0
- package/dist/credentials-K961ThG3.cjs.map +1 -0
- package/dist/deploy/sniffer-routes-worker.cjs +6 -2
- package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.mjs +6 -2
- package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
- package/dist/discover-CAlFgYec.mjs +229 -0
- package/dist/discover-CAlFgYec.mjs.map +1 -0
- package/dist/discover-DTmFeloL.cjs +271 -0
- package/dist/discover-DTmFeloL.cjs.map +1 -0
- package/dist/dokploy-api-BS2xnJLZ.mjs +3 -0
- package/dist/{dokploy-api-CqOIKHme.cjs → dokploy-api-BsVH0y_s.cjs} +141 -32
- package/dist/dokploy-api-BsVH0y_s.cjs.map +1 -0
- package/dist/dokploy-api-BuxDRo3l.cjs +3 -0
- package/dist/{dokploy-api-sfZFlWuE.mjs → dokploy-api-aTFPz7_4.mjs} +141 -32
- package/dist/dokploy-api-aTFPz7_4.mjs.map +1 -0
- package/dist/emit-CbcRolsa.cjs +236 -0
- package/dist/emit-CbcRolsa.cjs.map +1 -0
- package/dist/emit-CiZS_5Ub.mjs +206 -0
- package/dist/emit-CiZS_5Ub.mjs.map +1 -0
- package/dist/{encryption-MfXAiFTm.cjs → encryption-C6jaU0hE.cjs} +1 -1
- package/dist/{encryption-MfXAiFTm.cjs.map → encryption-C6jaU0hE.cjs.map} +1 -1
- package/dist/{encryption-BVS7Vmzs.cjs → encryption-CHzzeR8a.cjs} +1 -1
- package/dist/encryption-CQUncu7v.mjs +3 -0
- package/dist/{encryption-CO5Q4Bhf.mjs → encryption-D-abyhZx.mjs} +1 -1
- package/dist/{encryption-CO5Q4Bhf.mjs.map → encryption-D-abyhZx.mjs.map} +1 -1
- package/dist/fullstack-secrets-C-GGohke.cjs +111 -0
- package/dist/fullstack-secrets-C-GGohke.cjs.map +1 -0
- package/dist/fullstack-secrets-D1o9-G5l.mjs +87 -0
- package/dist/fullstack-secrets-D1o9-G5l.mjs.map +1 -0
- package/dist/{fullstack-secrets-BYzi6Hwl.cjs → generator-CNzBw7g5.cjs} +1 -114
- package/dist/generator-CNzBw7g5.cjs.map +1 -0
- package/dist/{fullstack-secrets-l8s3II_H.mjs → generator-VE2JrFlY.mjs} +2 -85
- package/dist/generator-VE2JrFlY.mjs.map +1 -0
- package/dist/index-BThUzEIp.d.mts +175 -0
- package/dist/index-BThUzEIp.d.mts.map +1 -0
- package/dist/index-CHB4tSzX.d.cts +175 -0
- package/dist/index-CHB4tSzX.d.cts.map +1 -0
- package/dist/index.cjs +2329 -1584
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2306 -1561
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-Cfwi0fqF.mjs → openapi-CgpMWMmM.mjs} +174 -95
- package/dist/openapi-CgpMWMmM.mjs.map +1 -0
- package/dist/{openapi-BzNOC7_i.cjs → openapi-CljONd_M.cjs} +175 -108
- package/dist/openapi-CljONd_M.cjs.map +1 -0
- package/dist/{openapi-react-query-C4iIvpPf.mjs → openapi-react-query-Byltvm_7.mjs} +2 -2
- package/dist/openapi-react-query-Byltvm_7.mjs.map +1 -0
- package/dist/{openapi-react-query-CYWik72n.cjs → openapi-react-query-CmJ1xDbn.cjs} +2 -2
- package/dist/openapi-react-query-CmJ1xDbn.cjs.map +1 -0
- package/dist/openapi-react-query.cjs +1 -1
- package/dist/openapi-react-query.mjs +1 -1
- package/dist/openapi.cjs +4 -3
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +4 -3
- package/dist/reconcile/public.cjs +9 -0
- package/dist/reconcile/public.d.cts +125 -0
- package/dist/reconcile/public.d.cts.map +1 -0
- package/dist/reconcile/public.d.mts +125 -0
- package/dist/reconcile/public.d.mts.map +1 -0
- package/dist/reconcile/public.mjs +4 -0
- package/dist/{reconcile-B2FoJE0a.mjs → reconcile-CFs8C_1a.mjs} +5 -4
- package/dist/reconcile-CFs8C_1a.mjs.map +1 -0
- package/dist/{reconcile-BzqKJ2Rt.cjs → reconcile-D0pimNiy.cjs} +5 -4
- package/dist/reconcile-D0pimNiy.cjs.map +1 -0
- package/dist/setup-CJiQM2pX.cjs +473 -0
- package/dist/setup-CJiQM2pX.cjs.map +1 -0
- package/dist/setup-DMtU3p41.cjs +11 -0
- package/dist/setup-DOsYueeQ.mjs +443 -0
- package/dist/setup-DOsYueeQ.mjs.map +1 -0
- package/dist/setup-DSutDAlt.mjs +11 -0
- package/dist/{storage-B1wvztiJ.cjs → storage-BJmzYxt8.cjs} +1 -1
- package/dist/{storage-B1wvztiJ.cjs.map → storage-BJmzYxt8.cjs.map} +1 -1
- package/dist/{storage-DOEtT2Hr.cjs → storage-BM9hGpgv.cjs} +1 -1
- package/dist/{storage-dbb9RyBl.mjs → storage-Bi24WfoW.mjs} +1 -1
- package/dist/{storage-dbb9RyBl.mjs.map → storage-Bi24WfoW.mjs.map} +1 -1
- package/dist/{storage-Cs4WBsc4.mjs → storage-CYlGwWTj.mjs} +1 -1
- package/dist/{sync-CSooqRQ8.mjs → sync-CmEuNZsB.mjs} +2 -2
- package/dist/{sync-CSooqRQ8.mjs.map → sync-CmEuNZsB.mjs.map} +1 -1
- package/dist/sync-D306yOWu.cjs +4 -0
- package/dist/{sync-o_CtEbvR.cjs → sync-SizaChmC.cjs} +2 -2
- package/dist/{sync-o_CtEbvR.cjs.map → sync-SizaChmC.cjs.map} +1 -1
- package/dist/{sync-B5UHXwRM.mjs → sync-hOqAWHR6.mjs} +1 -1
- package/dist/{index-Bw548Bta.d.mts → types-C-arnQ1r.d.mts} +590 -143
- package/dist/types-C-arnQ1r.d.mts.map +1 -0
- package/dist/{index-DTpkeFb8.d.cts → types-abJQuk7m.d.cts} +590 -143
- package/dist/types-abJQuk7m.d.cts.map +1 -0
- package/dist/workspace/index.cjs +5 -1
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +2 -2
- package/dist/{workspace-D-37Ylqo.mjs → workspace-7FqprxuJ.mjs} +117 -30
- package/dist/workspace-7FqprxuJ.mjs.map +1 -0
- package/dist/workspace-8acupeaI.cjs +9 -0
- package/dist/{workspace-CQTT7HJQ.cjs → workspace-XvqO9jIv.cjs} +139 -28
- package/dist/workspace-XvqO9jIv.cjs.map +1 -0
- package/dist/workspace-yP5AHnrn.mjs +8 -0
- package/package.json +26 -9
- package/CHANGELOG.md +0 -650
- package/FUNCTION_CRON_SUPPORT.md +0 -266
- package/dist/CachedStateProvider-GcGziXh1.mjs +0 -3
- package/dist/HostingerProvider-B2ZYz7Yc.mjs.map +0 -1
- package/dist/HostingerProvider-CrHfsgz9.cjs.map +0 -1
- package/dist/bundler-DkA4qzUD.mjs.map +0 -1
- package/dist/bundler-Dufq3uvI.cjs.map +0 -1
- package/dist/config-Bbu1JKvf.mjs +0 -211
- package/dist/config-Bbu1JKvf.mjs.map +0 -1
- package/dist/config-DujV8DbR.cjs +0 -253
- package/dist/config-DujV8DbR.cjs.map +0 -1
- package/dist/credentials-C8DWtnMY.cjs.map +0 -1
- package/dist/credentials-s1kLcIzK.mjs.map +0 -1
- package/dist/dokploy-api-BPYkG-ZZ.cjs +0 -3
- package/dist/dokploy-api-BiSzWM4v.mjs +0 -3
- package/dist/dokploy-api-CqOIKHme.cjs.map +0 -1
- package/dist/dokploy-api-sfZFlWuE.mjs.map +0 -1
- package/dist/encryption-Bd_m4q3g.mjs +0 -3
- package/dist/fullstack-secrets-BYzi6Hwl.cjs.map +0 -1
- package/dist/fullstack-secrets-l8s3II_H.mjs.map +0 -1
- package/dist/index-Bw548Bta.d.mts.map +0 -1
- package/dist/index-DTpkeFb8.d.cts.map +0 -1
- package/dist/openapi-BzNOC7_i.cjs.map +0 -1
- package/dist/openapi-Cfwi0fqF.mjs.map +0 -1
- package/dist/openapi-react-query-C4iIvpPf.mjs.map +0 -1
- package/dist/openapi-react-query-CYWik72n.cjs.map +0 -1
- package/dist/reconcile-B2FoJE0a.mjs.map +0 -1
- package/dist/reconcile-BzqKJ2Rt.cjs.map +0 -1
- package/dist/setup-DDXUXzzl.mjs +0 -765
- package/dist/setup-DDXUXzzl.mjs.map +0 -1
- package/dist/setup-DLwhfyt-.cjs +0 -8
- package/dist/setup-Dh-B7YTX.mjs +0 -8
- package/dist/setup-WZ-xqAQO.cjs +0 -849
- package/dist/setup-WZ-xqAQO.cjs.map +0 -1
- package/dist/sync-BLA94rgC.cjs +0 -4
- package/dist/types-B3GQUg3k.d.mts +0 -280
- package/dist/types-B3GQUg3k.d.mts.map +0 -1
- package/dist/types-BWQDiooe.d.cts +0 -280
- package/dist/types-BWQDiooe.d.cts.map +0 -1
- package/dist/workspace-CQTT7HJQ.cjs.map +0 -1
- package/dist/workspace-D-37Ylqo.mjs.map +0 -1
- package/docs/OPENAPI_TYPESCRIPT_DESIGN.md +0 -408
- package/docs/dev-server-resilience-design.md +0 -189
- package/docs/manifest-refactor-design.md +0 -287
- package/examples/cron-example.ts +0 -45
- package/examples/env.ts +0 -33
- package/examples/function-example.ts +0 -40
- package/examples/gkm.config.json +0 -22
- package/examples/gkm.config.ts +0 -14
- package/examples/gkm.minimal.config.json +0 -7
- package/examples/gkm.production.config.json +0 -27
- package/examples/logger.ts +0 -10
- package/scripts/sync-versions.ts +0 -108
- package/src/__tests__/EndpointGenerator.hooks.spec.ts +0 -204
- package/src/__tests__/config.spec.ts +0 -422
- package/src/__tests__/loadEnvFiles.spec.ts +0 -131
- package/src/__tests__/normalizeHooksConfig.spec.ts +0 -63
- package/src/__tests__/openapi-react-query.spec.ts +0 -506
- package/src/__tests__/openapi.spec.ts +0 -625
- package/src/__tests__/test-helpers.ts +0 -181
- package/src/auth/__tests__/credentials.spec.ts +0 -331
- package/src/auth/__tests__/index.spec.ts +0 -237
- package/src/auth/credentials.ts +0 -286
- package/src/auth/index.ts +0 -233
- package/src/build/__tests__/bundler.spec.ts +0 -446
- package/src/build/__tests__/endpoint-analyzer.spec.ts +0 -623
- package/src/build/__tests__/handler-templates.spec.ts +0 -1287
- package/src/build/__tests__/index-new.spec.ts +0 -550
- package/src/build/__tests__/manifests.spec.ts +0 -583
- package/src/build/__tests__/partitions.spec.ts +0 -110
- package/src/build/__tests__/workspace-build.spec.ts +0 -215
- package/src/build/bundler.ts +0 -256
- package/src/build/endpoint-analyzer.ts +0 -236
- package/src/build/handler-templates.ts +0 -1253
- package/src/build/index.ts +0 -616
- package/src/build/manifests.ts +0 -285
- package/src/build/partitions.ts +0 -58
- package/src/build/providerResolver.ts +0 -184
- package/src/build/types.ts +0 -104
- package/src/config.ts +0 -330
- package/src/credentials/__tests__/fullDockerPorts.spec.ts +0 -144
- package/src/credentials/__tests__/helpers.ts +0 -112
- package/src/credentials/__tests__/prepareEntryCredentials.spec.ts +0 -125
- package/src/credentials/__tests__/readonlyDockerPorts.spec.ts +0 -190
- package/src/credentials/__tests__/workspaceCredentials.spec.ts +0 -209
- package/src/credentials/index.ts +0 -843
- package/src/debug.ts +0 -68
- package/src/deploy/CachedStateProvider.ts +0 -86
- package/src/deploy/LocalStateProvider.ts +0 -57
- package/src/deploy/SSMStateProvider.ts +0 -117
- package/src/deploy/StateProvider.ts +0 -175
- package/src/deploy/__tests__/CachedStateProvider.spec.ts +0 -235
- package/src/deploy/__tests__/HostingerProvider.spec.ts +0 -347
- package/src/deploy/__tests__/LocalStateProvider.spec.ts +0 -130
- package/src/deploy/__tests__/Route53Provider.spec.ts +0 -425
- package/src/deploy/__tests__/SSMStateProvider.spec.ts +0 -201
- package/src/deploy/__tests__/__fixtures__/entry-apps/async-entry.ts +0 -24
- package/src/deploy/__tests__/__fixtures__/entry-apps/nested-config-entry.ts +0 -24
- package/src/deploy/__tests__/__fixtures__/entry-apps/no-env-entry.ts +0 -12
- package/src/deploy/__tests__/__fixtures__/entry-apps/simple-entry.ts +0 -14
- package/src/deploy/__tests__/__fixtures__/entry-apps/throwing-entry.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/env-parsers/non-function-export.ts +0 -10
- package/src/deploy/__tests__/__fixtures__/env-parsers/optional-env-parser.ts +0 -21
- package/src/deploy/__tests__/__fixtures__/env-parsers/parseable-env-parser.ts +0 -18
- package/src/deploy/__tests__/__fixtures__/env-parsers/throwing-env-parser.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/env-parsers/valid-env-parser.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/auth.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/health.ts +0 -13
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/users.ts +0 -15
- package/src/deploy/__tests__/__fixtures__/route-apps/services.ts +0 -55
- package/src/deploy/__tests__/backup-provisioner.spec.ts +0 -428
- package/src/deploy/__tests__/createDnsProvider.spec.ts +0 -195
- package/src/deploy/__tests__/createStateProvider.spec.ts +0 -126
- package/src/deploy/__tests__/dns-orchestration.spec.ts +0 -192
- package/src/deploy/__tests__/dns-verification.spec.ts +0 -229
- package/src/deploy/__tests__/docker.spec.ts +0 -149
- package/src/deploy/__tests__/dokploy-api.spec.ts +0 -697
- package/src/deploy/__tests__/dokploy.spec.ts +0 -435
- package/src/deploy/__tests__/domain.spec.ts +0 -235
- package/src/deploy/__tests__/env-resolver.spec.ts +0 -903
- package/src/deploy/__tests__/index.spec.ts +0 -1091
- package/src/deploy/__tests__/init.spec.ts +0 -793
- package/src/deploy/__tests__/secrets.spec.ts +0 -303
- package/src/deploy/__tests__/sniffer.spec.ts +0 -838
- package/src/deploy/__tests__/state-e2e.spec.ts +0 -387
- package/src/deploy/__tests__/state.spec.ts +0 -876
- package/src/deploy/__tests__/undeploy.spec.ts +0 -758
- package/src/deploy/backup-provisioner.ts +0 -316
- package/src/deploy/dns/DnsProvider.ts +0 -201
- package/src/deploy/dns/HostingerProvider.ts +0 -174
- package/src/deploy/dns/Route53Provider.ts +0 -340
- package/src/deploy/dns/hostinger-api.ts +0 -261
- package/src/deploy/dns/index.ts +0 -627
- package/src/deploy/docker.ts +0 -260
- package/src/deploy/dokploy-api.ts +0 -1101
- package/src/deploy/dokploy.ts +0 -177
- package/src/deploy/domain.ts +0 -134
- package/src/deploy/env-resolver.ts +0 -305
- package/src/deploy/index.ts +0 -2094
- package/src/deploy/init.ts +0 -427
- package/src/deploy/secrets.ts +0 -187
- package/src/deploy/sniffer-envkit-patch.ts +0 -61
- package/src/deploy/sniffer-hooks.ts +0 -57
- package/src/deploy/sniffer-loader.ts +0 -28
- package/src/deploy/sniffer-routes-worker.ts +0 -104
- package/src/deploy/sniffer-worker.ts +0 -75
- package/src/deploy/sniffer.ts +0 -578
- package/src/deploy/state-commands.ts +0 -274
- package/src/deploy/state.ts +0 -482
- package/src/deploy/types.ts +0 -102
- package/src/deploy/undeploy.ts +0 -407
- package/src/dev/__tests__/entry-integration.spec.ts +0 -347
- package/src/dev/__tests__/entry.spec.ts +0 -144
- package/src/dev/__tests__/index.spec.ts +0 -2084
- package/src/dev/index.ts +0 -1649
- package/src/docker/__tests__/compose.spec.ts +0 -1142
- package/src/docker/__tests__/templates.spec.ts +0 -694
- package/src/docker/compose.ts +0 -808
- package/src/docker/index.ts +0 -523
- package/src/docker/templates.ts +0 -1067
- package/src/exec/index.ts +0 -118
- package/src/generators/CronGenerator.ts +0 -105
- package/src/generators/EndpointGenerator.ts +0 -954
- package/src/generators/FunctionGenerator.ts +0 -117
- package/src/generators/Generator.ts +0 -147
- package/src/generators/OpenApiTsGenerator.ts +0 -821
- package/src/generators/QueueGenerator.ts +0 -245
- package/src/generators/SubscriberGenerator.ts +0 -282
- package/src/generators/TopicGenerator.ts +0 -45
- package/src/generators/__tests__/CronGenerator.spec.ts +0 -445
- package/src/generators/__tests__/EndpointGenerator.spec.ts +0 -544
- package/src/generators/__tests__/FunctionGenerator.spec.ts +0 -256
- package/src/generators/__tests__/Generator.bustCache.spec.ts +0 -72
- package/src/generators/__tests__/OpenApiTsGenerator.registry.spec.ts +0 -98
- package/src/generators/__tests__/OpenApiTsGenerator.responseType.spec.ts +0 -56
- package/src/generators/__tests__/QueueGenerator.spec.ts +0 -141
- package/src/generators/__tests__/SubscriberGenerator.spec.ts +0 -410
- package/src/generators/index.ts +0 -11
- package/src/index.ts +0 -972
- package/src/init/__tests__/generators.spec.ts +0 -1070
- package/src/init/__tests__/init.spec.ts +0 -577
- package/src/init/__tests__/utils.spec.ts +0 -104
- package/src/init/generators/auth.ts +0 -225
- package/src/init/generators/config.ts +0 -316
- package/src/init/generators/docker.ts +0 -388
- package/src/init/generators/env.ts +0 -62
- package/src/init/generators/index.ts +0 -6
- package/src/init/generators/mobile-expo.ts +0 -576
- package/src/init/generators/models.ts +0 -153
- package/src/init/generators/monorepo.ts +0 -475
- package/src/init/generators/package.ts +0 -95
- package/src/init/generators/source.ts +0 -15
- package/src/init/generators/test.ts +0 -178
- package/src/init/generators/ui.ts +0 -1473
- package/src/init/generators/web-tanstack.ts +0 -348
- package/src/init/generators/web.ts +0 -363
- package/src/init/index.ts +0 -542
- package/src/init/templates/api.ts +0 -404
- package/src/init/templates/index.ts +0 -342
- package/src/init/templates/minimal.ts +0 -207
- package/src/init/templates/serverless.ts +0 -148
- package/src/init/templates/worker.ts +0 -216
- package/src/init/utils.ts +0 -197
- package/src/init/versions.ts +0 -52
- package/src/openapi-react-query.ts +0 -288
- package/src/openapi.ts +0 -259
- package/src/secrets/__tests__/encryption.spec.ts +0 -226
- package/src/secrets/__tests__/generator.spec.ts +0 -575
- package/src/secrets/__tests__/index.spec.ts +0 -91
- package/src/secrets/__tests__/reconcile.spec.ts +0 -123
- package/src/secrets/__tests__/storage.spec.ts +0 -645
- package/src/secrets/encryption.ts +0 -91
- package/src/secrets/generator.ts +0 -329
- package/src/secrets/index.ts +0 -417
- package/src/secrets/keystore.ts +0 -144
- package/src/secrets/reconcile.ts +0 -53
- package/src/secrets/storage.ts +0 -337
- package/src/secrets/sync.ts +0 -136
- package/src/secrets/types.ts +0 -70
- package/src/setup/__tests__/auto-setup.spec.ts +0 -147
- package/src/setup/__tests__/reconcile-secrets.spec.ts +0 -439
- package/src/setup/fullstack-secrets.ts +0 -140
- package/src/setup/index.ts +0 -411
- package/src/test/__tests__/__fixtures__/workspace.ts +0 -104
- package/src/test/__tests__/api.spec.ts +0 -199
- package/src/test/__tests__/auth.spec.ts +0 -162
- package/src/test/__tests__/index.spec.ts +0 -502
- package/src/test/__tests__/web.spec.ts +0 -210
- package/src/test/index.ts +0 -198
- package/src/types.ts +0 -363
- package/src/upgrade/__tests__/index.spec.ts +0 -354
- package/src/upgrade/index.ts +0 -253
- package/src/workspace/__tests__/client-generator.spec.ts +0 -326
- package/src/workspace/__tests__/index.spec.ts +0 -766
- package/src/workspace/__tests__/publicEnv.spec.ts +0 -64
- package/src/workspace/__tests__/schema.spec.ts +0 -737
- package/src/workspace/__tests__/type-inference.spec.ts +0 -251
- package/src/workspace/client-generator.ts +0 -109
- package/src/workspace/index.ts +0 -433
- package/src/workspace/publicEnv.ts +0 -57
- package/src/workspace/schema.ts +0 -861
- package/src/workspace/types.ts +0 -943
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -22
|
@@ -1,1070 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { generateConfigFiles } from '../generators/config.js';
|
|
3
|
-
import { generateDockerFiles } from '../generators/docker.js';
|
|
4
|
-
import { generateEnvFiles } from '../generators/env.js';
|
|
5
|
-
import { generateExpoAppFiles } from '../generators/mobile-expo.js';
|
|
6
|
-
import { generateModelsPackage } from '../generators/models.js';
|
|
7
|
-
import { generateMonorepoFiles } from '../generators/monorepo.js';
|
|
8
|
-
import { generatePackageJson } from '../generators/package.js';
|
|
9
|
-
import { generateTestFiles } from '../generators/test.js';
|
|
10
|
-
import { generateUiPackageFiles } from '../generators/ui.js';
|
|
11
|
-
import { generateTanStackWebFiles } from '../generators/web-tanstack.js';
|
|
12
|
-
import { apiTemplate } from '../templates/api.js';
|
|
13
|
-
import type { TemplateOptions } from '../templates/index.js';
|
|
14
|
-
import { minimalTemplate } from '../templates/minimal.js';
|
|
15
|
-
import { serverlessTemplate } from '../templates/serverless.js';
|
|
16
|
-
import { workerTemplate } from '../templates/worker.js';
|
|
17
|
-
|
|
18
|
-
const baseOptions: TemplateOptions = {
|
|
19
|
-
name: 'test-project',
|
|
20
|
-
template: 'minimal',
|
|
21
|
-
telescope: true,
|
|
22
|
-
database: true,
|
|
23
|
-
studio: true,
|
|
24
|
-
loggerType: 'pino',
|
|
25
|
-
routesStructure: 'centralized-endpoints',
|
|
26
|
-
monorepo: false,
|
|
27
|
-
apiPath: '',
|
|
28
|
-
packageManager: 'pnpm',
|
|
29
|
-
deployTarget: 'dokploy',
|
|
30
|
-
services: { db: true, cache: true, mail: false, storage: false },
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
describe('generatePackageJson', () => {
|
|
34
|
-
it('should generate package.json with correct name', () => {
|
|
35
|
-
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
36
|
-
expect(files).toHaveLength(1);
|
|
37
|
-
expect(files[0].path).toBe('package.json');
|
|
38
|
-
|
|
39
|
-
const pkg = JSON.parse(files[0].content);
|
|
40
|
-
expect(pkg.name).toBe('test-project');
|
|
41
|
-
expect(pkg.type).toBe('module');
|
|
42
|
-
expect(pkg.private).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should include telescope when enabled', () => {
|
|
46
|
-
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
47
|
-
const pkg = JSON.parse(files[0].content);
|
|
48
|
-
expect(pkg.dependencies['@geekmidas/telescope']).toMatch(/^~/);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should include database dependencies when enabled', () => {
|
|
52
|
-
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
53
|
-
const pkg = JSON.parse(files[0].content);
|
|
54
|
-
expect(pkg.dependencies['@geekmidas/db']).toMatch(/^~/);
|
|
55
|
-
expect(pkg.dependencies.kysely).toBeDefined();
|
|
56
|
-
expect(pkg.dependencies.pg).toBeDefined();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should exclude telescope when disabled', () => {
|
|
60
|
-
const options = { ...baseOptions, telescope: false };
|
|
61
|
-
const files = generatePackageJson(options, minimalTemplate);
|
|
62
|
-
const pkg = JSON.parse(files[0].content);
|
|
63
|
-
expect(pkg.dependencies['@geekmidas/telescope']).toBeUndefined();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should use tilde versions for @geekmidas packages', () => {
|
|
67
|
-
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
68
|
-
const pkg = JSON.parse(files[0].content);
|
|
69
|
-
expect(pkg.dependencies['@geekmidas/constructs']).toMatch(/^~/);
|
|
70
|
-
expect(pkg.dependencies['@geekmidas/envkit']).toMatch(/^~/);
|
|
71
|
-
expect(pkg.dependencies['@geekmidas/logger']).toMatch(/^~/);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should use tilde versions for external packages', () => {
|
|
75
|
-
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
76
|
-
const pkg = JSON.parse(files[0].content);
|
|
77
|
-
expect(pkg.dependencies.hono).toMatch(/^~/);
|
|
78
|
-
expect(pkg.dependencies.pino).toMatch(/^~/);
|
|
79
|
-
expect(pkg.devDependencies.typescript).toMatch(/^~/);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should include biome and turbo for non-monorepo', () => {
|
|
83
|
-
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
84
|
-
const pkg = JSON.parse(files[0].content);
|
|
85
|
-
expect(pkg.devDependencies['@biomejs/biome']).toBeDefined();
|
|
86
|
-
expect(pkg.devDependencies.turbo).toBeDefined();
|
|
87
|
-
expect(pkg.scripts.lint).toBeDefined();
|
|
88
|
-
expect(pkg.scripts.fmt).toBeDefined();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('should exclude biome and turbo for monorepo apps', () => {
|
|
92
|
-
const options: TemplateOptions = {
|
|
93
|
-
...baseOptions,
|
|
94
|
-
monorepo: true,
|
|
95
|
-
apiPath: 'apps/api',
|
|
96
|
-
};
|
|
97
|
-
const files = generatePackageJson(options, minimalTemplate);
|
|
98
|
-
const pkg = JSON.parse(files[0].content);
|
|
99
|
-
expect(pkg.devDependencies['@biomejs/biome']).toBeUndefined();
|
|
100
|
-
expect(pkg.devDependencies.turbo).toBeUndefined();
|
|
101
|
-
expect(pkg.scripts.lint).toBeUndefined();
|
|
102
|
-
expect(pkg.scripts.fmt).toBeUndefined();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('should include models package for monorepo apps', () => {
|
|
106
|
-
const options: TemplateOptions = {
|
|
107
|
-
...baseOptions,
|
|
108
|
-
monorepo: true,
|
|
109
|
-
apiPath: 'apps/api',
|
|
110
|
-
};
|
|
111
|
-
const files = generatePackageJson(options, minimalTemplate);
|
|
112
|
-
const pkg = JSON.parse(files[0].content);
|
|
113
|
-
expect(pkg.dependencies['@test-project/models']).toBe('workspace:*');
|
|
114
|
-
expect(pkg.dependencies.zod).toBeUndefined(); // zod is in models
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('should use scoped package name for monorepo apps', () => {
|
|
118
|
-
const options: TemplateOptions = {
|
|
119
|
-
...baseOptions,
|
|
120
|
-
monorepo: true,
|
|
121
|
-
apiPath: 'apps/api',
|
|
122
|
-
};
|
|
123
|
-
const files = generatePackageJson(options, minimalTemplate);
|
|
124
|
-
const pkg = JSON.parse(files[0].content);
|
|
125
|
-
expect(pkg.name).toBe('@test-project/api');
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
describe('generateConfigFiles', () => {
|
|
130
|
-
it('should generate gkm.config.ts and tsconfig.json for non-monorepo', () => {
|
|
131
|
-
const files = generateConfigFiles(baseOptions, minimalTemplate);
|
|
132
|
-
const paths = files.map((f) => f.path);
|
|
133
|
-
expect(paths).toContain('gkm.config.ts');
|
|
134
|
-
expect(paths).toContain('tsconfig.json');
|
|
135
|
-
expect(paths).toContain('biome.json');
|
|
136
|
-
expect(paths).toContain('turbo.json');
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should only generate gkm.config.ts and tsconfig.json for monorepo', () => {
|
|
140
|
-
const options: TemplateOptions = {
|
|
141
|
-
...baseOptions,
|
|
142
|
-
monorepo: true,
|
|
143
|
-
apiPath: 'apps/api',
|
|
144
|
-
};
|
|
145
|
-
const files = generateConfigFiles(options, minimalTemplate);
|
|
146
|
-
const paths = files.map((f) => f.path);
|
|
147
|
-
expect(paths).toContain('gkm.config.ts');
|
|
148
|
-
expect(paths).toContain('tsconfig.json');
|
|
149
|
-
expect(paths).not.toContain('biome.json');
|
|
150
|
-
expect(paths).not.toContain('turbo.json');
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('should include telescope config when enabled', () => {
|
|
154
|
-
const files = generateConfigFiles(baseOptions, minimalTemplate);
|
|
155
|
-
const gkmConfig = files.find((f) => f.path === 'gkm.config.ts');
|
|
156
|
-
expect(gkmConfig?.content).toContain('telescope');
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('should include functions config for serverless template', () => {
|
|
160
|
-
const options = { ...baseOptions, template: 'serverless' as const };
|
|
161
|
-
const files = generateConfigFiles(options, serverlessTemplate);
|
|
162
|
-
const gkmConfig = files.find((f) => f.path === 'gkm.config.ts');
|
|
163
|
-
expect(gkmConfig?.content).toContain('functions');
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('should include paths config for monorepo apps', () => {
|
|
167
|
-
const options: TemplateOptions = {
|
|
168
|
-
...baseOptions,
|
|
169
|
-
monorepo: true,
|
|
170
|
-
apiPath: 'apps/api',
|
|
171
|
-
};
|
|
172
|
-
const files = generateConfigFiles(options, minimalTemplate);
|
|
173
|
-
const tsConfig = files.find((f) => f.path === 'tsconfig.json');
|
|
174
|
-
expect(tsConfig).toBeDefined();
|
|
175
|
-
const config = JSON.parse(tsConfig!.content);
|
|
176
|
-
expect(config.extends).toBe('../../tsconfig.json');
|
|
177
|
-
expect(config.compilerOptions.paths).toBeDefined();
|
|
178
|
-
expect(config.compilerOptions.paths['@test-project/*']).toBeDefined();
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
describe('generateEnvFiles', () => {
|
|
183
|
-
it('should only generate .gitignore for non-monorepo', () => {
|
|
184
|
-
// .env files are no longer generated - secrets are encrypted instead
|
|
185
|
-
const files = generateEnvFiles(baseOptions, minimalTemplate);
|
|
186
|
-
const paths = files.map((f) => f.path);
|
|
187
|
-
expect(paths).toContain('.gitignore');
|
|
188
|
-
expect(paths).not.toContain('.env');
|
|
189
|
-
expect(paths).not.toContain('.env.example');
|
|
190
|
-
expect(paths).not.toContain('.env.development');
|
|
191
|
-
expect(paths).not.toContain('.env.test');
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('should not generate any files for monorepo (gitignore at root)', () => {
|
|
195
|
-
const options: TemplateOptions = {
|
|
196
|
-
...baseOptions,
|
|
197
|
-
monorepo: true,
|
|
198
|
-
apiPath: 'apps/api',
|
|
199
|
-
};
|
|
200
|
-
const files = generateEnvFiles(options, minimalTemplate);
|
|
201
|
-
expect(files).toHaveLength(0);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it('should include .gkm in gitignore', () => {
|
|
205
|
-
const files = generateEnvFiles(baseOptions, minimalTemplate);
|
|
206
|
-
const gitignore = files.find((f) => f.path === '.gitignore');
|
|
207
|
-
expect(gitignore?.content).toContain('.gkm/');
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
describe('generateDockerFiles', () => {
|
|
212
|
-
it('should generate docker-compose.yml', () => {
|
|
213
|
-
const files = generateDockerFiles(baseOptions, minimalTemplate);
|
|
214
|
-
expect(files).toHaveLength(1);
|
|
215
|
-
expect(files[0].path).toBe('docker-compose.yml');
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it('should include postgres with dynamic port when database is enabled', () => {
|
|
219
|
-
const files = generateDockerFiles(baseOptions, minimalTemplate);
|
|
220
|
-
expect(files[0].content).toContain('postgres');
|
|
221
|
-
expect(files[0].content).toContain("'${POSTGRES_HOST_PORT:-5432}:5432'");
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it('should include redis with dynamic port', () => {
|
|
225
|
-
const files = generateDockerFiles(baseOptions, minimalTemplate);
|
|
226
|
-
expect(files[0].content).toContain('redis');
|
|
227
|
-
expect(files[0].content).toContain("'${REDIS_HOST_PORT:-6379}:6379'");
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it('should include serverless-redis-http with dynamic port for serverless template', () => {
|
|
231
|
-
const options = { ...baseOptions, template: 'serverless' as const };
|
|
232
|
-
const files = generateDockerFiles(options, serverlessTemplate);
|
|
233
|
-
expect(files[0].content).toContain('hiett/serverless-redis-http');
|
|
234
|
-
expect(files[0].content).toContain("'${SRH_HOST_PORT:-8079}:80'");
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it('should include rabbitmq with dynamic ports for worker template', () => {
|
|
238
|
-
const options = { ...baseOptions, template: 'worker' as const };
|
|
239
|
-
const files = generateDockerFiles(options, workerTemplate);
|
|
240
|
-
expect(files[0].content).toContain('rabbitmq');
|
|
241
|
-
expect(files[0].content).toContain("'${RABBITMQ_HOST_PORT:-5672}:5672'");
|
|
242
|
-
expect(files[0].content).toContain(
|
|
243
|
-
"'${RABBITMQ_MGMT_HOST_PORT:-15672}:15672'",
|
|
244
|
-
);
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
it('should include mailpit with dynamic ports when mail is enabled', () => {
|
|
248
|
-
const options = {
|
|
249
|
-
...baseOptions,
|
|
250
|
-
services: { ...baseOptions.services, mail: true },
|
|
251
|
-
};
|
|
252
|
-
const files = generateDockerFiles(options, minimalTemplate);
|
|
253
|
-
expect(files[0].content).toContain('mailpit');
|
|
254
|
-
expect(files[0].content).toContain("'${SMTP_PORT:-1025}:1025'");
|
|
255
|
-
expect(files[0].content).toContain("'${MAILPIT_PORT:-8025}:8025'");
|
|
256
|
-
expect(files[0].content).toContain('MP_SMTP_AUTH:');
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
it('should include minio with dynamic ports when storage is enabled', () => {
|
|
260
|
-
const options = {
|
|
261
|
-
...baseOptions,
|
|
262
|
-
services: { ...baseOptions.services, storage: true },
|
|
263
|
-
};
|
|
264
|
-
const files = generateDockerFiles(options, minimalTemplate);
|
|
265
|
-
expect(files[0].content).toContain('minio');
|
|
266
|
-
expect(files[0].content).toContain('minio/minio:latest');
|
|
267
|
-
expect(files[0].content).toContain("'${MINIO_API_HOST_PORT:-9000}:9000'");
|
|
268
|
-
expect(files[0].content).toContain(
|
|
269
|
-
"'${MINIO_CONSOLE_HOST_PORT:-9001}:9001'",
|
|
270
|
-
);
|
|
271
|
-
expect(files[0].content).toContain('MINIO_ROOT_USER:');
|
|
272
|
-
expect(files[0].content).toContain('MINIO_ROOT_PASSWORD:');
|
|
273
|
-
expect(files[0].content).toContain('minio_data:');
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
it('should include all services when all are enabled', () => {
|
|
277
|
-
const options = {
|
|
278
|
-
...baseOptions,
|
|
279
|
-
services: { db: true, cache: true, mail: true, storage: true },
|
|
280
|
-
};
|
|
281
|
-
const files = generateDockerFiles(options, minimalTemplate);
|
|
282
|
-
expect(files[0].content).toContain('postgres');
|
|
283
|
-
expect(files[0].content).toContain('redis');
|
|
284
|
-
expect(files[0].content).toContain('mailpit');
|
|
285
|
-
expect(files[0].content).toContain('minio');
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
it('should not include disabled services', () => {
|
|
289
|
-
const options = {
|
|
290
|
-
...baseOptions,
|
|
291
|
-
database: false,
|
|
292
|
-
services: { db: false, cache: false, mail: false, storage: false },
|
|
293
|
-
};
|
|
294
|
-
const files = generateDockerFiles(options, minimalTemplate);
|
|
295
|
-
expect(files[0].content).not.toContain('postgres');
|
|
296
|
-
expect(files[0].content).toContain('redis'); // redis is always included
|
|
297
|
-
expect(files[0].content).not.toContain('mailpit');
|
|
298
|
-
expect(files[0].content).not.toContain('minio');
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it('should include localstack when events is sns', () => {
|
|
302
|
-
const options = {
|
|
303
|
-
...baseOptions,
|
|
304
|
-
services: {
|
|
305
|
-
db: true,
|
|
306
|
-
cache: true,
|
|
307
|
-
mail: false,
|
|
308
|
-
storage: false,
|
|
309
|
-
events: 'sns' as const,
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
const files = generateDockerFiles(options, minimalTemplate);
|
|
313
|
-
const compose = files[0].content;
|
|
314
|
-
expect(compose).toContain('localstack');
|
|
315
|
-
expect(compose).toContain('SERVICES: sns,sqs');
|
|
316
|
-
expect(compose).toContain('LOCALSTACK_PORT');
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
it('should include rabbitmq when events is rabbitmq', () => {
|
|
320
|
-
const options = {
|
|
321
|
-
...baseOptions,
|
|
322
|
-
services: {
|
|
323
|
-
db: true,
|
|
324
|
-
cache: true,
|
|
325
|
-
mail: false,
|
|
326
|
-
storage: false,
|
|
327
|
-
events: 'rabbitmq' as const,
|
|
328
|
-
},
|
|
329
|
-
};
|
|
330
|
-
const files = generateDockerFiles(options, minimalTemplate);
|
|
331
|
-
const compose = files[0].content;
|
|
332
|
-
expect(compose).toContain('rabbitmq');
|
|
333
|
-
expect(compose).toContain('RABBITMQ_HOST_PORT');
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
it('should not add extra container for pgboss events', () => {
|
|
337
|
-
const options = {
|
|
338
|
-
...baseOptions,
|
|
339
|
-
services: {
|
|
340
|
-
db: true,
|
|
341
|
-
cache: true,
|
|
342
|
-
mail: false,
|
|
343
|
-
storage: false,
|
|
344
|
-
events: 'pgboss' as const,
|
|
345
|
-
},
|
|
346
|
-
};
|
|
347
|
-
const files = generateDockerFiles(options, minimalTemplate);
|
|
348
|
-
const compose = files[0].content;
|
|
349
|
-
expect(compose).not.toContain('localstack');
|
|
350
|
-
// pgboss reuses postgres, no separate container
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
it('should generate idempotent postgres init script with pgboss', () => {
|
|
354
|
-
const options = {
|
|
355
|
-
...baseOptions,
|
|
356
|
-
template: 'fullstack' as const,
|
|
357
|
-
monorepo: true,
|
|
358
|
-
apiPath: 'apps/api',
|
|
359
|
-
services: {
|
|
360
|
-
db: true,
|
|
361
|
-
cache: true,
|
|
362
|
-
mail: false,
|
|
363
|
-
storage: false,
|
|
364
|
-
events: 'pgboss' as const,
|
|
365
|
-
},
|
|
366
|
-
};
|
|
367
|
-
const dbApps = [
|
|
368
|
-
{ name: 'api', password: 'api-pass' },
|
|
369
|
-
{ name: 'auth', password: 'auth-pass' },
|
|
370
|
-
];
|
|
371
|
-
const files = generateDockerFiles(options, apiTemplate, dbApps);
|
|
372
|
-
const initScript = files.find((f) => f.path === 'docker/postgres/init.sh');
|
|
373
|
-
expect(initScript).toBeDefined();
|
|
374
|
-
expect(initScript!.content).toContain('IF NOT EXISTS');
|
|
375
|
-
expect(initScript!.content).toContain('pgboss');
|
|
376
|
-
expect(initScript!.content).toContain('PGBOSS_DB_PASSWORD');
|
|
377
|
-
expect(initScript!.content).toContain('CREATE SCHEMA IF NOT EXISTS pgboss');
|
|
378
|
-
|
|
379
|
-
// Docker env should include pgboss password
|
|
380
|
-
const envFile = files.find((f) => f.path === 'docker/.env');
|
|
381
|
-
expect(envFile).toBeDefined();
|
|
382
|
-
expect(envFile!.content).toContain('PGBOSS_DB_PASSWORD');
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
describe('generateMonorepoFiles', () => {
|
|
387
|
-
it('should return empty array for non-monorepo', () => {
|
|
388
|
-
const files = generateMonorepoFiles(baseOptions, minimalTemplate);
|
|
389
|
-
expect(files).toHaveLength(0);
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
it('should generate root files for monorepo', () => {
|
|
393
|
-
const options: TemplateOptions = {
|
|
394
|
-
...baseOptions,
|
|
395
|
-
monorepo: true,
|
|
396
|
-
apiPath: 'apps/api',
|
|
397
|
-
};
|
|
398
|
-
const files = generateMonorepoFiles(options, minimalTemplate);
|
|
399
|
-
const paths = files.map((f) => f.path);
|
|
400
|
-
expect(paths).toContain('package.json');
|
|
401
|
-
expect(paths).toContain('pnpm-workspace.yaml');
|
|
402
|
-
expect(paths).toContain('tsconfig.json');
|
|
403
|
-
expect(paths).toContain('biome.json');
|
|
404
|
-
expect(paths).toContain('turbo.json');
|
|
405
|
-
expect(paths).toContain('.gitignore');
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
it('should include correct workspace paths', () => {
|
|
409
|
-
const options: TemplateOptions = {
|
|
410
|
-
...baseOptions,
|
|
411
|
-
monorepo: true,
|
|
412
|
-
apiPath: 'apps/api',
|
|
413
|
-
};
|
|
414
|
-
const files = generateMonorepoFiles(options, minimalTemplate);
|
|
415
|
-
const workspace = files.find((f) => f.path === 'pnpm-workspace.yaml');
|
|
416
|
-
expect(workspace?.content).toContain("'apps/*'");
|
|
417
|
-
expect(workspace?.content).toContain("'packages/*'");
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
it('should include root scripts', () => {
|
|
421
|
-
const options: TemplateOptions = {
|
|
422
|
-
...baseOptions,
|
|
423
|
-
monorepo: true,
|
|
424
|
-
apiPath: 'apps/api',
|
|
425
|
-
};
|
|
426
|
-
const files = generateMonorepoFiles(options, minimalTemplate);
|
|
427
|
-
const pkgJson = files.find((f) => f.path === 'package.json');
|
|
428
|
-
expect(pkgJson).toBeDefined();
|
|
429
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
430
|
-
expect(pkg.scripts.dev).toBe('turbo dev');
|
|
431
|
-
expect(pkg.scripts.build).toBe('turbo build');
|
|
432
|
-
expect(pkg.scripts.lint).toBe('biome lint .');
|
|
433
|
-
});
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
describe('generateTanStackWebFiles', () => {
|
|
437
|
-
const fullstackOptions: TemplateOptions = {
|
|
438
|
-
...baseOptions,
|
|
439
|
-
template: 'fullstack',
|
|
440
|
-
monorepo: true,
|
|
441
|
-
apiPath: 'apps/api',
|
|
442
|
-
frontendFramework: 'tanstack-start',
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
it('returns empty array for non-fullstack template', () => {
|
|
446
|
-
expect(generateTanStackWebFiles(baseOptions)).toHaveLength(0);
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
it('generates the expected file paths', () => {
|
|
450
|
-
const files = generateTanStackWebFiles(fullstackOptions);
|
|
451
|
-
const paths = files.map((f) => f.path);
|
|
452
|
-
expect(paths).toContain('apps/web/package.json');
|
|
453
|
-
expect(paths).toContain('apps/web/vite.config.ts');
|
|
454
|
-
expect(paths).toContain('apps/web/src/router.tsx');
|
|
455
|
-
expect(paths).toContain('apps/web/src/routes/__root.tsx');
|
|
456
|
-
expect(paths).toContain('apps/web/src/routes/index.tsx');
|
|
457
|
-
expect(paths).toContain('apps/web/src/config/client.ts');
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
it('uses VITE_ prefix in client config, not NEXT_PUBLIC_', () => {
|
|
461
|
-
const files = generateTanStackWebFiles(fullstackOptions);
|
|
462
|
-
const clientConfig = files.find(
|
|
463
|
-
(f) => f.path === 'apps/web/src/config/client.ts',
|
|
464
|
-
);
|
|
465
|
-
expect(clientConfig).toBeDefined();
|
|
466
|
-
expect(clientConfig!.content).toContain('VITE_API_URL');
|
|
467
|
-
expect(clientConfig!.content).toContain('VITE_AUTH_URL');
|
|
468
|
-
expect(clientConfig!.content).not.toContain('NEXT_PUBLIC_');
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
it('declares tanstack and vite as dependencies', () => {
|
|
472
|
-
const files = generateTanStackWebFiles(fullstackOptions);
|
|
473
|
-
const pkg = JSON.parse(
|
|
474
|
-
files.find((f) => f.path === 'apps/web/package.json')!.content,
|
|
475
|
-
);
|
|
476
|
-
expect(pkg.dependencies['@tanstack/react-start']).toBeDefined();
|
|
477
|
-
expect(pkg.dependencies['@tanstack/react-router']).toBeDefined();
|
|
478
|
-
expect(pkg.devDependencies.vite).toBeDefined();
|
|
479
|
-
expect(pkg.dependencies.next).toBeUndefined();
|
|
480
|
-
});
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
describe('generateExpoAppFiles', () => {
|
|
484
|
-
const fullstackOptions: TemplateOptions = {
|
|
485
|
-
...baseOptions,
|
|
486
|
-
template: 'fullstack',
|
|
487
|
-
monorepo: true,
|
|
488
|
-
apiPath: 'apps/api',
|
|
489
|
-
frontendFramework: 'expo',
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
it('returns empty array for non-fullstack template', () => {
|
|
493
|
-
expect(generateExpoAppFiles(baseOptions)).toHaveLength(0);
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
it('generates the expected Expo file paths', () => {
|
|
497
|
-
const files = generateExpoAppFiles(fullstackOptions);
|
|
498
|
-
const paths = files.map((f) => f.path);
|
|
499
|
-
expect(paths).toContain('apps/app/package.json');
|
|
500
|
-
expect(paths).toContain('apps/app/app.config.ts');
|
|
501
|
-
expect(paths).toContain('apps/app/eas.json');
|
|
502
|
-
expect(paths).toContain('apps/app/babel.config.js');
|
|
503
|
-
expect(paths).toContain('apps/app/metro.config.js');
|
|
504
|
-
expect(paths).toContain('apps/app/app/_layout.tsx');
|
|
505
|
-
expect(paths).toContain('apps/app/app/index.tsx');
|
|
506
|
-
expect(paths).toContain('apps/app/app/login.tsx');
|
|
507
|
-
expect(paths).toContain('apps/app/lib/auth-client.ts');
|
|
508
|
-
});
|
|
509
|
-
|
|
510
|
-
it('uses EXPO_PUBLIC_ prefix in config.ts', () => {
|
|
511
|
-
const files = generateExpoAppFiles(fullstackOptions);
|
|
512
|
-
const configTs = files.find((f) => f.path === 'apps/app/config.ts');
|
|
513
|
-
expect(configTs).toBeDefined();
|
|
514
|
-
expect(configTs!.content).toContain('EXPO_PUBLIC_API_URL');
|
|
515
|
-
expect(configTs!.content).toContain('EXPO_PUBLIC_AUTH_URL');
|
|
516
|
-
expect(configTs!.content).not.toContain('VITE_');
|
|
517
|
-
expect(configTs!.content).not.toContain('NEXT_PUBLIC_');
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
it('seeds eas.json with EXPO_PUBLIC_ env vars per profile', () => {
|
|
521
|
-
const files = generateExpoAppFiles(fullstackOptions);
|
|
522
|
-
const eas = JSON.parse(
|
|
523
|
-
files.find((f) => f.path === 'apps/app/eas.json')!.content,
|
|
524
|
-
);
|
|
525
|
-
expect(eas.build.dev.env.EXPO_PUBLIC_API_URL).toBeDefined();
|
|
526
|
-
expect(eas.build.dev.env.EXPO_PUBLIC_AUTH_URL).toBeDefined();
|
|
527
|
-
});
|
|
528
|
-
|
|
529
|
-
it('declares expo + better-auth/expo as dependencies', () => {
|
|
530
|
-
const files = generateExpoAppFiles(fullstackOptions);
|
|
531
|
-
const pkg = JSON.parse(
|
|
532
|
-
files.find((f) => f.path === 'apps/app/package.json')!.content,
|
|
533
|
-
);
|
|
534
|
-
expect(pkg.dependencies.expo).toBeDefined();
|
|
535
|
-
expect(pkg.dependencies['@better-auth/expo']).toBeDefined();
|
|
536
|
-
expect(pkg.dependencies['expo-router']).toBeDefined();
|
|
537
|
-
expect(pkg.dependencies.next).toBeUndefined();
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
describe('generateMonorepoFiles - frontendFramework wiring', () => {
|
|
542
|
-
const fullstackBase: TemplateOptions = {
|
|
543
|
-
...baseOptions,
|
|
544
|
-
template: 'fullstack',
|
|
545
|
-
monorepo: true,
|
|
546
|
-
apiPath: 'apps/api',
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
it('emits framework: nextjs by default', () => {
|
|
550
|
-
const files = generateMonorepoFiles(
|
|
551
|
-
{ ...fullstackBase, frontendFramework: 'nextjs' },
|
|
552
|
-
minimalTemplate,
|
|
553
|
-
);
|
|
554
|
-
const cfg = files.find((f) => f.path === 'gkm.config.ts');
|
|
555
|
-
expect(cfg!.content).toContain("framework: 'nextjs'");
|
|
556
|
-
expect(cfg!.content).toContain("path: 'apps/web'");
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
it('emits framework: tanstack-start when selected', () => {
|
|
560
|
-
const files = generateMonorepoFiles(
|
|
561
|
-
{ ...fullstackBase, frontendFramework: 'tanstack-start' },
|
|
562
|
-
minimalTemplate,
|
|
563
|
-
);
|
|
564
|
-
const cfg = files.find((f) => f.path === 'gkm.config.ts');
|
|
565
|
-
expect(cfg!.content).toContain("framework: 'tanstack-start'");
|
|
566
|
-
expect(cfg!.content).toContain("path: 'apps/web'");
|
|
567
|
-
});
|
|
568
|
-
|
|
569
|
-
it('emits framework: expo and apps/app path when selected', () => {
|
|
570
|
-
const files = generateMonorepoFiles(
|
|
571
|
-
{ ...fullstackBase, frontendFramework: 'expo' },
|
|
572
|
-
minimalTemplate,
|
|
573
|
-
);
|
|
574
|
-
const cfg = files.find((f) => f.path === 'gkm.config.ts');
|
|
575
|
-
expect(cfg!.content).toContain("framework: 'expo'");
|
|
576
|
-
expect(cfg!.content).toContain("path: 'apps/app'");
|
|
577
|
-
expect(cfg!.content).toContain('port: 8081');
|
|
578
|
-
});
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
describe('generateModelsPackage', () => {
|
|
582
|
-
it('should return empty array for non-monorepo', () => {
|
|
583
|
-
const files = generateModelsPackage(baseOptions);
|
|
584
|
-
expect(files).toHaveLength(0);
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
it('should generate models package for monorepo', () => {
|
|
588
|
-
const options: TemplateOptions = {
|
|
589
|
-
...baseOptions,
|
|
590
|
-
monorepo: true,
|
|
591
|
-
apiPath: 'apps/api',
|
|
592
|
-
};
|
|
593
|
-
const files = generateModelsPackage(options);
|
|
594
|
-
const paths = files.map((f) => f.path);
|
|
595
|
-
expect(paths).toContain('packages/models/package.json');
|
|
596
|
-
expect(paths).toContain('packages/models/tsconfig.json');
|
|
597
|
-
expect(paths).toContain('packages/models/src/common.ts');
|
|
598
|
-
expect(paths).toContain('packages/models/src/user.ts');
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
it('should use correct package name', () => {
|
|
602
|
-
const options: TemplateOptions = {
|
|
603
|
-
...baseOptions,
|
|
604
|
-
monorepo: true,
|
|
605
|
-
apiPath: 'apps/api',
|
|
606
|
-
};
|
|
607
|
-
const files = generateModelsPackage(options);
|
|
608
|
-
const pkgJson = files.find(
|
|
609
|
-
(f) => f.path === 'packages/models/package.json',
|
|
610
|
-
);
|
|
611
|
-
expect(pkgJson).toBeDefined();
|
|
612
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
613
|
-
expect(pkg.name).toBe('@test-project/models');
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
it('should have empty dependencies (zod is at root level)', () => {
|
|
617
|
-
const options: TemplateOptions = {
|
|
618
|
-
...baseOptions,
|
|
619
|
-
monorepo: true,
|
|
620
|
-
apiPath: 'apps/api',
|
|
621
|
-
};
|
|
622
|
-
const files = generateModelsPackage(options);
|
|
623
|
-
const pkgJson = files.find(
|
|
624
|
-
(f) => f.path === 'packages/models/package.json',
|
|
625
|
-
);
|
|
626
|
-
expect(pkgJson).toBeDefined();
|
|
627
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
628
|
-
// zod is now at root level in monorepo, not in models package
|
|
629
|
-
expect(pkg.dependencies).toEqual({});
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
it('should include example schemas', () => {
|
|
633
|
-
const options: TemplateOptions = {
|
|
634
|
-
...baseOptions,
|
|
635
|
-
monorepo: true,
|
|
636
|
-
apiPath: 'apps/api',
|
|
637
|
-
};
|
|
638
|
-
const files = generateModelsPackage(options);
|
|
639
|
-
const userTs = files.find((f) => f.path === 'packages/models/src/user.ts');
|
|
640
|
-
const commonTs = files.find(
|
|
641
|
-
(f) => f.path === 'packages/models/src/common.ts',
|
|
642
|
-
);
|
|
643
|
-
expect(userTs?.content).toContain('UserSchema');
|
|
644
|
-
expect(userTs?.content).toContain('UserResponseSchema');
|
|
645
|
-
expect(userTs?.content).toContain("import { z } from 'zod'");
|
|
646
|
-
expect(commonTs?.content).toContain('PaginationSchema');
|
|
647
|
-
expect(commonTs?.content).toContain('IdSchema');
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
it('should extend root tsconfig', () => {
|
|
651
|
-
const options: TemplateOptions = {
|
|
652
|
-
...baseOptions,
|
|
653
|
-
monorepo: true,
|
|
654
|
-
apiPath: 'apps/api',
|
|
655
|
-
};
|
|
656
|
-
const files = generateModelsPackage(options);
|
|
657
|
-
const tsConfig = files.find(
|
|
658
|
-
(f) => f.path === 'packages/models/tsconfig.json',
|
|
659
|
-
);
|
|
660
|
-
expect(tsConfig).toBeDefined();
|
|
661
|
-
const config = JSON.parse(tsConfig!.content);
|
|
662
|
-
expect(config.extends).toBe('../../tsconfig.json');
|
|
663
|
-
});
|
|
664
|
-
});
|
|
665
|
-
|
|
666
|
-
describe('generateUiPackageFiles', () => {
|
|
667
|
-
const fullstackOptions: TemplateOptions = {
|
|
668
|
-
...baseOptions,
|
|
669
|
-
template: 'fullstack',
|
|
670
|
-
monorepo: true,
|
|
671
|
-
apiPath: 'apps/api',
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
it('should return empty array for non-monorepo', () => {
|
|
675
|
-
const files = generateUiPackageFiles(baseOptions);
|
|
676
|
-
expect(files).toHaveLength(0);
|
|
677
|
-
});
|
|
678
|
-
|
|
679
|
-
it('should return empty array for non-fullstack template', () => {
|
|
680
|
-
const options: TemplateOptions = {
|
|
681
|
-
...baseOptions,
|
|
682
|
-
template: 'minimal',
|
|
683
|
-
monorepo: true,
|
|
684
|
-
apiPath: 'apps/api',
|
|
685
|
-
};
|
|
686
|
-
const files = generateUiPackageFiles(options);
|
|
687
|
-
expect(files).toHaveLength(0);
|
|
688
|
-
});
|
|
689
|
-
|
|
690
|
-
it('should generate UI package files for fullstack template', () => {
|
|
691
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
692
|
-
const paths = files.map((f) => f.path);
|
|
693
|
-
expect(paths).toContain('packages/ui/package.json');
|
|
694
|
-
expect(paths).toContain('packages/ui/tsconfig.json');
|
|
695
|
-
expect(paths).toContain('packages/ui/components.json');
|
|
696
|
-
expect(paths).toContain('packages/ui/.storybook/main.ts');
|
|
697
|
-
expect(paths).toContain('packages/ui/.storybook/preview.ts');
|
|
698
|
-
expect(paths).toContain('packages/ui/src/styles/globals.css');
|
|
699
|
-
expect(paths).toContain('packages/ui/src/lib/utils.ts');
|
|
700
|
-
expect(paths).toContain('packages/ui/src/index.ts');
|
|
701
|
-
});
|
|
702
|
-
|
|
703
|
-
it('should use correct package name', () => {
|
|
704
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
705
|
-
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
706
|
-
expect(pkgJson).toBeDefined();
|
|
707
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
708
|
-
expect(pkg.name).toBe('@test-project/ui');
|
|
709
|
-
});
|
|
710
|
-
|
|
711
|
-
it('should have typescript source exports (not dist)', () => {
|
|
712
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
713
|
-
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
714
|
-
expect(pkgJson).toBeDefined();
|
|
715
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
716
|
-
expect(pkg.exports['.']).toBe('./src/index.ts');
|
|
717
|
-
expect(pkg.exports['./components']).toBe('./src/components/index.ts');
|
|
718
|
-
expect(pkg.exports['./lib/utils']).toBe('./src/lib/utils.ts');
|
|
719
|
-
expect(pkg.exports['./styles']).toBe('./src/styles/globals.css');
|
|
720
|
-
});
|
|
721
|
-
|
|
722
|
-
it('should not have build script (private packages are not built)', () => {
|
|
723
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
724
|
-
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
725
|
-
expect(pkgJson).toBeDefined();
|
|
726
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
727
|
-
expect(pkg.scripts.build).toBeUndefined();
|
|
728
|
-
expect(pkg.scripts.storybook).toBeDefined();
|
|
729
|
-
expect(pkg.scripts['build:storybook']).toBeDefined();
|
|
730
|
-
});
|
|
731
|
-
|
|
732
|
-
it('should include Radix UI dependencies', () => {
|
|
733
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
734
|
-
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
735
|
-
expect(pkgJson).toBeDefined();
|
|
736
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
737
|
-
expect(pkg.dependencies['@radix-ui/react-slot']).toBeDefined();
|
|
738
|
-
expect(pkg.dependencies['@radix-ui/react-dialog']).toBeDefined();
|
|
739
|
-
expect(pkg.dependencies['@radix-ui/react-label']).toBeDefined();
|
|
740
|
-
expect(pkg.dependencies['@radix-ui/react-separator']).toBeDefined();
|
|
741
|
-
expect(pkg.dependencies['@radix-ui/react-tabs']).toBeDefined();
|
|
742
|
-
expect(pkg.dependencies['@radix-ui/react-tooltip']).toBeDefined();
|
|
743
|
-
});
|
|
744
|
-
|
|
745
|
-
it('should include Storybook dependencies', () => {
|
|
746
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
747
|
-
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
748
|
-
expect(pkgJson).toBeDefined();
|
|
749
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
750
|
-
expect(pkg.devDependencies['@storybook/react']).toBeDefined();
|
|
751
|
-
expect(pkg.devDependencies['@storybook/react-vite']).toBeDefined();
|
|
752
|
-
expect(pkg.devDependencies['@storybook/addon-essentials']).toBeDefined();
|
|
753
|
-
expect(pkg.devDependencies.storybook).toBeDefined();
|
|
754
|
-
});
|
|
755
|
-
|
|
756
|
-
it('should include Tailwind CSS dependencies', () => {
|
|
757
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
758
|
-
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
759
|
-
expect(pkgJson).toBeDefined();
|
|
760
|
-
const pkg = JSON.parse(pkgJson!.content);
|
|
761
|
-
expect(pkg.devDependencies.tailwindcss).toBeDefined();
|
|
762
|
-
expect(pkg.devDependencies['@tailwindcss/vite']).toBeDefined();
|
|
763
|
-
expect(pkg.peerDependencies.tailwindcss).toBeDefined();
|
|
764
|
-
});
|
|
765
|
-
|
|
766
|
-
it('should extend root tsconfig with noEmit', () => {
|
|
767
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
768
|
-
const tsConfig = files.find((f) => f.path === 'packages/ui/tsconfig.json');
|
|
769
|
-
expect(tsConfig).toBeDefined();
|
|
770
|
-
const config = JSON.parse(tsConfig!.content);
|
|
771
|
-
expect(config.extends).toBe('../../tsconfig.json');
|
|
772
|
-
expect(config.compilerOptions.noEmit).toBe(true);
|
|
773
|
-
expect(config.compilerOptions.jsx).toBe('react-jsx');
|
|
774
|
-
});
|
|
775
|
-
|
|
776
|
-
it('should not include tsdown.config.ts', () => {
|
|
777
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
778
|
-
const paths = files.map((f) => f.path);
|
|
779
|
-
expect(paths).not.toContain('packages/ui/tsdown.config.ts');
|
|
780
|
-
});
|
|
781
|
-
|
|
782
|
-
it('should generate all component files in folder structure', () => {
|
|
783
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
784
|
-
const paths = files.map((f) => f.path);
|
|
785
|
-
|
|
786
|
-
// Button
|
|
787
|
-
expect(paths).toContain('packages/ui/src/components/ui/button/index.tsx');
|
|
788
|
-
expect(paths).toContain(
|
|
789
|
-
'packages/ui/src/components/ui/button/button.stories.tsx',
|
|
790
|
-
);
|
|
791
|
-
|
|
792
|
-
// Input
|
|
793
|
-
expect(paths).toContain('packages/ui/src/components/ui/input/index.tsx');
|
|
794
|
-
expect(paths).toContain(
|
|
795
|
-
'packages/ui/src/components/ui/input/input.stories.tsx',
|
|
796
|
-
);
|
|
797
|
-
|
|
798
|
-
// Card
|
|
799
|
-
expect(paths).toContain('packages/ui/src/components/ui/card/index.tsx');
|
|
800
|
-
expect(paths).toContain(
|
|
801
|
-
'packages/ui/src/components/ui/card/card.stories.tsx',
|
|
802
|
-
);
|
|
803
|
-
|
|
804
|
-
// Label
|
|
805
|
-
expect(paths).toContain('packages/ui/src/components/ui/label/index.tsx');
|
|
806
|
-
expect(paths).toContain(
|
|
807
|
-
'packages/ui/src/components/ui/label/label.stories.tsx',
|
|
808
|
-
);
|
|
809
|
-
|
|
810
|
-
// Badge
|
|
811
|
-
expect(paths).toContain('packages/ui/src/components/ui/badge/index.tsx');
|
|
812
|
-
expect(paths).toContain(
|
|
813
|
-
'packages/ui/src/components/ui/badge/badge.stories.tsx',
|
|
814
|
-
);
|
|
815
|
-
|
|
816
|
-
// Separator
|
|
817
|
-
expect(paths).toContain(
|
|
818
|
-
'packages/ui/src/components/ui/separator/index.tsx',
|
|
819
|
-
);
|
|
820
|
-
expect(paths).toContain(
|
|
821
|
-
'packages/ui/src/components/ui/separator/separator.stories.tsx',
|
|
822
|
-
);
|
|
823
|
-
|
|
824
|
-
// Tabs
|
|
825
|
-
expect(paths).toContain('packages/ui/src/components/ui/tabs/index.tsx');
|
|
826
|
-
expect(paths).toContain(
|
|
827
|
-
'packages/ui/src/components/ui/tabs/tabs.stories.tsx',
|
|
828
|
-
);
|
|
829
|
-
|
|
830
|
-
// Tooltip
|
|
831
|
-
expect(paths).toContain('packages/ui/src/components/ui/tooltip/index.tsx');
|
|
832
|
-
expect(paths).toContain(
|
|
833
|
-
'packages/ui/src/components/ui/tooltip/tooltip.stories.tsx',
|
|
834
|
-
);
|
|
835
|
-
|
|
836
|
-
// Dialog
|
|
837
|
-
expect(paths).toContain('packages/ui/src/components/ui/dialog/index.tsx');
|
|
838
|
-
expect(paths).toContain(
|
|
839
|
-
'packages/ui/src/components/ui/dialog/dialog.stories.tsx',
|
|
840
|
-
);
|
|
841
|
-
});
|
|
842
|
-
|
|
843
|
-
it('should export all components from index', () => {
|
|
844
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
845
|
-
const indexFile = files.find(
|
|
846
|
-
(f) => f.path === 'packages/ui/src/components/ui/index.ts',
|
|
847
|
-
);
|
|
848
|
-
expect(indexFile).toBeDefined();
|
|
849
|
-
expect(indexFile!.content).toContain("from './button.tsx'");
|
|
850
|
-
expect(indexFile!.content).toContain("from './input.tsx'");
|
|
851
|
-
expect(indexFile!.content).toContain("from './card.tsx'");
|
|
852
|
-
expect(indexFile!.content).toContain("from './label.tsx'");
|
|
853
|
-
expect(indexFile!.content).toContain("from './badge.tsx'");
|
|
854
|
-
expect(indexFile!.content).toContain("from './separator.tsx'");
|
|
855
|
-
expect(indexFile!.content).toContain("from './tabs.tsx'");
|
|
856
|
-
expect(indexFile!.content).toContain("from './tooltip.tsx'");
|
|
857
|
-
expect(indexFile!.content).toContain("from './dialog.tsx'");
|
|
858
|
-
});
|
|
859
|
-
|
|
860
|
-
it('should include cn utility function', () => {
|
|
861
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
862
|
-
const utilsFile = files.find(
|
|
863
|
-
(f) => f.path === 'packages/ui/src/lib/utils.ts',
|
|
864
|
-
);
|
|
865
|
-
expect(utilsFile).toBeDefined();
|
|
866
|
-
expect(utilsFile!.content).toContain('export function cn');
|
|
867
|
-
expect(utilsFile!.content).toContain('clsx');
|
|
868
|
-
expect(utilsFile!.content).toContain('twMerge');
|
|
869
|
-
});
|
|
870
|
-
|
|
871
|
-
it('should include Tailwind v4 CSS with theme variables', () => {
|
|
872
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
873
|
-
const globalsCss = files.find(
|
|
874
|
-
(f) => f.path === 'packages/ui/src/styles/globals.css',
|
|
875
|
-
);
|
|
876
|
-
expect(globalsCss).toBeDefined();
|
|
877
|
-
expect(globalsCss!.content).toContain('@import "tailwindcss"');
|
|
878
|
-
expect(globalsCss!.content).toContain('@theme');
|
|
879
|
-
expect(globalsCss!.content).toContain('--color-background');
|
|
880
|
-
expect(globalsCss!.content).toContain('--color-primary');
|
|
881
|
-
expect(globalsCss!.content).toContain('.dark');
|
|
882
|
-
});
|
|
883
|
-
|
|
884
|
-
it('should configure Storybook with Tailwind v4 plugin', () => {
|
|
885
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
886
|
-
const storybookMain = files.find(
|
|
887
|
-
(f) => f.path === 'packages/ui/.storybook/main.ts',
|
|
888
|
-
);
|
|
889
|
-
expect(storybookMain).toBeDefined();
|
|
890
|
-
expect(storybookMain!.content).toContain('@storybook/react-vite');
|
|
891
|
-
expect(storybookMain!.content).toContain('@tailwindcss/vite');
|
|
892
|
-
expect(storybookMain!.content).toContain('viteFinal');
|
|
893
|
-
});
|
|
894
|
-
|
|
895
|
-
it('should import globals.css in Storybook preview', () => {
|
|
896
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
897
|
-
const storybookPreview = files.find(
|
|
898
|
-
(f) => f.path === 'packages/ui/.storybook/preview.ts',
|
|
899
|
-
);
|
|
900
|
-
expect(storybookPreview).toBeDefined();
|
|
901
|
-
expect(storybookPreview!.content).toContain(
|
|
902
|
-
"import '../src/styles/globals.css'",
|
|
903
|
-
);
|
|
904
|
-
});
|
|
905
|
-
|
|
906
|
-
it('should include shadcn components.json config', () => {
|
|
907
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
908
|
-
const componentsJson = files.find(
|
|
909
|
-
(f) => f.path === 'packages/ui/components.json',
|
|
910
|
-
);
|
|
911
|
-
expect(componentsJson).toBeDefined();
|
|
912
|
-
const config = JSON.parse(componentsJson!.content);
|
|
913
|
-
expect(config.$schema).toContain('ui.shadcn.com');
|
|
914
|
-
expect(config.style).toBe('new-york');
|
|
915
|
-
expect(config.tailwind.cssVariables).toBe(true);
|
|
916
|
-
expect(config.aliases.components).toBe('~/components');
|
|
917
|
-
expect(config.aliases.utils).toBe('~/lib/utils');
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
it('should use ~/* path alias in components', () => {
|
|
921
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
922
|
-
const buttonFile = files.find(
|
|
923
|
-
(f) => f.path === 'packages/ui/src/components/ui/button/index.tsx',
|
|
924
|
-
);
|
|
925
|
-
expect(buttonFile).toBeDefined();
|
|
926
|
-
expect(buttonFile!.content).toContain("from '~/lib/utils'");
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
it('should configure ~/* path in tsconfig', () => {
|
|
930
|
-
const files = generateUiPackageFiles(fullstackOptions);
|
|
931
|
-
const tsConfig = files.find((f) => f.path === 'packages/ui/tsconfig.json');
|
|
932
|
-
expect(tsConfig).toBeDefined();
|
|
933
|
-
const config = JSON.parse(tsConfig!.content);
|
|
934
|
-
expect(config.compilerOptions.paths['~/*']).toEqual(['./src/*']);
|
|
935
|
-
});
|
|
936
|
-
});
|
|
937
|
-
|
|
938
|
-
describe('generateTestFiles', () => {
|
|
939
|
-
it('should return empty array when database is disabled', () => {
|
|
940
|
-
const options = { ...baseOptions, database: false };
|
|
941
|
-
const files = generateTestFiles(options, minimalTemplate);
|
|
942
|
-
expect(files).toHaveLength(0);
|
|
943
|
-
});
|
|
944
|
-
|
|
945
|
-
it('should generate all test infrastructure files when database is enabled', () => {
|
|
946
|
-
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
947
|
-
const paths = files.map((f) => f.path);
|
|
948
|
-
expect(paths).toContain('test/config.ts');
|
|
949
|
-
expect(paths).toContain('test/globalSetup.ts');
|
|
950
|
-
expect(paths).toContain('test/factory/index.ts');
|
|
951
|
-
expect(paths).toContain('test/factory/users.ts');
|
|
952
|
-
expect(paths).toContain('test/example.spec.ts');
|
|
953
|
-
});
|
|
954
|
-
|
|
955
|
-
it('should use wrapVitestKyselyTransaction in config', () => {
|
|
956
|
-
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
957
|
-
const configFile = files.find((f) => f.path === 'test/config.ts');
|
|
958
|
-
expect(configFile).toBeDefined();
|
|
959
|
-
expect(configFile!.content).toContain('wrapVitestKyselyTransaction');
|
|
960
|
-
expect(configFile!.content).toContain('@geekmidas/testkit/kysely');
|
|
961
|
-
expect(configFile!.content).toContain('~/services/database.ts');
|
|
962
|
-
});
|
|
963
|
-
|
|
964
|
-
it('should use PostgresKyselyMigrator with runInitScript in globalSetup', () => {
|
|
965
|
-
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
966
|
-
const setupFile = files.find((f) => f.path === 'test/globalSetup.ts');
|
|
967
|
-
expect(setupFile).toBeDefined();
|
|
968
|
-
expect(setupFile!.content).toContain('PostgresKyselyMigrator');
|
|
969
|
-
expect(setupFile!.content).toContain('runInitScript');
|
|
970
|
-
expect(setupFile!.content).toContain('afterCreate');
|
|
971
|
-
expect(setupFile!.content).toContain('Credentials');
|
|
972
|
-
expect(setupFile!.content).toContain('PGBOSS_DB_PASSWORD');
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
it('should use KyselyFactory in factory files', () => {
|
|
976
|
-
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
977
|
-
const factoryIndex = files.find((f) => f.path === 'test/factory/index.ts');
|
|
978
|
-
expect(factoryIndex).toBeDefined();
|
|
979
|
-
expect(factoryIndex!.content).toContain('KyselyFactory');
|
|
980
|
-
expect(factoryIndex!.content).toContain('createFactory');
|
|
981
|
-
|
|
982
|
-
const usersBuilder = files.find((f) => f.path === 'test/factory/users.ts');
|
|
983
|
-
expect(usersBuilder).toBeDefined();
|
|
984
|
-
expect(usersBuilder!.content).toContain('KyselyFactory.createBuilder');
|
|
985
|
-
expect(usersBuilder!.content).toContain("'users'");
|
|
986
|
-
});
|
|
987
|
-
|
|
988
|
-
it('should generate example spec with transaction-wrapped it', () => {
|
|
989
|
-
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
990
|
-
const exampleSpec = files.find((f) => f.path === 'test/example.spec.ts');
|
|
991
|
-
expect(exampleSpec).toBeDefined();
|
|
992
|
-
expect(exampleSpec!.content).toContain("from './config.ts'");
|
|
993
|
-
expect(exampleSpec!.content).toContain('{ db }');
|
|
994
|
-
});
|
|
995
|
-
|
|
996
|
-
it('should work with fullstack template options', () => {
|
|
997
|
-
const options: TemplateOptions = {
|
|
998
|
-
...baseOptions,
|
|
999
|
-
template: 'fullstack',
|
|
1000
|
-
monorepo: true,
|
|
1001
|
-
apiPath: 'apps/api',
|
|
1002
|
-
};
|
|
1003
|
-
const files = generateTestFiles(options, apiTemplate);
|
|
1004
|
-
expect(files.length).toBeGreaterThan(0);
|
|
1005
|
-
const paths = files.map((f) => f.path);
|
|
1006
|
-
expect(paths).toContain('test/config.ts');
|
|
1007
|
-
expect(paths).toContain('test/globalSetup.ts');
|
|
1008
|
-
});
|
|
1009
|
-
});
|
|
1010
|
-
|
|
1011
|
-
describe('generateConfigFiles - vitest.config.ts', () => {
|
|
1012
|
-
it('should generate vitest.config.ts when database is enabled (standalone)', () => {
|
|
1013
|
-
const files = generateConfigFiles(baseOptions, minimalTemplate);
|
|
1014
|
-
const paths = files.map((f) => f.path);
|
|
1015
|
-
expect(paths).toContain('vitest.config.ts');
|
|
1016
|
-
|
|
1017
|
-
const vitestConfig = files.find((f) => f.path === 'vitest.config.ts');
|
|
1018
|
-
expect(vitestConfig!.content).toContain('globalSetup');
|
|
1019
|
-
expect(vitestConfig!.content).toContain('./test/globalSetup.ts');
|
|
1020
|
-
expect(vitestConfig!.content).toContain('vite-tsconfig-paths');
|
|
1021
|
-
expect(vitestConfig!.content).not.toContain('globals: true');
|
|
1022
|
-
});
|
|
1023
|
-
|
|
1024
|
-
it('should not generate vitest.config.ts when database is disabled', () => {
|
|
1025
|
-
const options = { ...baseOptions, database: false };
|
|
1026
|
-
const files = generateConfigFiles(options, minimalTemplate);
|
|
1027
|
-
const paths = files.map((f) => f.path);
|
|
1028
|
-
expect(paths).not.toContain('vitest.config.ts');
|
|
1029
|
-
});
|
|
1030
|
-
|
|
1031
|
-
it('should generate vitest.config.ts for monorepo app with database', () => {
|
|
1032
|
-
const options: TemplateOptions = {
|
|
1033
|
-
...baseOptions,
|
|
1034
|
-
monorepo: true,
|
|
1035
|
-
apiPath: 'apps/api',
|
|
1036
|
-
};
|
|
1037
|
-
const files = generateConfigFiles(options, minimalTemplate);
|
|
1038
|
-
const paths = files.map((f) => f.path);
|
|
1039
|
-
expect(paths).toContain('vitest.config.ts');
|
|
1040
|
-
});
|
|
1041
|
-
|
|
1042
|
-
it('should generate vitest.config.ts for fullstack template with database', () => {
|
|
1043
|
-
const options: TemplateOptions = {
|
|
1044
|
-
...baseOptions,
|
|
1045
|
-
template: 'fullstack',
|
|
1046
|
-
monorepo: true,
|
|
1047
|
-
apiPath: 'apps/api',
|
|
1048
|
-
};
|
|
1049
|
-
const files = generateConfigFiles(options, apiTemplate);
|
|
1050
|
-
const paths = files.map((f) => f.path);
|
|
1051
|
-
expect(paths).toContain('vitest.config.ts');
|
|
1052
|
-
});
|
|
1053
|
-
});
|
|
1054
|
-
|
|
1055
|
-
describe('generatePackageJson - testkit dependencies', () => {
|
|
1056
|
-
it('should include testkit and faker when database is enabled', () => {
|
|
1057
|
-
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
1058
|
-
const pkg = JSON.parse(files[0].content);
|
|
1059
|
-
expect(pkg.devDependencies['@geekmidas/testkit']).toMatch(/^~/);
|
|
1060
|
-
expect(pkg.devDependencies['@faker-js/faker']).toMatch(/^~/);
|
|
1061
|
-
});
|
|
1062
|
-
|
|
1063
|
-
it('should not include testkit when database is disabled', () => {
|
|
1064
|
-
const options = { ...baseOptions, database: false };
|
|
1065
|
-
const files = generatePackageJson(options, minimalTemplate);
|
|
1066
|
-
const pkg = JSON.parse(files[0].content);
|
|
1067
|
-
expect(pkg.devDependencies['@geekmidas/testkit']).toBeUndefined();
|
|
1068
|
-
expect(pkg.devDependencies['@faker-js/faker']).toBeUndefined();
|
|
1069
|
-
});
|
|
1070
|
-
});
|