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
99
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
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
3
1.5k
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
550
🔨 小さなビルドシステムを作る
momeemt
4
690
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
130
The Past, Present, and Future of Enterprise Java with ASF in the Middle
ivargrimstad
0
190
チームのテスト力を鍛える
goyoki
3
980
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
HTMLの品質ってなんだっけ? “HTMLクライテリア”の設計と実践
unachang113
4
3k
Reading Rails 1.0 Source Code
okuramasafumi
0
260
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
2.1k
Testing Trophyは叫ばない
toms74209200
0
900
デザイナーが Androidエンジニアに 挑戦してみた
874wokiite
0
590
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
590
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Docker and Python
trallard
46
3.6k
KATA
mclloyd
32
14k
Speed Design
sergeychernyshev
32
1.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Fireside Chat
paigeccino
39
3.6k
The Language of Interfaces
destraynor
161
25k
Making Projects Easy
brettharned
117
6.4k
Git: the NoSQL Database
bkeepers
PRO
431
66k
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.