Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Working with npm packages

495 views

Published on

How to find npm package?
How to modify npm package?
How to create npm package?

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Working with npm packages

  1. 1. Working with npm packages Tomasz Bąk
  2. 2. https://www.npmjs.com
  3. 3. https://www.npmjs.com
  4. 4. Most popular languages used on GitHub by opened Pull Request in last 12 months https://octoverse.github.com/ 4395 PRs a day
  5. 5. Agenda ● How to find npm package? ● How to modify npm package? ● How to create npm package?
  6. 6. 41 stars 2,862 downloads in the last month last commit 1 year ago 26 stars 1,548 downloads in the last month last commit 1 month ago 1,752 stars 123,133 downloads in the last month
  7. 7. How to find npm package? ● Google, github.com, npmjs.com ○ always check github activity and code quality ○ Downloads (npmjs.com) > Github stars > search result position ● github activity ○ commits, issues, pull requests ● quality ○ documentation, demo page, code, tests
  8. 8. How to fix npm package? ● research ○ Github issues ○ source code ○ StackOverflow and other libs issues / source code ● fork, create branch and PR ● install modified package via npm
  9. 9. How modify npm package locally? ● fork and create branch ● use local package version ○ "dependencies": {"somelib": "file:../path/to/somelib"} ○ npm install
  10. 10. How to distribute modified package? ● npm install --save github-user/somelib#my-fix-branch ○ more at https://docs.npmjs.com/files/package.json#dependencies ○ will not work if dist/ code is .gitignored ● npm install --save github-user-somelib-my-fix ○ change “name” to github-user-somelib-my-fix ○ npm build ○ npm publish
  11. 11. How to create npm package? ● npm init ○ "name": "somelib" ○ "main": "index.js" ● add ○ README.md ○ "repository" : { "type" : "git", "url" : "https://github.com/me/somelib.git"} ○ "scripts" : { "test": ... } ○ more at https://docs.npmjs.com/files/package.json ● npm publish ○ bump "version": "0.0.2"!
  12. 12. Summary ● prefer npm package with ○ quality ○ Github activity ○ downloads ● when you need to make change ○ research it ○ modify package locally ○ make PR

×