create-svc 0.1.9 → 0.1.11
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 +138 -16
- package/bin/create-service.mjs +2 -0
- package/package.json +19 -11
- package/src/cli.test.ts +46 -7
- package/src/cli.ts +282 -84
- package/src/git-bootstrap.test.ts +40 -0
- package/src/git-bootstrap.ts +110 -0
- package/src/naming.test.ts +5 -2
- package/src/naming.ts +32 -1
- package/src/neon.ts +10 -8
- package/src/post-scaffold.test.ts +19 -0
- package/src/post-scaffold.ts +18 -26
- package/src/profiles.ts +25 -0
- package/src/scaffold.test.ts +320 -18
- package/src/scaffold.ts +154 -28
- package/src/vault.test.ts +94 -10
- package/src/vault.ts +81 -18
- package/templates/shared/.github/workflows/ci.yml +2 -1
- package/templates/shared/.github/workflows/deploy.yml +2 -0
- package/templates/shared/README.md +217 -29
- package/templates/shared/docker-compose.yml +19 -0
- package/templates/shared/grafana/alerts.yaml +54 -0
- package/templates/shared/grafana/waitlist-dashboard.json +63 -0
- package/templates/shared/scripts/authctl.ts +231 -0
- package/templates/shared/scripts/cloudrun/bootstrap.ts +24 -42
- package/templates/shared/scripts/cloudrun/cleanup.ts +81 -35
- package/templates/shared/scripts/cloudrun/cli.ts +324 -7
- package/templates/shared/scripts/cloudrun/config.ts +21 -19
- package/templates/shared/scripts/cloudrun/deploy.ts +16 -11
- package/templates/shared/scripts/cloudrun/lib.ts +232 -123
- package/templates/shared/scripts/cloudrun/neon.ts +127 -13
- package/templates/shared/scripts/dev.ts +22 -0
- package/templates/shared/scripts/ensure-local-db.ts +3 -0
- package/templates/shared/scripts/local-docker.ts +63 -0
- package/templates/shared/scripts/local-env.ts +27 -0
- package/templates/shared/scripts/seed.ts +73 -0
- package/templates/shared/scripts/wait-for-db.ts +32 -0
- package/templates/shared/service.config.ts +59 -0
- package/templates/shared/service.yaml +24 -1
- package/templates/targets/workers/.github/workflows/ci.yml +19 -0
- package/templates/targets/workers/.github/workflows/deploy.yml +19 -0
- package/templates/targets/workers/Makefile +33 -0
- package/templates/targets/workers/README.md +75 -0
- package/templates/targets/workers/package.json +35 -0
- package/templates/targets/workers/scripts/workers/cli.ts +397 -0
- package/templates/targets/workers/src/auth.ts +178 -0
- package/templates/targets/workers/src/index.ts +198 -0
- package/templates/targets/workers/src/storage.ts +370 -0
- package/templates/targets/workers/test/app.test.ts +108 -0
- package/templates/targets/workers/tsconfig.json +11 -0
- package/templates/targets/workers/wrangler.toml +24 -0
- package/templates/variants/bun-connectrpc/Dockerfile +1 -0
- package/templates/variants/bun-connectrpc/Makefile +17 -8
- package/templates/variants/bun-connectrpc/gen/protos/waitlist/v1/waitlist_pb.ts +424 -0
- package/templates/variants/bun-connectrpc/migrations/0000_init.sql +20 -0
- package/templates/variants/bun-connectrpc/package.json +25 -1
- package/templates/variants/bun-connectrpc/protos/waitlist/v1/waitlist.proto +91 -0
- package/templates/variants/bun-connectrpc/scripts/codegen.ts +31 -1
- package/templates/variants/bun-connectrpc/scripts/migrate.ts +49 -0
- package/templates/variants/bun-connectrpc/src/auth.ts +200 -0
- package/templates/variants/bun-connectrpc/src/db/client.ts +15 -0
- package/templates/variants/bun-connectrpc/src/db/repository.ts +126 -0
- package/templates/variants/bun-connectrpc/src/db/schema.ts +26 -0
- package/templates/variants/bun-connectrpc/src/index.ts +194 -22
- package/templates/variants/bun-connectrpc/src/temporal/activities.ts +14 -0
- package/templates/variants/bun-connectrpc/src/temporal/worker.ts +38 -0
- package/templates/variants/bun-connectrpc/src/temporal/workflows.ts +10 -0
- package/templates/variants/bun-connectrpc/src/waitlist/service.ts +172 -0
- package/templates/variants/bun-connectrpc/src/waitlist/types.ts +45 -0
- package/templates/variants/bun-connectrpc/test/app.test.ts +14 -13
- package/templates/variants/bun-connectrpc/test/waitlist.integration.test.ts +71 -0
- package/templates/variants/bun-connectrpc/tsconfig.json +2 -1
- package/templates/variants/bun-hono/Makefile +17 -8
- package/templates/variants/bun-hono/migrations/0000_init.sql +20 -0
- package/templates/variants/bun-hono/package.json +21 -1
- package/templates/variants/bun-hono/scripts/migrate.ts +49 -0
- package/templates/variants/bun-hono/src/auth.ts +181 -0
- package/templates/variants/bun-hono/src/db/client.ts +15 -0
- package/templates/variants/bun-hono/src/db/repository.ts +126 -0
- package/templates/variants/bun-hono/src/db/schema.ts +26 -0
- package/templates/variants/bun-hono/src/index.ts +141 -10
- package/templates/variants/bun-hono/src/temporal/activities.ts +14 -0
- package/templates/variants/bun-hono/src/temporal/worker.ts +38 -0
- package/templates/variants/bun-hono/src/temporal/workflows.ts +10 -0
- package/templates/variants/bun-hono/src/waitlist/service.ts +166 -0
- package/templates/variants/bun-hono/src/waitlist/types.ts +50 -0
- package/templates/variants/bun-hono/test/app.test.ts +90 -5
- package/templates/variants/bun-hono/test/waitlist.integration.test.ts +102 -0
- package/templates/variants/bun-hono/tsconfig.json +1 -0
- package/templates/variants/go-chi/Makefile +30 -10
- package/templates/variants/go-chi/atlas.hcl +8 -0
- package/templates/variants/go-chi/cmd/server/main.go +25 -13
- package/templates/variants/go-chi/go.mod +3 -2
- package/templates/variants/go-chi/internal/app/service.go +279 -70
- package/templates/variants/go-chi/internal/auth/middleware.go +289 -0
- package/templates/variants/go-chi/internal/auth/middleware_test.go +38 -0
- package/templates/variants/go-chi/internal/config/config.go +38 -7
- package/templates/variants/go-chi/internal/httpapi/routes.go +170 -47
- package/templates/variants/go-chi/internal/httpapi/waitlist_integration_test.go +199 -0
- package/templates/variants/go-chi/internal/temporal/activities.go +27 -0
- package/templates/variants/go-chi/internal/temporal/worker.go +42 -0
- package/templates/variants/go-chi/internal/temporal/workflows.go +18 -0
- package/templates/variants/go-chi/migrations/0000_init.sql +20 -0
- package/templates/variants/go-chi/migrations/atlas.sum +2 -0
- package/templates/variants/go-chi/package.json +7 -1
- package/templates/variants/go-chi/test/go.test.ts +4 -1
- package/templates/variants/go-connectrpc/Makefile +29 -8
- package/templates/variants/go-connectrpc/atlas.hcl +8 -0
- package/templates/variants/go-connectrpc/buf.gen.yaml +2 -0
- package/templates/variants/go-connectrpc/cmd/server/main.go +44 -9
- package/templates/variants/go-connectrpc/gen/waitlist/v1/waitlist.pb.go +960 -0
- package/templates/variants/go-connectrpc/gen/waitlist/v1/waitlistv1connect/waitlist.connect.go +283 -0
- package/templates/variants/go-connectrpc/go.mod +4 -0
- package/templates/variants/go-connectrpc/internal/app/service.go +279 -70
- package/templates/variants/go-connectrpc/internal/auth/middleware.go +289 -0
- package/templates/variants/go-connectrpc/internal/auth/middleware_test.go +38 -0
- package/templates/variants/go-connectrpc/internal/config/config.go +38 -7
- package/templates/variants/go-connectrpc/internal/connectapi/handler.go +129 -40
- package/templates/variants/go-connectrpc/internal/connectapi/waitlist_integration_test.go +122 -0
- package/templates/variants/go-connectrpc/internal/httpapi/routes.go +170 -47
- package/templates/variants/go-connectrpc/internal/temporal/activities.go +27 -0
- package/templates/variants/go-connectrpc/internal/temporal/worker.go +42 -0
- package/templates/variants/go-connectrpc/internal/temporal/workflows.go +18 -0
- package/templates/variants/go-connectrpc/migrations/0000_init.sql +20 -0
- package/templates/variants/go-connectrpc/migrations/atlas.sum +2 -0
- package/templates/variants/go-connectrpc/package.json +7 -1
- package/templates/variants/go-connectrpc/protos/waitlist/v1/waitlist.proto +93 -0
- package/templates/root/.github/workflows/buf-publish.yml +0 -19
- package/templates/root/.github/workflows/ci.yml +0 -26
- package/templates/root/.github/workflows/deploy.yml +0 -22
- package/templates/root/Dockerfile +0 -23
- package/templates/root/README.md +0 -69
- package/templates/root/buf.gen.yaml +0 -10
- package/templates/root/buf.yaml +0 -9
- package/templates/root/cmd/server/main.go +0 -44
- package/templates/root/gen/dns/v1/dns.pb.go +0 -623
- package/templates/root/gen/dns/v1/dnsv1connect/dns.connect.go +0 -192
- package/templates/root/go.mod +0 -10
- package/templates/root/internal/app/service.go +0 -152
- package/templates/root/internal/app/token_source.go +0 -50
- package/templates/root/internal/cloudflare/client.go +0 -160
- package/templates/root/internal/config/config.go +0 -55
- package/templates/root/internal/connectapi/handler.go +0 -79
- package/templates/root/internal/httpapi/routes.go +0 -93
- package/templates/root/internal/vault/client.go +0 -148
- package/templates/root/package.json +0 -12
- package/templates/root/protos/dns/v1/dns.proto +0 -58
- package/templates/root/scripts/cloudrun/bootstrap.ts +0 -65
- package/templates/root/scripts/cloudrun/config.ts +0 -50
- package/templates/root/scripts/cloudrun/deploy.ts +0 -41
- package/templates/root/scripts/cloudrun/lib.ts +0 -244
- package/templates/root/service.yaml +0 -50
- package/templates/root/test/go.test.ts +0 -19
- package/templates/shared/.env.example +0 -10
- package/templates/variants/go-chi/buf.gen.yaml +0 -10
- package/templates/variants/go-chi/buf.yaml +0 -9
- package/templates/variants/go-chi/gen/dns/v1/dns.pb.go +0 -623
- package/templates/variants/go-chi/gen/dns/v1/dnsv1connect/dns.connect.go +0 -192
- package/templates/variants/go-chi/internal/connectapi/handler.go +0 -79
- package/templates/variants/go-chi/protos/dns/v1/dns.proto +0 -58
- package/templates/variants/go-connectrpc/gen/dns/v1/dns.pb.go +0 -623
- package/templates/variants/go-connectrpc/gen/dns/v1/dnsv1connect/dns.connect.go +0 -192
- package/templates/variants/go-connectrpc/protos/dns/v1/dns.proto +0 -58
package/README.md
CHANGED
|
@@ -1,42 +1,164 @@
|
|
|
1
|
-
# create-
|
|
1
|
+
# create-service
|
|
2
2
|
|
|
3
|
-
`create-
|
|
3
|
+
`create-service` is a local microservice bootstrap CLI for generating standalone API services with:
|
|
4
4
|
|
|
5
|
-
- `
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
- `
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
5
|
+
- a single `microservice` generation path
|
|
6
|
+
- explicit deploy target selection: Cloud Run or Cloudflare Workers
|
|
7
|
+
- Go or Bun runtime choices where the target supports them
|
|
8
|
+
- HTTP frameworks (`chi` or `hono`) and ConnectRPC variants
|
|
9
|
+
- standalone package output that does not assume repo bootstrap
|
|
10
|
+
- a generated `service.config.ts` manifest
|
|
11
|
+
- a generated `service` lifecycle CLI for create, deploy, migrate, seed, dashboards, doctor, and destroy
|
|
12
|
+
- local Docker Compose Postgres for first-run development
|
|
13
|
+
- Neon-backed remote environments
|
|
14
|
+
- a production API origin at `https://api.<service_id>.anmho.com`
|
|
15
|
+
|
|
16
|
+
Local provisioning intentionally prefers known-good CLIs over SDK-heavy orchestration where that keeps the generated service easier to inspect and repair.
|
|
17
|
+
|
|
18
|
+
npm: <https://www.npmjs.com/package/create-svc>
|
|
12
19
|
|
|
13
20
|
## Usage
|
|
14
21
|
|
|
22
|
+
```bash
|
|
23
|
+
bun create svc my-service
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Compatibility alias:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun create svc my-service
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bunx create-svc my-service
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For the strict one-command production path:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
bun create svc my-service --yes
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`--profile microservice` is accepted as a compatibility no-op. App workspaces live outside this package in private app template repositories.
|
|
45
|
+
|
|
46
|
+
By default, a standalone generated service is initialized as a git repository,
|
|
47
|
+
committed with `Initial commit`, created as a private GitHub repository at
|
|
48
|
+
`anmho/<service-name>`, and pushed to `origin/main`. If the target directory is
|
|
49
|
+
inside an existing git worktree, create-service skips git and GitHub setup so the
|
|
50
|
+
parent repository remains in control. Pass `--no-git` to skip all git and GitHub
|
|
51
|
+
side effects.
|
|
52
|
+
|
|
53
|
+
## Local Testing
|
|
54
|
+
|
|
55
|
+
Without publishing to npm:
|
|
56
|
+
|
|
15
57
|
```bash
|
|
16
58
|
bun install
|
|
17
|
-
|
|
59
|
+
npm pack
|
|
60
|
+
bunx ./create-svc-*.tgz my-service
|
|
18
61
|
```
|
|
19
62
|
|
|
20
|
-
|
|
63
|
+
For faster iteration against your working tree:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bun link
|
|
67
|
+
bun link create-service
|
|
68
|
+
create-service my-service
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
During scaffold, the generator can discover:
|
|
21
72
|
|
|
22
73
|
- accessible GCP projects
|
|
23
74
|
- open billing accounts
|
|
24
|
-
- Neon defaults from `NEON_API_KEY`, or Vault via `VAULT_ADDR` plus `VAULT_TOKEN`, `VAULT_TOKEN_FILE`, or `~/.vault-token`
|
|
25
75
|
|
|
26
|
-
Generated
|
|
76
|
+
Generated provisioning commands use Neon credentials from `NEON_API_KEY`, or Vault via `VAULT_ADDR` plus `VAULT_TOKEN`, `VAULT_TOKEN_FILE`, or `~/.vault-token`.
|
|
77
|
+
The base waitlist service keeps provider integrations out of the runtime by default; add provider-specific secrets only when the generated service actually uses that provider.
|
|
78
|
+
|
|
79
|
+
Before running generated provisioning commands locally, authenticate `gcloud` on the machine:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
gcloud auth login
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Generated Service Package
|
|
86
|
+
|
|
87
|
+
First local run:
|
|
88
|
+
|
|
89
|
+
`bun run migrate`, `make migrate`, `bun run dev`, and `make dev` open Docker Desktop when needed, wait for Docker readiness, and start Docker Compose Postgres before touching the local database.
|
|
90
|
+
|
|
91
|
+
For Bun variants:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
bun run migrate
|
|
95
|
+
bun run dev
|
|
96
|
+
bun run gen
|
|
97
|
+
bun run lint
|
|
98
|
+
bun run test
|
|
99
|
+
bun run create
|
|
100
|
+
bun run deploy
|
|
101
|
+
bun run destroy
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For Go variants:
|
|
27
105
|
|
|
28
106
|
```bash
|
|
107
|
+
make migrate
|
|
29
108
|
make dev
|
|
30
109
|
make gen
|
|
31
110
|
make lint
|
|
32
111
|
make test
|
|
33
|
-
make
|
|
112
|
+
make create
|
|
34
113
|
make deploy
|
|
35
|
-
make
|
|
114
|
+
make destroy
|
|
36
115
|
```
|
|
37
116
|
|
|
117
|
+
Language-specific tasks such as local running, linting, formatting, testing, and building stay in package scripts or Make targets. Service lifecycle operations are exposed through the generated `service` CLI.
|
|
118
|
+
|
|
119
|
+
The generated service is intended to be consumed by a web app, mobile client, or another service over HTTPS. In v1, production is expected to live at `https://api.<service_id>.anmho.com`, while preview and personal environments keep using deterministic platform URLs where appropriate.
|
|
120
|
+
|
|
121
|
+
The generated microservice domain is a small waitlist/launch service example with public submit/status APIs and target-specific scheduled work.
|
|
122
|
+
|
|
38
123
|
## Development
|
|
39
124
|
|
|
40
125
|
```bash
|
|
41
|
-
bun
|
|
126
|
+
bun install
|
|
127
|
+
bun test src scripts
|
|
128
|
+
bun run index.ts my-service
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Validate the generated app matrix against local Docker Compose Postgres:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
bun run validate:generated
|
|
135
|
+
bun run validate:generated -- --variant bun-hono
|
|
136
|
+
bun run validate:generated -- --variant go-connectrpc --keep
|
|
42
137
|
```
|
|
138
|
+
|
|
139
|
+
The validation harness scaffolds generated services into ignored `bin/generated/run-*` workspaces, runs the generated public commands, starts the local server, and smoke-tests health or typed ConnectRPC clients where applicable.
|
|
140
|
+
|
|
141
|
+
## npm Trusted Publishing
|
|
142
|
+
|
|
143
|
+
`create-service` is set up for npm trusted publishing from GitHub Actions, so there is no long-lived npm publish token to store in Vault.
|
|
144
|
+
|
|
145
|
+
Repository workflow:
|
|
146
|
+
|
|
147
|
+
- [publish.yml](.github/workflows/publish.yml)
|
|
148
|
+
- Trigger: pushes to `main`, Git tags matching `v*`, or manual `workflow_dispatch`
|
|
149
|
+
- CI runtime: Bun for install/test/typecheck, npm for the final publish step
|
|
150
|
+
|
|
151
|
+
npm package setup still has to be configured once in the npm UI to trust this repository and workflow:
|
|
152
|
+
|
|
153
|
+
1. Open the `create-service` package settings on npm.
|
|
154
|
+
2. Go to `Settings` -> `Trusted Publisher`.
|
|
155
|
+
3. Select `GitHub Actions`.
|
|
156
|
+
4. Enter:
|
|
157
|
+
- Organization or user: `anmho`
|
|
158
|
+
- Repository: `create-service`
|
|
159
|
+
- Workflow filename: `publish.yml`
|
|
160
|
+
5. Save the trusted publisher.
|
|
161
|
+
|
|
162
|
+
After that, publishing can be triggered by pushing to `main`, creating a `v*` tag, or running the workflow manually.
|
|
163
|
+
|
|
164
|
+
The GitHub Actions workflow authenticates with npm via OIDC and runs `npm publish` without an npm token.
|
package/package.json
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-svc",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.11",
|
|
4
|
+
"description": "Local microservice bootstrap CLI for Cloud Run and Workers services with Neon-backed data.",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bin": {
|
|
9
|
-
"create-
|
|
10
|
-
"create-
|
|
9
|
+
"create-service": "bin/create-service.mjs",
|
|
10
|
+
"create-svc": "bin/create-svc.mjs"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"bin",
|
|
13
|
+
"bin/create-service.mjs",
|
|
14
|
+
"bin/create-svc.mjs",
|
|
14
15
|
"index.ts",
|
|
15
16
|
"src",
|
|
16
17
|
"templates",
|
|
18
|
+
"!bin/generated",
|
|
19
|
+
"!templates/**/node_modules",
|
|
17
20
|
"README.md"
|
|
18
21
|
],
|
|
19
22
|
"scripts": {
|
|
20
23
|
"dev": "bun run index.ts",
|
|
21
|
-
"test": "bun test src"
|
|
24
|
+
"test": "bun test src scripts",
|
|
25
|
+
"validate:generated": "bun run ./scripts/validate-generated.ts",
|
|
26
|
+
"typecheck": "bunx tsc --noEmit"
|
|
22
27
|
},
|
|
23
28
|
"repository": {
|
|
24
29
|
"type": "git",
|
|
@@ -30,22 +35,25 @@
|
|
|
30
35
|
},
|
|
31
36
|
"keywords": [
|
|
32
37
|
"bun",
|
|
38
|
+
"backend",
|
|
33
39
|
"cloud-run",
|
|
34
40
|
"connectrpc",
|
|
35
|
-
"go",
|
|
36
41
|
"grpc",
|
|
42
|
+
"hono",
|
|
43
|
+
"monorepo",
|
|
37
44
|
"scaffold"
|
|
38
45
|
],
|
|
46
|
+
"packageManager": "bun@1.3.2",
|
|
39
47
|
"devDependencies": {
|
|
40
48
|
"@types/bun": "latest"
|
|
41
49
|
},
|
|
42
50
|
"peerDependencies": {
|
|
43
|
-
"typescript": "^5"
|
|
51
|
+
"typescript": "^5.9.3"
|
|
44
52
|
},
|
|
45
53
|
"dependencies": {
|
|
46
|
-
"@clack/prompts": "^1.
|
|
47
|
-
"@google-cloud/billing": "^5.1.
|
|
48
|
-
"@google-cloud/resource-manager": "^6.2.
|
|
54
|
+
"@clack/prompts": "^1.4.0",
|
|
55
|
+
"@google-cloud/billing": "^5.1.2",
|
|
56
|
+
"@google-cloud/resource-manager": "^6.2.2",
|
|
49
57
|
"@neondatabase/api-client": "^2.7.1",
|
|
50
58
|
"picocolors": "^1.1.1"
|
|
51
59
|
}
|
package/src/cli.test.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { expect, test } from "bun:test";
|
|
2
2
|
import { mkdir } from "node:fs/promises";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
assertDiscoveryReady,
|
|
5
|
+
normalizeValidationResult,
|
|
6
|
+
parseArgs,
|
|
7
|
+
validateTargetRuntimeFramework,
|
|
8
|
+
validateServiceNameInput,
|
|
9
|
+
} from "./cli";
|
|
4
10
|
|
|
5
11
|
test("normalizeValidationResult converts success to undefined", () => {
|
|
6
12
|
expect(normalizeValidationResult(true)).toBeUndefined();
|
|
@@ -10,16 +16,49 @@ test("normalizeValidationResult preserves validation errors", () => {
|
|
|
10
16
|
expect(normalizeValidationResult("Service name is required")).toBe("Service name is required");
|
|
11
17
|
});
|
|
12
18
|
|
|
13
|
-
test("assertDiscoveryReady
|
|
14
|
-
expect(
|
|
19
|
+
test("assertDiscoveryReady no longer blocks scaffold when remote discovery is unavailable", () => {
|
|
20
|
+
expect(
|
|
15
21
|
assertDiscoveryReady({
|
|
16
22
|
projects: [],
|
|
17
23
|
billingAccounts: [],
|
|
18
|
-
warnings: [],
|
|
19
|
-
neonError: "Vault secret resolution requires VAULT_ADDR, VAULT_TOKEN, and a secret path",
|
|
24
|
+
warnings: ["Skipping GCP project discovery: gcloud not installed"],
|
|
20
25
|
})
|
|
21
|
-
).
|
|
22
|
-
|
|
26
|
+
).toEqual({
|
|
27
|
+
projects: [],
|
|
28
|
+
billingAccounts: [],
|
|
29
|
+
warnings: ["Skipping GCP project discovery: gcloud not installed"],
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("parseArgs defaults to microservice and cloudrun target", () => {
|
|
34
|
+
expect(parseArgs(["launch-api", "--yes"])).toMatchObject({
|
|
35
|
+
directory: "launch-api",
|
|
36
|
+
profile: "microservice",
|
|
37
|
+
yes: true,
|
|
38
|
+
});
|
|
39
|
+
expect(parseArgs(["launch-api", "--target", "workers", "--yes"])).toMatchObject({
|
|
40
|
+
directory: "launch-api",
|
|
41
|
+
target: "workers",
|
|
42
|
+
yes: true,
|
|
43
|
+
});
|
|
44
|
+
expect(parseArgs(["launch-api", "--yes"]).autoDeploy).toBeUndefined();
|
|
45
|
+
expect(parseArgs(["launch-api", "--yes", "--no-git"]).noGit).toBeTrue();
|
|
46
|
+
|
|
47
|
+
expect(() => parseArgs(["launch-api", "--profile", "microservice", "--bootstrap"])).toThrow("Unknown argument");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("parseArgs rejects the removed app profile", () => {
|
|
51
|
+
expect(() => parseArgs(["tracker", "--profile=app", "--yes"])).toThrow("app profile has moved");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("target/runtime/framework combinations are validated", () => {
|
|
55
|
+
expect(() => validateTargetRuntimeFramework("cloudrun", "go", "connectrpc")).not.toThrow();
|
|
56
|
+
expect(() => validateTargetRuntimeFramework("workers", "bun", "hono")).not.toThrow();
|
|
57
|
+
expect(() => validateTargetRuntimeFramework("workers", "bun", "connectrpc")).toThrow(
|
|
58
|
+
"Framework connectrpc is not valid for target workers and runtime bun"
|
|
59
|
+
);
|
|
60
|
+
expect(() => validateTargetRuntimeFramework("workers", "go", "connectrpc")).toThrow(
|
|
61
|
+
"Framework connectrpc is not valid for target workers and runtime go"
|
|
23
62
|
);
|
|
24
63
|
});
|
|
25
64
|
|