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
81
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
51
Smarta stilmallar
voxpelli
0
130
Smarta stilmallar
voxpelli
0
860
Other Decks in Programming
See All in Programming
CDKコントリビュートの最初の壁を越えよう! -簡単issueの見つけ方-
badmintoncryer
3
220
Elm Form Validation
bkuhlmann
0
510
Documentation for users with AsciiDoc and Antora
ahus1
0
370
VS Code をプロダクトにどう取り込むか
onomax
1
730
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
310
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
Apache Hive 4 on Treasure Data
ryukobayashi
1
420
Site Reliability Engineering for GMO
pyama86
8
1.1k
雑に思考を整理する技術と効能
konifar
63
30k
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
680
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
610
業務ツールとして使うPostman
msys75
0
110
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
323
20k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
242
1.2M
A better future with KSS
kneath
231
16k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
245
20k
Faster Mobile Websites
deanohume
300
30k
The Art of Programming - Codeland 2020
erikaheidi
43
12k
Unsuck your backbone
ammeep
663
57k
It's Worth the Effort
3n
180
27k
Visualization
eitanlees
137
14k
How to name files
jennybc
65
93k
The MySQL Ecosystem @ GitHub 2015
samlambert
244
12k
YesSQL, Process and Tooling at Scale
rocio
165
13k
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.