How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
Package JSON files can have internal variables. Anything you place in any field can be referenced to interpolate anything else in your package.json.
$npm_package_{field} where field is a field in the top level. Just add more underscores to drill deeper. I commonly store constants in the config field to cut repetition within package.json AND get values in process env as mentioned in post.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
You might not know this. 🔥
Package JSON files can have internal variables. Anything you place in any field can be referenced to interpolate anything else in your package.json.
$npm_package_{field}
where field is a field in the top level. Just add more underscores to drill deeper. I commonly store constants in the config field to cut repetition within package.json AND get values in process env as mentioned in post.I did not know that indeed! That's an awesome tip, thanks for sharing! ✌️
This won't work in Windows, unfortunately. Need to use cross-var (npmjs.com/package/cross-var)
2 / 3 cases, what about Linux subsystem?