422 lines
41 KiB
Plaintext
422 lines
41 KiB
Plaintext
[38;5;12m [39m[38;2;255;187;0m[1m[4mAwesome npm [0m[38;5;14m[1m[4m![0m[38;2;255;187;0m[1m[4mAwesome[0m[38;5;14m[1m[4m (https://awesome.re/badge.svg)[0m[38;2;255;187;0m[1m[4m (https://awesome.re) [0m[38;2;255;187;0m[1m[4m (https://www.npmjs.com)[0m
|
||
|
||
[38;5;11m[1m▐[0m[38;5;12m [39m[38;5;12mAwesome [39m[38;5;14m[1mnpm[0m[38;5;12m (https://www.npmjs.com) resources and tips[39m
|
||
|
||
[38;5;14m[1mnpm[0m[38;5;12m (https://en.wikipedia.org/wiki/Npm_(software)) is a package manager for the JavaScript programming language and comes bundled in the [39m[38;5;14m[1mNode.js[0m[38;5;12m (https://en.wikipedia.org/wiki/Node.js) runtime.[39m
|
||
|
||
[48;2;30;30;40m[38;5;13m[3mPlease read the [0m[48;2;30;30;40m[38;5;14m[1m[3mcontribution guidelines[0m[48;2;30;30;40m[38;5;13m[3m (contributing.md) before contributing.[0m
|
||
|
||
[38;2;255;187;0m[4mContents[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mArticles[0m[38;5;12m (#articles)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mTools[0m[38;5;12m (#tools)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mPackages[0m[38;5;12m (#packages)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mClients[0m[38;5;12m (#clients)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mTips[0m[38;5;12m (#tips)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mFAQ[0m[38;5;12m (#faq)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mCommunity[0m[38;5;12m (#community)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mDocumentation[0m[38;5;12m (#documentation)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mSupport[0m[38;5;12m (#support)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mRelated[0m[38;5;12m (#related)[39m
|
||
|
||
[38;2;255;187;0m[4mArticles[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mSmall focused modules[0m[38;5;12m (https://github.com/sindresorhus/ama/issues/10#issuecomment-117766328)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mUnix philosophy and Node.js[0m[38;5;12m (http://blog.izs.me/post/48281998870/unix-philosophy-and-nodejs) - Write programs that do one thing and do it well.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mWriting small modules[0m[38;5;12m (https://web.archive.org/web/20180302125059/https://substack.net/how_I_write_modules)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mSemver: A Primer[0m[38;5;12m (https://nodesource.com/blog/semver-a-primer/) [39m[48;2;30;30;40m[38;5;13m[3m(Must read!)[0m
|
||
[38;5;12m- [39m[38;5;14m[1mSemver: Tilde and Caret[0m[38;5;12m (https://nodesource.com/blog/semver-tilde-and-caret/)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mOffline installation of npm packages[0m[38;5;12m (https://addyosmani.com/blog/using-npm-offline/)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mTask automation with npm run[0m[38;5;12m (https://web.archive.org/web/20180302164842/http://substack.net/task_automation_with_npm_run)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mHow to use npm as a build tool[0m[38;5;12m (https://www.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mInstall npm packages globally without sudo on macOS and Linux[0m[38;5;12m (https://github.com/sindresorhus/guides/blob/main/npm-global-without-sudo.md)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mOptimizing the footprint of an npm package[0m[38;5;12m (https://medium.com/@goldglovecb/npm-needs-a-personal-trainer-537e0f8859c6)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mThe Art of Node[0m[38;5;12m (https://github.com/maxogden/art-of-node#modules) - An introduction to Node.js and client-side development with npm.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mWhy npm scripts?[0m[38;5;12m (https://css-tricks.com/why-npm-scripts/) - An introduction to npm scripts with common packages and scripts, as well as a boilerplate project.[39m
|
||
|
||
[38;2;255;187;0m[4mTools[0m
|
||
|
||
[38;2;255;187;0m[4mWeb[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mnpms[0m[38;5;12m (https://npms.io) - Superb package search with deep analysis of package quality using a [39m[38;5;14m[1mmyriad of metrics[0m[38;5;12m (https://npms.io/about).[39m
|
||
[38;5;12m- [39m[38;5;14m[1mNodeICO[0m[38;5;12m (https://nodei.co/) - Package badges.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mLibraries.io[0m[38;5;12m (https://libraries.io/npm) - Package discovery.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-stat[0m[38;5;12m (http://npm-stat.com) - Statistics charts for packages.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpmgraph[0m[38;5;12m (http://npm.anvaka.com) - Visualization of dependencies.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm trends[0m[38;5;12m (http://www.npmtrends.com) - Compare package download counts over time.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-top[0m[38;5;12m (https://gist.github.com/bcoe/dcc961b869bbf6685002) - npm users by downloads.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm semver calculator[0m[38;5;12m (http://semver.npmjs.com) - Visually explore what versions of a package a semver range matches.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mghub.io[0m[38;5;12m (https://ghub.io) - Redirects to the GitHub repo of an npm package.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mmoiva[0m[38;5;12m (https://moiva.io) - Discover and compare packages.[39m
|
||
|
||
[38;2;255;187;0m[4mBrowser extensions[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mOcto-Linker[0m[38;5;12m (https://chrome.google.com/webstore/detail/octo-linker/jlmafbaeoofdegohdhinkhilhclaklkp) - Chrome extension to navigate across npm packages on GitHub with ease.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-hub[0m[38;5;12m (https://chrome.google.com/webstore/detail/npm-hub/kbbbjimdjbjclaebffknlabpogocablj) - Chrome extension to explore npm dependencies on GitHub repos.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mgithub-npm-stats[0m[38;5;12m (https://chrome.google.com/webstore/detail/github-npm-stats/oomfflokggoffaiagenekchfnpighcef) - View npm download stats on GitHub.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-search-update[0m[38;5;12m (https://chrome.google.com/webstore/detail/npm-search-update/kagpoplamlmaonpddimnnigiojimihnh) - Chrome extension to quickly search for dependencies and monitor changes from the npm registry.[39m
|
||
|
||
[38;2;255;187;0m[4mCLI[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mzsh-better-npm-completion[0m[38;5;12m (https://github.com/lukechilds/zsh-better-npm-completion) - Better ZSH completion for npm.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpkill[0m[38;5;12m (https://github.com/voidcosmos/npkill) - Easily find and remove old and heavy node_modules folders.[39m
|
||
|
||
[38;2;255;187;0m[4mPackages[0m
|
||
|
||
[38;2;255;187;0m[4mPublishing[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mnp[0m[38;5;12m (https://github.com/sindresorhus/np) - A better [39m[48;5;235m[38;5;249mnpm publish[49m[39m[38;5;12m.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpublish-please[0m[38;5;12m (https://github.com/inikulin/publish-please) - Publish packages safely and gracefully.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-release[0m[38;5;12m (https://github.com/phuu/npm-release) - Making releasing to npm so easy a kitten could probably do it™.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpkgfiles[0m[38;5;12m (https://github.com/timoxley/pkgfiles) - List all files which would be published in a package.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mrelease-it[0m[38;5;12m (https://github.com/webpro/release-it) - Automate releases for Git repositories and/or npm packages. Changelog generation, GitHub/GitLab releases, etc.[39m
|
||
[38;5;12m- [39m[38;5;14m[1msemantic-release[0m[38;5;12m (https://github.com/semantic-release/semantic-release) - Fully automated package publishing.[39m
|
||
|
||
[38;2;255;187;0m[4mRegistry[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-name[0m[38;5;12m (https://github.com/sindresorhus/npm-name-cli) - Check whether a package name is available on npm.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpackage-json[0m[38;5;12m (https://github.com/sindresorhus/package-json) - Get the package.json of a package from the npm registry.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mlatest-version[0m[38;5;12m (https://github.com/sindresorhus/latest-version-cli) - Get the latest version of an npm package.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-keyword[0m[38;5;12m (https://github.com/sindresorhus/npm-keyword) - Get a list of npm packages with a certain keyword.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-user[0m[38;5;12m (https://github.com/sindresorhus/npm-user) - Get user info of an npm user.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-email[0m[38;5;12m (https://github.com/sindresorhus/npm-email) - Get the email of an npm user.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-user-packages[0m[38;5;12m (https://github.com/kevva/npm-user-packages-cli) - Get packages by an npm user.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mdpn[0m[38;5;12m (https://github.com/gillstrom/dpn) - Get the dependents of a user's npm packages.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-stats[0m[38;5;12m (https://github.com/hughsk/npm-stats) - Get data from an npm registry.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-cli-login[0m[38;5;12m (https://github.com/postmanlabs/npm-cli-login) - Log in to npm.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnrm[0m[38;5;12m (https://github.com/Pana/nrm) - Registry manager.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-register[0m[38;5;12m (https://github.com/dickeyxxx/npm-register) - Easy to set up and maintain npm registry and proxy.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mverdaccio[0m[38;5;12m (https://github.com/verdaccio/verdaccio) - Lightweight private npm proxy registry.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mcloudsmith[0m[38;5;12m (https://cloudsmith.io/l/npm-registry/) - A fully managed package management SaaS with support for public and private npm registries (and many others).[39m
|
||
|
||
[38;2;255;187;0m[4mOther[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-home[0m[38;5;12m (https://github.com/sindresorhus/npm-home) - Open the npm page of a package.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mgh-home[0m[38;5;12m (https://github.com/sindresorhus/gh-home) - Open the GitHub page of a package.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mdavid[0m[38;5;12m (https://github.com/alanshaw/david) - Check if your package dependencies are out of date.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-check[0m[38;5;12m (https://github.com/dylang/npm-check) - Check for outdated, incorrect, and unused dependencies, as well as interactive update.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-upgrade[0m[38;5;12m (https://github.com/th0r/npm-upgrade) - Update outdated npm dependencies interactively.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-shrinkwrap[0m[38;5;12m (https://github.com/uber/npm-shrinkwrap) - A consistent shrinkwrap tool.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-windows-upgrade[0m[38;5;12m (https://github.com/felixrieseberg/npm-windows-upgrade) - Upgrade npm on Windows.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mgenerator-nm[0m[38;5;12m (https://github.com/sindresorhus/generator-nm) - Scaffold out an npm package.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpackage-up[0m[38;5;12m (https://github.com/sindresorhus/package-up) - Find the closest package.json file.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mread-package-up[0m[38;5;12m (https://github.com/sindresorhus/read-package-up) - Read the closest package.json file.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnormalize-package-data[0m[38;5;12m (https://github.com/npm/normalize-package-data) - Normalize package metadata.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpackage-config[0m[38;5;12m (https://github.com/sindresorhus/package-config) - Get namespaced config from the closest package.json.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-run-path[0m[38;5;12m (https://github.com/sindresorhus/npm-run-path) - Run locally installed binaries in the terminal by name like with global ones.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mlocal-npm[0m[38;5;12m (https://github.com/nolanlawson/local-npm) - Use npm [39m[38;5;14m[1moffline[0m[38;5;12m (https://addyosmani.com/blog/using-npm-offline/).[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpe[0m[38;5;12m (https://github.com/zeke/npe) - CLI for inspecting and editing properties in package.json.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mengine-deps[0m[38;5;12m (https://github.com/samccone/engine-deps) - Manage Node.js version specific dependencies with ease.[39m
|
||
[38;5;12m- [39m[38;5;14m[1menpeem-search[0m[38;5;12m (https://github.com/amovah/enpeem-search) - Search packages by scraping the npm web search.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-issues[0m[38;5;12m (https://github.com/seanzarrin/npm-issues) - Search known issues of all your packages at once.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mjohn[0m[38;5;12m (https://github.com/davej/john) - Make npm3's flat dependencies easier to find and sort.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mntl[0m[38;5;12m (https://github.com/ruyadorno/ntl) - Interactive CLI menu to list & run npm tasks.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mdecheck[0m[38;5;12m (https://github.com/egoist/decheck) - Explore dependencies of npm packages in the command-line.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mshrinkpack[0m[38;5;12m (https://github.com/JamieMason/shrinkpack) - Lock down your dependencies and install offline.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mredrun[0m[38;5;12m (https://github.com/coderaiser/redrun) - Expand scripts from package.json to improve execution speed.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpackage-size[0m[38;5;12m (https://github.com/egoist/package-size) - Get the bundle size of an npm package.[39m
|
||
[38;5;12m- [39m[38;5;14m[1msynp[0m[38;5;12m (https://github.com/imsnif/synp) - Convert yarn.lock to package-lock.json and vice versa.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm-run-all[0m[38;5;12m (https://github.com/mysticatea/npm-run-all) - CLI tool to run multiple npm-scripts in parallel or serial.[39m
|
||
[38;5;12m- [39m[38;5;14m[1monchange[0m[38;5;12m (https://github.com/Qard/onchange) - Watch files and folders and run a command when something changed.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mcli-error-notifier[0m[38;5;12m (https://github.com/micromata/cli-error-notifier) - Sends native desktop notifications when npm scripts fail.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mluna[0m[38;5;12m (https://github.com/rvpanoz/luna) - App to manage npm dependencies.[39m
|
||
[38;5;12m- [39m[38;5;14m[1memma-cli[0m[38;5;12m (https://github.com/maticzav/emma-cli) - Interactive CLI package search utility.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mlockfile-lint[0m[38;5;12m (https://github.com/lirantal/lockfile-lint) - Lint lockfiles for improved security and trust policies to mitigate malicious package injection and insecure lockfile resources.[39m
|
||
|
||
[38;2;255;187;0m[4mClients[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1myarn[0m[38;5;12m (https://github.com/yarnpkg/yarn) - Fast, reliable, and secure dependency management.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm[0m[38;5;12m (https://github.com/npm/cli) - The official client.[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpnpm[0m[38;5;12m (https://github.com/pnpm/pnpm) - Fast, disk space efficient package manager.[39m
|
||
|
||
[38;2;255;187;0m[4mTips[0m
|
||
|
||
[38;2;255;187;0m[4mUpdate to the latest npm version[0m
|
||
|
||
[48;5;235m[38;5;249m$ npm install --global npm[49m[39m
|
||
|
||
[48;2;30;30;40m[38;5;14m[1m[3mWindows users, read more.[0m[48;2;30;30;40m[38;5;13m[3m (https://github.com/felixrieseberg/npm-windows-upgrade)[0m
|
||
|
||
[38;2;255;187;0m[4mCommand aliases[0m
|
||
|
||
[38;5;12m- [39m[48;5;235m[38;5;249mnpm i [49m[39m[38;5;12m → [39m[48;5;235m[38;5;249mnpm install[49m[39m
|
||
[38;5;12m- [39m[48;5;235m[38;5;249mnpm i -D[49m[39m[38;5;12m → [39m[48;5;235m[38;5;249mnpm install --save-dev[49m[39m
|
||
[38;5;12m- [39m[48;5;235m[38;5;249mnpm t[49m[39m[38;5;12m → [39m[48;5;235m[38;5;249mnpm test[49m[39m
|
||
[38;5;12m- [39m[48;5;235m[38;5;249mnpm it[49m[39m[38;5;12m → [39m[48;5;235m[38;5;249mnpm install && npm test[49m[39m
|
||
[38;5;12m- [39m[48;5;235m[38;5;249mnpm r[49m[39m[38;5;12m → [39m[48;5;235m[38;5;249mnpm uninstall[49m[39m
|
||
[38;5;12m- [39m[48;5;235m[38;5;249mnpm un[49m[39m[38;5;12m → [39m[48;5;235m[38;5;249mnpm uninstall[49m[39m
|
||
[38;5;12m- [39m[48;5;235m[38;5;249mnpm up[49m[39m[38;5;12m → [39m[48;5;235m[38;5;249mnpm update[49m[39m
|
||
|
||
[38;2;255;187;0m[4mShell aliases[0m
|
||
|
||
[38;5;12mSpeed up your common npm tasks.[39m
|
||
|
||
[38;5;12mIn your [39m[48;5;235m[38;5;249m.zshrc[49m[39m[38;5;12m/[39m[48;5;235m[38;5;249m.bashrc[49m[39m[38;5;12m:[39m
|
||
|
||
[48;5;235m[38;5;249malias ni='npm install'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias nid='npm install --save-dev'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias nig='npm install --global'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias nt='npm test'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias nit='npm install && npm test'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias nk='npm link'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias nr='npm run'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias ns='npm start'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249malias nf='npm cache clean && rm -rf node_modules && npm install'[49m[39m
|
||
[48;5;235m[38;5;249malias nlg='npm list --global --depth=0'[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;2;255;187;0m[4mDon't add to package.json when installing[0m
|
||
|
||
[38;5;12mBy default npm adds packages you install to the [39m[48;5;235m[38;5;249mdependencies[49m[39m[38;5;12m field in package.json (since v5). You can prevent this by specifying the [39m[48;5;235m[38;5;249m--no-save[49m[39m[38;5;12m flag. You can add a package to [39m[48;5;235m[38;5;249mdevDependencies[49m[39m[38;5;12m with [39m[48;5;235m[38;5;249m--save-dev[49m[39m[38;5;12m/[39m[48;5;235m[38;5;249m-D[49m[39m[38;5;12m:[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm install --save-dev ava[49m[39m
|
||
|
||
[38;2;255;187;0m[4mRun scripts[0m
|
||
|
||
[38;5;12mYou[39m[38;5;12m [39m[38;5;12mcan[39m[38;5;12m [39m[38;5;12measily[39m[38;5;12m [39m[38;5;14m[1mrun[0m[38;5;14m[1m [0m[38;5;14m[1mscripts[0m[38;5;12m [39m[38;5;12m(https://docs.npmjs.com/cli/run-script)[39m[38;5;12m [39m[38;5;12musing[39m[38;5;12m [39m[38;5;12mnpm[39m[38;5;12m [39m[38;5;12mby[39m[38;5;12m [39m[38;5;12madding[39m[38;5;12m [39m[38;5;12mthem[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[48;5;235m[38;5;249m"scripts"[49m[39m[38;5;12m [39m[38;5;12mfield[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12mpackage.json[39m[38;5;12m [39m[38;5;12mand[39m[38;5;12m [39m[38;5;12mrun[39m[38;5;12m [39m[38;5;12mthem[39m[38;5;12m [39m[38;5;12mwith[39m[38;5;12m [39m[48;5;235m[38;5;249mnpm run [49m[39m[38;5;12m.[39m[38;5;12m [39m[38;5;12mRun[39m[38;5;12m [39m[48;5;235m[38;5;249mnpm run[49m[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12msee[39m[38;5;12m [39m[38;5;12mavailable[39m[38;5;12m [39m[38;5;12mscripts.[39m[38;5;12m [39m[38;5;12mBinaries[39m[38;5;12m [39m[38;5;12mof[39m[38;5;12m [39m[38;5;12mlocally[39m[38;5;12m [39m[38;5;12minstall[39m[38;5;12m [39m[38;5;12mpackages[39m[38;5;12m [39m[38;5;12mare[39m[38;5;12m [39m[38;5;12mmade[39m[38;5;12m [39m
|
||
[38;5;12mavailable[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[38;5;14m[1mPATH[0m[38;5;12m [39m[38;5;12m(https://en.wikipedia.org/wiki/PATH_(variable)),[39m[38;5;12m [39m[38;5;12mso[39m[38;5;12m [39m[38;5;12myou[39m[38;5;12m [39m[38;5;12mcan[39m[38;5;12m [39m[38;5;12mrun[39m[38;5;12m [39m[38;5;12mthem[39m[38;5;12m [39m[38;5;12mby[39m[38;5;12m [39m[38;5;12mname.[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m
|
||
[48;5;235m[38;5;249m "scripts": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "cat": "cat-names"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m },[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "dependencies": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "cat-names": "^1.0.0"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm run cat[49m[39m
|
||
[48;5;235m[38;5;249mMax[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;5;12mAll package.json properties are [39m[38;5;14m[1mexposed[0m[38;5;12m (https://docs.npmjs.com/misc/scripts#packagejson-vars) as environment variables:[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "scripts": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "echo $npm_package_name"[49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm run name[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249mawesome-package[49m[39m
|
||
|
||
[38;2;255;187;0m[4mPassing options to commands[0m
|
||
|
||
[38;5;12mYou[39m[38;5;12m [39m[38;5;12mcan[39m[38;5;12m [39m[38;5;12mpass[39m[38;5;12m [39m[38;5;12moptions[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[38;5;12mcommand[39m[38;5;12m [39m[38;5;12myou[39m[38;5;12m [39m[38;5;12mare[39m[38;5;12m [39m[38;5;12musing[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12myour[39m[38;5;12m [39m[38;5;12mnpm[39m[38;5;12m [39m[38;5;12mscript[39m[38;5;12m [39m[38;5;12mby[39m[38;5;12m [39m[38;5;12madding[39m[38;5;12m [39m[48;5;235m[38;5;249m-- --flag[49m[39m[38;5;12m [39m[38;5;12mlike[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[38;5;12mexample[39m[38;5;12m [39m[38;5;12mbelow.[39m[38;5;12m [39m[38;5;12mThe[39m[38;5;12m [39m[48;5;235m[38;5;249m--[49m[39m[38;5;12m [39m[38;5;14m[1mmarks[0m[38;5;14m[1m [0m[38;5;14m[1mthe[0m[38;5;14m[1m [0m[38;5;14m[1mend[0m[38;5;14m[1m [0m[38;5;14m[1mof[0m[38;5;14m[1m [0m[38;5;14m[1moptions[0m[38;5;14m[1m [0m[38;5;14m[1mparsing[0m[38;5;12m [39m
|
||
[38;5;12m(https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash),[39m[38;5;12m [39m[38;5;12mso[39m[38;5;12m [39m[48;5;235m[38;5;249mnpm run[49m[39m[38;5;12m [39m[38;5;12mwill[39m[38;5;12m [39m[38;5;12mjust[39m[38;5;12m [39m[38;5;12mignore[39m[38;5;12m [39m[38;5;12mit[39m[38;5;12m [39m[38;5;12mand[39m[38;5;12m [39m[38;5;12mpass[39m[38;5;12m [39m[38;5;12mit[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[38;5;12mcommand.[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "scripts": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "xo": "xo",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "xo:fix": "npm run xo -- --fix",[49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[48;2;30;30;40m[38;5;13m[3mAdding the [0m[48;5;235m[38;5;249m[3m-- --fix [0m[48;2;30;30;40m[38;5;13m[3m option is like executing [0m[48;5;235m[38;5;249m[3mxo --fix[0m[38;5;12m.[39m
|
||
|
||
[38;2;255;187;0m[4mSilent option[0m
|
||
|
||
[48;5;235m[38;5;249mnpm run[49m[39m[38;5;12m has a [39m[48;5;235m[38;5;249m--silent[49m[39m[38;5;12m option which is especially useful when combining npm scripts.[39m
|
||
|
||
[38;5;12mImagine you have a setup for linting your JavaScript files like the following:[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "scripts": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "xo": "xo",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "xo:fix": "npm run xo --silent -- --fix",[49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[48;2;30;30;40m[38;5;13m[3mUsing the [0m[48;5;235m[38;5;249m[3m--silent[0m[48;2;30;30;40m[38;5;13m[3m option reduces the output in the terminal. See [0m[48;2;30;30;40m[38;5;14m[1m[3mthis comparison[0m[48;2;30;30;40m[38;5;13m[3m (https://twitter.com/mkuehnel/status/957965749473210369).[0m
|
||
|
||
[38;2;255;187;0m[4mLifecycle scripts[0m
|
||
|
||
[38;5;12mnpm comes with predefined [39m[38;5;14m[1mlifecyle scripts[0m[38;5;12m (https://docs.npmjs.com/misc/scripts) which are excuted under specific conditions if they are defined in your package.json.[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "scripts": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "prepublishOnly": "nsp check"[49m[39m
|
||
[48;5;235m[38;5;249m },[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "devDependencies": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "nsp": "^3.0.0"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;5;12mThis will be executed automatically before your npm package is published to the registry via [39m[48;5;235m[38;5;249mnpm publish[49m[39m[38;5;12m to check for known vulnerabilties in your dependencies.[39m
|
||
|
||
[48;2;30;30;40m[38;5;13m[3mNote: [0m[48;2;30;30;40m[38;5;14m[1m[3mprepublishOnly[0m[48;2;30;30;40m[38;5;13m[3m is available since npm v4.0.0. See [0m[48;2;30;30;40m[38;5;14m[1m[3mnpm docs[0m[48;2;30;30;40m[38;5;13m[3m (https://docs.npmjs.com/misc/scripts#deprecation-note).[0m
|
||
|
||
[48;5;235m[38;5;249m[4mnpm start[0m[38;2;255;187;0m[4m and [0m[48;5;235m[38;5;249m[4mnpm test[0m
|
||
|
||
[48;5;235m[38;5;249mnpm start[49m[39m[38;5;12m and [39m[48;5;235m[38;5;249mnpm test[49m[39m[38;5;12m are also lifecycle scripts but are not executed automatically.[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m
|
||
[48;5;235m[38;5;249m "scripts": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "start": "node server.js",[49m[39m
|
||
[48;5;235m[38;5;249m "test": "ava"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m },[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "devDependencies": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "ava": "^1.0.0"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;5;12mTherefore they can be executed simply with:[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm test[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m$ npm start[49m[39m
|
||
|
||
[48;5;235m[38;5;249m[4mpre[0m[38;2;255;187;0m[4m and [0m[48;5;235m[38;5;249m[4mpost[0m[38;2;255;187;0m[4m scripts[0m
|
||
|
||
[38;5;12mThese are special lifecycle scripts which can be used to run scripts automatically in sequence.[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m
|
||
[48;5;235m[38;5;249m "scripts": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "pretest": "eslint .",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "test": "ava"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m },[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "devDependencies": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "eslint": "^4.19.0",[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "ava": "^1.0.0"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm test[49m[39m
|
||
|
||
[38;5;12mThis will lint your files before running your tests. The tests will not run if linting fails. Or more generally spoken: the following script won’t be executed if one of the scripts running in sequence exits with an exit code other than 0.[39m
|
||
|
||
[48;2;30;30;40m[38;5;13m[3mNote: [0m[48;5;235m[38;5;249m[3mpre[0m[48;2;30;30;40m[38;5;13m[3m and [0m[48;5;235m[38;5;249m[3mpost[0m[48;2;30;30;40m[38;5;13m[3m scripts can also be used for your custom npm scripts. So [0m[48;5;235m[38;5;249m[3mnpm run foo[0m[48;2;30;30;40m[38;5;13m[3m will also run [0m[48;5;235m[38;5;249m[3mprefoo[0m[48;2;30;30;40m[38;5;13m[3m and [0m[48;5;235m[38;5;249m[3mpostfoo[0m[48;2;30;30;40m[38;5;13m[3m if defined.[0m
|
||
|
||
[38;2;255;187;0m[4mRun script with [0m[48;5;235m[38;5;249m[4mnpx[0m
|
||
|
||
[48;5;235m[38;5;249mnpm[49m[39m[38;5;12m [39m[38;5;14m[1mcomes[0m[38;5;14m[1m [0m[38;5;14m[1mbundled[0m[38;5;12m [39m[38;5;12m(https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b)[39m[38;5;12m [39m[38;5;12mwith[39m[38;5;12m [39m[48;5;235m[38;5;249mnpx[49m[39m[38;5;12m [39m[38;5;12m(Since[39m[38;5;12m [39m[38;5;12mv5.2.0)[39m[38;5;12m [39m[38;5;12m—[39m[38;5;12m [39m[38;5;12ma[39m[38;5;12m [39m[38;5;12mtool[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mexecute[39m[38;5;12m [39m[38;5;12mpackage[39m[38;5;12m [39m[38;5;12mbinaries.[39m[38;5;12m [39m[38;5;12mEach[39m[38;5;12m [39m[38;5;12mcommand[39m[38;5;12m [39m[38;5;12mis[39m[38;5;12m [39m[38;5;12mexecuted[39m[38;5;12m [39m[38;5;12meither[39m[38;5;12m [39m[38;5;12mfrom[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[38;5;12mlocal[39m[38;5;12m [39m[48;5;235m[38;5;249mnode_modules/.bin[49m[39m[38;5;12m [39m[38;5;12mdirectory,[39m[38;5;12m [39m[38;5;12mor[39m[38;5;12m [39m[38;5;12mfrom[39m
|
||
[38;5;12ma[39m[38;5;12m [39m[38;5;12mcentral[39m[38;5;12m [39m[38;5;12mcache,[39m[38;5;12m [39m[38;5;12minstalling[39m[38;5;12m [39m[38;5;12many[39m[38;5;12m [39m[38;5;12mpackages[39m[38;5;12m [39m[38;5;12mneeded[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12morder[39m[38;5;12m [39m[38;5;12mfor[39m[38;5;12m [39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mrun.[39m
|
||
|
||
[48;5;235m[38;5;249m{[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "name": "awesome-package",[49m[39m
|
||
[48;5;235m[38;5;249m "dependencies": {[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m "cat-names": "^1.0.0"[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m }[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m}[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;5;12mIf the binary is already installed, it will be executed from [39m[48;5;235m[38;5;249mnode_modules/.bin[49m[39m[38;5;12m.[39m
|
||
|
||
[48;5;235m[38;5;249m$ npx cat-names[49m[39m
|
||
[48;5;235m[38;5;249mMax[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;5;12mBut if the binary is missing, it will be installed first.[39m
|
||
|
||
[48;5;235m[38;5;249m$ npx dog-names[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249mnpx: installed 46 in 3.136s[49m[39m
|
||
[48;5;235m[38;5;249mBentley[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;2;255;187;0m[4mRun commands with different Node.js versions[0m
|
||
|
||
[38;5;12mWith[39m[38;5;12m [39m[48;5;235m[38;5;249mnpx[49m[39m[38;5;12m [39m[38;5;12m(Comes[39m[38;5;12m [39m[38;5;12mbundled[39m[38;5;12m [39m[38;5;12mwith[39m[38;5;12m [39m[38;5;12mnpm[39m[38;5;12m [39m[38;5;12mv5.2.0[39m[38;5;12m [39m[38;5;12mor[39m[38;5;12m [39m[38;5;12mnewer)[39m[38;5;12m [39m[38;5;12mand[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[48;5;235m[38;5;249m[1mnode-bin[0m[38;5;12m [39m[38;5;12m(https://www.npmjs.com/package/node-bin)[39m[38;5;12m [39m[38;5;12mpackage,[39m[38;5;12m [39m[38;5;12myou[39m[38;5;12m [39m[38;5;12mcan[39m[38;5;12m [39m[38;5;12measily[39m[38;5;12m [39m[38;5;12mtry[39m[38;5;12m [39m[38;5;12mout[39m[38;5;12m [39m[38;5;12mcode[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12mdifferent[39m[38;5;12m [39m[38;5;12mNode.js[39m[38;5;12m [39m[38;5;12mversions[39m[38;5;12m [39m[38;5;12mwithout[39m[38;5;12m [39m[38;5;12mhaving[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12muse[39m[38;5;12m [39m[38;5;12ma[39m[38;5;12m [39m[38;5;12mversion[39m[38;5;12m [39m[38;5;12mmanager[39m[38;5;12m [39m[38;5;12mlike[39m[38;5;12m [39m[48;5;235m[38;5;249m[1mnvm[0m[38;5;12m [39m[38;5;12m(http://nvm.sh),[39m[38;5;12m [39m[48;5;235m[38;5;249m[1mnave[0m[38;5;12m [39m
|
||
[38;5;12m(https://github.com/isaacs/nave),[39m[38;5;12m [39m[38;5;12mor[39m[38;5;12m [39m[48;5;235m[38;5;249m[1mn[0m[38;5;12m [39m[38;5;12m(https://github.com/tj/n).[39m
|
||
|
||
[48;5;235m[38;5;249m$ npx --package=node-bin@6.11.0 -- node --version[49m[39m
|
||
[48;5;235m[38;5;249mv6.11.0[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
|
||
[38;2;255;187;0m[4mLink local packages[0m
|
||
|
||
[38;5;12mSometimes[39m[38;5;12m [39m[38;5;12mit[39m[38;5;12m [39m[38;5;12mcan[39m[38;5;12m [39m[38;5;12mbe[39m[38;5;12m [39m[38;5;12museful[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mhave[39m[38;5;12m [39m[38;5;12ma[39m[38;5;12m [39m[38;5;12mlocal[39m[38;5;12m [39m[38;5;12mversion[39m[38;5;12m [39m[38;5;12mof[39m[38;5;12m [39m[38;5;12ma[39m[38;5;12m [39m[38;5;12mpackage[39m[38;5;12m [39m[38;5;12mas[39m[38;5;12m [39m[38;5;12ma[39m[38;5;12m [39m[38;5;12mdependency.[39m[38;5;12m [39m[38;5;12mYou[39m[38;5;12m [39m[38;5;12mcan[39m[38;5;12m [39m[38;5;12muse[39m[38;5;12m [39m[48;5;235m[38;5;249mnpm link[49m[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mlink[39m[38;5;12m [39m[38;5;12mone[39m[38;5;12m [39m[38;5;12mlocal[39m[38;5;12m [39m[38;5;12mpackage[39m[38;5;12m [39m[38;5;12minto[39m[38;5;12m [39m[38;5;12manother.[39m[38;5;12m [39m[38;5;12mRun[39m[38;5;12m [39m[48;5;235m[38;5;249mnpm link[49m[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[38;5;12mpackage[39m[38;5;12m [39m[38;5;12myou[39m[38;5;12m [39m[38;5;12mwant[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12muse.[39m[38;5;12m [39m[38;5;12mThis[39m[38;5;12m [39m[38;5;12mcreates[39m[38;5;12m [39m[38;5;12ma[39m[38;5;12m [39m[38;5;12mglobal[39m[38;5;12m [39m[38;5;12mreference.[39m[38;5;12m [39m[38;5;12mThen[39m[38;5;12m [39m[38;5;12mgo[39m[38;5;12m [39m[38;5;12minto[39m[38;5;12m [39m[38;5;12myour[39m[38;5;12m [39m[38;5;12moriginal[39m
|
||
[38;5;12mpackage[39m[38;5;12m [39m[38;5;12mand[39m[38;5;12m [39m[38;5;12mrun[39m[38;5;12m [39m[48;5;235m[38;5;249mnpm link [49m[39m[38;5;12m [39m[38;5;12mto[39m[38;5;12m [39m[38;5;12mlink[39m[38;5;12m [39m[38;5;12min[39m[38;5;12m [39m[38;5;12mthe[39m[38;5;12m [39m[38;5;12mother[39m[38;5;12m [39m[38;5;12mpackage.[39m
|
||
|
||
[48;5;235m[38;5;249m$ cd rainbow[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m$ npm link[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m$ cd ../unicorn[49m[39m[48;5;235m[38;5;249m [49m[39m
|
||
[48;5;235m[38;5;249m$ npm link rainbow[49m[39m
|
||
|
||
[38;5;12mYou can now use [39m[48;5;235m[38;5;249mrainbow[49m[39m[38;5;12m as a dependency in the [39m[48;5;235m[38;5;249municorn[49m[39m[38;5;12m package.[39m
|
||
|
||
[38;2;255;187;0m[4mInstall a package from GitHub[0m
|
||
|
||
[38;5;12mnpm supports using a shorthand for installing a package directly from a GitHub repo:[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm install sindresorhus/chalk[49m[39m
|
||
|
||
[38;5;12mLet's target a specific commit as the main branch is a moving target:[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm install 'sindresorhus/chalk#51b8f32'[49m[39m
|
||
|
||
[38;5;12mSpecify either a commit SHA, branch, tag, or nothing.[39m
|
||
|
||
[38;5;12mYou can also install Git dependencies with semver: [39m[48;2;30;30;40m[38;5;13m[3m(Requires npm v5 or newer)[0m
|
||
|
||
[48;5;235m[38;5;249m$ npm install 'sindresorhus/chalk#semver:^2.0.0'[49m[39m
|
||
|
||
[38;2;255;187;0m[4mInstall a specific version of a package[0m
|
||
|
||
[48;5;235m[38;5;249m$ npm install chalk@1.0.0[49m[39m
|
||
|
||
|
||
[38;2;255;187;0m[4mList top-level installed packages and their version[0m
|
||
|
||
[48;5;235m[38;5;249m$ npm ls --depth=0[49m[39m
|
||
|
||
[38;2;255;187;0m[4mCommand help[0m
|
||
|
||
[38;5;12mGet help docs for a command:[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm help [49m[39m
|
||
|
||
[38;5;12mExample:[39m
|
||
|
||
[48;5;235m[38;5;249m$ npm help install[49m[39m
|
||
|
||
[38;2;255;187;0m[4mStandalone version of a package[0m
|
||
|
||
[38;5;12mQuickly get a standalone version of a package that is browserified and usable in the browser.[39m
|
||
|
||
[48;5;235m[38;5;249mhttps://wzrd.in/standalone/** [49m[39m
|
||
|
||
[38;5;12mExamples:[39m
|
||
|
||
[38;5;12m- [39m
|
||
[38;5;12m- [39m
|
||
|
||
[38;5;12mGreat for prototyping, but download the file or use Browserify yourself for production.[39m
|
||
|
||
[38;2;255;187;0m[4mFAQ[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mCheck in node_modules vs. shrinkwrap[0m[38;5;12m (http://stackoverflow.com/questions/11459733/check-in-node-modules-vs-shrinkwrap)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mWhat is the difference between Bower and npm?[0m[38;5;12m (http://stackoverflow.com/questions/18641899/what-is-the-difference-between-bower-and-npm)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mWhat does [0m[48;5;235m[38;5;249m[1m^[0m[38;5;14m[1m mean in package.json versioning?[0m[38;5;12m (http://stackoverflow.com/questions/22137778/what-does-mean-in-package-json-versioning)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mFind the version of an installed npm package[0m[38;5;12m (http://stackoverflow.com/questions/10972176/find-the-version-of-an-installed-npm-package)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mWhat's the difference between dependencies, devDependencies, and peerDependencies in package.json?[0m[38;5;12m (http://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies)[39m
|
||
|
||
[38;2;255;187;0m[4mCommunity[0m
|
||
|
||
[38;5;12m- [39m[48;5;235m[38;5;249m[1m#npm[0m[38;5;14m[1m on Freenode[0m[38;5;12m (http://webchat.freenode.net/?channels=npm)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mStack Overflow[0m[38;5;12m (https://stackoverflow.com/questions/tagged/npm)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mReddit[0m[38;5;12m (https://www.reddit.com/r/npm)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mTwitter[0m[38;5;12m (https://twitter.com/npmjs)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mBlog[0m[38;5;12m (https://blog.npmjs.org)[39m
|
||
|
||
[38;2;255;187;0m[4mDocumentation[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mOfficial[0m[38;5;12m (https://docs.npmjs.com)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mTroubleshooting[0m[38;5;12m (https://github.com/npm/npm/wiki/Troubleshooting)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mSemantic versioning[0m[38;5;12m (https://docs.npmjs.com/getting-started/semantic-versioning)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mFixing npm permissions[0m[38;5;12m (https://docs.npmjs.com/getting-started/fixing-npm-permissions)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mpackage.json[0m[38;5;12m (https://docs.npmjs.com/files/package.json)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mnpm run script[0m[38;5;12m (https://docs.npmjs.com/cli/run-script)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mStats API[0m[38;5;12m (https://github.com/npm/download-counts)[39m
|
||
|
||
[38;2;255;187;0m[4mSupport[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mnpm.community[0m[38;5;12m (https://npm.community/c/support)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mTwitter[0m[38;5;12m (https://twitter.com/npm_support)[39m
|
||
[38;5;12m- [39m[38;5;14m[1mContact form[0m[38;5;12m (https://www.npmjs.com/support)[39m
|
||
|
||
[38;2;255;187;0m[4mRelated[0m
|
||
|
||
[38;5;12m- [39m[38;5;14m[1mawesome-nodejs[0m[38;5;12m (https://github.com/sindresorhus/awesome-nodejs)[39m
|
||
|
||
[38;5;12mnpm Github: https://github.com/sindresorhus/awesome-npm[39m
|