View
896
Download
4
Category
Tags:
Preview:
DESCRIPTION
Node's official package manager npm already has more then 17.000 entries. These packages enable node developers to build web applications faster than ever. It's time to give something back to this great community and to contribute your own package. Damien Klinnert will show how to become a node package maintainer with a detailed introduction and a best practices talk.
Citation preview
become a node package maintainer
opinionated guide about creating and maintaining
Donnerstag, 22. November 12
intro
Donnerstag, 22. November 12
whois damienklinnert.com
• javascript developer && computer science student && working at doctape
• follow me @damienklinnert
Donnerstag, 22. November 12
summary
one: create
• npm commands, package.json, folder structure, documentation, testing, style, build tools, git(-hub), publish
two: maintain
• evolution / revolution, update, semantic versioning, appreciate help
Donnerstag, 22. November 12
y u speak?
• node and npm are awesome
• everyone can publish packages w/o control
• lots of crappy packages (crappy maintenance, crappy docs, crappy code, crappy style, crappy structure, …)
Donnerstag, 22. November 12
one: create
Donnerstag, 22. November 12
npm commands• npm init
• npm install
• npm run-script
• npm docs
• npm test
• npm pack
• npm adduser
• npm publish
Donnerstag, 22. November 12
package.jsoncreate skeleton with $ npm init
Donnerstag, 22. November 12
folder structure
Donnerstag, 22. November 12
documentation
• minimum: README.md and LICENSE
• better: docs/, HISTORY.md, config.example
• use comments, jsdoc and UML
• easy to install, use and contribute
Donnerstag, 22. November 12
testing
• use all: unit tests, functional tests, integration tests
• add working examples in examples/
• travis-ci
• utilize $ npm test
Donnerstag, 22. November 12
style
• lint your code (use a lintconfig and ship it)
• use only one coding style and keep a reference to it
• make it simple + understandable
Donnerstag, 22. November 12
build toolGRUNT.JS
simple tasks: npm, complex task: grunt.jsDonnerstag, 22. November 12
git(-hub)
• .npmignore / .gitignore
• specify repo and bugtracker url in package.json
• keep versions the same with git tags
• create HISTORY.md from git log
Donnerstag, 22. November 12
publish
• as easy as $ npm adduser && npm publish
• will read your package.json
Donnerstag, 22. November 12
two: maintain
Donnerstag, 22. November 12
evolution / revolution
• check whether there already is a similar package and contribute instead
• stick to your own design, style and guides
Donnerstag, 22. November 12
update
• update often
• fix bugs ASAP
• never ever unpublish (be aware of dependencies)
• keep repo and npm packages at the same state
Donnerstag, 22. November 12
semantic versioning
MAJOR.MINOR.PATCH
0.1.0, 0.2.3, 2.3.15Major: API changes
Minor: new functionalityPatch: bugfixes
http://semver.org/
Donnerstag, 22. November 12
appreciate help
• name contributors
• react immediately
• enable discussions
• merge pull requests
Donnerstag, 22. November 12
thank youwho writes a tool to automate this?
Donnerstag, 22. November 12
Recommended