@wrkspace-co/env 0.1.0
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/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/chunk-32DQKIYR.js +4474 -0
- package/dist/chunk-32DQKIYR.js.map +1 -0
- package/dist/cli.js +4299 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +707 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-Dj0BMNPC.d.ts +241 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +47 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wrkspace.co
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>Airlock (Wrkspace Env)</h1>
|
|
3
|
+
<p>
|
|
4
|
+
<img alt="Release" src="https://img.shields.io/github/v/release/wrkspace-co/env" />
|
|
5
|
+
<img alt="CI" src="https://img.shields.io/github/actions/workflow/status/wrkspace-co/env/ci.yml" />
|
|
6
|
+
<a href="https://badge.socket.dev/npm/package/@wrkspace-co/env">
|
|
7
|
+
<img alt="Socket" src="https://badge.socket.dev/npm/package/@wrkspace-co/env" />
|
|
8
|
+
</a>
|
|
9
|
+
<img alt="License" src="https://img.shields.io/github/license/wrkspace-co/env" />
|
|
10
|
+
<img alt="Stars" src="https://img.shields.io/github/stars/wrkspace-co/env" />
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
Airlock `(@wrkspace-co/env)` is a migration-first environment contract system for Node.js projects.
|
|
15
|
+
You define env evolution with TypeScript migrations, then generate schema/docs/artifacts and validate targets (`dev`, `preview`, `prod`) from a single source of truth.
|
|
16
|
+
|
|
17
|
+
**Docs:** [https://wrkspace-co.github.io/env/](https://wrkspace-co.github.io/env/)
|
|
18
|
+
|
|
19
|
+
## Benefits
|
|
20
|
+
- **Single source of truth.** Your env contract lives in `env/migrations/*.ts`, not scattered `.env*` files.
|
|
21
|
+
- **Safe iterative changes.** Add, rename, deprecate, and remove keys with reviewable migration history.
|
|
22
|
+
- **CI-ready validation.** Run strict checks with stable JSON output for automation.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
- Chain-based migration API (`ctx.key(...).define(...).value(...).remove()`)
|
|
26
|
+
- Migration integrity and rollback support
|
|
27
|
+
- Generated artifacts: `.env*`, `env/schema.generated.json`, `env/ENV.md`, `env/env.audit.json`
|
|
28
|
+
- Environment validation, audit, and deprecation checks
|
|
29
|
+
- Provider sync/diff/export workflows (Vercel/Heroku + export formats)
|
|
30
|
+
- TypeScript-first
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
```bash
|
|
34
|
+
pnpm add -D @wrkspace-co/env
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If you also use the Wrkspace wrapper, install both packages:
|
|
38
|
+
```bash
|
|
39
|
+
pnpm add -D @wrkspace-co/cli @wrkspace-co/env
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
1. Create migration:
|
|
44
|
+
```bash
|
|
45
|
+
airlock migrate:make bootstrap-env
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. Edit migration:
|
|
49
|
+
```ts
|
|
50
|
+
import type { EnvMigrationContext } from "@wrkspace-co/env";
|
|
51
|
+
|
|
52
|
+
export async function up(ctx: EnvMigrationContext) {
|
|
53
|
+
ctx.setPrefixPolicy("nextjs");
|
|
54
|
+
|
|
55
|
+
ctx.url("DATABASE_URL")
|
|
56
|
+
.scope("server")
|
|
57
|
+
.requiredIn("prod");
|
|
58
|
+
|
|
59
|
+
ctx.url("NEXT_PUBLIC_SITE_URL")
|
|
60
|
+
.scope("client")
|
|
61
|
+
.requiredIn(["dev", "preview", "prod"])
|
|
62
|
+
.value("https://example.com");
|
|
63
|
+
|
|
64
|
+
ctx.enum("LOG_LEVEL")
|
|
65
|
+
.values(["debug", "info", "warn", "error"])
|
|
66
|
+
.requiredIn(["dev", "preview", "prod"])
|
|
67
|
+
.defaultValue("info");
|
|
68
|
+
|
|
69
|
+
ctx.string("OLD_TOKEN")
|
|
70
|
+
.requiredIn("prod")
|
|
71
|
+
.deprecate("NEW_TOKEN", "2026-12-31", "Rotate to NEW_TOKEN");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export async function down(ctx: EnvMigrationContext) {
|
|
75
|
+
ctx.key("DATABASE_URL").remove();
|
|
76
|
+
ctx.key("NEXT_PUBLIC_SITE_URL").remove();
|
|
77
|
+
ctx.key("LOG_LEVEL").remove();
|
|
78
|
+
ctx.key("OLD_TOKEN").remove();
|
|
79
|
+
ctx.setPrefixPolicy(undefined);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
3. Apply migrations:
|
|
84
|
+
```bash
|
|
85
|
+
airlock migrate
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
4. Validate target:
|
|
89
|
+
```bash
|
|
90
|
+
airlock check --target prod --json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Common commands
|
|
94
|
+
```bash
|
|
95
|
+
airlock migrate:status --json
|
|
96
|
+
airlock generate --write-local --write-target-files
|
|
97
|
+
airlock audit --json
|
|
98
|
+
airlock deprecations --json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`wrkspace env <cmd>` and `airlock <cmd>` use the same command handlers and options.
|
|
102
|
+
|
|
103
|
+
## Learn more
|
|
104
|
+
[Full documentation](https://wrkspace-co.github.io/env/)
|
|
105
|
+
|
|
106
|
+
**Credits**
|
|
107
|
+
Airlock is a part of [Wrkspace Co.](https://wrkspace.co) © group.
|