crabenv 0.0.1 → 0.0.3
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 +70 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
# crabenv
|
|
1
|
+
# 🦀 crabenv
|
|
2
2
|
|
|
3
3
|
The simplest, opinionated way to keep .env files, schemas, and examples aligned.
|
|
4
4
|
|
|
5
|
-
crabenv is an
|
|
5
|
+
`crabenv` is an env var management standard created by [Carlo Taleon](http://carlo.tl) to minimize env var schema + documentation drift in any codebase. If you follow this standard, you'll find it extremely seamless to "develop locally" and "deploy to production" in any platform!
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Why use it
|
|
8
|
+
|
|
9
|
+
- [x] Typesafety & Validation
|
|
10
|
+
- [x] Good documentation. Never stale, does what it says.
|
|
11
|
+
- [x] Seamless _local development_ to _deployment_ story.
|
|
12
|
+
- [x] No new config files. Your team doesn't need to install crabenv, it's just manual-crud made automated via CLI.
|
|
13
|
+
- [x] Language-agnostic. No need to learn language-specific configurations for multi-language and monorepos, just use the same CLI commands.
|
|
8
14
|
|
|
9
15
|
## Installation
|
|
10
16
|
|
|
@@ -17,15 +23,56 @@ cargo install crabenv # or cargo (build from source)
|
|
|
17
23
|
curl -sSL https://raw.githubusercontent.com/Blankeos/crabenv/main/install.sh | sh # or linux/macos (via curl)
|
|
18
24
|
```
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
## Quickstart
|
|
27
|
+
|
|
28
|
+
> 💡 Before anything else, read this 1-page concept of the standard [here](https://crabenv.pages.dev/#concepts). Must know **Local (`.env`)**, **Schema (`env.ts`, etc.)**, **Template (`.env.example`)**
|
|
29
|
+
|
|
30
|
+
1. This command auto-detects your project and creates a Local, Schema, and Template
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
crabenv init
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. Add an env var
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
crabenv add
|
|
40
|
+
◆ Variable name: DATABASE_URL
|
|
41
|
+
◆ Scope: private
|
|
42
|
+
◆ Type: string
|
|
43
|
+
◆ Example Value: $(pwd)/data.db
|
|
44
|
+
◆ Mark as optional: no
|
|
45
|
+
◆ Add? yes
|
|
46
|
+
|
|
47
|
+
# Notice that Local, Template, and Schema are correctly synced 🎉
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
3. List your env vars to see if it's used, remove, or update vars
|
|
21
51
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
52
|
+
```sh
|
|
53
|
+
crabenv ls
|
|
54
|
+
crabenv remove
|
|
55
|
+
crabenv update
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
😎 That's it! Now imagine the convenience when...
|
|
59
|
+
|
|
60
|
+
- A new dev onboards on a new project, they just need to do `crabenv cp` to get a correct `.env` file! It's a better `cp .env.example .env` command!
|
|
61
|
+
- A senior dev wants to deploy a monorepo so what env vars needed for specific apps? Show them all with `crabenv ls`
|
|
62
|
+
- A senior dev wants to reorganize, sort, standardize the structure of env vars? Re-sort them without thinking about it with `crabenv fmt`
|
|
63
|
+
- A senior dev wants to check for any drift? `crabenv doctor`
|
|
64
|
+
|
|
65
|
+
## 📁 Languages supported
|
|
66
|
+
|
|
67
|
+
Regardless of the language or mix of languages in your repositories, you'll be able to use the same commands.
|
|
27
68
|
|
|
28
|
-
|
|
69
|
+
- [x] 💙 TypeScript/Javascript and Monorepos (includes React, Solid, Vue, Svelte, Vite, NextJS, ReactNative, Backends, and Cloudflare apps)
|
|
70
|
+
- [x] 🐍 Python
|
|
71
|
+
- [x] 🦀 Rust
|
|
72
|
+
- [x] 🐦 Flutter
|
|
73
|
+
- [x] More? Request an adapter via issue (the conventional standard must be discussed).
|
|
74
|
+
|
|
75
|
+
<!--### 🤒 Pains solved:
|
|
29
76
|
|
|
30
77
|
- [x] CRUD and Documentation drift
|
|
31
78
|
- [ ] Deployment/sink drift via explicit managed blocks, not arbitrary file inference
|
|
@@ -37,45 +84,35 @@ curl -sSL https://raw.githubusercontent.com/Blankeos/crabenv/main/install.sh | s
|
|
|
37
84
|
- [x] Use templating patterns like `"RSA_KEY=$(openssl rand -base64 32)` - the crabenv copy
|
|
38
85
|
- [x] ~Rotating??~ Kinda impossible actually.
|
|
39
86
|
- [ ] Cloudflare `.dev.vars` guidance/docs
|
|
40
|
-
|
|
41
|
-
## Philosophy
|
|
42
|
-
|
|
43
|
-
- No new config file. Your team doesn't have to install crabenv, but it helps a lot! The CLI just abstracts the manual maintenance.
|
|
44
|
-
- Env config is synced across **surfaces**:
|
|
45
|
-
- 1. **Schema** - The validator language-specific schema. Multiple based on apps. i.e. `env.ts`, `env.private.ts`, `env.public.ts`, `config.rs`, `config.dart`.
|
|
46
|
-
- 2. **Template (`.env.example`)** - Safe example/template values for env values. Multiple based on apps.
|
|
47
|
-
- 3. **Local (`.env`)** - The actual local runtime values/secrets. 1 only.
|
|
48
|
-
- 4. **Sinks** - Reserved for future explicit integrations. crabenv does not currently infer or rewrite arbitrary deployment files.
|
|
49
|
-
- More? Make an adapter
|
|
50
|
-
- Packages in monorepos don't have .env.
|
|
87
|
+
-->
|
|
51
88
|
|
|
52
89
|
## Agent skill
|
|
53
90
|
|
|
54
|
-
Install the crabenv skill for coding agents with:
|
|
91
|
+
Completely optional, but in case you want your agent to be autonomous when adding new env vars... Install the crabenv skill for coding agents with:
|
|
55
92
|
|
|
56
93
|
```sh
|
|
57
94
|
npx skills add blankeos/crabenv
|
|
58
95
|
```
|
|
59
96
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## Usage
|
|
97
|
+
## Useful commands you should know
|
|
63
98
|
|
|
64
99
|
```sh
|
|
65
100
|
crabenv init
|
|
66
|
-
crabenv copy # or crabenv cp.
|
|
101
|
+
crabenv copy # or crabenv cp. (It's a better `cp .env.example .env` command)
|
|
67
102
|
crabenv doctor # It's a checklist of common mistakes
|
|
68
103
|
crabenv doctor --fix
|
|
69
104
|
|
|
70
105
|
# CRUD
|
|
71
|
-
crabenv list #
|
|
106
|
+
crabenv list # Searchable interactive env inventory, expanded by default
|
|
107
|
+
crabenv ls -p # Print env inventory for scripts/agents
|
|
72
108
|
crabenv add # Wizard-like experience
|
|
73
109
|
crabenv update # Wizard-like experience
|
|
74
110
|
crabenv remove # Wizard-like experience
|
|
75
111
|
|
|
76
112
|
crabenv add {VARIABLE_NAME}
|
|
77
|
-
--shared # if monorepo, adds it to all apps
|
|
78
|
-
--
|
|
113
|
+
--shared # if monorepo, adds it to all apps (also --shared '*')
|
|
114
|
+
--shared apps/api apps/web # add it to selected apps
|
|
115
|
+
--example # optional, for .env.example (you can use templating w/ "$(pwd)/data.db")
|
|
79
116
|
--optional # optional, required by default
|
|
80
117
|
--default # optional
|
|
81
118
|
# Type flags
|
|
@@ -97,16 +134,10 @@ crabenv remove {VARIABLE_NAME}
|
|
|
97
134
|
crabenv update {VARIABLE_NAME} # Same flags as add
|
|
98
135
|
```
|
|
99
136
|
|
|
100
|
-
##
|
|
137
|
+
## Documentation
|
|
101
138
|
|
|
102
|
-
|
|
139
|
+
https://crabenv.pages.dev
|
|
103
140
|
|
|
104
|
-
|
|
105
|
-
crabenv --root _checks/sample-projects/basic-npm list
|
|
106
|
-
crabenv --root _checks/sample-projects/basic-npm doctor
|
|
107
|
-
crabenv --root _checks/sample-projects/basic-npm copy
|
|
141
|
+
## License
|
|
108
142
|
|
|
109
|
-
|
|
110
|
-
crabenv --root _checks/sample-projects/monorepo add NEXT_PUBLIC_ANALYTICS_ID --owner apps/next-web --public --example dev --optional
|
|
111
|
-
crabenv --root _checks/sample-projects/monorepo remove NEXT_PUBLIC_ANALYTICS_ID --owner apps/next-web --public
|
|
112
|
-
```
|
|
143
|
+
MIT. Fork it if you want!
|