Support cross platform environment variables
See original GitHub issueAdd a cross-env feature which resolves environment variables in a standard way.
Example: I like to use env vars so that configuration information can be stored in package.json. I believe the following will fail on windows but works fine on mac:
"mkdirs": "dist docs/dist docs/models",
"scripts": {
"clean": "shx rm -rf $npm_package_mkdirs && shx mkdir $npm_package_mkdirs",
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:18 (7 by maintainers)
Top Results From Across the Web
How to set environment variables in a cross-platform way?
I recently came across the cross-env project. It's pretty straight-forward { "scripts": { "build": "cross-env NODE_ENV=production webpack ...
Read more >cross-env - npm
Run scripts that set and use environment variables across platforms. NOTICE: cross-env still works well, but is in maintenance mode.
Read more >Cross-env: Set Environment Variables Cross-platform - Morioh
cross -env. Run scripts that set and use environment variables across platforms. NOTICE: cross-env still works well, but is in maintenance mode.
Read more >Variables in any environment - Christopher G. Jennings
PowerShell is primarily found on Windows, but it is cross-platform. For example, if the environment variable TARGET refers to a target directory, you...
Read more >Environment variables on cross platform - Google Groups
I want to control my FLTK app with a few simple environment variables. However, I don't know how to get all of them...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can we just start with node_env? Pretty much every single user of this package will be using node_env sometime in their scripts, and it’s a pain that on OSX and Linux it’s ‘node_env=“production”’ and on Windows it’s ‘set node_env=“production”’. cross-env solves this problem, but I would like a simple solution in shx. Another option is if there are if statements that can run in shx, and you can do one for windows and the other for everything else.
Nice approach! I may do that.
I use shelljs in nearly all my node utilities. Like the es6 usage, thanks. And didn’t know I could require a json file, that is cool.