nero-env 0.1.5 → 1.0.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/README.md +14 -19
- package/dist/cli/command.js +3 -3
- package/dist/index.js +20 -2
- package/dist/output/printer.js +15 -15
- package/dist/output/theme.js +26 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
<img src="https://img.shields.io/github/license/alcanivorax/nero-env?color=22c55e" alt="license" />
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
+
<br />
|
|
10
|
+
|
|
9
11
|
<p align="center">
|
|
10
12
|
<img
|
|
11
13
|
src="https://raw.githubusercontent.com/alcanivorax/nero-env/main/assets/nero-env-preview.png"
|
|
@@ -14,21 +16,12 @@
|
|
|
14
16
|
/>
|
|
15
17
|
</p>
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Overview
|
|
20
|
-
|
|
21
|
-
nero-env compares your active `.env` file with `.env.example` and reports discrepancies. It helps ensure your environment configuration is complete and accurate.
|
|
22
|
-
|
|
23
|
-
**What it checks:**
|
|
19
|
+
## What is nero-env?
|
|
24
20
|
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
- **Unused variables** - present in `.env` but not declared in `.env.example`
|
|
21
|
+
**nero-env** is a CLI tool for validating and comparing `.env` files against `.env.example`.
|
|
22
|
+
It helps catch missing, empty, and unused environment variables early.
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
---
|
|
24
|
+
<br />
|
|
32
25
|
|
|
33
26
|
## Installation
|
|
34
27
|
|
|
@@ -38,9 +31,7 @@ Install globally using npm:
|
|
|
38
31
|
npm install -g nero-env
|
|
39
32
|
```
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Usage
|
|
34
|
+
<br/>
|
|
44
35
|
|
|
45
36
|
### Basic Usage
|
|
46
37
|
|
|
@@ -52,6 +43,8 @@ nero-env
|
|
|
52
43
|
|
|
53
44
|
This will check for `.env` and `.env.example` files in the current directory.
|
|
54
45
|
|
|
46
|
+
<br/>
|
|
47
|
+
|
|
55
48
|
### Check a Specific Project
|
|
56
49
|
|
|
57
50
|
Specify a custom path:
|
|
@@ -60,10 +53,12 @@ Specify a custom path:
|
|
|
60
53
|
nero-env --path ./apps/api
|
|
61
54
|
```
|
|
62
55
|
|
|
56
|
+
<br />
|
|
57
|
+
|
|
63
58
|
## What it checks
|
|
64
59
|
|
|
65
|
-
- **Missing** → defined in
|
|
66
|
-
- **Empty** → defined but has no value
|
|
67
|
-
- **Unused** → present in
|
|
60
|
+
- **Missing variables** → defined in `.env.example` but not in `.env`
|
|
61
|
+
- **Empty values** → defined in `.env` but has no value assigned
|
|
62
|
+
- **Unused variables** → present in `.env` but not declared in `.env.example`
|
|
68
63
|
|
|
69
64
|
Output clearly shows which file needs fixing.
|
package/dist/cli/command.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { run } from "./cli/command.js";
|
|
3
|
-
import {
|
|
3
|
+
import { checkForCliUpdate } from "cli-update-check";
|
|
4
|
+
import { CLI_NAME, CLI_VERSION } from "./meta.js";
|
|
5
|
+
import { theme } from "./output/theme.js";
|
|
4
6
|
try {
|
|
5
|
-
notifyUpdate();
|
|
6
7
|
run();
|
|
8
|
+
setTimeout(async () => {
|
|
9
|
+
const msg = await checkForCliUpdate({
|
|
10
|
+
name: CLI_NAME,
|
|
11
|
+
version: CLI_VERSION,
|
|
12
|
+
});
|
|
13
|
+
if (msg) {
|
|
14
|
+
console.log("\n" +
|
|
15
|
+
theme.muted("─────────────") +
|
|
16
|
+
"\n" +
|
|
17
|
+
theme.muted("Update available") +
|
|
18
|
+
"\n" +
|
|
19
|
+
theme.muted(msg.replace("Update available:", "").trim()) +
|
|
20
|
+
"\n" +
|
|
21
|
+
theme.muted("─────────────"));
|
|
22
|
+
}
|
|
23
|
+
}, 0);
|
|
7
24
|
}
|
|
8
25
|
catch (err) {
|
|
9
26
|
console.error("Unexpected error:", err);
|
|
27
|
+
// console.log("Run: nero-env --help for usage");
|
|
10
28
|
process.exit(1);
|
|
11
29
|
}
|
package/dist/output/printer.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { theme } from "./theme.js";
|
|
2
2
|
const icons = {
|
|
3
|
-
error:
|
|
4
|
-
warning:
|
|
5
|
-
success:
|
|
3
|
+
error: theme.severity.high("❌"),
|
|
4
|
+
warning: theme.severity.medium("⚠️"),
|
|
5
|
+
success: theme.severity.low("✅"),
|
|
6
6
|
};
|
|
7
7
|
export function printReport(report) {
|
|
8
8
|
// Title
|
|
9
|
-
console.log(
|
|
10
|
-
console.log(
|
|
9
|
+
console.log(theme.header("Nero Env Check"));
|
|
10
|
+
console.log(theme.muted("─────────────\n"));
|
|
11
11
|
// Success case
|
|
12
12
|
if (!report.hasIssues || report.sections.length === 0) {
|
|
13
|
-
console.log(`${icons.success} ${
|
|
13
|
+
console.log(`${icons.success} ${theme.muted("No environment issues found")}`);
|
|
14
14
|
printSummary(0, 0);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
@@ -32,27 +32,27 @@ export function printReport(report) {
|
|
|
32
32
|
function printSection(section) {
|
|
33
33
|
const icon = icons[section.severity];
|
|
34
34
|
if (section.source === ".env") {
|
|
35
|
-
console.log(`${icon} ${
|
|
35
|
+
console.log(`${icon} ${theme.title(section.title)} ${theme.muted(`(${section.source})`)}`);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
console.log(`${icon} ${
|
|
38
|
+
console.log(`${icon} ${theme.title(section.title)} ${theme.muted(`(not declared in ${section.source})`)}`);
|
|
39
39
|
}
|
|
40
40
|
for (const item of section.items) {
|
|
41
|
-
console.log(` ${
|
|
41
|
+
console.log(` ${theme.bullet} ${theme.muted(item)}`);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
function printSummary(errors, warnings) {
|
|
45
|
-
console.log(
|
|
45
|
+
console.log(theme.muted("─────────────"));
|
|
46
46
|
if (errors === 0 && warnings === 0) {
|
|
47
|
-
console.log(
|
|
47
|
+
console.log(theme.title("Summary: ") + theme.muted("No issues found"));
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
const parts = [];
|
|
51
51
|
if (errors > 0) {
|
|
52
|
-
parts.push(
|
|
52
|
+
parts.push(theme.severity.high(`${errors} error${errors > 1 ? "s" : ""}`));
|
|
53
53
|
}
|
|
54
54
|
if (warnings > 0) {
|
|
55
|
-
parts.push(
|
|
55
|
+
parts.push(theme.severity.medium(`${warnings} warning${warnings > 1 ? "s" : ""}`));
|
|
56
56
|
}
|
|
57
|
-
console.log(
|
|
57
|
+
console.log(theme.title("Summary: ") + parts.join(theme.muted(", ")));
|
|
58
58
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
export const theme = {
|
|
3
|
+
// Section headers - soft blue-gray for elegance
|
|
4
|
+
header: chalk.hex("#7AA2F7").bold,
|
|
5
|
+
// Severity labels with refined, professional colors
|
|
6
|
+
severity: {
|
|
7
|
+
high: chalk.hex("#F7768E"), // Soft coral red
|
|
8
|
+
medium: chalk.hex("#E0AF68"), // Muted amber
|
|
9
|
+
low: chalk.hex("#9ABCA7"), // Sage green
|
|
10
|
+
unknown: chalk.hex("#565F89"), // Muted slate
|
|
11
|
+
},
|
|
12
|
+
// General text roles
|
|
13
|
+
title: chalk.hex("#C0CAF5").bold, // Soft periwinkle
|
|
14
|
+
muted: chalk.hex("#565F89"), // Slate gray
|
|
15
|
+
success: chalk.hex("#9ECE6A"), // Soft lime green
|
|
16
|
+
warning: chalk.hex("#E0AF68"), // Muted amber
|
|
17
|
+
error: chalk.hex("#F7768E"), // Soft coral red
|
|
18
|
+
bullet: chalk.hex("#73DACA")("•"), // Soft teal
|
|
19
|
+
// arrow: chalk.hex("#565F89")("→"), // Slate gray
|
|
20
|
+
arrow: chalk.hex("#73DACA")("→"), // Slate gray
|
|
21
|
+
loader: chalk.hex("#C0CAF5"),
|
|
22
|
+
message: chalk.hex("#7AA2F7"),
|
|
23
|
+
divider: (width) => chalk.hex("#414868")("─".repeat(width)), // Dark slate
|
|
24
|
+
// Metadata
|
|
25
|
+
lineInfo: (line) => chalk.hex("#565F89")(`(line ~ ${line})`),
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nero-env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Validate and compare .env files to catch missing, empty, and unused variables.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"devtools",
|
|
31
31
|
"nero"
|
|
32
32
|
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/alcanivorax/nero-env"
|
|
36
|
+
},
|
|
33
37
|
"author": "alcanivorax",
|
|
34
38
|
"license": "MIT",
|
|
35
39
|
"packageManager": "pnpm@10.17.1",
|
|
@@ -42,7 +46,7 @@
|
|
|
42
46
|
},
|
|
43
47
|
"dependencies": {
|
|
44
48
|
"chalk": "^5.6.2",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
49
|
+
"cli-update-check": "^1.0.0",
|
|
50
|
+
"commander": "^14.0.2"
|
|
47
51
|
}
|
|
48
52
|
}
|