Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Node Meetup Malmö, March 2014
Search
Pelle Wessman
March 04, 2014
Programming
0
100
Node Meetup Malmö, March 2014
Quick presentation on some good things to know about if one want to publish a package on npm
Pelle Wessman
March 04, 2014
Tweet
Share
More Decks by Pelle Wessman
See All by Pelle Wessman
Keeping Code From Failing
voxpelli
0
56
Smarta stilmallar
voxpelli
0
240
Smarta stilmallar
voxpelli
0
940
Other Decks in Programming
See All in Programming
Cursorハンズオン実践!
eltociear
2
1.2k
SODA - FACT BOOK(JP)
sodainc
1
8.6k
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
190
Range on Rails ―「多重範囲型」という新たな選択肢が、複雑ロジックを劇的にシンプルにしたワケ
rizap_tech
0
6.7k
なぜGoのジェネリクスはこの形なのか? - Featherweight Goが明かす設計の核心
qualiarts
0
230
Writing Better Go: Lessons from 10 Code Reviews
konradreiche
3
5.6k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
390
エンジニアインターン「Treasure」とHonoの2年、そして未来へ / Our Journey with Hono Two Years at Treasure and Beyond
carta_engineering
0
400
Go言語はstack overflowの夢を見るか?
logica0419
0
510
Six and a half ridiculous things to do with Quarkus
hollycummins
0
210
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
420
CSC305 Lecture 06
javiergs
PRO
0
270
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
920
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
The Language of Interfaces
destraynor
162
25k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
How to train your dragon (web standard)
notwaldorf
97
6.3k
Balancing Empowerment & Direction
lara
5
700
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.7k
Speed Design
sergeychernyshev
32
1.2k
Site-Speed That Sticks
csswizardry
13
920
Six Lessons from altMBA
skipperchong
29
4k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Transcript
npm publishing by Pelle Wessman, @voxpelli
package.json the core of it all
CommonJS Based on the Packages/1.0 spec
npm is basically the registry and the registry client (developed
by Isaac Z. Schlueter – npm, Inc.)
Required fields • name – should be URL-safe! (and no
”js”, ”node”) • version – semantic please! http://semver.org/ 1.0.0 === Major.Minor.Patch version
Important field ”private”: ”true” if you don’t want to publish!
Info fields • description • repository • homepage • bugs
• author • (README.md – and please – a changelog somewhere!) • (http://npmjs.org/~ – your social media and geek media (IRC) links!)
Code fields • main – the one field that node.js
itself uses • directories – directories.lib / directories.example
Env fields • engines – should define ”node • engineStrict
Global module fields • preferGlobal – results in warning on
local install • bin / directories.bin • man / directories.man
Script fields • scripts – test / start / lots-of-fun-stuffs
• config – for the above scripts
dependencies
devDependencies
• bundledDependencies • optionalDependencies • peerDependencies
.npmignore Defaults to .gitignore + eg. .DS_Store, .git, npm-debug.log Good
for excluding tests, examples etc. from packages
Compiled modules… …stuff for them to – but lets save
that for another time
Commands for the publisher
npm publish npm publish or npm publish https://github.com/voxpelli/foo/archive/v0.2.5.tar.gz
npm publish —tag <foo> for prereleases, betas, alphas, dev-releases etc
npm install foo@dev
• npm deprecate – package or version range • npm
version <major,minor,patch,1.33.7>
npm link to use your module locally during development (…but
exclude the global npm folder from OS X Time Machine)
Other use cases Not just Node.js uses NPM, but also
Browserify, Ender.js etc.