Publishing your own packages to NPM (talk)
2018-05-08 : 3 Min Read : In tech
I recently gave a talk at SouthBayReact regarding publishing React components to NPM. While React components were the focus, these techniques can work for all kinds of packages.
Overview
Beyond publishing "Hello World". How to setup, develop, test, and publish your React components to NPM for your own selfish reasons.
This talk presented by Christopher Dunavan, who started out, like a lot of us, sharing some custom functions and components between different projects by manually copying a file or two from one project to another. Then one day he wondered why wasn't he using NPM to manage this for him and what else he could leverage to make his code better and his life easier.
Slide Deck
Resources:
NPM Resources
- npm-workspace - If you need more control over your npm link you might like workspaces
- npm dependencies - Fine-grained dependencies explanation
- npm audit - NPM package audit for your projects
- npm publish - Video how-to on publishing for the first time
- npm version - Allows for easier versioning of packages
- npm outdated - Checks NPM packages for versions
Other Resources
- Jest - JavaScript Testing
- Enzyme - Testing utility for React
- Husky - Pre-commit and other hooks to help automate your workflow
- eslint - Modern JavaScript linting
- React Styleguidist - Styleguide for React
- Cypress - End-to-end testing
- Codesandbox.io - For when words don't do it justice, make an example
Basic starter used in example
- My Basic Stateless Starter - github - A basic stateless starter setup with readme template and unit testing
Things found during research, but not used yet...
- Gatsby docgen - React component to docgen transformer
- renovate - Dependency checking
- updtr - Uses npm outdated to update packages like a robot
- webpack: output library target