dotenv-diff 1.0.0 → 1.0.1

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.
@@ -0,0 +1,7 @@
1
+ export function diffEnv(current, example) {
2
+ const currentKeys = Object.keys(current);
3
+ const exampleKeys = Object.keys(example);
4
+ const missing = exampleKeys.filter((key) => !currentKeys.includes(key));
5
+ const extra = currentKeys.filter((key) => !exampleKeys.includes(key));
6
+ return { missing, extra };
7
+ }
@@ -0,0 +1,16 @@
1
+ import fs from 'fs';
2
+ export function parseEnvFile(path) {
3
+ const content = fs.readFileSync(path, 'utf-8');
4
+ const lines = content.split('\n');
5
+ const result = {};
6
+ for (const line of lines) {
7
+ const trimmed = line.trim();
8
+ if (!trimmed || trimmed.startsWith('#'))
9
+ continue;
10
+ const [key, ...rest] = trimmed.split('=');
11
+ if (!key)
12
+ continue;
13
+ result[key.trim()] = rest.join('=').trim();
14
+ }
15
+ return result;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotenv-diff",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "A small CLI and library to find differences between .env and .env.example files.",
6
6
  "bin": {
@@ -10,6 +10,8 @@
10
10
  "types": "dist/index.d.ts",
11
11
  "files": [
12
12
  "dist/cli.js",
13
+ "dist/lib/diffEnv.js",
14
+ "dist/lib/parseEnv.js",
13
15
  "dist/index.js",
14
16
  "dist/index.d.ts",
15
17
  "README.md"