create-svc 0.1.1 → 0.1.2

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 CHANGED
@@ -22,7 +22,7 @@ bun dev
22
22
  bun gen
23
23
  bun lint
24
24
  bun test
25
- bun deploy
25
+ bun run deploy
26
26
  ```
27
27
 
28
28
  ## Development
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-svc",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Bun-authored CLI to scaffold Go Cloud Run services with Chi, ConnectRPC, Vault, and Cloudflare examples.",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -0,0 +1,10 @@
1
+ import { expect, test } from "bun:test";
2
+ import { normalizeValidationResult } from "./cli";
3
+
4
+ test("normalizeValidationResult converts success to undefined", () => {
5
+ expect(normalizeValidationResult(true)).toBeUndefined();
6
+ });
7
+
8
+ test("normalizeValidationResult preserves validation errors", () => {
9
+ expect(normalizeValidationResult("Service name is required")).toBe("Service name is required");
10
+ });
package/src/cli.ts CHANGED
@@ -56,7 +56,7 @@ export async function run(argv: string[]) {
56
56
  `Next: ${pc.cyan(`cd ${config.directory}`)}`,
57
57
  `Local dev: ${pc.cyan("bun dev")}`,
58
58
  `Generate stubs: ${pc.cyan("bun gen")}`,
59
- `First deploy: set ${pc.cyan("BOOTSTRAP_VAULT_ROLE_ID")} and ${pc.cyan("BOOTSTRAP_VAULT_SECRET_ID")}, then run ${pc.cyan("bun deploy")}`,
59
+ `First deploy: set ${pc.cyan("BOOTSTRAP_VAULT_ROLE_ID")} and ${pc.cyan("BOOTSTRAP_VAULT_SECRET_ID")}, then run ${pc.cyan("bun run deploy")}`,
60
60
  ].join("\n")
61
61
  );
62
62
  }
@@ -259,7 +259,7 @@ async function promptText(
259
259
  const value = await text({
260
260
  message,
261
261
  initialValue,
262
- validate: (input) => validate(input.trim()),
262
+ validate: (input) => normalizeValidationResult(validate(input.trim())),
263
263
  });
264
264
 
265
265
  if (isCancel(value)) {
@@ -270,6 +270,10 @@ async function promptText(
270
270
  return value.trim();
271
271
  }
272
272
 
273
+ export function normalizeValidationResult(result: true | string): string | undefined {
274
+ return result === true ? undefined : result;
275
+ }
276
+
273
277
  function slugify(value: string): string {
274
278
  return value
275
279
  .trim()
@@ -19,4 +19,4 @@ jobs:
19
19
  workload_identity_provider: ${{ vars.GCP_WIF_PROVIDER }}
20
20
  service_account: ${{ vars.GCP_DEPLOYER_SERVICE_ACCOUNT }}
21
21
  - uses: google-github-actions/setup-gcloud@v2
22
- - run: bun deploy -- --ci
22
+ - run: bun run deploy -- --ci
@@ -36,7 +36,7 @@ bun dev
36
36
  bun gen
37
37
  bun lint
38
38
  bun test
39
- bun deploy
39
+ bun run deploy
40
40
  ```
41
41
 
42
42
  `bun test` uses Bun's test runner to invoke `go test ./...` so the command surface stays Bun-first.
@@ -48,10 +48,10 @@ The runtime reads Vault AppRole credentials from Secret Manager. On the first de
48
48
  ```bash
49
49
  export BOOTSTRAP_VAULT_ROLE_ID=...
50
50
  export BOOTSTRAP_VAULT_SECRET_ID=...
51
- bun deploy
51
+ bun run deploy
52
52
  ```
53
53
 
54
- `bun deploy` will:
54
+ `bun run deploy` will:
55
55
 
56
56
  1. enable required GCP services
57
57
  2. create runtime and deployer service accounts