env-drift-check 0.1.0 → 0.1.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.
@@ -5,11 +5,46 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseEnv = parseEnv;
7
7
  const fs_1 = __importDefault(require("fs"));
8
- const dotenv_1 = __importDefault(require("dotenv"));
9
8
  function parseEnv(path) {
10
9
  if (!fs_1.default.existsSync(path)) {
11
10
  throw new Error(`Env file not found: ${path}`);
12
11
  }
13
- const content = fs_1.default.readFileSync(path);
14
- return dotenv_1.default.parse(content);
12
+ const content = fs_1.default.readFileSync(path, 'utf8');
13
+ const result = {};
14
+ // Split into lines and process each
15
+ const lines = content.split(/\r?\n/);
16
+ for (const line of lines) {
17
+ const trimmed = line.trim();
18
+ // Skip empty lines and comments
19
+ if (!trimmed || trimmed.startsWith('#'))
20
+ continue;
21
+ // Match KEY=VALUE (taking the first '=' as the separator)
22
+ const firstEqual = trimmed.indexOf('=');
23
+ if (firstEqual === -1)
24
+ continue;
25
+ const key = trimmed.slice(0, firstEqual).trim();
26
+ const rawValue = trimmed.slice(firstEqual + 1).trim();
27
+ let value = "";
28
+ if (rawValue.startsWith('"') || rawValue.startsWith("'")) {
29
+ const quote = rawValue[0];
30
+ const closingQuoteIndex = rawValue.indexOf(quote, 1);
31
+ if (closingQuoteIndex !== -1) {
32
+ value = rawValue.slice(1, closingQuoteIndex);
33
+ }
34
+ else {
35
+ value = rawValue.slice(1); // Unclosed quote
36
+ }
37
+ }
38
+ else {
39
+ const hashIndex = rawValue.indexOf('#');
40
+ if (hashIndex !== -1) {
41
+ value = rawValue.slice(0, hashIndex).trim();
42
+ }
43
+ else {
44
+ value = rawValue;
45
+ }
46
+ }
47
+ result[key] = value;
48
+ }
49
+ return result;
15
50
  }
@@ -17,8 +17,7 @@ function report(result) {
17
17
  if (result.mismatches.length) {
18
18
  console.log("\n Value Mismatches:");
19
19
  result.mismatches.forEach(m => {
20
- console.log(` - ${m.key}: expected="${m.expected}" actual="${m.actual}"`);
21
- console.log(` -Run --fix to sync ${m.key}`);
20
+ console.log(` - ${m.key.padEnd(15)} Expected: ${m.expected.padEnd(12)} Actual: ${m.actual}`);
22
21
  });
23
22
  }
24
23
  if (!result.missing.length &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "env-drift-check",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Interactive environment variable checker and setup wizard. Sync .env files with validation (Email, URL, Regex) and prompts.",
5
5
  "keywords": [
6
6
  "env",
@@ -42,7 +42,6 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "commander": "^11.0.0",
45
- "dotenv": "^16.4.0",
46
45
  "prompts": "^2.4.2"
47
46
  },
48
47
  "devDependencies": {