NodeJS: Difference between revisions
From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
== Stuff I wish I had known a few weeks ago == | == Stuff I wish I had known a few weeks ago == | ||
=== package.json scripts === | |||
There about 20 predefined, the complete list and what they mean is [https://docs.npmjs.com/misc/scripts here]. | |||
Additionally if that's not enough you can define your own and use '''npm run ''scriptname'''''. | |||
=== Setting a browser === | === Setting a browser === |
Revision as of 18:03, 28 November 2018
Stuff I wish I had known a few weeks ago
package.json scripts
There about 20 predefined, the complete list and what they mean is here. Additionally if that's not enough you can define your own and use npm run scriptname.
Setting a browser
I usually use Chrome on Windows and Firefox on Mac. Instead of wiring a browser into my package.json 'start' command with "--open chrome", I now use just "--open" and let it pick. I can set the browser with
npm config set browser {chrome|firefox|lynx}
Reading docs
npm docs packagename
This jumps to a browser and opens the relevant site for packagename. For example, "npm docs react" opens https://reactjs.org. If you publish your own project as a package then it takes you to the npmjs.com site page.