@sibyllinesoft/arbiter 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -0
- package/dist/cli.js +28718 -0
- package/dist/templates/plopfiles/__tests__/build-systems.test.ts +730 -0
- package/dist/templates/plopfiles/__tests__/e2e.test.ts +451 -0
- package/dist/templates/plopfiles/__tests__/generation.test.ts +384 -0
- package/dist/templates/plopfiles/__tests__/linting.test.ts +854 -0
- package/dist/templates/plopfiles/__tests__/modules.test.ts +278 -0
- package/dist/templates/plopfiles/__tests__/smoke.test.ts +619 -0
- package/dist/templates/plopfiles/__tests__/templates.test.ts +341 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/module.js +43 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/.air.toml.hbs +30 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/cmd/server/main.go.hbs +50 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/go.mod.hbs +9 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/internal/handlers/health.go.hbs +51 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/module.js +38 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/build.gradle.kts.hbs +37 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/settings.gradle.kts.hbs +1 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/src/main/kotlin/Application.kt.hbs +44 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/src/main/kotlin/routes/Health.kt.hbs +41 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/src/main/resources/logback.xml.hbs +11 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/module.js +54 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/templates/src/index.ts.hbs +37 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/templates/src/routes/health.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/templates/tsconfig.json.hbs +18 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/module.js +56 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/src/index.ts.hbs +30 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/src/routes/health.ts.hbs +64 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/src/routes/index.ts.hbs +38 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/tsconfig.json.hbs +20 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/typedoc.json.hbs +25 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/module.js +65 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/__init__.py.hbs +1 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/config.py.hbs +28 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/main.py.hbs +40 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/routers/__init__.py.hbs +1 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/routers/health.py.hbs +24 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/pyproject.toml.hbs +40 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/requirements.txt.hbs +6 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/module.js +44 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/templates/Cargo.toml.hbs +23 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/templates/src/health.rs.hbs +41 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/templates/src/main.rs.hbs +57 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/module.js +33 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-alb.tf.hbs +92 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-ecs.tf.hbs +84 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-iam.tf.hbs +60 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-vpc.tf.hbs +106 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws.tf.hbs +56 -0
- package/dist/templates/plopfiles/_modules/cloud/azure/module.js +31 -0
- package/dist/templates/plopfiles/_modules/cloud/azure/templates/azure-container-apps.tf.hbs +99 -0
- package/dist/templates/plopfiles/_modules/cloud/azure/templates/azure.tf.hbs +54 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/module.js +43 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/templates/src/types.d.ts.hbs +6 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/templates/src/worker.ts.hbs +51 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/templates/wrangler.toml.hbs +36 -0
- package/dist/templates/plopfiles/_modules/cloud/gcp/module.js +31 -0
- package/dist/templates/plopfiles/_modules/cloud/gcp/templates/gcp-cloudrun.tf.hbs +89 -0
- package/dist/templates/plopfiles/_modules/cloud/gcp/templates/gcp.tf.hbs +62 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/module.js +51 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/src/lib/supabase.ts.hbs +25 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/src/types/supabase.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/supabase/config.toml.hbs +71 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/supabase/functions/hello/index.ts.hbs +34 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/supabase/migrations/00000000000000_init.sql.hbs +60 -0
- package/dist/templates/plopfiles/_modules/composer.js +180 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/drizzle.config.ts.hbs +10 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/module.js +53 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/templates/index.ts.hbs +15 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/templates/schema.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/module.js +51 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/forge.config.ts.hbs +38 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/package.json.hbs +22 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/src/main.ts.hbs +48 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/src/preload.ts.hbs +18 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/tsconfig.json.hbs +14 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/module.js +38 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/Cargo.toml.hbs +20 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/build.rs.hbs +3 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/src/main.rs.hbs +30 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/tauri.conf.json.hbs +44 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/module.js +61 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/architecture/components.md.hbs +37 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/architecture/overview.md.hbs +43 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/contributing/development.md.hbs +164 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/contributing/guidelines.md.hbs +50 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/getting-started/configuration.md.hbs +37 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/getting-started/installation.md.hbs +53 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/getting-started/quickstart.md.hbs +39 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/index.md.hbs +44 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/javascripts/extra.js.hbs +23 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/stylesheets/extra.css.hbs +51 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/mkdocs.yml.hbs +141 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/requirements-docs.txt.hbs +15 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/scripts/aggregate-docs.mjs.hbs +188 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/scripts/gen_ref_pages.py.hbs +54 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/module.js +60 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/index.html.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/nginx.conf.hbs +31 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/postcss.config.js.hbs +6 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/App.tsx.hbs +12 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/index.css.hbs +25 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/main.tsx.hbs +18 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/pages/Home.tsx.hbs +31 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/tailwind.config.js.hbs +8 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/tsconfig.json.hbs +25 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/tsconfig.node.json.hbs +10 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/vite.config.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/module.js +51 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/index.html.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/postcss.config.js.hbs +6 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/App.tsx.hbs +12 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/index.css.hbs +3 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/index.tsx.hbs +21 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/pages/Home.tsx.hbs +34 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/tailwind.config.js.hbs +8 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/tsconfig.json.hbs +24 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/vite.config.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/module.js +54 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/index.html.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/postcss.config.js.hbs +6 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/App.vue.hbs +9 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/index.css.hbs +3 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/main.ts.hbs +14 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/pages/Home.vue.hbs +27 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/router.ts.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/tailwind.config.js.hbs +8 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/tsconfig.json.hbs +25 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/vite.config.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/module.js +52 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/templates/Dockerfile.backend.hbs +32 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/templates/Dockerfile.frontend.hbs +31 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/templates/docker-compose.yml.hbs +97 -0
- package/dist/templates/plopfiles/_modules/infra/github-actions/module.js +24 -0
- package/dist/templates/plopfiles/_modules/infra/github-actions/templates/.github/workflows/ci.yml.hbs +78 -0
- package/dist/templates/plopfiles/_modules/infra/github-actions/templates/.github/workflows/deploy.yml.hbs +60 -0
- package/dist/templates/plopfiles/_modules/infra/just/module.js +26 -0
- package/dist/templates/plopfiles/_modules/infra/just/templates/justfile.hbs +205 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/module.js +30 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/deployment.yaml.hbs +48 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/ingress.yaml.hbs +23 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/kustomization.yaml.hbs +11 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/service.yaml.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/dev/deployment-patch.yaml.hbs +17 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/dev/kustomization.yaml.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/prod/deployment-patch.yaml.hbs +17 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/prod/kustomization.yaml.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/module.js +30 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/.gitignore.hbs +5 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/Pulumi.dev.yaml.hbs +3 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/Pulumi.yaml.hbs +7 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/index.ts.hbs +26 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/package.json.hbs +12 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/tsconfig.json.hbs +16 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/module.js +31 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/.gitignore.hbs +12 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/main.tf.hbs +34 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/outputs.tf.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/terraform.tfvars.example.hbs +6 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/variables.tf.hbs +30 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/module.js +38 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/build.gradle.kts.hbs +102 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/proguard-rules.pro.hbs +20 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/AndroidManifest.xml.hbs +25 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ApiClient.kt.hbs +38 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/App.kt.hbs +116 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/MainActivity.kt.hbs +28 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ui/theme/Color.kt.hbs +11 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ui/theme/Theme.kt.hbs +55 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ui/theme/Type.kt.hbs +31 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/res/values/strings.xml.hbs +3 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/res/values/themes.xml.hbs +4 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/build.gradle.kts.hbs +6 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/gradle.properties.hbs +4 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/settings.gradle.kts.hbs +18 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/module.js +36 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/.env.hbs +1 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/lib/main.dart.hbs +29 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/lib/screens/home_screen.dart.hbs +88 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/lib/services/api_service.dart.hbs +61 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/pubspec.yaml.hbs +25 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/module.js +39 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/App.swift.hbs +10 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Assets.xcassets/AccentColor.colorset/Contents.json.hbs +11 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Assets.xcassets/AppIcon.appiconset/Contents.json.hbs +13 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Assets.xcassets/Contents.json.hbs +6 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/ContentView.swift.hbs +13 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Services/APIClient.swift.hbs +58 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Views/DetailsView.swift.hbs +22 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Views/HomeView.swift.hbs +62 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App.xcodeproj/project.pbxproj.hbs +363 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/module.js +36 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/app/_layout.tsx.hbs +16 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/app/index.tsx.hbs +66 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/app.json.hbs +37 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/package.json.hbs +29 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/tsconfig.json.hbs +11 -0
- package/dist/templates/plopfiles/_modules/quality/biome/module.js +44 -0
- package/dist/templates/plopfiles/_modules/quality/biome/templates/biome.json.hbs +126 -0
- package/dist/templates/plopfiles/_modules/quality/clippy/module.js +40 -0
- package/dist/templates/plopfiles/_modules/quality/clippy/templates/clippy.toml.hbs +29 -0
- package/dist/templates/plopfiles/_modules/quality/clippy/templates/rustfmt.toml.hbs +44 -0
- package/dist/templates/plopfiles/_modules/quality/golangci-lint/module.js +40 -0
- package/dist/templates/plopfiles/_modules/quality/golangci-lint/templates/.golangci.yml.hbs +199 -0
- package/dist/templates/plopfiles/_modules/quality/ruff/module.js +43 -0
- package/dist/templates/plopfiles/_modules/quality/ruff/templates/mypy.ini.hbs +48 -0
- package/dist/templates/plopfiles/_modules/quality/ruff/templates/ruff.toml.hbs +111 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/module.js +54 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/templates/.storybook/main.ts.hbs +44 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/templates/.storybook/preview.ts.hbs +68 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/templates/src/stories/Button.stories.tsx.hbs +158 -0
- package/dist/templates/plopfiles/_modules/types.ts +98 -0
- package/dist/templates/plopfiles/full-stack/plopfile.js +132 -0
- package/dist/templates/plopfiles/full-stack/templates/gitignore.hbs +44 -0
- package/dist/templates/plopfiles/full-stack/templates/package.json.hbs +21 -0
- package/dist/templates/plopfiles/presets/cli-go/module.js +43 -0
- package/dist/templates/plopfiles/presets/cli-go/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-go/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/cli-node/module.js +45 -0
- package/dist/templates/plopfiles/presets/cli-node/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-node/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/cli-python/module.js +43 -0
- package/dist/templates/plopfiles/presets/cli-python/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-python/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/cli-rust/module.js +43 -0
- package/dist/templates/plopfiles/presets/cli-rust/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-rust/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/loader.js +125 -0
- package/dist/templates/plopfiles/typescript-service/plopfile.js +186 -0
- package/dist/templates/plopfiles/typescript-service/templates/Dockerfile.hbs +29 -0
- package/dist/templates/plopfiles/typescript-service/templates/README.md.hbs +85 -0
- package/dist/templates/plopfiles/typescript-service/templates/config.ts.hbs +15 -0
- package/dist/templates/plopfiles/typescript-service/templates/db/index.ts.hbs +19 -0
- package/dist/templates/plopfiles/typescript-service/templates/db/schema.ts.hbs +16 -0
- package/dist/templates/plopfiles/typescript-service/templates/index.ts.hbs +89 -0
- package/dist/templates/plopfiles/typescript-service/templates/package.json.hbs +36 -0
- package/dist/templates/plopfiles/typescript-service/templates/routes/health.ts.hbs +61 -0
- package/dist/templates/plopfiles/typescript-service/templates/routes/index.ts.hbs +35 -0
- package/dist/templates/plopfiles/typescript-service/templates/tsconfig.json.hbs +24 -0
- package/dist/templates/plopfiles/typescript-service/templates/types.ts.hbs +28 -0
- package/dist/templates/typescript/component.module.css.tpl +6 -0
- package/dist/templates/typescript/component.test.tsx.tpl +9 -0
- package/dist/templates/typescript/component.tsx.tpl +17 -0
- package/dist/templates/typescript/component.types.ts.tpl +3 -0
- package/dist/templates/typescript/project/nextjs/app/globals.css.tpl +10 -0
- package/dist/templates/typescript/project/nextjs/app/layout.tsx.tpl +15 -0
- package/dist/templates/typescript/project/nextjs/app/page.tsx.tpl +8 -0
- package/dist/templates/typescript/project/nextjs/babel.config.js.tpl +8 -0
- package/dist/templates/typescript/project/nextjs/jest.config.js.tpl +10 -0
- package/dist/templates/typescript/project/nextjs/jest.setup.ts.tpl +6 -0
- package/dist/templates/typescript/project/nextjs/next-env.d.ts.tpl +5 -0
- package/dist/templates/typescript/project/nextjs/next.config.js.tpl +9 -0
- package/dist/templates/typescript/project/nextjs/package.json.tpl +1 -0
- package/dist/templates/typescript/project/nextjs/tsconfig.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/App.css.tpl +8 -0
- package/dist/templates/typescript/project/vite/App.tsx.tpl +17 -0
- package/dist/templates/typescript/project/vite/index.css.tpl +8 -0
- package/dist/templates/typescript/project/vite/index.html.tpl +13 -0
- package/dist/templates/typescript/project/vite/main.tsx.tpl +10 -0
- package/dist/templates/typescript/project/vite/package.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/test-setup.ts.tpl +1 -0
- package/dist/templates/typescript/project/vite/tsconfig.build.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/tsconfig.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/tsconfig.node.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/vite.config.ts.tpl +18 -0
- package/dist/templates/typescript/service.api.ts.tpl +27 -0
- package/dist/templates/typescript/service.class.ts.tpl +28 -0
- package/dist/templates/typescript/service.handler.ts.tpl +42 -0
- package/dist/templates/typescript/service.schema.ts.tpl +16 -0
- package/package.json +95 -0
- package/templates/typescript/component.module.css.tpl +6 -0
- package/templates/typescript/component.test.tsx.tpl +9 -0
- package/templates/typescript/component.tsx.tpl +17 -0
- package/templates/typescript/component.types.ts.tpl +3 -0
- package/templates/typescript/project/nextjs/app/globals.css.tpl +10 -0
- package/templates/typescript/project/nextjs/app/layout.tsx.tpl +15 -0
- package/templates/typescript/project/nextjs/app/page.tsx.tpl +8 -0
- package/templates/typescript/project/nextjs/babel.config.js.tpl +8 -0
- package/templates/typescript/project/nextjs/jest.config.js.tpl +10 -0
- package/templates/typescript/project/nextjs/jest.setup.ts.tpl +6 -0
- package/templates/typescript/project/nextjs/next-env.d.ts.tpl +5 -0
- package/templates/typescript/project/nextjs/next.config.js.tpl +9 -0
- package/templates/typescript/project/nextjs/package.json.tpl +1 -0
- package/templates/typescript/project/nextjs/tsconfig.json.tpl +1 -0
- package/templates/typescript/project/vite/App.css.tpl +8 -0
- package/templates/typescript/project/vite/App.tsx.tpl +17 -0
- package/templates/typescript/project/vite/index.css.tpl +8 -0
- package/templates/typescript/project/vite/index.html.tpl +13 -0
- package/templates/typescript/project/vite/main.tsx.tpl +10 -0
- package/templates/typescript/project/vite/package.json.tpl +1 -0
- package/templates/typescript/project/vite/test-setup.ts.tpl +1 -0
- package/templates/typescript/project/vite/tsconfig.build.json.tpl +1 -0
- package/templates/typescript/project/vite/tsconfig.json.tpl +1 -0
- package/templates/typescript/project/vite/tsconfig.node.json.tpl +1 -0
- package/templates/typescript/project/vite/vite.config.ts.tpl +18 -0
- package/templates/typescript/service.api.ts.tpl +27 -0
- package/templates/typescript/service.class.ts.tpl +28 -0
- package/templates/typescript/service.handler.ts.tpl +42 -0
- package/templates/typescript/service.schema.ts.tpl +16 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Tests
|
|
3
|
+
*
|
|
4
|
+
* Actually starts servers and makes HTTP requests to verify they work.
|
|
5
|
+
* These tests are slower and require the generated projects to run.
|
|
6
|
+
*
|
|
7
|
+
* Run with: bun test e2e.test.ts
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
11
|
+
import { tmpdir } from "os";
|
|
12
|
+
import { dirname, join } from "path";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
import { $ } from "bun";
|
|
15
|
+
import { mkdir, mkdtemp, rm, writeFile } from "fs/promises";
|
|
16
|
+
import nodePlop from "node-plop";
|
|
17
|
+
import { loadModule } from "../_modules/composer.js";
|
|
18
|
+
|
|
19
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
|
|
21
|
+
const E2E_TIMEOUT = 60_000; // 1 minute per test
|
|
22
|
+
|
|
23
|
+
// Helper to execute plop actions
|
|
24
|
+
async function executePlopActions(
|
|
25
|
+
destPath: string,
|
|
26
|
+
actions: Array<Record<string, unknown>>,
|
|
27
|
+
context: Record<string, unknown>,
|
|
28
|
+
) {
|
|
29
|
+
const plop = await nodePlop(undefined, {
|
|
30
|
+
destBasePath: destPath,
|
|
31
|
+
force: true,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Register helpers on plop's Handlebars instance
|
|
35
|
+
plop.setHelper(
|
|
36
|
+
"kebabCase",
|
|
37
|
+
(str: string) =>
|
|
38
|
+
str
|
|
39
|
+
?.toLowerCase()
|
|
40
|
+
.replace(/\s+/g, "-")
|
|
41
|
+
.replace(/[^a-z0-9-]/g, "") || "",
|
|
42
|
+
);
|
|
43
|
+
plop.setHelper(
|
|
44
|
+
"snakeCase",
|
|
45
|
+
(str: string) =>
|
|
46
|
+
str
|
|
47
|
+
?.toLowerCase()
|
|
48
|
+
.replace(/\s+/g, "_")
|
|
49
|
+
.replace(/[^a-z0-9_]/g, "") || "",
|
|
50
|
+
);
|
|
51
|
+
plop.setHelper("camelCase", (str: string) => {
|
|
52
|
+
if (!str) return "";
|
|
53
|
+
return str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_, chr: string) => chr.toUpperCase());
|
|
54
|
+
});
|
|
55
|
+
plop.setHelper("pascalCase", (str: string) => {
|
|
56
|
+
if (!str) return "";
|
|
57
|
+
const camel = str
|
|
58
|
+
.toLowerCase()
|
|
59
|
+
.replace(/[^a-zA-Z0-9]+(.)/g, (_, chr: string) => chr.toUpperCase());
|
|
60
|
+
return camel.charAt(0).toUpperCase() + camel.slice(1);
|
|
61
|
+
});
|
|
62
|
+
plop.setHelper(
|
|
63
|
+
"titleCase",
|
|
64
|
+
(str: string) => str?.replace(/\b\w/g, (char) => char.toUpperCase()) || "",
|
|
65
|
+
);
|
|
66
|
+
plop.setHelper("eq", (a: unknown, b: unknown) => a === b);
|
|
67
|
+
plop.setHelper("ne", (a: unknown, b: unknown) => a !== b);
|
|
68
|
+
plop.setHelper("json", (obj: unknown) => JSON.stringify(obj, null, 2));
|
|
69
|
+
|
|
70
|
+
plop.setGenerator("temp", {
|
|
71
|
+
description: "temp",
|
|
72
|
+
prompts: [],
|
|
73
|
+
actions: actions as any[],
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const gen = plop.getGenerator("temp");
|
|
77
|
+
const results = await gen.runActions(context);
|
|
78
|
+
|
|
79
|
+
if (results.failures && results.failures.length > 0) {
|
|
80
|
+
const errors = results.failures.map((f) => f.error || f.message || String(f)).join("\n");
|
|
81
|
+
throw new Error(`Generation failed:\n${errors}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return results;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Helper to generate a single module
|
|
88
|
+
async function generateModule(
|
|
89
|
+
category: string,
|
|
90
|
+
moduleName: string,
|
|
91
|
+
destPath: string,
|
|
92
|
+
context: Record<string, unknown>,
|
|
93
|
+
) {
|
|
94
|
+
const mod = await loadModule(category, moduleName);
|
|
95
|
+
const actions = mod.default(context);
|
|
96
|
+
await executePlopActions(destPath, actions, context);
|
|
97
|
+
return mod;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Helper to wait for server to be ready
|
|
101
|
+
async function waitForServer(url: string, maxAttempts = 30, intervalMs = 200): Promise<boolean> {
|
|
102
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
103
|
+
try {
|
|
104
|
+
const response = await fetch(url);
|
|
105
|
+
if (response.ok) return true;
|
|
106
|
+
} catch {
|
|
107
|
+
// Server not ready yet
|
|
108
|
+
}
|
|
109
|
+
await Bun.sleep(intervalMs);
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Helper to check if a command exists
|
|
115
|
+
async function commandExists(cmd: string): Promise<boolean> {
|
|
116
|
+
try {
|
|
117
|
+
await $`which ${cmd}`.quiet();
|
|
118
|
+
return true;
|
|
119
|
+
} catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
describe("E2E Tests - Node.js Backends", () => {
|
|
125
|
+
let tempDir: string;
|
|
126
|
+
|
|
127
|
+
beforeAll(async () => {
|
|
128
|
+
tempDir = await mkdtemp(join(tmpdir(), "arbiter-e2e-node-"));
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
afterAll(async () => {
|
|
132
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test(
|
|
136
|
+
"node-hono backend starts and responds to health check",
|
|
137
|
+
async () => {
|
|
138
|
+
const projectDir = join(tempDir, "hono-e2e");
|
|
139
|
+
await mkdir(projectDir, { recursive: true });
|
|
140
|
+
|
|
141
|
+
const context = {
|
|
142
|
+
name: "hono-e2e",
|
|
143
|
+
projectDir,
|
|
144
|
+
backendDir: "backend",
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
await generateModule("backends", "node-hono", projectDir, context);
|
|
148
|
+
|
|
149
|
+
const packageJson = {
|
|
150
|
+
name: "hono-e2e",
|
|
151
|
+
type: "module",
|
|
152
|
+
dependencies: {
|
|
153
|
+
hono: "^4.0.0",
|
|
154
|
+
"@hono/node-server": "^1.8.0",
|
|
155
|
+
},
|
|
156
|
+
devDependencies: {
|
|
157
|
+
tsx: "^4.0.0",
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
await writeFile(join(projectDir, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
161
|
+
|
|
162
|
+
// Install dependencies
|
|
163
|
+
await $`cd ${projectDir} && bun install`.quiet();
|
|
164
|
+
|
|
165
|
+
// Use a random high port to avoid conflicts
|
|
166
|
+
const port = 30000 + Math.floor(Math.random() * 10000);
|
|
167
|
+
|
|
168
|
+
// Start server with tsx (handles .ts files with .js imports correctly)
|
|
169
|
+
const server = Bun.spawn(["bunx", "tsx", "backend/src/index.ts"], {
|
|
170
|
+
cwd: projectDir,
|
|
171
|
+
stdout: "pipe",
|
|
172
|
+
stderr: "pipe",
|
|
173
|
+
env: { ...process.env, PORT: String(port) },
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
// Wait for server to be ready
|
|
178
|
+
const ready = await waitForServer(`http://localhost:${port}/health`);
|
|
179
|
+
expect(ready).toBe(true);
|
|
180
|
+
|
|
181
|
+
// Test health endpoint
|
|
182
|
+
const healthResponse = await fetch(`http://localhost:${port}/health`);
|
|
183
|
+
expect(healthResponse.ok).toBe(true);
|
|
184
|
+
const healthData = await healthResponse.json();
|
|
185
|
+
expect(healthData).toHaveProperty("status");
|
|
186
|
+
|
|
187
|
+
// Test root endpoint
|
|
188
|
+
const rootResponse = await fetch(`http://localhost:${port}/`);
|
|
189
|
+
expect(rootResponse.ok).toBe(true);
|
|
190
|
+
} finally {
|
|
191
|
+
server.kill();
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
E2E_TIMEOUT,
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
test(
|
|
198
|
+
"node-express backend starts and responds to health check",
|
|
199
|
+
async () => {
|
|
200
|
+
const projectDir = join(tempDir, "express-e2e");
|
|
201
|
+
await mkdir(projectDir, { recursive: true });
|
|
202
|
+
|
|
203
|
+
const context = {
|
|
204
|
+
name: "express-e2e",
|
|
205
|
+
projectDir,
|
|
206
|
+
backendDir: "backend",
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
await generateModule("backends", "node-express", projectDir, context);
|
|
210
|
+
|
|
211
|
+
// Use a random high port to avoid conflicts
|
|
212
|
+
const port = 30000 + Math.floor(Math.random() * 10000);
|
|
213
|
+
|
|
214
|
+
const packageJson = {
|
|
215
|
+
name: "express-e2e",
|
|
216
|
+
type: "module",
|
|
217
|
+
scripts: {
|
|
218
|
+
start: "bun run backend/src/index.ts",
|
|
219
|
+
},
|
|
220
|
+
dependencies: {
|
|
221
|
+
express: "^4.18.0",
|
|
222
|
+
cors: "^2.8.5",
|
|
223
|
+
helmet: "^7.1.0",
|
|
224
|
+
"express-rate-limit": "^7.1.0",
|
|
225
|
+
dotenv: "^16.3.0",
|
|
226
|
+
},
|
|
227
|
+
devDependencies: {
|
|
228
|
+
"@types/express": "^4.17.0",
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
await writeFile(join(projectDir, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
232
|
+
|
|
233
|
+
await $`cd ${projectDir} && bun install`.quiet();
|
|
234
|
+
|
|
235
|
+
const server = Bun.spawn(["bun", "run", "start"], {
|
|
236
|
+
cwd: projectDir,
|
|
237
|
+
stdout: "pipe",
|
|
238
|
+
stderr: "pipe",
|
|
239
|
+
env: { ...process.env, PORT: String(port) },
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
try {
|
|
243
|
+
const ready = await waitForServer(`http://localhost:${port}/health`);
|
|
244
|
+
expect(ready).toBe(true);
|
|
245
|
+
|
|
246
|
+
const healthResponse = await fetch(`http://localhost:${port}/health`);
|
|
247
|
+
expect(healthResponse.ok).toBe(true);
|
|
248
|
+
const healthData = await healthResponse.json();
|
|
249
|
+
expect(healthData).toHaveProperty("status");
|
|
250
|
+
} finally {
|
|
251
|
+
server.kill();
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
E2E_TIMEOUT,
|
|
255
|
+
);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
describe("E2E Tests - Go Backend", () => {
|
|
259
|
+
let tempDir: string;
|
|
260
|
+
let goAvailable: boolean;
|
|
261
|
+
|
|
262
|
+
beforeAll(async () => {
|
|
263
|
+
tempDir = await mkdtemp(join(tmpdir(), "arbiter-e2e-go-"));
|
|
264
|
+
goAvailable = await commandExists("go");
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
afterAll(async () => {
|
|
268
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
test(
|
|
272
|
+
"go-chi backend builds and responds to health check",
|
|
273
|
+
async () => {
|
|
274
|
+
if (!goAvailable) {
|
|
275
|
+
console.log("Skipping: go not available");
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const projectDir = join(tempDir, "go-chi-e2e");
|
|
280
|
+
await mkdir(projectDir, { recursive: true });
|
|
281
|
+
|
|
282
|
+
const context = {
|
|
283
|
+
name: "go-chi-e2e",
|
|
284
|
+
projectDir,
|
|
285
|
+
backendDir: "backend",
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
await generateModule("backends", "go-chi", projectDir, context);
|
|
289
|
+
|
|
290
|
+
const backendDir = join(projectDir, "backend");
|
|
291
|
+
|
|
292
|
+
// Build the Go binary (main package is in cmd/server)
|
|
293
|
+
const buildResult =
|
|
294
|
+
await $`cd ${backendDir} && go mod tidy && go build -o server ./cmd/server`.nothrow();
|
|
295
|
+
expect(buildResult.exitCode).toBe(0);
|
|
296
|
+
|
|
297
|
+
// Use a random high port to avoid conflicts
|
|
298
|
+
const port = 30000 + Math.floor(Math.random() * 10000);
|
|
299
|
+
|
|
300
|
+
// Start server
|
|
301
|
+
const server = Bun.spawn(["./server"], {
|
|
302
|
+
cwd: backendDir,
|
|
303
|
+
stdout: "pipe",
|
|
304
|
+
stderr: "pipe",
|
|
305
|
+
env: { ...process.env, PORT: String(port) },
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
try {
|
|
309
|
+
const ready = await waitForServer(`http://localhost:${port}/health`);
|
|
310
|
+
expect(ready).toBe(true);
|
|
311
|
+
|
|
312
|
+
const healthResponse = await fetch(`http://localhost:${port}/health`);
|
|
313
|
+
expect(healthResponse.ok).toBe(true);
|
|
314
|
+
} finally {
|
|
315
|
+
server.kill();
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
E2E_TIMEOUT,
|
|
319
|
+
);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
describe("E2E Tests - Python Backend", () => {
|
|
323
|
+
let tempDir: string;
|
|
324
|
+
let uvicornAvailable: boolean;
|
|
325
|
+
|
|
326
|
+
beforeAll(async () => {
|
|
327
|
+
tempDir = await mkdtemp(join(tmpdir(), "arbiter-e2e-python-"));
|
|
328
|
+
uvicornAvailable = await commandExists("uvicorn");
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
afterAll(async () => {
|
|
332
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
test(
|
|
336
|
+
"python-fastapi backend starts and responds to health check",
|
|
337
|
+
async () => {
|
|
338
|
+
if (!uvicornAvailable) {
|
|
339
|
+
console.log("Skipping: uvicorn not available");
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const projectDir = join(tempDir, "fastapi-e2e");
|
|
344
|
+
await mkdir(projectDir, { recursive: true });
|
|
345
|
+
|
|
346
|
+
const context = {
|
|
347
|
+
name: "fastapi-e2e",
|
|
348
|
+
projectDir,
|
|
349
|
+
backendDir: "backend",
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
await generateModule("backends", "python-fastapi", projectDir, context);
|
|
353
|
+
|
|
354
|
+
const backendDir = join(projectDir, "backend");
|
|
355
|
+
|
|
356
|
+
// Install dependencies
|
|
357
|
+
const installResult = await $`cd ${backendDir} && pip install -e . --quiet`.nothrow();
|
|
358
|
+
if (installResult.exitCode !== 0) {
|
|
359
|
+
console.log("Skipping: pip install failed");
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Start server
|
|
364
|
+
const server = Bun.spawn(["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "3904"], {
|
|
365
|
+
cwd: backendDir,
|
|
366
|
+
stdout: "pipe",
|
|
367
|
+
stderr: "pipe",
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
try {
|
|
371
|
+
const ready = await waitForServer("http://localhost:3904/health");
|
|
372
|
+
expect(ready).toBe(true);
|
|
373
|
+
|
|
374
|
+
const healthResponse = await fetch("http://localhost:3904/health");
|
|
375
|
+
expect(healthResponse.ok).toBe(true);
|
|
376
|
+
|
|
377
|
+
// FastAPI also generates OpenAPI docs
|
|
378
|
+
const docsResponse = await fetch("http://localhost:3904/docs");
|
|
379
|
+
expect(docsResponse.ok).toBe(true);
|
|
380
|
+
} finally {
|
|
381
|
+
server.kill();
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
E2E_TIMEOUT,
|
|
385
|
+
);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
describe("E2E Tests - Cloudflare Worker", () => {
|
|
389
|
+
let tempDir: string;
|
|
390
|
+
let wranglerAvailable: boolean;
|
|
391
|
+
|
|
392
|
+
beforeAll(async () => {
|
|
393
|
+
tempDir = await mkdtemp(join(tmpdir(), "arbiter-e2e-cf-"));
|
|
394
|
+
wranglerAvailable = await commandExists("wrangler");
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
afterAll(async () => {
|
|
398
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
test(
|
|
402
|
+
"cloudflare worker runs locally with wrangler",
|
|
403
|
+
async () => {
|
|
404
|
+
if (!wranglerAvailable) {
|
|
405
|
+
console.log("Skipping: wrangler not available");
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const projectDir = join(tempDir, "cf-worker-e2e");
|
|
410
|
+
await mkdir(projectDir, { recursive: true });
|
|
411
|
+
|
|
412
|
+
const context = {
|
|
413
|
+
name: "cf-worker-e2e",
|
|
414
|
+
projectDir,
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
await generateModule("cloud", "cloudflare", projectDir, context);
|
|
418
|
+
|
|
419
|
+
// Install dependencies
|
|
420
|
+
const packageJson = {
|
|
421
|
+
name: "cf-worker-e2e",
|
|
422
|
+
type: "module",
|
|
423
|
+
devDependencies: {
|
|
424
|
+
wrangler: "^3.0.0",
|
|
425
|
+
},
|
|
426
|
+
};
|
|
427
|
+
await writeFile(join(projectDir, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
428
|
+
await $`cd ${projectDir} && bun install`.quiet();
|
|
429
|
+
|
|
430
|
+
// Start local dev server
|
|
431
|
+
const server = Bun.spawn(["bunx", "wrangler", "dev", "--port", "3905"], {
|
|
432
|
+
cwd: projectDir,
|
|
433
|
+
stdout: "pipe",
|
|
434
|
+
stderr: "pipe",
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
try {
|
|
438
|
+
const ready = await waitForServer("http://localhost:3905/");
|
|
439
|
+
if (ready) {
|
|
440
|
+
const response = await fetch("http://localhost:3905/");
|
|
441
|
+
expect(response.ok).toBe(true);
|
|
442
|
+
} else {
|
|
443
|
+
console.log("Wrangler dev server did not start in time");
|
|
444
|
+
}
|
|
445
|
+
} finally {
|
|
446
|
+
server.kill();
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
E2E_TIMEOUT,
|
|
450
|
+
);
|
|
451
|
+
});
|