@acryps/environment
Advanced tools
Comparing version 0.0.3 to 1.0.0
@@ -60,3 +60,3 @@ "use strict"; | ||
function convertToEnvironmentVariableName(...path) { | ||
return path.join('_').toUpperCase(); | ||
return path.join('_').replace(/[A-Z]/g, match => `_${match}`).toUpperCase(); | ||
} | ||
@@ -127,7 +127,6 @@ const environment = {}; | ||
} | ||
// todo add multi platform support | ||
const childProgramLocation = (0, child_process_1.spawnSync)('which', [childProgram[0]]).stdout.toString().trim(); | ||
const nodeLocation = process.execPath; | ||
// do not inject any variables from our state | ||
// passing our own properties like 'active setting' would allow developers to add checks to them instead of using the configured environment variables, which is not intended | ||
const childProcess = (0, child_process_1.spawn)(childProgramLocation, childProgram.slice(1), { | ||
const childProcess = (0, child_process_1.spawn)(nodeLocation, childProgram.slice(1), { | ||
stdio: 'inherit', | ||
@@ -134,0 +133,0 @@ env: { |
@@ -13,3 +13,6 @@ { | ||
} | ||
}, | ||
"scripts": { | ||
"start": "environment index.js" | ||
} | ||
} |
{ | ||
"name": "@acryps/environment", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"license": "GPL-3.0-only", | ||
@@ -5,0 +5,0 @@ "bin": { |
# acryps environment | ||
Environment variable manager for local development | ||
> Currently only supports systems that have the unix 'which' command. | ||
## Getting Started | ||
@@ -11,3 +9,3 @@ `npm install @acryps/environment --save-dev` | ||
`tsc && node index.js` → `tsc && environment node index.js` | ||
`tsc && node index.js` → `tsc && environment index.js` | ||
@@ -39,2 +37,10 @@ Define environment variables in your `package.json` | ||
- `…?default`: Set a default value which will be accepted when the user does not provide a value | ||
- `+…`: Require a numeric value | ||
- `+…`: Require a numeric value | ||
Adding an uppercase letter in the variables name will automatically be expanded with a `_`: `accessKey` → `ACCESS_KEY` | ||
## Node Options | ||
Options for node can still be used, just add them before your modules location | ||
`node --max-old-space-size=16192 index.js` → `environment --max-old-space-size=16192 index.js` | ||
The child program will be executed with the same node as environment (using `process.execPath`) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8918
1
44
1
176