enviable
reads from .env, replaces in files
Get a map of values.
Usage
Step 1
Add comments at the end of lines where you want to replace values.
const foo = number: 99 // #NUMBER color: 'red' // #COLOR const boo = x: 1 // I wonder if it works without trailing commas? y: 2 // #GUESS_SO const name = "Dangerous Johnny" // #NAMEconst stats = age: 15 male: true ; // #STATS
Step 2
Set the values in your .env
file.
NUMBER=66COLOR='green'GUESS_SO=42NAME = "Serious Lady"# NAME = "Great Potato" STATS =
Note: We don't care about spacing and you can comment out values.
Step 3
Do the magic. You can run this from the command line, passing a glob for it to search through.
./node_modules/.bin/enviable "src/**/*.js"
Your source will now be.
const foo = number: 66 // #NUMBER color: 'green' // #COLOR const boo = x: 1 // I wonder if it works without trailing commas? y: 42 // #GUESS_SO const name = "Serious Lady" // #NAMEconst stats = age: 33 male: false ; // #STATS
kickstarted by npm-boom