Duck Friend

Npm on steroids

May 04, 2019

Maybe it’s too late to post something about NPM, since latest news by Github.

I discovered a while a go that you can pass arguments to npm scripts, even though it seems pretty basic and obvious, yet for some reason I was always interacting with projects who had multiple scripts

{
  "scripts": {
    "build": "gulp build",
    "build-cms": "gulp build cms",
    "build-ecommerce": "gulp build ecommerce",
    "build-blog": "gulp build blog",
  }
}

As you can see there are so many scripts that are essentially doing the same thing, one can reduce this to basically

{
  "scripts": {
    "build": "gulp build",
  }
}

and then excute it

npm run build -- --project=cms

For more information check out this


Seif sayed

Personal Blog for Seif sayed
I share my thoughts with my duck.