env-detector 1.0.1 → 1.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 +26 -58
- package/bin/env-scan.js +6 -0
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,65 +1,51 @@
|
|
|
1
1
|
# env-detector
|
|
2
2
|
|
|
3
|
-
Smart environment variable analyzer and
|
|
3
|
+
Smart environment variable analyzer and `.env` generator.
|
|
4
4
|
|
|
5
5
|
Automatically detects `process.env` usage, generates `.env`, groups environments, detects missing variables, and audits configuration.
|
|
6
6
|
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
Run directly:
|
|
12
|
-
|
|
13
7
|
npx env-detector
|
|
14
|
-
|
|
15
|
-
OR install globally:
|
|
16
|
-
|
|
17
|
-
npm install -g env-detector
|
|
8
|
+
```
|
|
18
9
|
|
|
19
10
|
---
|
|
20
11
|
|
|
21
12
|
## Usage
|
|
22
13
|
|
|
14
|
+
```bash
|
|
23
15
|
env-detector
|
|
16
|
+
```
|
|
24
17
|
|
|
25
18
|
---
|
|
26
19
|
|
|
27
20
|
## Commands
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Compare env usage
|
|
33
|
-
env-detector --
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
env-detector --
|
|
37
|
-
|
|
38
|
-
Fix unused variables
|
|
39
|
-
env-detector --fix
|
|
40
|
-
|
|
41
|
-
Security scan
|
|
42
|
-
env-detector --security
|
|
43
|
-
|
|
44
|
-
Strict mode (CI)
|
|
45
|
-
env-detector --strict
|
|
46
|
-
|
|
47
|
-
Interactive fill
|
|
48
|
-
env-detector --ask
|
|
22
|
+
| Command | Description |
|
|
23
|
+
|---------|-------------|
|
|
24
|
+
| `env-detector` | Generate `.env` |
|
|
25
|
+
| `env-detector --compare` | Compare env usage |
|
|
26
|
+
| `env-detector --check` | Check missing variables |
|
|
27
|
+
| `env-detector --fix` | Fix unused variables |
|
|
28
|
+
| `env-detector --security` | Security scan |
|
|
29
|
+
| `env-detector --strict` | Strict mode (CI) |
|
|
30
|
+
| `env-detector --ask` | Interactive fill |
|
|
49
31
|
|
|
50
32
|
---
|
|
51
33
|
|
|
52
34
|
## Example
|
|
53
35
|
|
|
54
|
-
Code
|
|
36
|
+
**Code:**
|
|
55
37
|
|
|
56
|
-
|
|
57
|
-
process.env.
|
|
38
|
+
```javascript
|
|
39
|
+
process.env.DB_HOST
|
|
40
|
+
process.env.PORT
|
|
41
|
+
```
|
|
58
42
|
|
|
59
|
-
Generated `.env
|
|
43
|
+
**Generated `.env`:**
|
|
60
44
|
|
|
61
|
-
|
|
45
|
+
```
|
|
46
|
+
DB_HOST=
|
|
62
47
|
PORT=
|
|
48
|
+
```
|
|
63
49
|
|
|
64
50
|
---
|
|
65
51
|
|
|
@@ -67,32 +53,14 @@ PORT=
|
|
|
67
53
|
|
|
68
54
|
If config file contains:
|
|
69
55
|
|
|
56
|
+
```javascript
|
|
70
57
|
development: {
|
|
71
58
|
username: process.env.DBUSERNAME
|
|
72
59
|
}
|
|
60
|
+
```
|
|
73
61
|
|
|
74
62
|
Generated:
|
|
75
63
|
|
|
64
|
+
```
|
|
76
65
|
# development
|
|
77
|
-
DBUSERNAME=
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Features
|
|
82
|
-
|
|
83
|
-
- Detect process.env usage
|
|
84
|
-
- Auto generate .env
|
|
85
|
-
- Detect missing variables
|
|
86
|
-
- Detect unused variables
|
|
87
|
-
- Detect empty values
|
|
88
|
-
- Extract fallback defaults
|
|
89
|
-
- Group by environment
|
|
90
|
-
- Security scan
|
|
91
|
-
- CI strict mode
|
|
92
|
-
- Auto fix unused
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## License
|
|
97
|
-
|
|
98
|
-
MIT
|
|
66
|
+
DBUSERNAME=
|
package/bin/env-scan.js
CHANGED
|
@@ -16,9 +16,15 @@ const checkMode = args.includes("--check");
|
|
|
16
16
|
const fixMode = args.includes("--fix");
|
|
17
17
|
const securityMode = args.includes("--security");
|
|
18
18
|
const strictMode = args.includes("--strict");
|
|
19
|
+
const versionMode = args.includes("--version") || args.includes("--v")
|
|
19
20
|
|
|
20
21
|
let result = scanProject(cwd);
|
|
21
22
|
|
|
23
|
+
if (versionMode) {
|
|
24
|
+
const pkg = require("../package.json");
|
|
25
|
+
console.log(`env-detector v${pkg.version}`);
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
22
28
|
|
|
23
29
|
// security
|
|
24
30
|
if (securityMode) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "env-detector",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Smart .env generator and auditor",
|
|
5
5
|
"main": "src/scan.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"env",
|
|
14
|
+
"dotenv",
|
|
15
|
+
"environment",
|
|
16
|
+
"env-scan",
|
|
17
|
+
"env-detector"
|
|
18
|
+
],
|
|
13
19
|
"author": "Jenil Gajjar",
|
|
14
20
|
"license": "MIT",
|
|
15
21
|
"dependencies": {
|