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 +1 -1
- package/package.json +1 -1
- package/src/cli.test.ts +10 -0
- package/src/cli.ts +6 -2
- package/templates/root/.github/workflows/deploy.yml +1 -1
- package/templates/root/README.md +3 -3
package/README.md
CHANGED
package/package.json
CHANGED
package/src/cli.test.ts
ADDED
|
@@ -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()
|
package/templates/root/README.md
CHANGED
|
@@ -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
|