create-svc 0.1.83 → 0.1.85

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-svc",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
4
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",
@@ -71,6 +71,7 @@ test("scaffolds all runtime/framework variants with shared cloudrun config", asy
71
71
  expect(serviceConfig).toContain('"project_mode": "create_new"');
72
72
  expect(serviceConfig).toContain('"quota_project_id": "anmho-infra-prod"');
73
73
  expect(serviceConfig).toContain('"artifact_repository": "cloud-run"');
74
+ expect(serviceConfig).toContain('"worker_min_instances": 0');
74
75
  expect(serviceConfig).not.toContain("cloudbuild.googleapis.com");
75
76
  expect(serviceConfig).toContain('"jwks_url": "https://auth.anmho.com/api/auth/jwks"');
76
77
  expect(serviceConfig).toContain('"git": {');
@@ -97,6 +98,7 @@ test("scaffolds all runtime/framework variants with shared cloudrun config", asy
97
98
  expect(manifest).toContain("${AUTH_AUDIENCE}");
98
99
  expect(manifest).toContain("managed_by: create-service");
99
100
  expect(manifest).toContain("service_id: ${SERVICE_ID}");
101
+ expect(manifest).toContain('autoscaling.knative.dev/minScale: "${SERVICE_MIN_SCALE}"');
100
102
  expect(manifest).not.toContain("CLERK_SECRET_KEY");
101
103
  expect(manifest).not.toContain("STRIPE_SECRET_KEY");
102
104
  expect(manifest).not.toContain("REVENUECAT_API_KEY");
@@ -138,6 +140,17 @@ test("scaffolds all runtime/framework variants with shared cloudrun config", asy
138
140
  expect(await Bun.file(join(generatedRoot, "grafana", "waitlist-dashboard.json")).exists()).toBeTrue();
139
141
  expect(await Bun.file(join(generatedRoot, "grafana", "alerts.yaml")).exists()).toBeTrue();
140
142
 
143
+ const ciWorkflow = await Bun.file(join(generatedRoot, ".github", "workflows", "ci.yml")).text();
144
+ expect(ciWorkflow).not.toContain("go install github.com/bufbuild/buf/cmd/buf@latest");
145
+ if (variant.runtime === "go" && variant.framework === "connectrpc") {
146
+ expect(ciWorkflow).toContain("bufbuild/buf-setup-action@v1");
147
+ expect(ciWorkflow).toContain('version: "1.60.0"');
148
+ expect(ciWorkflow).toContain("'connectrpc' == 'connectrpc'");
149
+ }
150
+ if (variant.runtime === "go" && variant.framework === "chi") {
151
+ expect(ciWorkflow).toContain("'chi' == 'connectrpc'");
152
+ }
153
+
141
154
  const previewWorkflow = await Bun.file(join(generatedRoot, ".github", "workflows", "preview.yml")).text();
142
155
  expect(previewWorkflow).toContain("issue_comment:");
143
156
  expect(previewWorkflow).toContain("/deploy preview");
@@ -14,6 +14,7 @@ export const config = {
14
14
  region: cloudrun.region,
15
15
  artifactRepository: cloudrun.artifact_repository,
16
16
  runtimeServiceAccount: cloudrun.service_account,
17
+ workerMinInstances: Number(cloudrun.worker_min_instances ?? 0),
17
18
  project: {
18
19
  mode: cloudrun.project_mode,
19
20
  id: cloudrun.project_id,
@@ -518,6 +518,7 @@ export async function renderManifest(image: string, target: DeploymentTarget, pr
518
518
  SERVICE_ID: config.serviceName,
519
519
  SERVICE_ROLE: process,
520
520
  SERVICE_INGRESS: process === "worker" ? "internal" : "all",
521
+ SERVICE_MIN_SCALE: process === "worker" ? String(config.workerMinInstances) : "0",
521
522
  CONTAINER_COMMAND: renderContainerCommand(process),
522
523
  RUNTIME_SERVICE_ACCOUNT: config.runtimeServiceAccount,
523
524
  IMAGE_URL: image,
@@ -18,8 +18,10 @@ jobs:
18
18
  go-version: "1.25"
19
19
  - if: ${{ '{{RUNTIME}}' == 'go' }}
20
20
  uses: ariga/setup-atlas@v0
21
- - if: ${{ '{{RUNTIME}}' == 'go' }}
22
- run: go install github.com/bufbuild/buf/cmd/buf@latest
21
+ - if: ${{ '{{RUNTIME}}' == 'go' && '{{FRAMEWORK}}' == 'connectrpc' }}
22
+ uses: bufbuild/buf-setup-action@v1
23
+ with:
24
+ version: "1.60.0"
23
25
  - run: bun install
24
26
  - run: bun run lint
25
27
  - run: bun run test
@@ -88,6 +88,11 @@ with real connection settings before the worker can run:
88
88
  - `TEMPORAL_NAMESPACE`
89
89
  - any TLS certificate/key or API-key settings used by your worker code
90
90
 
91
+ Cloud Run worker min instances are controlled by
92
+ `cloudrun.worker_min_instances` in `service.jsonc`. The generated default is
93
+ `0`; set it to `1` for production services that must keep a Temporal poller
94
+ warm for scheduled workflows.
95
+
91
96
  If a service does not need Temporal, opt out with:
92
97
 
93
98
  ```bash
@@ -107,6 +107,7 @@
107
107
  "region": "{{REGION}}",
108
108
  "artifact_repository": "cloud-run",
109
109
  "service_account": "{{RUNTIME_SERVICE_ACCOUNT}}",
110
+ "worker_min_instances": 0,
110
111
  "required_apis": [
111
112
  "run.googleapis.com",
112
113
  "artifactregistry.googleapis.com",
@@ -15,6 +15,8 @@ spec:
15
15
  managed_by: create-service
16
16
  service_id: ${SERVICE_ID}
17
17
  service_role: ${SERVICE_ROLE}
18
+ annotations:
19
+ autoscaling.knative.dev/minScale: "${SERVICE_MIN_SCALE}"
18
20
  spec:
19
21
  serviceAccountName: ${RUNTIME_SERVICE_ACCOUNT}
20
22
  containers: