0

I use dotenv module to apply .env in my projects.

In windows, prefix cross-env should be put before every setting environment scripts in package.json.

For example, this is my yarn build command in windows.

scripts: {
...
    "build": "rm -rf dist/ && cross-env NODE_ENV=production yarn build:client && cross-env NODE_ENV=production yarn build:server",
...
}

I use both window and mac OS in different device, don't want to remove / put cross-env prefix each times I change my device.

Is there ways to automative scripts I can make to edit scripts section in package.json?

dante
  • 933
  • 4
  • 16
  • 39
  • 1
    See e.g. https://stackoverflow.com/questions/45082648/npm-package-json-os-specific-script – glinda93 Jul 18 '20 at 05:56
  • @DᴀʀᴛʜVᴀᴅᴇʀ yeap. as bravemaster mentioned same contents earlier, it helped me alot. thank you for your comments – dante Jul 18 '20 at 16:57

1 Answers1

0

I found the simplest way to use npm module named run-script-os NPM

Thank you for all the comments here.

dante
  • 933
  • 4
  • 16
  • 39