Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross platform node-env #1

Open
xgqfrms opened this issue Oct 14, 2021 · 4 comments
Open

cross platform node-env #1

xgqfrms opened this issue Oct 14, 2021 · 4 comments

Comments

@xgqfrms
Copy link
Owner

xgqfrms commented Oct 14, 2021

cross platform node-env

https://www.npmjs.com/package/cross-env

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 14, 2021

$  npm i -D cross-env

$  yarn add cross-env -D
{
  "scripts": {
    "build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js"
  }
}
# cli ???
$ cross-env PORT_ENV=8090  


# local
$ ./node_modules/cross-env/dist/bin/cross-env.js PORT_ENV=8090  

$ ./node_modules/cross-env/dist/bin/cross-env-shell.js PORT_ENV=8090  


# node_modules true folder ???
# cross-env@5.2.0@cross-env

// testing

console.log('PORT_ENV =', process.env.PORT_ENV);

https://www.cnblogs.com/xgqfrms/p/13747577.html

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 14, 2021

node.js set process.env.port

#!/usr/bin/env node

// ./node_modules/cross-env/dist/bin/cross-env.js PORT_ENV=8090 && node ./test.js

// node PORT_ENV=8090 && ./test.js

console.log('process.env =', process.env);

console.log('PORT_ENV =', process.env.PORT_ENV);
console.log('NODE_ENV =', process.env.NODE_ENV);

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 14, 2021

shelljs

shelljs 执行 command ???

hui cli xgqfrms

https://github.com/xgqfrms/hui-cli

https://github.com/xgqfrms/hui-cli/blob/master/hui#L100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant