@shubhammaji1/envparity 0.1.0 → 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 +111 -0
- package/package.json +27 -16
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# EnvParity
|
|
2
|
+
|
|
3
|
+
EnvParity checks local environment configuration before you start a JavaScript
|
|
4
|
+
or TypeScript project. Use it when you join a repository, change branches, or
|
|
5
|
+
pull a change that adds a required variable. Checks run offline and report key
|
|
6
|
+
names, file locations, and suggested fixes without printing dotenv values.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
Requires Node.js 22.15 or later. Install Git for branch and worktree discovery.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install -g @shubhammaji1/envparity
|
|
14
|
+
envparity --version
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
In your application's directory, add the following key to `.env.example`.
|
|
20
|
+
Commit the template with empty or placeholder values and keep real values in
|
|
21
|
+
an ignored local dotenv file.
|
|
22
|
+
|
|
23
|
+
```dotenv
|
|
24
|
+
API_BASE_URL=
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Run `init` once, or skip it if the project already has `envparity.yml`.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
envparity init
|
|
31
|
+
envparity doctor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If the key is absent from the active local files, `doctor` reports
|
|
35
|
+
`MISSING API_BASE_URL` and exits with code 1. Add this example value to your
|
|
36
|
+
local `.env` file and run `envparity validate` again.
|
|
37
|
+
|
|
38
|
+
```dotenv
|
|
39
|
+
API_BASE_URL=https://example.com
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
By default, EnvParity uses `.env.example` or falls back to `.env.template`.
|
|
45
|
+
Template keys are required unless their YAML rule sets `required: false`.
|
|
46
|
+
Add rules when a value must satisfy a type or constraint:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
version: 1
|
|
50
|
+
files:
|
|
51
|
+
schema: .env.example
|
|
52
|
+
variables:
|
|
53
|
+
API_BASE_URL:
|
|
54
|
+
type: url
|
|
55
|
+
PORT:
|
|
56
|
+
required: false
|
|
57
|
+
type: integer
|
|
58
|
+
min: 1
|
|
59
|
+
max: 65535
|
|
60
|
+
validation:
|
|
61
|
+
undeclared: error
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Supported types are `string`, `boolean`, `number`, `integer`, `url`, `email`,
|
|
65
|
+
`json`, and `enum`. Use `files.local` to select a single project-relative
|
|
66
|
+
dotenv file. Otherwise the CLI checks layered files for the selected mode.
|
|
67
|
+
The default mode is `development`; use `--mode test` to check the test layers.
|
|
68
|
+
Precedence depends on the detected framework.
|
|
69
|
+
|
|
70
|
+
## Commands
|
|
71
|
+
|
|
72
|
+
| Command | Behavior |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `envparity init` | Creates `envparity.yml` and preserves an existing configuration. |
|
|
75
|
+
| `envparity doctor`, `diff`, `status` | Report local configuration and static source findings. |
|
|
76
|
+
| `envparity validate` | Checks dotenv files and schema rules. |
|
|
77
|
+
| `envparity scan` | Reports source findings from common JavaScript and TypeScript environment references. |
|
|
78
|
+
|
|
79
|
+
Add `--json` for machine-readable output. Exit code `0` means the command
|
|
80
|
+
completed without error-level findings, `1` means error-level findings were
|
|
81
|
+
reported, and `2` means a usage or operational error.
|
|
82
|
+
|
|
83
|
+
## Git guard in 0.2.0 beta
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
npm install -g @shubhammaji1/envparity@0.2.0
|
|
87
|
+
envparity hook install
|
|
88
|
+
envparity hook status
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The opt-in guard checks development configuration at the worktree root after
|
|
92
|
+
branch checkout, merge, or rebase. It warns without rewriting dotenv files or
|
|
93
|
+
blocking Git. Existing hooks and custom `core.hooksPath` setups can call the
|
|
94
|
+
check manually. For a `post-checkout` shell hook, add this to its successful
|
|
95
|
+
path:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
envparity hook check post-checkout "$@"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Use `post-merge` or `post-rewrite` for the corresponding event. Run
|
|
102
|
+
`envparity hook uninstall` to remove EnvParity-managed hooks. Reinstall them
|
|
103
|
+
if the Node or CLI installation path moves.
|
|
104
|
+
|
|
105
|
+
## Current limits
|
|
106
|
+
|
|
107
|
+
Checks use values from dotenv files on disk. Shell-injected variables are
|
|
108
|
+
outside the check, and possible interpolations are reported as uncertain.
|
|
109
|
+
Computed source references and custom environment wrappers may need manual
|
|
110
|
+
review. EnvParity currently provides local validation and the opt-in Git
|
|
111
|
+
guard. Provider sync, a secret vault, and dedicated PR checks are future work.
|
package/package.json
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@shubhammaji1/envparity",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Offline environment configuration checks for Git repositories",
|
|
5
|
-
"engines": {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@shubhammaji1/envparity",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Offline environment configuration checks for Git repositories",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.15.0"
|
|
7
|
+
},
|
|
8
|
+
"bin": {
|
|
9
|
+
"envparity": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"lint": "tsc --noEmit --noUnusedLocals --noUnusedParameters",
|
|
18
|
+
"test": "node --test"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"typescript": "5.9.3",
|
|
22
|
+
"yaml": "2.8.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "22.18.11"
|
|
26
|
+
}
|
|
27
|
+
}
|