+6
-0
| # with-env | ||
| ## 1.1.1 | ||
| ### Patch Changes | ||
| - [`ee3e02f`](https://github.com/MatthewSH/npm-packages/commit/ee3e02fa116edf6af9839458caebad272a678eae) Thanks [@MatthewSH](https://github.com/MatthewSH)! - added npm ignore | ||
| ## 1.1.0 | ||
@@ -4,0 +10,0 @@ |
+4
-1
| { | ||
| "name": "with-env", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "Read and then apply .env file in the working directory, assuming the .env exists", | ||
@@ -19,2 +19,5 @@ "type": "module", | ||
| }, | ||
| "publishConfig": { | ||
| "provenance": true | ||
| }, | ||
| "author": { | ||
@@ -21,0 +24,0 @@ "name": "matthewh", |
| > with-env@1.1.0 build /home/runner/work/npm-packages/npm-packages/packages/with-env | ||
| > pkgroll | ||
-29
| import { readFileSync } from "node:fs"; | ||
| function envApply(file) { | ||
| if (typeof file !== "string") { | ||
| envApply("./.env"); | ||
| } | ||
| try { | ||
| const document = readFileSync(file).toString().split("\n"); | ||
| let i = -1; | ||
| while (++i < document.length) { | ||
| if (!document[i]) { | ||
| continue; | ||
| } | ||
| const row = document[i].split(/\s*=\s*/); | ||
| // biome-ignore lint/style/noNonNullAssertion: Known to be non-null | ||
| process.env[row.shift()!] = row.join("=").replace(/['"]/g, ""); | ||
| } | ||
| } catch (exception) { | ||
| throw new Error( | ||
| "The .env file could not be found or read correctly. Are you sure it is in the root directory?", | ||
| ); | ||
| } | ||
| } | ||
| export default envApply; |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
2
-33.33%4151
-11.45%8
-20%45
-33.82%