@elumixor/devkit 0.3.0 → 0.3.1
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 +51 -0
- package/package.json +1 -1
- package/src/bin/devkit.ts +0 -0
- package/src/bin/free-port.ts +0 -0
package/README.md
CHANGED
|
@@ -40,7 +40,58 @@ Each app runs `bun --filter <name> dev` by default. Override with:
|
|
|
40
40
|
| `color` | prefix color (blue, magenta, green, yellow, cyan, red) |
|
|
41
41
|
| `open` | with `--open`, open this app's URL when its port comes up |
|
|
42
42
|
|
|
43
|
+
## Setting up a machine
|
|
44
|
+
|
|
45
|
+
A repo usually needs a couple of gitignored files before it will run — `.env`, `infra/terraform.tfvars` — and those cannot be fetched back from a host. Vercel, for one, stores Terraform-managed variables write-only and hands them back from `vercel env pull` as *empty strings*, which looks like it worked and quietly leaves you with a `.env` full of blanks.
|
|
46
|
+
|
|
47
|
+
So devkit syncs them itself, age-encrypted, in a private repo:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
devkit clone elumixor/puretype # clone, decrypt secrets, install, terraform init
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Declare what to sync and what to run:
|
|
54
|
+
|
|
55
|
+
```jsonc
|
|
56
|
+
"devkit": {
|
|
57
|
+
"apps": [ /* ... */ ],
|
|
58
|
+
"setup": {
|
|
59
|
+
"secrets": [".env", "infra/terraform.tfvars"],
|
|
60
|
+
"env": [{ "file": ".env", "example": ".env.example" }],
|
|
61
|
+
"terraform": "infra",
|
|
62
|
+
"steps": ["bun --filter backend prisma:generate"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| key | meaning |
|
|
68
|
+
| ------------- | ------------------------------------------------------------------------------------ |
|
|
69
|
+
| `secrets` | gitignored files to sync, encrypted, via `devkit secrets push` / `pull` |
|
|
70
|
+
| `secretsRepo` | private repo holding them (default `elumixor/secrets`) |
|
|
71
|
+
| `env` | env files to validate against a committed `.example` — missing *or empty* keys fail |
|
|
72
|
+
| `terraform` | directory to `terraform init`, skipped if it has no `terraform.tfvars` |
|
|
73
|
+
| `install` | run `bun install` (default true) |
|
|
74
|
+
| `steps` | shell commands to run last, in order |
|
|
75
|
+
|
|
76
|
+
`setup` refuses to continue on a blank value. A missing secret that reads as `""` otherwise surfaces much later as an unrelated-looking bug.
|
|
77
|
+
|
|
78
|
+
### The age identity
|
|
79
|
+
|
|
80
|
+
Encryption uses [age](https://github.com/FiloSottile/age). Your identity lives at `~/.config/age/key.txt` and is **the one thing you must carry to a new machine** — without it the encrypted secrets are unreadable. Back it up somewhere outside the laptop.
|
|
81
|
+
|
|
82
|
+
First time on a machine:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
brew install age gh
|
|
86
|
+
gh auth login
|
|
87
|
+
cp /somewhere/key.txt ~/.config/age/key.txt # or age-keygen -o ~/.config/age/key.txt
|
|
88
|
+
devkit clone <owner/repo>
|
|
89
|
+
```
|
|
90
|
+
|
|
43
91
|
## Bins
|
|
44
92
|
|
|
45
93
|
- `devkit [root] [--open] [--dry] [--version]` — the orchestrator above. `root` is an optional path to the folder holding the `devkit` config (defaults to the current directory); `--dry` prints the resolved commands and URLs without running anything.
|
|
94
|
+
- `devkit clone <owner/repo> [dir]` — clone, decrypt secrets, run setup.
|
|
95
|
+
- `devkit setup [root] [--dry]` — validate secrets, install, `terraform init`, run steps.
|
|
96
|
+
- `devkit secrets push|pull [root]` — sync the encrypted secrets.
|
|
46
97
|
- `free-port <port>` — kill whatever is listening on a port (handy in a `predev`).
|
package/package.json
CHANGED
package/src/bin/devkit.ts
CHANGED
|
File without changes
|
package/src/bin/free-port.ts
CHANGED
|
File without changes
|