@geekmidas/cli 10.0.0-alpha.98 → 10.0.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/CHANGELOG.md +667 -0
- package/FUNCTION_CRON_SUPPORT.md +266 -0
- package/README.md +533 -382
- package/bin/gkm.mjs +2 -16
- package/dist/CachedStateProvider-BdX7klRc.cjs +3 -0
- package/dist/CachedStateProvider-CzyFct42.mjs +54 -0
- package/dist/CachedStateProvider-CzyFct42.mjs.map +1 -0
- package/dist/CachedStateProvider-GcGziXh1.mjs +3 -0
- package/dist/CachedStateProvider-klLWZXWF.cjs +60 -0
- package/dist/CachedStateProvider-klLWZXWF.cjs.map +1 -0
- package/dist/{HostingerProvider-BNpS9aRJ.mjs → HostingerProvider-B2ZYz7Yc.mjs} +26 -31
- package/dist/HostingerProvider-B2ZYz7Yc.mjs.map +1 -0
- package/dist/{HostingerProvider-DR1iws1P.cjs → HostingerProvider-CrHfsgz9.cjs} +26 -31
- package/dist/HostingerProvider-CrHfsgz9.cjs.map +1 -0
- package/dist/LocalStateProvider-CP49rjzt.mjs +42 -0
- package/dist/LocalStateProvider-CP49rjzt.mjs.map +1 -0
- package/dist/LocalStateProvider-CalzNfNA.cjs +43 -0
- package/dist/LocalStateProvider-CalzNfNA.cjs.map +1 -0
- package/dist/{Route53Provider-Bllus2NR.cjs → Route53Provider-DwgXiLxt.cjs} +22 -21
- package/dist/Route53Provider-DwgXiLxt.cjs.map +1 -0
- package/dist/{Route53Provider-QXxjkZO1.mjs → Route53Provider-tlgBzrRQ.mjs} +13 -13
- package/dist/Route53Provider-tlgBzrRQ.mjs.map +1 -0
- package/dist/SSMStateProvider-BlrTiV5m.mjs +66 -0
- package/dist/SSMStateProvider-BlrTiV5m.mjs.map +1 -0
- package/dist/SSMStateProvider-Bt6r8CTL.cjs +66 -0
- package/dist/SSMStateProvider-Bt6r8CTL.cjs.map +1 -0
- package/dist/{backup-provisioner-oDEsPj02.cjs → backup-provisioner-B3HBN-2k.cjs} +20 -22
- package/dist/backup-provisioner-B3HBN-2k.cjs.map +1 -0
- package/dist/{backup-provisioner-C8DnCmxK.mjs → backup-provisioner-Xunq-p_8.mjs} +9 -12
- package/dist/backup-provisioner-Xunq-p_8.mjs.map +1 -0
- package/dist/bundler-DkA4qzUD.mjs +135 -0
- package/dist/bundler-DkA4qzUD.mjs.map +1 -0
- package/dist/bundler-Dufq3uvI.cjs +136 -0
- package/dist/bundler-Dufq3uvI.cjs.map +1 -0
- package/dist/{rolldown-runtime-C0BPl7ul.cjs → chunk-CUT6urMc.cjs} +10 -23
- package/dist/chunk-Duj1WY3L.mjs +7 -0
- package/dist/config-Bbu1JKvf.mjs +211 -0
- package/dist/config-Bbu1JKvf.mjs.map +1 -0
- package/dist/config-DujV8DbR.cjs +253 -0
- package/dist/config-DujV8DbR.cjs.map +1 -0
- package/dist/config.cjs +10 -421
- package/dist/config.d.cts +120 -4
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +120 -4
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +3 -405
- package/dist/credentials-C8DWtnMY.cjs +174 -0
- package/dist/credentials-C8DWtnMY.cjs.map +1 -0
- package/dist/credentials-s1kLcIzK.mjs +126 -0
- package/dist/credentials-s1kLcIzK.mjs.map +1 -0
- package/dist/deploy/sniffer-envkit-patch.cjs +10 -18
- package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.cts +2 -0
- package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.mts +2 -0
- package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.mjs +2 -10
- package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
- package/dist/deploy/sniffer-hooks.cjs +7 -13
- package/dist/deploy/sniffer-hooks.cjs.map +1 -1
- package/dist/deploy/sniffer-hooks.d.cts +2 -1
- package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
- package/dist/deploy/sniffer-hooks.d.mts +2 -1
- package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
- package/dist/deploy/sniffer-hooks.mjs +3 -10
- package/dist/deploy/sniffer-hooks.mjs.map +1 -1
- package/dist/deploy/sniffer-loader.cjs +7 -16
- package/dist/deploy/sniffer-loader.cjs.map +1 -1
- package/dist/deploy/sniffer-loader.d.cts +1 -1
- package/dist/deploy/sniffer-loader.d.mts +1 -1
- package/dist/deploy/sniffer-loader.mjs +3 -14
- package/dist/deploy/sniffer-loader.mjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.cjs +13 -17
- package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
- package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
- package/dist/deploy/sniffer-routes-worker.mjs +6 -10
- package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
- package/dist/deploy/sniffer-worker.cjs +6 -15
- package/dist/deploy/sniffer-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-worker.d.cts +3 -1
- package/dist/deploy/sniffer-worker.d.cts.map +1 -1
- package/dist/deploy/sniffer-worker.d.mts +3 -1
- package/dist/deploy/sniffer-worker.d.mts.map +1 -1
- package/dist/deploy/sniffer-worker.mjs +4 -15
- package/dist/deploy/sniffer-worker.mjs.map +1 -1
- package/dist/dokploy-api-BPYkG-ZZ.cjs +3 -0
- package/dist/dokploy-api-BiSzWM4v.mjs +3 -0
- package/dist/dokploy-api-CqOIKHme.cjs +609 -0
- package/dist/dokploy-api-CqOIKHme.cjs.map +1 -0
- package/dist/dokploy-api-sfZFlWuE.mjs +597 -0
- package/dist/dokploy-api-sfZFlWuE.mjs.map +1 -0
- package/dist/encryption-BVS7Vmzs.cjs +4 -0
- package/dist/encryption-Bd_m4q3g.mjs +3 -0
- package/dist/encryption-CO5Q4Bhf.mjs +42 -0
- package/dist/encryption-CO5Q4Bhf.mjs.map +1 -0
- package/dist/encryption-MfXAiFTm.cjs +54 -0
- package/dist/encryption-MfXAiFTm.cjs.map +1 -0
- package/dist/fullstack-secrets-BYzi6Hwl.cjs +402 -0
- package/dist/fullstack-secrets-BYzi6Hwl.cjs.map +1 -0
- package/dist/fullstack-secrets-l8s3II_H.mjs +336 -0
- package/dist/fullstack-secrets-l8s3II_H.mjs.map +1 -0
- package/dist/index-CoVW_fFS.d.cts +1737 -0
- package/dist/index-CoVW_fFS.d.cts.map +1 -0
- package/dist/index-oWibAYQY.d.mts +1737 -0
- package/dist/index-oWibAYQY.d.mts.map +1 -0
- package/dist/index.cjs +11337 -10263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +11303 -10217
- package/dist/index.mjs.map +1 -1
- package/dist/openapi-BzNOC7_i.cjs +1931 -0
- package/dist/openapi-BzNOC7_i.cjs.map +1 -0
- package/dist/openapi-Cfwi0fqF.mjs +1883 -0
- package/dist/openapi-Cfwi0fqF.mjs.map +1 -0
- package/dist/openapi-react-query-C4iIvpPf.mjs +167 -0
- package/dist/openapi-react-query-C4iIvpPf.mjs.map +1 -0
- package/dist/openapi-react-query-CYWik72n.cjs +173 -0
- package/dist/openapi-react-query-CYWik72n.cjs.map +1 -0
- package/dist/openapi-react-query.cjs +4 -0
- package/dist/openapi-react-query.d.cts +11 -0
- package/dist/openapi-react-query.d.cts.map +1 -0
- package/dist/openapi-react-query.d.mts +11 -0
- package/dist/openapi-react-query.d.mts.map +1 -0
- package/dist/openapi-react-query.mjs +4 -0
- package/dist/openapi.cjs +7 -214
- package/dist/openapi.d.cts +15 -72
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +15 -72
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +4 -208
- package/dist/{reconcile--I7V4Klj.mjs → reconcile-B2FoJE0a.mjs} +8 -6
- package/dist/reconcile-B2FoJE0a.mjs.map +1 -0
- package/dist/{reconcile-CuCQBa5-.cjs → reconcile-BzqKJ2Rt.cjs} +8 -6
- package/dist/reconcile-BzqKJ2Rt.cjs.map +1 -0
- package/dist/setup-DDXUXzzl.mjs +765 -0
- package/dist/setup-DDXUXzzl.mjs.map +1 -0
- package/dist/setup-DLwhfyt-.cjs +8 -0
- package/dist/setup-Dh-B7YTX.mjs +8 -0
- package/dist/setup-WZ-xqAQO.cjs +849 -0
- package/dist/setup-WZ-xqAQO.cjs.map +1 -0
- package/dist/storage-B1wvztiJ.cjs +363 -0
- package/dist/storage-B1wvztiJ.cjs.map +1 -0
- package/dist/storage-Cs4WBsc4.mjs +3 -0
- package/dist/storage-DOEtT2Hr.cjs +7 -0
- package/dist/storage-dbb9RyBl.mjs +297 -0
- package/dist/storage-dbb9RyBl.mjs.map +1 -0
- package/dist/sync-B5UHXwRM.mjs +3 -0
- package/dist/sync-BLA94rgC.cjs +4 -0
- package/dist/sync-CSooqRQ8.mjs +76 -0
- package/dist/sync-CSooqRQ8.mjs.map +1 -0
- package/dist/sync-o_CtEbvR.cjs +93 -0
- package/dist/sync-o_CtEbvR.cjs.map +1 -0
- package/dist/types-B3GQUg3k.d.mts +280 -0
- package/dist/types-B3GQUg3k.d.mts.map +1 -0
- package/dist/types-BWQDiooe.d.cts +280 -0
- package/dist/types-BWQDiooe.d.cts.map +1 -0
- package/dist/workspace/index.cjs +4 -12
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +3 -2
- package/dist/workspace-CQTT7HJQ.cjs +4361 -0
- package/dist/workspace-CQTT7HJQ.cjs.map +1 -0
- package/dist/workspace-D-37Ylqo.mjs +4236 -0
- package/dist/workspace-D-37Ylqo.mjs.map +1 -0
- package/docs/OPENAPI_TYPESCRIPT_DESIGN.md +408 -0
- package/docs/dev-server-resilience-design.md +189 -0
- package/docs/manifest-refactor-design.md +287 -0
- package/examples/cron-example.ts +45 -0
- package/examples/env.ts +33 -0
- package/examples/function-example.ts +40 -0
- package/examples/gkm.config.json +22 -0
- package/examples/gkm.config.ts +14 -0
- package/examples/gkm.minimal.config.json +7 -0
- package/examples/gkm.production.config.json +27 -0
- package/examples/logger.ts +10 -0
- package/package.json +37 -87
- package/scripts/sync-versions.ts +108 -0
- package/src/__tests__/EndpointGenerator.hooks.spec.ts +204 -0
- package/src/__tests__/config.spec.ts +422 -0
- package/src/__tests__/loadEnvFiles.spec.ts +131 -0
- package/src/__tests__/normalizeHooksConfig.spec.ts +63 -0
- package/src/__tests__/openapi-react-query.spec.ts +506 -0
- package/src/__tests__/openapi.spec.ts +625 -0
- package/src/__tests__/test-helpers.ts +180 -0
- package/src/auth/__tests__/credentials.spec.ts +331 -0
- package/src/auth/__tests__/index.spec.ts +237 -0
- package/src/auth/credentials.ts +286 -0
- package/src/auth/index.ts +233 -0
- package/src/build/__tests__/bundler.spec.ts +446 -0
- package/src/build/__tests__/endpoint-analyzer.spec.ts +623 -0
- package/src/build/__tests__/handler-templates.spec.ts +1287 -0
- package/src/build/__tests__/index-new.spec.ts +550 -0
- package/src/build/__tests__/manifests.spec.ts +583 -0
- package/src/build/__tests__/partitions.spec.ts +110 -0
- package/src/build/__tests__/workspace-build.spec.ts +215 -0
- package/src/build/bundler.ts +256 -0
- package/src/build/endpoint-analyzer.ts +236 -0
- package/src/build/handler-templates.ts +1253 -0
- package/src/build/index.ts +616 -0
- package/src/build/manifests.ts +285 -0
- package/src/build/partitions.ts +58 -0
- package/src/build/providerResolver.ts +184 -0
- package/src/build/types.ts +104 -0
- package/src/config.ts +330 -0
- package/src/credentials/__tests__/fullDockerPorts.spec.ts +144 -0
- package/src/credentials/__tests__/helpers.ts +112 -0
- package/src/credentials/__tests__/prepareEntryCredentials.spec.ts +125 -0
- package/src/credentials/__tests__/readonlyDockerPorts.spec.ts +190 -0
- package/src/credentials/__tests__/workspaceCredentials.spec.ts +209 -0
- package/src/credentials/index.ts +843 -0
- package/src/debug.ts +68 -0
- package/src/deploy/CachedStateProvider.ts +86 -0
- package/src/deploy/LocalStateProvider.ts +57 -0
- package/src/deploy/SSMStateProvider.ts +117 -0
- package/src/deploy/StateProvider.ts +175 -0
- package/src/deploy/__tests__/CachedStateProvider.spec.ts +235 -0
- package/src/deploy/__tests__/HostingerProvider.spec.ts +347 -0
- package/src/deploy/__tests__/LocalStateProvider.spec.ts +130 -0
- package/src/deploy/__tests__/Route53Provider.spec.ts +425 -0
- package/src/deploy/__tests__/SSMStateProvider.spec.ts +201 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/async-entry.ts +24 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/nested-config-entry.ts +24 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/no-env-entry.ts +12 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/simple-entry.ts +14 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/throwing-entry.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/non-function-export.ts +10 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/optional-env-parser.ts +21 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/parseable-env-parser.ts +18 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/throwing-env-parser.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/valid-env-parser.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/auth.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/health.ts +13 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/users.ts +15 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/services.ts +55 -0
- package/src/deploy/__tests__/backup-provisioner.spec.ts +428 -0
- package/src/deploy/__tests__/createDnsProvider.spec.ts +195 -0
- package/src/deploy/__tests__/createStateProvider.spec.ts +126 -0
- package/src/deploy/__tests__/dns-orchestration.spec.ts +192 -0
- package/src/deploy/__tests__/dns-verification.spec.ts +229 -0
- package/src/deploy/__tests__/docker.spec.ts +149 -0
- package/src/deploy/__tests__/dokploy-api.spec.ts +697 -0
- package/src/deploy/__tests__/dokploy.spec.ts +435 -0
- package/src/deploy/__tests__/domain.spec.ts +235 -0
- package/src/deploy/__tests__/env-resolver.spec.ts +903 -0
- package/src/deploy/__tests__/index.spec.ts +1091 -0
- package/src/deploy/__tests__/init.spec.ts +793 -0
- package/src/deploy/__tests__/secrets.spec.ts +303 -0
- package/src/deploy/__tests__/sniffer.spec.ts +838 -0
- package/src/deploy/__tests__/state-e2e.spec.ts +387 -0
- package/src/deploy/__tests__/state.spec.ts +876 -0
- package/src/deploy/__tests__/undeploy.spec.ts +758 -0
- package/src/deploy/backup-provisioner.ts +316 -0
- package/src/deploy/dns/DnsProvider.ts +201 -0
- package/src/deploy/dns/HostingerProvider.ts +174 -0
- package/src/deploy/dns/Route53Provider.ts +340 -0
- package/src/deploy/dns/hostinger-api.ts +261 -0
- package/src/deploy/dns/index.ts +627 -0
- package/src/deploy/docker.ts +260 -0
- package/src/deploy/dokploy-api.ts +1101 -0
- package/src/deploy/dokploy.ts +177 -0
- package/src/deploy/domain.ts +134 -0
- package/src/deploy/env-resolver.ts +305 -0
- package/src/deploy/index.ts +2094 -0
- package/src/deploy/init.ts +427 -0
- package/src/deploy/secrets.ts +187 -0
- package/src/deploy/sniffer-envkit-patch.ts +61 -0
- package/src/deploy/sniffer-hooks.ts +57 -0
- package/src/deploy/sniffer-loader.ts +28 -0
- package/src/deploy/sniffer-routes-worker.ts +104 -0
- package/src/deploy/sniffer-worker.ts +75 -0
- package/src/deploy/sniffer.ts +578 -0
- package/src/deploy/state-commands.ts +274 -0
- package/src/deploy/state.ts +482 -0
- package/src/deploy/types.ts +102 -0
- package/src/deploy/undeploy.ts +407 -0
- package/src/dev/__tests__/entry-integration.spec.ts +347 -0
- package/src/dev/__tests__/entry.spec.ts +144 -0
- package/src/dev/__tests__/index.spec.ts +2084 -0
- package/src/dev/index.ts +1649 -0
- package/src/docker/__tests__/compose.spec.ts +1142 -0
- package/src/docker/__tests__/templates.spec.ts +694 -0
- package/src/docker/compose.ts +812 -0
- package/src/docker/index.ts +523 -0
- package/src/docker/templates.ts +1067 -0
- package/src/exec/index.ts +118 -0
- package/src/generators/CronGenerator.ts +105 -0
- package/src/generators/EndpointGenerator.ts +954 -0
- package/src/generators/FunctionGenerator.ts +117 -0
- package/src/generators/Generator.ts +147 -0
- package/src/generators/OpenApiTsGenerator.ts +821 -0
- package/src/generators/QueueGenerator.ts +245 -0
- package/src/generators/SubscriberGenerator.ts +282 -0
- package/src/generators/TopicGenerator.ts +45 -0
- package/src/generators/__tests__/CronGenerator.spec.ts +445 -0
- package/src/generators/__tests__/EndpointGenerator.spec.ts +544 -0
- package/src/generators/__tests__/FunctionGenerator.spec.ts +256 -0
- package/src/generators/__tests__/Generator.bustCache.spec.ts +72 -0
- package/src/generators/__tests__/OpenApiTsGenerator.registry.spec.ts +98 -0
- package/src/generators/__tests__/OpenApiTsGenerator.responseType.spec.ts +56 -0
- package/src/generators/__tests__/QueueGenerator.spec.ts +141 -0
- package/src/generators/__tests__/SubscriberGenerator.spec.ts +410 -0
- package/src/generators/index.ts +11 -0
- package/src/index.ts +972 -0
- package/src/init/__tests__/generators.spec.ts +1072 -0
- package/src/init/__tests__/init.spec.ts +577 -0
- package/src/init/__tests__/utils.spec.ts +104 -0
- package/src/init/generators/auth.ts +225 -0
- package/src/init/generators/config.ts +316 -0
- package/src/init/generators/docker.ts +388 -0
- package/src/init/generators/env.ts +62 -0
- package/src/init/generators/index.ts +6 -0
- package/src/init/generators/mobile-expo.ts +576 -0
- package/src/init/generators/models.ts +153 -0
- package/src/init/generators/monorepo.ts +475 -0
- package/src/init/generators/package.ts +95 -0
- package/src/init/generators/source.ts +15 -0
- package/src/init/generators/test.ts +178 -0
- package/src/init/generators/ui.ts +1473 -0
- package/src/init/generators/web-tanstack.ts +348 -0
- package/src/init/generators/web.ts +363 -0
- package/src/init/index.ts +542 -0
- package/src/init/templates/api.ts +404 -0
- package/src/init/templates/index.ts +342 -0
- package/src/init/templates/minimal.ts +207 -0
- package/src/init/templates/serverless.ts +148 -0
- package/src/init/templates/worker.ts +216 -0
- package/src/init/utils.ts +197 -0
- package/src/init/versions.ts +52 -0
- package/src/openapi-react-query.ts +288 -0
- package/src/openapi.ts +259 -0
- package/src/secrets/__tests__/encryption.spec.ts +226 -0
- package/src/secrets/__tests__/generator.spec.ts +575 -0
- package/src/secrets/__tests__/index.spec.ts +91 -0
- package/src/secrets/__tests__/reconcile.spec.ts +123 -0
- package/src/secrets/__tests__/storage.spec.ts +645 -0
- package/src/secrets/encryption.ts +91 -0
- package/src/secrets/generator.ts +329 -0
- package/src/secrets/index.ts +417 -0
- package/src/secrets/keystore.ts +144 -0
- package/src/secrets/reconcile.ts +53 -0
- package/src/secrets/storage.ts +337 -0
- package/src/secrets/sync.ts +136 -0
- package/src/secrets/types.ts +70 -0
- package/src/setup/__tests__/auto-setup.spec.ts +147 -0
- package/src/setup/__tests__/reconcile-secrets.spec.ts +439 -0
- package/src/setup/fullstack-secrets.ts +140 -0
- package/src/setup/index.ts +411 -0
- package/src/test/__tests__/__fixtures__/workspace.ts +104 -0
- package/src/test/__tests__/api.spec.ts +199 -0
- package/src/test/__tests__/auth.spec.ts +162 -0
- package/src/test/__tests__/index.spec.ts +502 -0
- package/src/test/__tests__/web.spec.ts +210 -0
- package/src/test/index.ts +198 -0
- package/src/types.ts +363 -0
- package/src/upgrade/__tests__/index.spec.ts +354 -0
- package/src/upgrade/index.ts +253 -0
- package/src/workspace/__tests__/client-generator.spec.ts +326 -0
- package/src/workspace/__tests__/index.spec.ts +766 -0
- package/src/workspace/__tests__/publicEnv.spec.ts +64 -0
- package/src/workspace/__tests__/schema.spec.ts +737 -0
- package/src/workspace/__tests__/type-inference.spec.ts +251 -0
- package/src/workspace/client-generator.ts +109 -0
- package/src/workspace/index.ts +433 -0
- package/src/workspace/publicEnv.ts +57 -0
- package/src/workspace/schema.ts +861 -0
- package/src/workspace/types.ts +943 -0
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +22 -0
- package/bin/adjacent-tsconfig.mjs +0 -97
- package/bin/owning-tsconfig-jsx-register.mjs +0 -18
- package/bin/owning-tsconfig-jsx.mjs +0 -108
- package/dist/EndpointGenerator-Bor2tZCm.mjs +0 -1031
- package/dist/EndpointGenerator-Bor2tZCm.mjs.map +0 -1
- package/dist/EndpointGenerator-De03t1hd.cjs +0 -1090
- package/dist/EndpointGenerator-De03t1hd.cjs.map +0 -1
- package/dist/GoDaddyProvider-C2fK-zeQ.mjs +0 -388
- package/dist/GoDaddyProvider-C2fK-zeQ.mjs.map +0 -1
- package/dist/GoDaddyProvider-SLlyDwD1.cjs +0 -388
- package/dist/GoDaddyProvider-SLlyDwD1.cjs.map +0 -1
- package/dist/HostingerProvider-BNpS9aRJ.mjs.map +0 -1
- package/dist/HostingerProvider-DR1iws1P.cjs.map +0 -1
- package/dist/LegacyStateStore-CAvxM8U5.cjs +0 -124
- package/dist/LegacyStateStore-CAvxM8U5.cjs.map +0 -1
- package/dist/LegacyStateStore-D9QDWCst.mjs +0 -124
- package/dist/LegacyStateStore-D9QDWCst.mjs.map +0 -1
- package/dist/LocalStateStore-DPQSqkSb.mjs +0 -167
- package/dist/LocalStateStore-DPQSqkSb.mjs.map +0 -1
- package/dist/LocalStateStore-QcrdjCl6.cjs +0 -178
- package/dist/LocalStateStore-QcrdjCl6.cjs.map +0 -1
- package/dist/OpenApiTsGenerator-CS_RtWOz.cjs +0 -541
- package/dist/OpenApiTsGenerator-CS_RtWOz.cjs.map +0 -1
- package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs +0 -536
- package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs.map +0 -1
- package/dist/Route53Provider-Bllus2NR.cjs.map +0 -1
- package/dist/Route53Provider-QXxjkZO1.mjs.map +0 -1
- package/dist/S3StateStore-C16tVikU.cjs +0 -222
- package/dist/S3StateStore-C16tVikU.cjs.map +0 -1
- package/dist/S3StateStore-jorgKaee.mjs +0 -223
- package/dist/S3StateStore-jorgKaee.mjs.map +0 -1
- package/dist/SSMStateStore-Dvjt_INw.mjs +0 -205
- package/dist/SSMStateStore-Dvjt_INw.mjs.map +0 -1
- package/dist/SSMStateStore-mPAEr2P2.cjs +0 -204
- package/dist/SSMStateStore-mPAEr2P2.cjs.map +0 -1
- package/dist/SubscriberGenerator-CyN2VF5X.mjs +0 -449
- package/dist/SubscriberGenerator-CyN2VF5X.mjs.map +0 -1
- package/dist/SubscriberGenerator-Dvz7EzqK.cjs +0 -490
- package/dist/SubscriberGenerator-Dvz7EzqK.cjs.map +0 -1
- package/dist/add-CZIIsTcv.mjs +0 -718
- package/dist/add-CZIIsTcv.mjs.map +0 -1
- package/dist/add-SRk65Udu.cjs +0 -720
- package/dist/add-SRk65Udu.cjs.map +0 -1
- package/dist/appPorts-C9z9Pzn9.mjs +0 -223
- package/dist/appPorts-C9z9Pzn9.mjs.map +0 -1
- package/dist/appPorts-Cu79hJF6.cjs +0 -264
- package/dist/appPorts-Cu79hJF6.cjs.map +0 -1
- package/dist/aws-8QQ8n-t6.mjs +0 -89
- package/dist/aws-8QQ8n-t6.mjs.map +0 -1
- package/dist/aws-DY9NqQIT.cjs +0 -100
- package/dist/aws-DY9NqQIT.cjs.map +0 -1
- package/dist/awsStore-Bx5nCFnS.mjs +0 -121
- package/dist/awsStore-Bx5nCFnS.mjs.map +0 -1
- package/dist/awsStore-u3ehhMoY.cjs +0 -138
- package/dist/awsStore-u3ehhMoY.cjs.map +0 -1
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +0 -1
- package/dist/backup-provisioner-oDEsPj02.cjs.map +0 -1
- package/dist/bundler-B0Pj5FXT.cjs +0 -169
- package/dist/bundler-B0Pj5FXT.cjs.map +0 -1
- package/dist/bundler-DxJ-cIEt.mjs +0 -169
- package/dist/bundler-DxJ-cIEt.mjs.map +0 -1
- package/dist/cli-CRDJWWmZ.cjs +0 -73
- package/dist/cli-CRDJWWmZ.cjs.map +0 -1
- package/dist/cli-CV85bY3-.mjs +0 -73
- package/dist/cli-CV85bY3-.mjs.map +0 -1
- package/dist/compose-CQQRRJC3.mjs +0 -1511
- package/dist/compose-CQQRRJC3.mjs.map +0 -1
- package/dist/compose-DMY4ouEk.cjs +0 -1558
- package/dist/compose-DMY4ouEk.cjs.map +0 -1
- package/dist/config-CS76CzXM.d.cts +0 -269
- package/dist/config-CS76CzXM.d.cts.map +0 -1
- package/dist/config-pBzLfNef.d.mts +0 -269
- package/dist/config-pBzLfNef.d.mts.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/credentialSchemas-BJFvfkaz.mjs +0 -237
- package/dist/credentialSchemas-BJFvfkaz.mjs.map +0 -1
- package/dist/credentialSchemas-CAPKFkrG.cjs +0 -272
- package/dist/credentialSchemas-CAPKFkrG.cjs.map +0 -1
- package/dist/credentials-B5N5yKk6.mjs +0 -267
- package/dist/credentials-B5N5yKk6.mjs.map +0 -1
- package/dist/credentials-Zqr3QQYB.cjs +0 -350
- package/dist/credentials-Zqr3QQYB.cjs.map +0 -1
- package/dist/databases-BeGP5eDh.mjs +0 -495
- package/dist/databases-BeGP5eDh.mjs.map +0 -1
- package/dist/databases-DGALFDG3.cjs +0 -598
- package/dist/databases-DGALFDG3.cjs.map +0 -1
- package/dist/define-6poNqm5O.mjs +0 -106
- package/dist/define-6poNqm5O.mjs.map +0 -1
- package/dist/define-crmMcXFS.cjs +0 -153
- package/dist/define-crmMcXFS.cjs.map +0 -1
- package/dist/deploy/public.cjs +0 -211
- package/dist/deploy/public.cjs.map +0 -1
- package/dist/deploy/public.d.cts +0 -664
- package/dist/deploy/public.d.cts.map +0 -1
- package/dist/deploy/public.d.mts +0 -664
- package/dist/deploy/public.d.mts.map +0 -1
- package/dist/deploy/public.mjs +0 -144
- package/dist/deploy/public.mjs.map +0 -1
- package/dist/deploy/sniffer-envparser-worker.cjs +0 -54
- package/dist/deploy/sniffer-envparser-worker.cjs.map +0 -1
- package/dist/deploy/sniffer-envparser-worker.d.cts +0 -1
- package/dist/deploy/sniffer-envparser-worker.d.mts +0 -1
- package/dist/deploy/sniffer-envparser-worker.mjs +0 -55
- package/dist/deploy/sniffer-envparser-worker.mjs.map +0 -1
- package/dist/deploy-277jek46.cjs +0 -2068
- package/dist/deploy-277jek46.cjs.map +0 -1
- package/dist/deploy-Dw8g3sLY.mjs +0 -2019
- package/dist/deploy-Dw8g3sLY.mjs.map +0 -1
- package/dist/derive-B4vDpzgP.mjs +0 -150
- package/dist/derive-B4vDpzgP.mjs.map +0 -1
- package/dist/derive-DAbo49sm.cjs +0 -161
- package/dist/derive-DAbo49sm.cjs.map +0 -1
- package/dist/discover-CU1LjCOf.d.cts +0 -108
- package/dist/discover-CU1LjCOf.d.cts.map +0 -1
- package/dist/discover-DJCCgimv.d.mts +0 -108
- package/dist/discover-DJCCgimv.d.mts.map +0 -1
- package/dist/discover-DPgu-ScS.cjs +0 -600
- package/dist/discover-DPgu-ScS.cjs.map +0 -1
- package/dist/discover-qjFapetL.mjs +0 -527
- package/dist/discover-qjFapetL.mjs.map +0 -1
- package/dist/dns-4RAiVFa7.cjs +0 -55
- package/dist/dns-4RAiVFa7.cjs.map +0 -1
- package/dist/dns-CU22K_i0.mjs +0 -44
- package/dist/dns-CU22K_i0.mjs.map +0 -1
- package/dist/dns-Dhjbnjgl.cjs +0 -663
- package/dist/dns-Dhjbnjgl.cjs.map +0 -1
- package/dist/dns-LqWzPb8l.mjs +0 -610
- package/dist/dns-LqWzPb8l.mjs.map +0 -1
- package/dist/dokploy-D_uCbZQ7.mjs +0 -38
- package/dist/dokploy-D_uCbZQ7.mjs.map +0 -1
- package/dist/dokploy-Dw4oCXqR.cjs +0 -38
- package/dist/dokploy-Dw4oCXqR.cjs.map +0 -1
- package/dist/drivers-CTaWrA_L.mjs +0 -177
- package/dist/drivers-CTaWrA_L.mjs.map +0 -1
- package/dist/drivers-DDojgzz0.cjs +0 -200
- package/dist/drivers-DDojgzz0.cjs.map +0 -1
- package/dist/emit-C1e8qD08.mjs +0 -193
- package/dist/emit-C1e8qD08.mjs.map +0 -1
- package/dist/emit-Dmc1nvdS.cjs +0 -210
- package/dist/emit-Dmc1nvdS.cjs.map +0 -1
- package/dist/encryption-C0uKYE9v.mjs +0 -89
- package/dist/encryption-C0uKYE9v.mjs.map +0 -1
- package/dist/encryption-CtVPHWWq.cjs +0 -90
- package/dist/encryption-CtVPHWWq.cjs.map +0 -1
- package/dist/engine-BE5PdE8S.mjs +0 -3080
- package/dist/engine-BE5PdE8S.mjs.map +0 -1
- package/dist/engine-HI8aLw1M.cjs +0 -3193
- package/dist/engine-HI8aLw1M.cjs.map +0 -1
- package/dist/errors-D8Gwp5kU.mjs +0 -23
- package/dist/errors-D8Gwp5kU.mjs.map +0 -1
- package/dist/errors-DMC4Umsb.cjs +0 -34
- package/dist/errors-DMC4Umsb.cjs.map +0 -1
- package/dist/github-BCdfZ9zO.cjs +0 -818
- package/dist/github-BCdfZ9zO.cjs.map +0 -1
- package/dist/github-CT3X720_.mjs +0 -818
- package/dist/github-CT3X720_.mjs.map +0 -1
- package/dist/index-DKtB01YC.d.cts +0 -190
- package/dist/index-DKtB01YC.d.cts.map +0 -1
- package/dist/index-ZAUrXH6Q.d.mts +0 -190
- package/dist/index-ZAUrXH6Q.d.mts.map +0 -1
- package/dist/local-BwC2v2Y8.mjs +0 -224
- package/dist/local-BwC2v2Y8.mjs.map +0 -1
- package/dist/local-DNhnkugT.cjs +0 -241
- package/dist/local-DNhnkugT.cjs.map +0 -1
- package/dist/migrate-CCZUgxMK.mjs +0 -266
- package/dist/migrate-CCZUgxMK.mjs.map +0 -1
- package/dist/migrate-Cs7kQxD5.cjs +0 -271
- package/dist/migrate-Cs7kQxD5.cjs.map +0 -1
- package/dist/migrate-DBGyoBvZ.cjs +0 -181
- package/dist/migrate-DBGyoBvZ.cjs.map +0 -1
- package/dist/migrate-DH-lOK3j.mjs +0 -181
- package/dist/migrate-DH-lOK3j.mjs.map +0 -1
- package/dist/openapi.cjs.map +0 -1
- package/dist/openapi.mjs.map +0 -1
- package/dist/projectBucket-BjeDcAYy.cjs +0 -206
- package/dist/projectBucket-BjeDcAYy.cjs.map +0 -1
- package/dist/projectBucket-DrkEht-j.mjs +0 -177
- package/dist/projectBucket-DrkEht-j.mjs.map +0 -1
- package/dist/provider-BqpjG9QM.cjs +0 -57
- package/dist/provider-BqpjG9QM.cjs.map +0 -1
- package/dist/provider-CEOKk8NS.mjs +0 -46
- package/dist/provider-CEOKk8NS.mjs.map +0 -1
- package/dist/ready-D3PIjx3S.cjs +0 -403
- package/dist/ready-D3PIjx3S.cjs.map +0 -1
- package/dist/ready-naOSJpeJ.mjs +0 -374
- package/dist/ready-naOSJpeJ.mjs.map +0 -1
- package/dist/reconcile/public.cjs +0 -7
- package/dist/reconcile/public.d.cts +0 -49
- package/dist/reconcile/public.d.cts.map +0 -1
- package/dist/reconcile/public.d.mts +0 -49
- package/dist/reconcile/public.d.mts.map +0 -1
- package/dist/reconcile/public.mjs +0 -3
- package/dist/reconcile--I7V4Klj.mjs.map +0 -1
- package/dist/reconcile-CuCQBa5-.cjs.map +0 -1
- package/dist/resolve-CScrqgdC.cjs +0 -316
- package/dist/resolve-CScrqgdC.cjs.map +0 -1
- package/dist/resolve-OfLaxaxY.mjs +0 -263
- package/dist/resolve-OfLaxaxY.mjs.map +0 -1
- package/dist/rollback-D7p4wJNO.cjs +0 -165
- package/dist/rollback-D7p4wJNO.cjs.map +0 -1
- package/dist/rollback-DQBSN-i7.mjs +0 -136
- package/dist/rollback-DQBSN-i7.mjs.map +0 -1
- package/dist/rolldown-runtime-BhDjJH2R.mjs +0 -15
- package/dist/run-BJLIerMM.mjs +0 -133
- package/dist/run-BJLIerMM.mjs.map +0 -1
- package/dist/run-fVZ-rLnc.cjs +0 -174
- package/dist/run-fVZ-rLnc.cjs.map +0 -1
- package/dist/runtime-BlHOVx8L.d.cts +0 -82
- package/dist/runtime-BlHOVx8L.d.cts.map +0 -1
- package/dist/runtime-DMq9C3KB.d.mts +0 -82
- package/dist/runtime-DMq9C3KB.d.mts.map +0 -1
- package/dist/s3-CUKzBBae.mjs +0 -215
- package/dist/s3-CUKzBBae.mjs.map +0 -1
- package/dist/s3-QQi4sNOQ.cjs +0 -215
- package/dist/s3-QQi4sNOQ.cjs.map +0 -1
- package/dist/sandbox/config-worker.cjs +0 -43
- package/dist/sandbox/config-worker.cjs.map +0 -1
- package/dist/sandbox/config-worker.d.cts +0 -1
- package/dist/sandbox/config-worker.d.mts +0 -1
- package/dist/sandbox/config-worker.mjs +0 -44
- package/dist/sandbox/config-worker.mjs.map +0 -1
- package/dist/sandbox/credentials-worker.cjs +0 -54
- package/dist/sandbox/credentials-worker.cjs.map +0 -1
- package/dist/sandbox/credentials-worker.d.cts +0 -1
- package/dist/sandbox/credentials-worker.d.mts +0 -1
- package/dist/sandbox/credentials-worker.mjs +0 -55
- package/dist/sandbox/credentials-worker.mjs.map +0 -1
- package/dist/sandbox/discover-worker.cjs +0 -47
- package/dist/sandbox/discover-worker.cjs.map +0 -1
- package/dist/sandbox/discover-worker.d.cts +0 -1
- package/dist/sandbox/discover-worker.d.mts +0 -1
- package/dist/sandbox/discover-worker.mjs +0 -48
- package/dist/sandbox/discover-worker.mjs.map +0 -1
- package/dist/sandbox/migrate-worker.cjs +0 -75
- package/dist/sandbox/migrate-worker.cjs.map +0 -1
- package/dist/sandbox/migrate-worker.d.cts +0 -1
- package/dist/sandbox/migrate-worker.d.mts +0 -1
- package/dist/sandbox/migrate-worker.mjs +0 -76
- package/dist/sandbox/migrate-worker.mjs.map +0 -1
- package/dist/sandbox-ArJ_hEKk.d.cts +0 -104
- package/dist/sandbox-ArJ_hEKk.d.cts.map +0 -1
- package/dist/sandbox-CHv3OYXg.cjs +0 -165
- package/dist/sandbox-CHv3OYXg.cjs.map +0 -1
- package/dist/sandbox-CbVB7uOD.mjs +0 -118
- package/dist/sandbox-CbVB7uOD.mjs.map +0 -1
- package/dist/sandbox-Cm4X6HRh.d.mts +0 -104
- package/dist/sandbox-Cm4X6HRh.d.mts.map +0 -1
- package/dist/schemas-BObwxB_t.cjs +0 -6017
- package/dist/schemas-BObwxB_t.cjs.map +0 -1
- package/dist/schemas-D-xeKJDD.mjs +0 -5916
- package/dist/schemas-D-xeKJDD.mjs.map +0 -1
- package/dist/secrets-AA_tQUl-.mjs +0 -36
- package/dist/secrets-AA_tQUl-.mjs.map +0 -1
- package/dist/secrets-B_biKsKx.cjs +0 -47
- package/dist/secrets-B_biKsKx.cjs.map +0 -1
- package/dist/secretsManager-CQORubp9.mjs +0 -97
- package/dist/secretsManager-CQORubp9.mjs.map +0 -1
- package/dist/secretsManager-RAGcEDX1.cjs +0 -108
- package/dist/secretsManager-RAGcEDX1.cjs.map +0 -1
- package/dist/seeds-BvxWUGKJ.mjs +0 -8263
- package/dist/seeds-BvxWUGKJ.mjs.map +0 -1
- package/dist/seeds-Df4BI-T3.cjs +0 -9266
- package/dist/seeds-Df4BI-T3.cjs.map +0 -1
- package/dist/sniffer-BqjXvcaK.mjs +0 -1825
- package/dist/sniffer-BqjXvcaK.mjs.map +0 -1
- package/dist/sniffer-DZeQJKty.cjs +0 -1998
- package/dist/sniffer-DZeQJKty.cjs.map +0 -1
- package/dist/sst-CGdjHn2A.mjs +0 -441
- package/dist/sst-CGdjHn2A.mjs.map +0 -1
- package/dist/sst-DGuHDxVU.cjs +0 -464
- package/dist/sst-DGuHDxVU.cjs.map +0 -1
- package/dist/stack-A6MAFZ6u.mjs +0 -1201
- package/dist/stack-A6MAFZ6u.mjs.map +0 -1
- package/dist/stack-BpkZEEfB.cjs +0 -1308
- package/dist/stack-BpkZEEfB.cjs.map +0 -1
- package/dist/stages-6SEoRA4x.mjs +0 -190
- package/dist/stages-6SEoRA4x.mjs.map +0 -1
- package/dist/stages-DH5z89eT.cjs +0 -190
- package/dist/stages-DH5z89eT.cjs.map +0 -1
- package/dist/target/public.cjs +0 -15
- package/dist/target/public.d.cts +0 -28
- package/dist/target/public.d.cts.map +0 -1
- package/dist/target/public.d.mts +0 -28
- package/dist/target/public.d.mts.map +0 -1
- package/dist/target/public.mjs +0 -4
- package/dist/terminal-CPHuH4S1.cjs +0 -85
- package/dist/terminal-CPHuH4S1.cjs.map +0 -1
- package/dist/terminal-iNmAXXjs.mjs +0 -85
- package/dist/terminal-iNmAXXjs.mjs.map +0 -1
- package/dist/types-DipUP9zp.d.cts +0 -7606
- package/dist/types-DipUP9zp.d.cts.map +0 -1
- package/dist/types-Drpl9HX9.d.mts +0 -7605
- package/dist/types-Drpl9HX9.d.mts.map +0 -1
- package/dist/utils-D2Nk1Nv2.cjs +0 -205
- package/dist/utils-D2Nk1Nv2.cjs.map +0 -1
- package/dist/utils-D_fxUqvU.mjs +0 -156
- package/dist/utils-D_fxUqvU.mjs.map +0 -1
- package/dist/vitest.cjs +0 -65
- package/dist/vitest.cjs.map +0 -1
- package/dist/vitest.d.cts +0 -29
- package/dist/vitest.d.cts.map +0 -1
- package/dist/vitest.d.mts +0 -29
- package/dist/vitest.d.mts.map +0 -1
- package/dist/vitest.mjs +0 -65
- package/dist/vitest.mjs.map +0 -1
- package/dist/workerRuntime-BXfhbe13.cjs +0 -108
- package/dist/workerRuntime-BXfhbe13.cjs.map +0 -1
- package/dist/workerRuntime-CsOyBRx2.mjs +0 -79
- package/dist/workerRuntime-CsOyBRx2.mjs.map +0 -1
- package/dist/workspace-BBeT6Pil.mjs +0 -2088
- package/dist/workspace-BBeT6Pil.mjs.map +0 -1
- package/dist/workspace-BJ78Bgvm.cjs +0 -2494
- package/dist/workspace-BJ78Bgvm.cjs.map +0 -1
|
@@ -0,0 +1,1072 @@
|
|
|
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(
|
|
267
|
+
'pgsty/minio:RELEASE.2026-08-04T00-00-00Z',
|
|
268
|
+
);
|
|
269
|
+
expect(files[0].content).toContain("'${MINIO_API_HOST_PORT:-9000}:9000'");
|
|
270
|
+
expect(files[0].content).toContain(
|
|
271
|
+
"'${MINIO_CONSOLE_HOST_PORT:-9001}:9001'",
|
|
272
|
+
);
|
|
273
|
+
expect(files[0].content).toContain('MINIO_ROOT_USER:');
|
|
274
|
+
expect(files[0].content).toContain('MINIO_ROOT_PASSWORD:');
|
|
275
|
+
expect(files[0].content).toContain('minio_data:');
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should include all services when all are enabled', () => {
|
|
279
|
+
const options = {
|
|
280
|
+
...baseOptions,
|
|
281
|
+
services: { db: true, cache: true, mail: true, storage: true },
|
|
282
|
+
};
|
|
283
|
+
const files = generateDockerFiles(options, minimalTemplate);
|
|
284
|
+
expect(files[0].content).toContain('postgres');
|
|
285
|
+
expect(files[0].content).toContain('redis');
|
|
286
|
+
expect(files[0].content).toContain('mailpit');
|
|
287
|
+
expect(files[0].content).toContain('minio');
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it('should not include disabled services', () => {
|
|
291
|
+
const options = {
|
|
292
|
+
...baseOptions,
|
|
293
|
+
database: false,
|
|
294
|
+
services: { db: false, cache: false, mail: false, storage: false },
|
|
295
|
+
};
|
|
296
|
+
const files = generateDockerFiles(options, minimalTemplate);
|
|
297
|
+
expect(files[0].content).not.toContain('postgres');
|
|
298
|
+
expect(files[0].content).toContain('redis'); // redis is always included
|
|
299
|
+
expect(files[0].content).not.toContain('mailpit');
|
|
300
|
+
expect(files[0].content).not.toContain('minio');
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('should include localstack when events is sns', () => {
|
|
304
|
+
const options = {
|
|
305
|
+
...baseOptions,
|
|
306
|
+
services: {
|
|
307
|
+
db: true,
|
|
308
|
+
cache: true,
|
|
309
|
+
mail: false,
|
|
310
|
+
storage: false,
|
|
311
|
+
events: 'sns' as const,
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
const files = generateDockerFiles(options, minimalTemplate);
|
|
315
|
+
const compose = files[0].content;
|
|
316
|
+
expect(compose).toContain('localstack');
|
|
317
|
+
expect(compose).toContain('SERVICES: sns,sqs');
|
|
318
|
+
expect(compose).toContain('LOCALSTACK_PORT');
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it('should include rabbitmq when events is rabbitmq', () => {
|
|
322
|
+
const options = {
|
|
323
|
+
...baseOptions,
|
|
324
|
+
services: {
|
|
325
|
+
db: true,
|
|
326
|
+
cache: true,
|
|
327
|
+
mail: false,
|
|
328
|
+
storage: false,
|
|
329
|
+
events: 'rabbitmq' as const,
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
const files = generateDockerFiles(options, minimalTemplate);
|
|
333
|
+
const compose = files[0].content;
|
|
334
|
+
expect(compose).toContain('rabbitmq');
|
|
335
|
+
expect(compose).toContain('RABBITMQ_HOST_PORT');
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it('should not add extra container for pgboss events', () => {
|
|
339
|
+
const options = {
|
|
340
|
+
...baseOptions,
|
|
341
|
+
services: {
|
|
342
|
+
db: true,
|
|
343
|
+
cache: true,
|
|
344
|
+
mail: false,
|
|
345
|
+
storage: false,
|
|
346
|
+
events: 'pgboss' as const,
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
const files = generateDockerFiles(options, minimalTemplate);
|
|
350
|
+
const compose = files[0].content;
|
|
351
|
+
expect(compose).not.toContain('localstack');
|
|
352
|
+
// pgboss reuses postgres, no separate container
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('should generate idempotent postgres init script with pgboss', () => {
|
|
356
|
+
const options = {
|
|
357
|
+
...baseOptions,
|
|
358
|
+
template: 'fullstack' as const,
|
|
359
|
+
monorepo: true,
|
|
360
|
+
apiPath: 'apps/api',
|
|
361
|
+
services: {
|
|
362
|
+
db: true,
|
|
363
|
+
cache: true,
|
|
364
|
+
mail: false,
|
|
365
|
+
storage: false,
|
|
366
|
+
events: 'pgboss' as const,
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
const dbApps = [
|
|
370
|
+
{ name: 'api', password: 'api-pass' },
|
|
371
|
+
{ name: 'auth', password: 'auth-pass' },
|
|
372
|
+
];
|
|
373
|
+
const files = generateDockerFiles(options, apiTemplate, dbApps);
|
|
374
|
+
const initScript = files.find((f) => f.path === 'docker/postgres/init.sh');
|
|
375
|
+
expect(initScript).toBeDefined();
|
|
376
|
+
expect(initScript!.content).toContain('IF NOT EXISTS');
|
|
377
|
+
expect(initScript!.content).toContain('pgboss');
|
|
378
|
+
expect(initScript!.content).toContain('PGBOSS_DB_PASSWORD');
|
|
379
|
+
expect(initScript!.content).toContain('CREATE SCHEMA IF NOT EXISTS pgboss');
|
|
380
|
+
|
|
381
|
+
// Docker env should include pgboss password
|
|
382
|
+
const envFile = files.find((f) => f.path === 'docker/.env');
|
|
383
|
+
expect(envFile).toBeDefined();
|
|
384
|
+
expect(envFile!.content).toContain('PGBOSS_DB_PASSWORD');
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
describe('generateMonorepoFiles', () => {
|
|
389
|
+
it('should return empty array for non-monorepo', () => {
|
|
390
|
+
const files = generateMonorepoFiles(baseOptions, minimalTemplate);
|
|
391
|
+
expect(files).toHaveLength(0);
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it('should generate root files for monorepo', () => {
|
|
395
|
+
const options: TemplateOptions = {
|
|
396
|
+
...baseOptions,
|
|
397
|
+
monorepo: true,
|
|
398
|
+
apiPath: 'apps/api',
|
|
399
|
+
};
|
|
400
|
+
const files = generateMonorepoFiles(options, minimalTemplate);
|
|
401
|
+
const paths = files.map((f) => f.path);
|
|
402
|
+
expect(paths).toContain('package.json');
|
|
403
|
+
expect(paths).toContain('pnpm-workspace.yaml');
|
|
404
|
+
expect(paths).toContain('tsconfig.json');
|
|
405
|
+
expect(paths).toContain('biome.json');
|
|
406
|
+
expect(paths).toContain('turbo.json');
|
|
407
|
+
expect(paths).toContain('.gitignore');
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
it('should include correct workspace paths', () => {
|
|
411
|
+
const options: TemplateOptions = {
|
|
412
|
+
...baseOptions,
|
|
413
|
+
monorepo: true,
|
|
414
|
+
apiPath: 'apps/api',
|
|
415
|
+
};
|
|
416
|
+
const files = generateMonorepoFiles(options, minimalTemplate);
|
|
417
|
+
const workspace = files.find((f) => f.path === 'pnpm-workspace.yaml');
|
|
418
|
+
expect(workspace?.content).toContain("'apps/*'");
|
|
419
|
+
expect(workspace?.content).toContain("'packages/*'");
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
it('should include root scripts', () => {
|
|
423
|
+
const options: TemplateOptions = {
|
|
424
|
+
...baseOptions,
|
|
425
|
+
monorepo: true,
|
|
426
|
+
apiPath: 'apps/api',
|
|
427
|
+
};
|
|
428
|
+
const files = generateMonorepoFiles(options, minimalTemplate);
|
|
429
|
+
const pkgJson = files.find((f) => f.path === 'package.json');
|
|
430
|
+
expect(pkgJson).toBeDefined();
|
|
431
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
432
|
+
expect(pkg.scripts.dev).toBe('turbo dev');
|
|
433
|
+
expect(pkg.scripts.build).toBe('turbo build');
|
|
434
|
+
expect(pkg.scripts.lint).toBe('biome lint .');
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
describe('generateTanStackWebFiles', () => {
|
|
439
|
+
const fullstackOptions: TemplateOptions = {
|
|
440
|
+
...baseOptions,
|
|
441
|
+
template: 'fullstack',
|
|
442
|
+
monorepo: true,
|
|
443
|
+
apiPath: 'apps/api',
|
|
444
|
+
frontendFramework: 'tanstack-start',
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
it('returns empty array for non-fullstack template', () => {
|
|
448
|
+
expect(generateTanStackWebFiles(baseOptions)).toHaveLength(0);
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
it('generates the expected file paths', () => {
|
|
452
|
+
const files = generateTanStackWebFiles(fullstackOptions);
|
|
453
|
+
const paths = files.map((f) => f.path);
|
|
454
|
+
expect(paths).toContain('apps/web/package.json');
|
|
455
|
+
expect(paths).toContain('apps/web/vite.config.ts');
|
|
456
|
+
expect(paths).toContain('apps/web/src/router.tsx');
|
|
457
|
+
expect(paths).toContain('apps/web/src/routes/__root.tsx');
|
|
458
|
+
expect(paths).toContain('apps/web/src/routes/index.tsx');
|
|
459
|
+
expect(paths).toContain('apps/web/src/config/client.ts');
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
it('uses VITE_ prefix in client config, not NEXT_PUBLIC_', () => {
|
|
463
|
+
const files = generateTanStackWebFiles(fullstackOptions);
|
|
464
|
+
const clientConfig = files.find(
|
|
465
|
+
(f) => f.path === 'apps/web/src/config/client.ts',
|
|
466
|
+
);
|
|
467
|
+
expect(clientConfig).toBeDefined();
|
|
468
|
+
expect(clientConfig!.content).toContain('VITE_API_URL');
|
|
469
|
+
expect(clientConfig!.content).toContain('VITE_AUTH_URL');
|
|
470
|
+
expect(clientConfig!.content).not.toContain('NEXT_PUBLIC_');
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it('declares tanstack and vite as dependencies', () => {
|
|
474
|
+
const files = generateTanStackWebFiles(fullstackOptions);
|
|
475
|
+
const pkg = JSON.parse(
|
|
476
|
+
files.find((f) => f.path === 'apps/web/package.json')!.content,
|
|
477
|
+
);
|
|
478
|
+
expect(pkg.dependencies['@tanstack/react-start']).toBeDefined();
|
|
479
|
+
expect(pkg.dependencies['@tanstack/react-router']).toBeDefined();
|
|
480
|
+
expect(pkg.devDependencies.vite).toBeDefined();
|
|
481
|
+
expect(pkg.dependencies.next).toBeUndefined();
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
describe('generateExpoAppFiles', () => {
|
|
486
|
+
const fullstackOptions: TemplateOptions = {
|
|
487
|
+
...baseOptions,
|
|
488
|
+
template: 'fullstack',
|
|
489
|
+
monorepo: true,
|
|
490
|
+
apiPath: 'apps/api',
|
|
491
|
+
frontendFramework: 'expo',
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
it('returns empty array for non-fullstack template', () => {
|
|
495
|
+
expect(generateExpoAppFiles(baseOptions)).toHaveLength(0);
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
it('generates the expected Expo file paths', () => {
|
|
499
|
+
const files = generateExpoAppFiles(fullstackOptions);
|
|
500
|
+
const paths = files.map((f) => f.path);
|
|
501
|
+
expect(paths).toContain('apps/app/package.json');
|
|
502
|
+
expect(paths).toContain('apps/app/app.config.ts');
|
|
503
|
+
expect(paths).toContain('apps/app/eas.json');
|
|
504
|
+
expect(paths).toContain('apps/app/babel.config.js');
|
|
505
|
+
expect(paths).toContain('apps/app/metro.config.js');
|
|
506
|
+
expect(paths).toContain('apps/app/app/_layout.tsx');
|
|
507
|
+
expect(paths).toContain('apps/app/app/index.tsx');
|
|
508
|
+
expect(paths).toContain('apps/app/app/login.tsx');
|
|
509
|
+
expect(paths).toContain('apps/app/lib/auth-client.ts');
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it('uses EXPO_PUBLIC_ prefix in config.ts', () => {
|
|
513
|
+
const files = generateExpoAppFiles(fullstackOptions);
|
|
514
|
+
const configTs = files.find((f) => f.path === 'apps/app/config.ts');
|
|
515
|
+
expect(configTs).toBeDefined();
|
|
516
|
+
expect(configTs!.content).toContain('EXPO_PUBLIC_API_URL');
|
|
517
|
+
expect(configTs!.content).toContain('EXPO_PUBLIC_AUTH_URL');
|
|
518
|
+
expect(configTs!.content).not.toContain('VITE_');
|
|
519
|
+
expect(configTs!.content).not.toContain('NEXT_PUBLIC_');
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
it('seeds eas.json with EXPO_PUBLIC_ env vars per profile', () => {
|
|
523
|
+
const files = generateExpoAppFiles(fullstackOptions);
|
|
524
|
+
const eas = JSON.parse(
|
|
525
|
+
files.find((f) => f.path === 'apps/app/eas.json')!.content,
|
|
526
|
+
);
|
|
527
|
+
expect(eas.build.dev.env.EXPO_PUBLIC_API_URL).toBeDefined();
|
|
528
|
+
expect(eas.build.dev.env.EXPO_PUBLIC_AUTH_URL).toBeDefined();
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
it('declares expo + better-auth/expo as dependencies', () => {
|
|
532
|
+
const files = generateExpoAppFiles(fullstackOptions);
|
|
533
|
+
const pkg = JSON.parse(
|
|
534
|
+
files.find((f) => f.path === 'apps/app/package.json')!.content,
|
|
535
|
+
);
|
|
536
|
+
expect(pkg.dependencies.expo).toBeDefined();
|
|
537
|
+
expect(pkg.dependencies['@better-auth/expo']).toBeDefined();
|
|
538
|
+
expect(pkg.dependencies['expo-router']).toBeDefined();
|
|
539
|
+
expect(pkg.dependencies.next).toBeUndefined();
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
describe('generateMonorepoFiles - frontendFramework wiring', () => {
|
|
544
|
+
const fullstackBase: TemplateOptions = {
|
|
545
|
+
...baseOptions,
|
|
546
|
+
template: 'fullstack',
|
|
547
|
+
monorepo: true,
|
|
548
|
+
apiPath: 'apps/api',
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
it('emits framework: nextjs by default', () => {
|
|
552
|
+
const files = generateMonorepoFiles(
|
|
553
|
+
{ ...fullstackBase, frontendFramework: 'nextjs' },
|
|
554
|
+
minimalTemplate,
|
|
555
|
+
);
|
|
556
|
+
const cfg = files.find((f) => f.path === 'gkm.config.ts');
|
|
557
|
+
expect(cfg!.content).toContain("framework: 'nextjs'");
|
|
558
|
+
expect(cfg!.content).toContain("path: 'apps/web'");
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
it('emits framework: tanstack-start when selected', () => {
|
|
562
|
+
const files = generateMonorepoFiles(
|
|
563
|
+
{ ...fullstackBase, frontendFramework: 'tanstack-start' },
|
|
564
|
+
minimalTemplate,
|
|
565
|
+
);
|
|
566
|
+
const cfg = files.find((f) => f.path === 'gkm.config.ts');
|
|
567
|
+
expect(cfg!.content).toContain("framework: 'tanstack-start'");
|
|
568
|
+
expect(cfg!.content).toContain("path: 'apps/web'");
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
it('emits framework: expo and apps/app path when selected', () => {
|
|
572
|
+
const files = generateMonorepoFiles(
|
|
573
|
+
{ ...fullstackBase, frontendFramework: 'expo' },
|
|
574
|
+
minimalTemplate,
|
|
575
|
+
);
|
|
576
|
+
const cfg = files.find((f) => f.path === 'gkm.config.ts');
|
|
577
|
+
expect(cfg!.content).toContain("framework: 'expo'");
|
|
578
|
+
expect(cfg!.content).toContain("path: 'apps/app'");
|
|
579
|
+
expect(cfg!.content).toContain('port: 8081');
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
describe('generateModelsPackage', () => {
|
|
584
|
+
it('should return empty array for non-monorepo', () => {
|
|
585
|
+
const files = generateModelsPackage(baseOptions);
|
|
586
|
+
expect(files).toHaveLength(0);
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
it('should generate models package for monorepo', () => {
|
|
590
|
+
const options: TemplateOptions = {
|
|
591
|
+
...baseOptions,
|
|
592
|
+
monorepo: true,
|
|
593
|
+
apiPath: 'apps/api',
|
|
594
|
+
};
|
|
595
|
+
const files = generateModelsPackage(options);
|
|
596
|
+
const paths = files.map((f) => f.path);
|
|
597
|
+
expect(paths).toContain('packages/models/package.json');
|
|
598
|
+
expect(paths).toContain('packages/models/tsconfig.json');
|
|
599
|
+
expect(paths).toContain('packages/models/src/common.ts');
|
|
600
|
+
expect(paths).toContain('packages/models/src/user.ts');
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
it('should use correct package name', () => {
|
|
604
|
+
const options: TemplateOptions = {
|
|
605
|
+
...baseOptions,
|
|
606
|
+
monorepo: true,
|
|
607
|
+
apiPath: 'apps/api',
|
|
608
|
+
};
|
|
609
|
+
const files = generateModelsPackage(options);
|
|
610
|
+
const pkgJson = files.find(
|
|
611
|
+
(f) => f.path === 'packages/models/package.json',
|
|
612
|
+
);
|
|
613
|
+
expect(pkgJson).toBeDefined();
|
|
614
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
615
|
+
expect(pkg.name).toBe('@test-project/models');
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
it('should have empty dependencies (zod is at root level)', () => {
|
|
619
|
+
const options: TemplateOptions = {
|
|
620
|
+
...baseOptions,
|
|
621
|
+
monorepo: true,
|
|
622
|
+
apiPath: 'apps/api',
|
|
623
|
+
};
|
|
624
|
+
const files = generateModelsPackage(options);
|
|
625
|
+
const pkgJson = files.find(
|
|
626
|
+
(f) => f.path === 'packages/models/package.json',
|
|
627
|
+
);
|
|
628
|
+
expect(pkgJson).toBeDefined();
|
|
629
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
630
|
+
// zod is now at root level in monorepo, not in models package
|
|
631
|
+
expect(pkg.dependencies).toEqual({});
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
it('should include example schemas', () => {
|
|
635
|
+
const options: TemplateOptions = {
|
|
636
|
+
...baseOptions,
|
|
637
|
+
monorepo: true,
|
|
638
|
+
apiPath: 'apps/api',
|
|
639
|
+
};
|
|
640
|
+
const files = generateModelsPackage(options);
|
|
641
|
+
const userTs = files.find((f) => f.path === 'packages/models/src/user.ts');
|
|
642
|
+
const commonTs = files.find(
|
|
643
|
+
(f) => f.path === 'packages/models/src/common.ts',
|
|
644
|
+
);
|
|
645
|
+
expect(userTs?.content).toContain('UserSchema');
|
|
646
|
+
expect(userTs?.content).toContain('UserResponseSchema');
|
|
647
|
+
expect(userTs?.content).toContain("import { z } from 'zod'");
|
|
648
|
+
expect(commonTs?.content).toContain('PaginationSchema');
|
|
649
|
+
expect(commonTs?.content).toContain('IdSchema');
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
it('should extend root tsconfig', () => {
|
|
653
|
+
const options: TemplateOptions = {
|
|
654
|
+
...baseOptions,
|
|
655
|
+
monorepo: true,
|
|
656
|
+
apiPath: 'apps/api',
|
|
657
|
+
};
|
|
658
|
+
const files = generateModelsPackage(options);
|
|
659
|
+
const tsConfig = files.find(
|
|
660
|
+
(f) => f.path === 'packages/models/tsconfig.json',
|
|
661
|
+
);
|
|
662
|
+
expect(tsConfig).toBeDefined();
|
|
663
|
+
const config = JSON.parse(tsConfig!.content);
|
|
664
|
+
expect(config.extends).toBe('../../tsconfig.json');
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
describe('generateUiPackageFiles', () => {
|
|
669
|
+
const fullstackOptions: TemplateOptions = {
|
|
670
|
+
...baseOptions,
|
|
671
|
+
template: 'fullstack',
|
|
672
|
+
monorepo: true,
|
|
673
|
+
apiPath: 'apps/api',
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
it('should return empty array for non-monorepo', () => {
|
|
677
|
+
const files = generateUiPackageFiles(baseOptions);
|
|
678
|
+
expect(files).toHaveLength(0);
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
it('should return empty array for non-fullstack template', () => {
|
|
682
|
+
const options: TemplateOptions = {
|
|
683
|
+
...baseOptions,
|
|
684
|
+
template: 'minimal',
|
|
685
|
+
monorepo: true,
|
|
686
|
+
apiPath: 'apps/api',
|
|
687
|
+
};
|
|
688
|
+
const files = generateUiPackageFiles(options);
|
|
689
|
+
expect(files).toHaveLength(0);
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
it('should generate UI package files for fullstack template', () => {
|
|
693
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
694
|
+
const paths = files.map((f) => f.path);
|
|
695
|
+
expect(paths).toContain('packages/ui/package.json');
|
|
696
|
+
expect(paths).toContain('packages/ui/tsconfig.json');
|
|
697
|
+
expect(paths).toContain('packages/ui/components.json');
|
|
698
|
+
expect(paths).toContain('packages/ui/.storybook/main.ts');
|
|
699
|
+
expect(paths).toContain('packages/ui/.storybook/preview.ts');
|
|
700
|
+
expect(paths).toContain('packages/ui/src/styles/globals.css');
|
|
701
|
+
expect(paths).toContain('packages/ui/src/lib/utils.ts');
|
|
702
|
+
expect(paths).toContain('packages/ui/src/index.ts');
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
it('should use correct package name', () => {
|
|
706
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
707
|
+
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
708
|
+
expect(pkgJson).toBeDefined();
|
|
709
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
710
|
+
expect(pkg.name).toBe('@test-project/ui');
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
it('should have typescript source exports (not dist)', () => {
|
|
714
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
715
|
+
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
716
|
+
expect(pkgJson).toBeDefined();
|
|
717
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
718
|
+
expect(pkg.exports['.']).toBe('./src/index.ts');
|
|
719
|
+
expect(pkg.exports['./components']).toBe('./src/components/index.ts');
|
|
720
|
+
expect(pkg.exports['./lib/utils']).toBe('./src/lib/utils.ts');
|
|
721
|
+
expect(pkg.exports['./styles']).toBe('./src/styles/globals.css');
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
it('should not have build script (private packages are not built)', () => {
|
|
725
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
726
|
+
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
727
|
+
expect(pkgJson).toBeDefined();
|
|
728
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
729
|
+
expect(pkg.scripts.build).toBeUndefined();
|
|
730
|
+
expect(pkg.scripts.storybook).toBeDefined();
|
|
731
|
+
expect(pkg.scripts['build:storybook']).toBeDefined();
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
it('should include Radix UI dependencies', () => {
|
|
735
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
736
|
+
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
737
|
+
expect(pkgJson).toBeDefined();
|
|
738
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
739
|
+
expect(pkg.dependencies['@radix-ui/react-slot']).toBeDefined();
|
|
740
|
+
expect(pkg.dependencies['@radix-ui/react-dialog']).toBeDefined();
|
|
741
|
+
expect(pkg.dependencies['@radix-ui/react-label']).toBeDefined();
|
|
742
|
+
expect(pkg.dependencies['@radix-ui/react-separator']).toBeDefined();
|
|
743
|
+
expect(pkg.dependencies['@radix-ui/react-tabs']).toBeDefined();
|
|
744
|
+
expect(pkg.dependencies['@radix-ui/react-tooltip']).toBeDefined();
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
it('should include Storybook dependencies', () => {
|
|
748
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
749
|
+
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
750
|
+
expect(pkgJson).toBeDefined();
|
|
751
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
752
|
+
expect(pkg.devDependencies['@storybook/react']).toBeDefined();
|
|
753
|
+
expect(pkg.devDependencies['@storybook/react-vite']).toBeDefined();
|
|
754
|
+
expect(pkg.devDependencies['@storybook/addon-essentials']).toBeDefined();
|
|
755
|
+
expect(pkg.devDependencies.storybook).toBeDefined();
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
it('should include Tailwind CSS dependencies', () => {
|
|
759
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
760
|
+
const pkgJson = files.find((f) => f.path === 'packages/ui/package.json');
|
|
761
|
+
expect(pkgJson).toBeDefined();
|
|
762
|
+
const pkg = JSON.parse(pkgJson!.content);
|
|
763
|
+
expect(pkg.devDependencies.tailwindcss).toBeDefined();
|
|
764
|
+
expect(pkg.devDependencies['@tailwindcss/vite']).toBeDefined();
|
|
765
|
+
expect(pkg.peerDependencies.tailwindcss).toBeDefined();
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
it('should extend root tsconfig with noEmit', () => {
|
|
769
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
770
|
+
const tsConfig = files.find((f) => f.path === 'packages/ui/tsconfig.json');
|
|
771
|
+
expect(tsConfig).toBeDefined();
|
|
772
|
+
const config = JSON.parse(tsConfig!.content);
|
|
773
|
+
expect(config.extends).toBe('../../tsconfig.json');
|
|
774
|
+
expect(config.compilerOptions.noEmit).toBe(true);
|
|
775
|
+
expect(config.compilerOptions.jsx).toBe('react-jsx');
|
|
776
|
+
});
|
|
777
|
+
|
|
778
|
+
it('should not include tsdown.config.ts', () => {
|
|
779
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
780
|
+
const paths = files.map((f) => f.path);
|
|
781
|
+
expect(paths).not.toContain('packages/ui/tsdown.config.ts');
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
it('should generate all component files in folder structure', () => {
|
|
785
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
786
|
+
const paths = files.map((f) => f.path);
|
|
787
|
+
|
|
788
|
+
// Button
|
|
789
|
+
expect(paths).toContain('packages/ui/src/components/ui/button/index.tsx');
|
|
790
|
+
expect(paths).toContain(
|
|
791
|
+
'packages/ui/src/components/ui/button/button.stories.tsx',
|
|
792
|
+
);
|
|
793
|
+
|
|
794
|
+
// Input
|
|
795
|
+
expect(paths).toContain('packages/ui/src/components/ui/input/index.tsx');
|
|
796
|
+
expect(paths).toContain(
|
|
797
|
+
'packages/ui/src/components/ui/input/input.stories.tsx',
|
|
798
|
+
);
|
|
799
|
+
|
|
800
|
+
// Card
|
|
801
|
+
expect(paths).toContain('packages/ui/src/components/ui/card/index.tsx');
|
|
802
|
+
expect(paths).toContain(
|
|
803
|
+
'packages/ui/src/components/ui/card/card.stories.tsx',
|
|
804
|
+
);
|
|
805
|
+
|
|
806
|
+
// Label
|
|
807
|
+
expect(paths).toContain('packages/ui/src/components/ui/label/index.tsx');
|
|
808
|
+
expect(paths).toContain(
|
|
809
|
+
'packages/ui/src/components/ui/label/label.stories.tsx',
|
|
810
|
+
);
|
|
811
|
+
|
|
812
|
+
// Badge
|
|
813
|
+
expect(paths).toContain('packages/ui/src/components/ui/badge/index.tsx');
|
|
814
|
+
expect(paths).toContain(
|
|
815
|
+
'packages/ui/src/components/ui/badge/badge.stories.tsx',
|
|
816
|
+
);
|
|
817
|
+
|
|
818
|
+
// Separator
|
|
819
|
+
expect(paths).toContain(
|
|
820
|
+
'packages/ui/src/components/ui/separator/index.tsx',
|
|
821
|
+
);
|
|
822
|
+
expect(paths).toContain(
|
|
823
|
+
'packages/ui/src/components/ui/separator/separator.stories.tsx',
|
|
824
|
+
);
|
|
825
|
+
|
|
826
|
+
// Tabs
|
|
827
|
+
expect(paths).toContain('packages/ui/src/components/ui/tabs/index.tsx');
|
|
828
|
+
expect(paths).toContain(
|
|
829
|
+
'packages/ui/src/components/ui/tabs/tabs.stories.tsx',
|
|
830
|
+
);
|
|
831
|
+
|
|
832
|
+
// Tooltip
|
|
833
|
+
expect(paths).toContain('packages/ui/src/components/ui/tooltip/index.tsx');
|
|
834
|
+
expect(paths).toContain(
|
|
835
|
+
'packages/ui/src/components/ui/tooltip/tooltip.stories.tsx',
|
|
836
|
+
);
|
|
837
|
+
|
|
838
|
+
// Dialog
|
|
839
|
+
expect(paths).toContain('packages/ui/src/components/ui/dialog/index.tsx');
|
|
840
|
+
expect(paths).toContain(
|
|
841
|
+
'packages/ui/src/components/ui/dialog/dialog.stories.tsx',
|
|
842
|
+
);
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
it('should export all components from index', () => {
|
|
846
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
847
|
+
const indexFile = files.find(
|
|
848
|
+
(f) => f.path === 'packages/ui/src/components/ui/index.ts',
|
|
849
|
+
);
|
|
850
|
+
expect(indexFile).toBeDefined();
|
|
851
|
+
expect(indexFile!.content).toContain("from './button.tsx'");
|
|
852
|
+
expect(indexFile!.content).toContain("from './input.tsx'");
|
|
853
|
+
expect(indexFile!.content).toContain("from './card.tsx'");
|
|
854
|
+
expect(indexFile!.content).toContain("from './label.tsx'");
|
|
855
|
+
expect(indexFile!.content).toContain("from './badge.tsx'");
|
|
856
|
+
expect(indexFile!.content).toContain("from './separator.tsx'");
|
|
857
|
+
expect(indexFile!.content).toContain("from './tabs.tsx'");
|
|
858
|
+
expect(indexFile!.content).toContain("from './tooltip.tsx'");
|
|
859
|
+
expect(indexFile!.content).toContain("from './dialog.tsx'");
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
it('should include cn utility function', () => {
|
|
863
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
864
|
+
const utilsFile = files.find(
|
|
865
|
+
(f) => f.path === 'packages/ui/src/lib/utils.ts',
|
|
866
|
+
);
|
|
867
|
+
expect(utilsFile).toBeDefined();
|
|
868
|
+
expect(utilsFile!.content).toContain('export function cn');
|
|
869
|
+
expect(utilsFile!.content).toContain('clsx');
|
|
870
|
+
expect(utilsFile!.content).toContain('twMerge');
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
it('should include Tailwind v4 CSS with theme variables', () => {
|
|
874
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
875
|
+
const globalsCss = files.find(
|
|
876
|
+
(f) => f.path === 'packages/ui/src/styles/globals.css',
|
|
877
|
+
);
|
|
878
|
+
expect(globalsCss).toBeDefined();
|
|
879
|
+
expect(globalsCss!.content).toContain('@import "tailwindcss"');
|
|
880
|
+
expect(globalsCss!.content).toContain('@theme');
|
|
881
|
+
expect(globalsCss!.content).toContain('--color-background');
|
|
882
|
+
expect(globalsCss!.content).toContain('--color-primary');
|
|
883
|
+
expect(globalsCss!.content).toContain('.dark');
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
it('should configure Storybook with Tailwind v4 plugin', () => {
|
|
887
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
888
|
+
const storybookMain = files.find(
|
|
889
|
+
(f) => f.path === 'packages/ui/.storybook/main.ts',
|
|
890
|
+
);
|
|
891
|
+
expect(storybookMain).toBeDefined();
|
|
892
|
+
expect(storybookMain!.content).toContain('@storybook/react-vite');
|
|
893
|
+
expect(storybookMain!.content).toContain('@tailwindcss/vite');
|
|
894
|
+
expect(storybookMain!.content).toContain('viteFinal');
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
it('should import globals.css in Storybook preview', () => {
|
|
898
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
899
|
+
const storybookPreview = files.find(
|
|
900
|
+
(f) => f.path === 'packages/ui/.storybook/preview.ts',
|
|
901
|
+
);
|
|
902
|
+
expect(storybookPreview).toBeDefined();
|
|
903
|
+
expect(storybookPreview!.content).toContain(
|
|
904
|
+
"import '../src/styles/globals.css'",
|
|
905
|
+
);
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
it('should include shadcn components.json config', () => {
|
|
909
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
910
|
+
const componentsJson = files.find(
|
|
911
|
+
(f) => f.path === 'packages/ui/components.json',
|
|
912
|
+
);
|
|
913
|
+
expect(componentsJson).toBeDefined();
|
|
914
|
+
const config = JSON.parse(componentsJson!.content);
|
|
915
|
+
expect(config.$schema).toContain('ui.shadcn.com');
|
|
916
|
+
expect(config.style).toBe('new-york');
|
|
917
|
+
expect(config.tailwind.cssVariables).toBe(true);
|
|
918
|
+
expect(config.aliases.components).toBe('~/components');
|
|
919
|
+
expect(config.aliases.utils).toBe('~/lib/utils');
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
it('should use ~/* path alias in components', () => {
|
|
923
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
924
|
+
const buttonFile = files.find(
|
|
925
|
+
(f) => f.path === 'packages/ui/src/components/ui/button/index.tsx',
|
|
926
|
+
);
|
|
927
|
+
expect(buttonFile).toBeDefined();
|
|
928
|
+
expect(buttonFile!.content).toContain("from '~/lib/utils'");
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
it('should configure ~/* path in tsconfig', () => {
|
|
932
|
+
const files = generateUiPackageFiles(fullstackOptions);
|
|
933
|
+
const tsConfig = files.find((f) => f.path === 'packages/ui/tsconfig.json');
|
|
934
|
+
expect(tsConfig).toBeDefined();
|
|
935
|
+
const config = JSON.parse(tsConfig!.content);
|
|
936
|
+
expect(config.compilerOptions.paths['~/*']).toEqual(['./src/*']);
|
|
937
|
+
});
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
describe('generateTestFiles', () => {
|
|
941
|
+
it('should return empty array when database is disabled', () => {
|
|
942
|
+
const options = { ...baseOptions, database: false };
|
|
943
|
+
const files = generateTestFiles(options, minimalTemplate);
|
|
944
|
+
expect(files).toHaveLength(0);
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
it('should generate all test infrastructure files when database is enabled', () => {
|
|
948
|
+
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
949
|
+
const paths = files.map((f) => f.path);
|
|
950
|
+
expect(paths).toContain('test/config.ts');
|
|
951
|
+
expect(paths).toContain('test/globalSetup.ts');
|
|
952
|
+
expect(paths).toContain('test/factory/index.ts');
|
|
953
|
+
expect(paths).toContain('test/factory/users.ts');
|
|
954
|
+
expect(paths).toContain('test/example.spec.ts');
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
it('should use wrapVitestKyselyTransaction in config', () => {
|
|
958
|
+
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
959
|
+
const configFile = files.find((f) => f.path === 'test/config.ts');
|
|
960
|
+
expect(configFile).toBeDefined();
|
|
961
|
+
expect(configFile!.content).toContain('wrapVitestKyselyTransaction');
|
|
962
|
+
expect(configFile!.content).toContain('@geekmidas/testkit/kysely');
|
|
963
|
+
expect(configFile!.content).toContain('~/services/database.ts');
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
it('should use PostgresKyselyMigrator with runInitScript in globalSetup', () => {
|
|
967
|
+
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
968
|
+
const setupFile = files.find((f) => f.path === 'test/globalSetup.ts');
|
|
969
|
+
expect(setupFile).toBeDefined();
|
|
970
|
+
expect(setupFile!.content).toContain('PostgresKyselyMigrator');
|
|
971
|
+
expect(setupFile!.content).toContain('runInitScript');
|
|
972
|
+
expect(setupFile!.content).toContain('afterCreate');
|
|
973
|
+
expect(setupFile!.content).toContain('Credentials');
|
|
974
|
+
expect(setupFile!.content).toContain('PGBOSS_DB_PASSWORD');
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
it('should use KyselyFactory in factory files', () => {
|
|
978
|
+
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
979
|
+
const factoryIndex = files.find((f) => f.path === 'test/factory/index.ts');
|
|
980
|
+
expect(factoryIndex).toBeDefined();
|
|
981
|
+
expect(factoryIndex!.content).toContain('KyselyFactory');
|
|
982
|
+
expect(factoryIndex!.content).toContain('createFactory');
|
|
983
|
+
|
|
984
|
+
const usersBuilder = files.find((f) => f.path === 'test/factory/users.ts');
|
|
985
|
+
expect(usersBuilder).toBeDefined();
|
|
986
|
+
expect(usersBuilder!.content).toContain('KyselyFactory.createBuilder');
|
|
987
|
+
expect(usersBuilder!.content).toContain("'users'");
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
it('should generate example spec with transaction-wrapped it', () => {
|
|
991
|
+
const files = generateTestFiles(baseOptions, minimalTemplate);
|
|
992
|
+
const exampleSpec = files.find((f) => f.path === 'test/example.spec.ts');
|
|
993
|
+
expect(exampleSpec).toBeDefined();
|
|
994
|
+
expect(exampleSpec!.content).toContain("from './config.ts'");
|
|
995
|
+
expect(exampleSpec!.content).toContain('{ db }');
|
|
996
|
+
});
|
|
997
|
+
|
|
998
|
+
it('should work with fullstack template options', () => {
|
|
999
|
+
const options: TemplateOptions = {
|
|
1000
|
+
...baseOptions,
|
|
1001
|
+
template: 'fullstack',
|
|
1002
|
+
monorepo: true,
|
|
1003
|
+
apiPath: 'apps/api',
|
|
1004
|
+
};
|
|
1005
|
+
const files = generateTestFiles(options, apiTemplate);
|
|
1006
|
+
expect(files.length).toBeGreaterThan(0);
|
|
1007
|
+
const paths = files.map((f) => f.path);
|
|
1008
|
+
expect(paths).toContain('test/config.ts');
|
|
1009
|
+
expect(paths).toContain('test/globalSetup.ts');
|
|
1010
|
+
});
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
describe('generateConfigFiles - vitest.config.ts', () => {
|
|
1014
|
+
it('should generate vitest.config.ts when database is enabled (standalone)', () => {
|
|
1015
|
+
const files = generateConfigFiles(baseOptions, minimalTemplate);
|
|
1016
|
+
const paths = files.map((f) => f.path);
|
|
1017
|
+
expect(paths).toContain('vitest.config.ts');
|
|
1018
|
+
|
|
1019
|
+
const vitestConfig = files.find((f) => f.path === 'vitest.config.ts');
|
|
1020
|
+
expect(vitestConfig!.content).toContain('globalSetup');
|
|
1021
|
+
expect(vitestConfig!.content).toContain('./test/globalSetup.ts');
|
|
1022
|
+
expect(vitestConfig!.content).toContain('vite-tsconfig-paths');
|
|
1023
|
+
expect(vitestConfig!.content).not.toContain('globals: true');
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
it('should not generate vitest.config.ts when database is disabled', () => {
|
|
1027
|
+
const options = { ...baseOptions, database: false };
|
|
1028
|
+
const files = generateConfigFiles(options, minimalTemplate);
|
|
1029
|
+
const paths = files.map((f) => f.path);
|
|
1030
|
+
expect(paths).not.toContain('vitest.config.ts');
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
it('should generate vitest.config.ts for monorepo app with database', () => {
|
|
1034
|
+
const options: TemplateOptions = {
|
|
1035
|
+
...baseOptions,
|
|
1036
|
+
monorepo: true,
|
|
1037
|
+
apiPath: 'apps/api',
|
|
1038
|
+
};
|
|
1039
|
+
const files = generateConfigFiles(options, minimalTemplate);
|
|
1040
|
+
const paths = files.map((f) => f.path);
|
|
1041
|
+
expect(paths).toContain('vitest.config.ts');
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
it('should generate vitest.config.ts for fullstack template with database', () => {
|
|
1045
|
+
const options: TemplateOptions = {
|
|
1046
|
+
...baseOptions,
|
|
1047
|
+
template: 'fullstack',
|
|
1048
|
+
monorepo: true,
|
|
1049
|
+
apiPath: 'apps/api',
|
|
1050
|
+
};
|
|
1051
|
+
const files = generateConfigFiles(options, apiTemplate);
|
|
1052
|
+
const paths = files.map((f) => f.path);
|
|
1053
|
+
expect(paths).toContain('vitest.config.ts');
|
|
1054
|
+
});
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
describe('generatePackageJson - testkit dependencies', () => {
|
|
1058
|
+
it('should include testkit and faker when database is enabled', () => {
|
|
1059
|
+
const files = generatePackageJson(baseOptions, minimalTemplate);
|
|
1060
|
+
const pkg = JSON.parse(files[0].content);
|
|
1061
|
+
expect(pkg.devDependencies['@geekmidas/testkit']).toMatch(/^~/);
|
|
1062
|
+
expect(pkg.devDependencies['@faker-js/faker']).toMatch(/^~/);
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
it('should not include testkit when database is disabled', () => {
|
|
1066
|
+
const options = { ...baseOptions, database: false };
|
|
1067
|
+
const files = generatePackageJson(options, minimalTemplate);
|
|
1068
|
+
const pkg = JSON.parse(files[0].content);
|
|
1069
|
+
expect(pkg.devDependencies['@geekmidas/testkit']).toBeUndefined();
|
|
1070
|
+
expect(pkg.devDependencies['@faker-js/faker']).toBeUndefined();
|
|
1071
|
+
});
|
|
1072
|
+
});
|