env-checklist 1.1.0 → 1.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 ADDED
@@ -0,0 +1,22 @@
1
+ # ✈️ env-checklist
2
+
3
+ A lightweight, color-coded CLI tool to ensure your local environment variables match your `.env.example` before you launch your app.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/env-checklist.svg)](https://www.npmjs.com/package/env-checklist)
6
+ [![license](https://img.shields.io/npm/l/env-checklist.svg)](https://github.com/YOUR_GITHUB_USERNAME/env-checklist)
7
+
8
+ ## 🚀 Why use this?
9
+ How many times has your app crashed because you forgot to add a new API key to your `.env` file? `env-checklist` prevents that by comparing your active `.env` against your template.
10
+
11
+ - **🎨 Beautiful Terminal Output**: Uses Chalk for high-contrast success/error messages.
12
+ - **🛡️ Robust Parsing**: Automatically ignores comments and empty lines.
13
+ - **📦 Zero Config**: Works out of the box with any Node.js project.
14
+
15
+ ---
16
+
17
+ ## 🛠 Usage
18
+
19
+ ### Run once (Recommended)
20
+ You don't even need to install it. Just run this in your project root:
21
+ ```bash
22
+ npx env-checklist@latest
package/dist/cli.cjs CHANGED
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var p=Object.create;var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var y=(e,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of v(o))!u.call(e,s)&&s!==r&&c(e,s,{get:()=>o[s],enumerable:!(i=d(o,s))||i.enumerable});return e};var t=(e,o,r)=>(r=e!=null?p(h(e)):{},y(o||!e||!e.__esModule?c(r,"default",{value:e,enumerable:!0}):r,e));var l=t(require("fs"),1),f=t(require("path"),1),n=t(require("chalk"),1);function a(e){let o=[],r={};for(let i of e){let s=process.env[i];s?r[i]=s:o.push(i)}return o.length>0&&(console.error(`
3
- \u2708\uFE0F [env-preflight] Missing variables: ${o.join(", ")}`),process.exit(1)),r}var g=f.default.join(process.cwd(),".env.example"),b=e=>console.log(`${n.default.cyan.bold("[env-checklist]")} ${e}`);l.default.existsSync(g)||(console.error(n.default.red.bold(`
4
- \u274C Error: No .env.example file found in this directory.`)),console.log(n.default.dim(`Make sure you have a .env.example file to define your required variables.
5
- `)),process.exit(1));var x=l.default.readFileSync(g,"utf-8"),m=x.match(/^[^#\s=]+/gm)||[];m.length===0&&(b(n.default.yellow("No variables found in .env.example to validate.")),process.exit(0));console.log(n.default.blue.bold(`
6
- \u2708\uFE0F Checking environment variables...`));try{a(m),console.log(n.default.green.bold(`\u2705 All systems go. Environment is flight-ready.
2
+ "use strict";var d=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var y=(e,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of b(o))!x.call(e,s)&&s!==r&&a(e,s,{get:()=>o[s],enumerable:!(i=h(o,s))||i.enumerable});return e};var t=(e,o,r)=>(r=e!=null?d(u(e)):{},y(o||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e));var l=t(require("fs"),1),c=t(require("path"),1),n=t(require("chalk"),1),g=t(require("dotenv"),1);function f(e){let o=[],r={};for(let i of e){let s=process.env[i];s?r[i]=s:o.push(i)}return o.length>0&&(console.error(`
3
+ \u2708\uFE0F [env-preflight] Missing variables: ${o.join(", ")}`),process.exit(1)),r}g.default.config();var m=process.cwd(),p=c.default.join(m,".env.example"),k=c.default.join(m,".env"),w=e=>console.log(`${n.default.cyan.bold("[env-checklist]")} ${e}`);l.default.existsSync(p)||(console.error(n.default.red.bold(`
4
+ \u274C Error: No .env.example file found.`)),console.log(n.default.dim(`This tool requires a .env.example file to know what variables to check for.
5
+ `)),process.exit(1));l.default.existsSync(k)||(console.warn(n.default.yellow.bold(`
6
+ \u26A0\uFE0F Warning: No .env file found.`)),console.log(n.default.dim(`Create a .env file to satisfy the requirements in .env.example.
7
+ `)));var C=l.default.readFileSync(p,"utf-8"),v=C.split(`
8
+ `).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#")).map(e=>e.split("=")[0].trim());v.length===0&&(w(n.default.yellow("No variables found in .env.example to validate.")),process.exit(0));console.log(n.default.blue.bold(`
9
+ \u2708\uFE0F Checking environment variables...`));try{f(v),console.log(n.default.green.bold(`\u2705 All systems go. Environment is flight-ready.
7
10
  `))}catch(e){let o=e instanceof Error?e.message:String(e);console.error(n.default.red.bold(`
8
11
  \u274C Preflight Failed!`)),console.error(n.default.yellow(`Missing variables: ${o}`)),console.log(n.default.dim(`Please update your .env file to match .env.example.
9
12
  `)),process.exit(1)}
package/dist/cli.js CHANGED
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import{a as r}from"./chunk-FEPVSWMN.js";import n from"fs";import t from"path";import e from"chalk";var l=t.join(process.cwd(),".env.example"),a=o=>console.log(`${e.cyan.bold("[env-checklist]")} ${o}`);n.existsSync(l)||(console.error(e.red.bold(`
3
- \u274C Error: No .env.example file found in this directory.`)),console.log(e.dim(`Make sure you have a .env.example file to define your required variables.
4
- `)),process.exit(1));var c=n.readFileSync(l,"utf-8"),s=c.match(/^[^#\s=]+/gm)||[];s.length===0&&(a(e.yellow("No variables found in .env.example to validate.")),process.exit(0));console.log(e.blue.bold(`
5
- \u2708\uFE0F Checking environment variables...`));try{r(s),console.log(e.green.bold(`\u2705 All systems go. Environment is flight-ready.
6
- `))}catch(o){let i=o instanceof Error?o.message:String(o);console.error(e.red.bold(`
7
- \u274C Preflight Failed!`)),console.error(e.yellow(`Missing variables: ${i}`)),console.log(e.dim(`Please update your .env file to match .env.example.
2
+ import{a as r}from"./chunk-FEPVSWMN.js";import n from"fs";import l from"path";import o from"chalk";import c from"dotenv";c.config();var s=process.cwd(),t=l.join(s,".env.example"),m=l.join(s,".env"),f=e=>console.log(`${o.cyan.bold("[env-checklist]")} ${e}`);n.existsSync(t)||(console.error(o.red.bold(`
3
+ \u274C Error: No .env.example file found.`)),console.log(o.dim(`This tool requires a .env.example file to know what variables to check for.
4
+ `)),process.exit(1));n.existsSync(m)||(console.warn(o.yellow.bold(`
5
+ \u26A0\uFE0F Warning: No .env file found.`)),console.log(o.dim(`Create a .env file to satisfy the requirements in .env.example.
6
+ `)));var d=n.readFileSync(t,"utf-8"),i=d.split(`
7
+ `).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#")).map(e=>e.split("=")[0].trim());i.length===0&&(f(o.yellow("No variables found in .env.example to validate.")),process.exit(0));console.log(o.blue.bold(`
8
+ \u2708\uFE0F Checking environment variables...`));try{r(i),console.log(o.green.bold(`\u2705 All systems go. Environment is flight-ready.
9
+ `))}catch(e){let a=e instanceof Error?e.message:String(e);console.error(o.red.bold(`
10
+ \u274C Preflight Failed!`)),console.error(o.yellow(`Missing variables: ${a}`)),console.log(o.dim(`Please update your .env file to match .env.example.
8
11
  `)),process.exit(1)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "env-checklist",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Ensure your environment variables are flight-ready before takeoff.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -13,7 +13,7 @@
13
13
  "dist"
14
14
  ],
15
15
  "scripts": {
16
- "start": "env-checklist && node dist/index.js",
16
+ "start": "node ./dist/cli.js && node dist/index.js",
17
17
  "build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean --minify",
18
18
  "dev": "tsup src/index.ts --watch",
19
19
  "test": "vitest run",
@@ -31,12 +31,13 @@
31
31
  "author": "Rishi Joshi",
32
32
  "license": "MIT",
33
33
  "devDependencies": {
34
- "@types/node": "^20.19.37",
34
+ "@types/node": "^20.11.0",
35
35
  "tsup": "^8.5.1",
36
- "typescript": "^5.9.3",
37
- "vitest": "^4.0.18"
36
+ "typescript": "^5.0.0",
37
+ "vitest": "^1.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "chalk": "^5.6.2"
40
+ "chalk": "^5.3.0",
41
+ "dotenv": "^16.4.5"
41
42
  }
42
- }
43
+ }