This commit is contained in:
Benjamin Toby
2025-01-13 22:50:42 +01:00
parent f56f2849e0
commit a3440692a9
21 changed files with 730 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import fs from "fs";
import path from "path";
const targetPath = path.resolve(
process.cwd(),
process.argv[process.argv.length - 1]
);
try {
let obj: any = {};
const envFile = fs.readFileSync(targetPath, "utf-8");
const envLinesArr = envFile.split(/\r\n/).filter((ln) => ln.match(/\=/));
envLinesArr.forEach((ln) => {
const keyValArr = ln.split("=");
obj[keyValArr[0]] = keyValArr[1] || "";
});
console.log(obj);
} catch (error) {}
console.log(targetPath);