DEV Community

Cover image for 5 Tips for better NPM script organization

5 Tips for better NPM script organization

Marcel Cremer on January 30, 2019

Not too long ago, it was pretty normal to use grunt, gulp and other tools to organize building, testing and other tasks in JS-Projects. However, th...
Collapse
 
easyaspython profile image
Dane Hillard

Wonderful suggestions! Happy that it converges with a lot of what we've done, though I'd love to start looking at the capabilities of npx more closely 😄

Collapse
 
marcel_cremer profile image
Marcel Cremer

I'm happy that you liked it :-)

Collapse
 
thejaredwilcurt profile image
The Jared Wilcurt

npm is never capitalized officially.

  • npm, Inc. - When talking about the company
  • npm - When talking generically about the product
  • npmjs.com - When talking about the website
  • npm - When referencing code to be executed (such as npm install)
  • npx - For executable code (which is what it is used for most of the time).
  • npx - If referring to the product, such as "You can view the source code on the npx repo".

Important thing is just don't put it in all caps ever. Similar to typing "Macdonalds Big Mac", people will know what you are talking about, but it is better to use their official brand name, "McDonald's Big Mac". Unless intentionally misbranding is the point (à la Banksy) people may dismiss your article as uninformed, unpolished, or unprofessional and skip it before giving it a chance.

Hope that helps.

Collapse
 
marcel_cremer profile image
Marcel Cremer

TBH, I personally don't use them. Most of the time when I remember that they exist and I "refactor" my scripts into using hooks, the package.json feels bloated afterwards (especially if the hooks just call other npm scripts).

If I see them in other projects, I sometimes like how they're used though.

Maybe you can give some pro / cons, why to use them?