create-svc 0.1.10 → 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 +46 -43
- package/bin/create-service.mjs +2 -0
- package/package.json +12 -9
- package/src/cli.test.ts +28 -10
- package/src/cli.ts +195 -30
- package/src/git-bootstrap.test.ts +40 -0
- package/src/git-bootstrap.ts +110 -0
- package/src/naming.test.ts +1 -0
- package/src/naming.ts +23 -0
- package/src/post-scaffold.test.ts +19 -0
- package/src/post-scaffold.ts +17 -4
- package/src/profiles.ts +2 -5
- package/src/scaffold.test.ts +231 -40
- package/src/scaffold.ts +84 -29
- package/src/vault.test.ts +61 -1
- package/src/vault.ts +77 -15
- package/templates/shared/.github/workflows/ci.yml +2 -1
- package/templates/shared/.github/workflows/deploy.yml +2 -0
- package/templates/shared/README.md +124 -47
- 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 +14 -5
- package/templates/shared/scripts/cloudrun/cleanup.ts +64 -4
- package/templates/shared/scripts/cloudrun/cli.ts +324 -7
- package/templates/shared/scripts/cloudrun/config.ts +11 -4
- package/templates/shared/scripts/cloudrun/deploy.ts +0 -4
- package/templates/shared/scripts/cloudrun/lib.ts +174 -41
- package/templates/shared/scripts/cloudrun/neon.ts +45 -0
- 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 -44
- 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/Makefile +14 -8
- package/templates/variants/bun-connectrpc/gen/protos/waitlist/v1/waitlist_pb.ts +424 -0
- package/templates/variants/bun-connectrpc/migrations/0000_init.sql +12 -55
- package/templates/variants/bun-connectrpc/package.json +12 -5
- package/templates/variants/bun-connectrpc/protos/waitlist/v1/waitlist.proto +91 -0
- package/templates/variants/bun-connectrpc/scripts/codegen.ts +1 -1
- package/templates/variants/bun-connectrpc/scripts/migrate.ts +4 -1
- package/templates/variants/bun-connectrpc/src/auth.ts +200 -0
- package/templates/variants/bun-connectrpc/src/db/repository.ts +67 -420
- package/templates/variants/bun-connectrpc/src/db/schema.ts +15 -64
- package/templates/variants/bun-connectrpc/src/index.ts +76 -176
- 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 +4 -4
- package/templates/variants/bun-connectrpc/test/waitlist.integration.test.ts +71 -0
- package/templates/variants/bun-hono/Makefile +14 -8
- package/templates/variants/bun-hono/migrations/0000_init.sql +12 -55
- package/templates/variants/bun-hono/package.json +12 -5
- package/templates/variants/bun-hono/scripts/migrate.ts +4 -1
- package/templates/variants/bun-hono/src/auth.ts +181 -0
- package/templates/variants/bun-hono/src/db/repository.ts +68 -421
- package/templates/variants/bun-hono/src/db/schema.ts +15 -64
- package/templates/variants/bun-hono/src/index.ts +65 -180
- 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 +72 -41
- package/templates/variants/bun-hono/test/waitlist.integration.test.ts +102 -0
- package/templates/variants/go-chi/Makefile +27 -11
- package/templates/variants/go-chi/atlas.hcl +8 -0
- package/templates/variants/go-chi/cmd/server/main.go +21 -10
- package/templates/variants/go-chi/go.mod +1 -3
- package/templates/variants/go-chi/internal/app/service.go +202 -685
- 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 +27 -11
- package/templates/variants/go-chi/internal/httpapi/routes.go +78 -157
- 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 +12 -55
- package/templates/variants/go-chi/migrations/atlas.sum +2 -0
- package/templates/variants/go-chi/package.json +7 -1
- package/templates/variants/go-connectrpc/Makefile +26 -9
- package/templates/variants/go-connectrpc/atlas.hcl +8 -0
- package/templates/variants/go-connectrpc/buf.gen.yaml +2 -2
- package/templates/variants/go-connectrpc/cmd/server/main.go +23 -12
- 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 +1 -1
- package/templates/variants/go-connectrpc/internal/app/service.go +202 -685
- 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 +27 -11
- package/templates/variants/go-connectrpc/internal/connectapi/handler.go +78 -201
- package/templates/variants/go-connectrpc/internal/connectapi/waitlist_integration_test.go +122 -0
- package/templates/variants/go-connectrpc/internal/httpapi/routes.go +147 -9
- 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 +12 -55
- 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/scripts/cloudrun/integrations.ts +0 -111
- package/templates/variants/bun-connectrpc/gen/protos/chat/v1/chat_pb.ts +0 -1078
- package/templates/variants/bun-connectrpc/protos/chat/v1/chat.proto +0 -228
- package/templates/variants/bun-connectrpc/src/chat/service.ts +0 -384
- package/templates/variants/bun-connectrpc/src/chat/types.ts +0 -142
- package/templates/variants/bun-connectrpc/src/storage.ts +0 -72
- package/templates/variants/bun-connectrpc/src/webhooks.ts +0 -35
- package/templates/variants/bun-connectrpc/test/list-messages.integration.test.ts +0 -182
- package/templates/variants/bun-hono/src/chat/service.ts +0 -384
- package/templates/variants/bun-hono/src/chat/types.ts +0 -142
- package/templates/variants/bun-hono/src/storage.ts +0 -72
- package/templates/variants/bun-hono/src/webhooks.ts +0 -35
- package/templates/variants/bun-hono/test/list-messages.integration.test.ts +0 -256
- package/templates/variants/go-chi/buf.gen.yaml +0 -12
- package/templates/variants/go-chi/buf.yaml +0 -9
- package/templates/variants/go-chi/cmd/migrate/main.go +0 -101
- package/templates/variants/go-chi/internal/httpapi/list_messages_integration_test.go +0 -298
- package/templates/variants/go-chi/protos/chat/v1/chat.proto +0 -219
- package/templates/variants/go-connectrpc/cmd/migrate/main.go +0 -101
- package/templates/variants/go-connectrpc/gen/chat/v1/chat.pb.go +0 -2512
- package/templates/variants/go-connectrpc/gen/chat/v1/chatv1connect/chat.connect.go +0 -571
- package/templates/variants/go-connectrpc/internal/connectapi/list_messages_integration_test.go +0 -216
- package/templates/variants/go-connectrpc/protos/chat/v1/chat.proto +0 -232
package/README.md
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
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
5
|
- a single `microservice` generation path
|
|
6
|
-
-
|
|
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
|
|
7
9
|
- standalone package output that does not assume repo bootstrap
|
|
8
|
-
-
|
|
9
|
-
- a
|
|
10
|
-
- shared Cloud Run bootstrap, deploy, and cleanup automation
|
|
10
|
+
- a generated `service.config.ts` manifest
|
|
11
|
+
- a generated `service` lifecycle CLI for create, deploy, migrate, seed, dashboards, doctor, and destroy
|
|
11
12
|
- local Docker Compose Postgres for first-run development
|
|
12
|
-
- Neon-backed remote
|
|
13
|
-
-
|
|
14
|
-
- typed HTTP webhook ingress
|
|
15
|
-
- a production API origin at `https://api.<appname>.anmho.com`
|
|
13
|
+
- Neon-backed remote environments
|
|
14
|
+
- a production API origin at `https://api.<service_id>.anmho.com`
|
|
16
15
|
|
|
17
|
-
Local provisioning intentionally prefers known-good CLIs
|
|
18
|
-
Terraform, control planes, and platform consoles are optional advanced paths, not default prerequisites.
|
|
16
|
+
Local provisioning intentionally prefers known-good CLIs over SDK-heavy orchestration where that keeps the generated service easier to inspect and repair.
|
|
19
17
|
|
|
20
18
|
npm: <https://www.npmjs.com/package/create-svc>
|
|
21
19
|
|
|
@@ -25,6 +23,12 @@ npm: <https://www.npmjs.com/package/create-svc>
|
|
|
25
23
|
bun create svc my-service
|
|
26
24
|
```
|
|
27
25
|
|
|
26
|
+
Compatibility alias:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun create svc my-service
|
|
30
|
+
```
|
|
31
|
+
|
|
28
32
|
or:
|
|
29
33
|
|
|
30
34
|
```bash
|
|
@@ -34,10 +38,17 @@ bunx create-svc my-service
|
|
|
34
38
|
For the strict one-command production path:
|
|
35
39
|
|
|
36
40
|
```bash
|
|
37
|
-
bun create svc my-service --
|
|
41
|
+
bun create svc my-service --yes
|
|
38
42
|
```
|
|
39
43
|
|
|
40
|
-
`--profile microservice` is accepted as a compatibility no-op.
|
|
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.
|
|
41
52
|
|
|
42
53
|
## Local Testing
|
|
43
54
|
|
|
@@ -53,8 +64,8 @@ For faster iteration against your working tree:
|
|
|
53
64
|
|
|
54
65
|
```bash
|
|
55
66
|
bun link
|
|
56
|
-
bun link create-
|
|
57
|
-
create-
|
|
67
|
+
bun link create-service
|
|
68
|
+
create-service my-service
|
|
58
69
|
```
|
|
59
70
|
|
|
60
71
|
During scaffold, the generator can discover:
|
|
@@ -62,8 +73,8 @@ During scaffold, the generator can discover:
|
|
|
62
73
|
- accessible GCP projects
|
|
63
74
|
- open billing accounts
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
|
|
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.
|
|
67
78
|
|
|
68
79
|
Before running generated provisioning commands locally, authenticate `gcloud` on the machine:
|
|
69
80
|
|
|
@@ -71,13 +82,11 @@ Before running generated provisioning commands locally, authenticate `gcloud` on
|
|
|
71
82
|
gcloud auth login
|
|
72
83
|
```
|
|
73
84
|
|
|
74
|
-
## Generated
|
|
85
|
+
## Generated Service Package
|
|
75
86
|
|
|
76
87
|
First local run:
|
|
77
88
|
|
|
78
|
-
|
|
79
|
-
docker compose up -d
|
|
80
|
-
```
|
|
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.
|
|
81
90
|
|
|
82
91
|
For Bun variants:
|
|
83
92
|
|
|
@@ -87,9 +96,9 @@ bun run dev
|
|
|
87
96
|
bun run gen
|
|
88
97
|
bun run lint
|
|
89
98
|
bun run test
|
|
90
|
-
bun run
|
|
99
|
+
bun run create
|
|
91
100
|
bun run deploy
|
|
92
|
-
bun run
|
|
101
|
+
bun run destroy
|
|
93
102
|
```
|
|
94
103
|
|
|
95
104
|
For Go variants:
|
|
@@ -100,18 +109,16 @@ make dev
|
|
|
100
109
|
make gen
|
|
101
110
|
make lint
|
|
102
111
|
make test
|
|
103
|
-
make
|
|
112
|
+
make create
|
|
104
113
|
make deploy
|
|
105
|
-
make
|
|
114
|
+
make destroy
|
|
106
115
|
```
|
|
107
116
|
|
|
108
|
-
|
|
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.
|
|
109
118
|
|
|
110
|
-
The
|
|
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.
|
|
111
120
|
|
|
112
|
-
|
|
113
|
-
- image attachment upload/finalize plumbing via GCS
|
|
114
|
-
- generic typed webhook ingestion on plain HTTP
|
|
121
|
+
The generated microservice domain is a small waitlist/launch service example with public submit/status APIs and target-specific scheduled work.
|
|
115
122
|
|
|
116
123
|
## Development
|
|
117
124
|
|
|
@@ -129,33 +136,29 @@ bun run validate:generated -- --variant bun-hono
|
|
|
129
136
|
bun run validate:generated -- --variant go-connectrpc --keep
|
|
130
137
|
```
|
|
131
138
|
|
|
132
|
-
The validation harness scaffolds generated
|
|
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.
|
|
133
140
|
|
|
134
141
|
## npm Trusted Publishing
|
|
135
142
|
|
|
136
|
-
`create-
|
|
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.
|
|
137
144
|
|
|
138
145
|
Repository workflow:
|
|
146
|
+
|
|
139
147
|
- [publish.yml](.github/workflows/publish.yml)
|
|
140
|
-
- Trigger: Git tags matching `v
|
|
148
|
+
- Trigger: pushes to `main`, Git tags matching `v*`, or manual `workflow_dispatch`
|
|
141
149
|
- CI runtime: Bun for install/test/typecheck, npm for the final publish step
|
|
142
150
|
|
|
143
151
|
npm package setup still has to be configured once in the npm UI to trust this repository and workflow:
|
|
144
152
|
|
|
145
|
-
1. Open the `create-
|
|
153
|
+
1. Open the `create-service` package settings on npm.
|
|
146
154
|
2. Go to `Settings` -> `Trusted Publisher`.
|
|
147
155
|
3. Select `GitHub Actions`.
|
|
148
156
|
4. Enter:
|
|
149
157
|
- Organization or user: `anmho`
|
|
150
|
-
- Repository: `create-
|
|
158
|
+
- Repository: `create-service`
|
|
151
159
|
- Workflow filename: `publish.yml`
|
|
152
160
|
5. Save the trusted publisher.
|
|
153
161
|
|
|
154
|
-
After that, publishing
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
git tag v0.1.10
|
|
158
|
-
git push origin v0.1.10
|
|
159
|
-
```
|
|
162
|
+
After that, publishing can be triggered by pushing to `main`, creating a `v*` tag, or running the workflow manually.
|
|
160
163
|
|
|
161
|
-
The GitHub Actions workflow
|
|
164
|
+
The GitHub Actions workflow authenticates with npm via OIDC and runs `npm publish` without an npm token.
|
package/package.json
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-svc",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Local
|
|
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": {
|
|
@@ -45,12 +48,12 @@
|
|
|
45
48
|
"@types/bun": "latest"
|
|
46
49
|
},
|
|
47
50
|
"peerDependencies": {
|
|
48
|
-
"typescript": "^5"
|
|
51
|
+
"typescript": "^5.9.3"
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"@clack/prompts": "^1.
|
|
52
|
-
"@google-cloud/billing": "^5.1.
|
|
53
|
-
"@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",
|
|
54
57
|
"@neondatabase/api-client": "^2.7.1",
|
|
55
58
|
"picocolors": "^1.1.1"
|
|
56
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();
|
|
@@ -24,24 +30,36 @@ test("assertDiscoveryReady no longer blocks scaffold when remote discovery is un
|
|
|
24
30
|
});
|
|
25
31
|
});
|
|
26
32
|
|
|
27
|
-
test("parseArgs defaults to
|
|
33
|
+
test("parseArgs defaults to microservice and cloudrun target", () => {
|
|
28
34
|
expect(parseArgs(["launch-api", "--yes"])).toMatchObject({
|
|
29
35
|
directory: "launch-api",
|
|
30
36
|
profile: "microservice",
|
|
31
37
|
yes: true,
|
|
32
38
|
});
|
|
33
|
-
expect(parseArgs(["launch-api", "--yes"])
|
|
34
|
-
|
|
35
|
-
expect(parseArgs(["launch-api", "--profile", "microservice", "--bootstrap"])).toMatchObject({
|
|
39
|
+
expect(parseArgs(["launch-api", "--target", "workers", "--yes"])).toMatchObject({
|
|
36
40
|
directory: "launch-api",
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
target: "workers",
|
|
42
|
+
yes: true,
|
|
39
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");
|
|
40
52
|
});
|
|
41
53
|
|
|
42
|
-
test("
|
|
43
|
-
expect(() =>
|
|
44
|
-
expect(() =>
|
|
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"
|
|
62
|
+
);
|
|
45
63
|
});
|
|
46
64
|
|
|
47
65
|
test("validateServiceNameInput rejects a taken target directory", async () => {
|