question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support cross platform environment variables

See original GitHub issue

Add 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:open
  • Created 6 years ago
  • Reactions:7
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
frastlincommented, Dec 1, 2019

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.

2reactions
backspacescommented, Feb 8, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found