class: center, middle # you don't know ![npm logo](public/img/npm.png) --- class: center, middle ## http://bit.ly/node-live ### (gh-pages: ashleygwilliams/node-live) --- class: center, middle, nodetogether ![node-together-boston](public/img/nodetogether_boston.jpg) --- class: center, middle, nodetogether # NodeTogether
require('all');
--- class: center, middle, nodetogether ### tech has a diversity problem --- class: center, middle, nodetogether ### Node has a diversity problem --- class: center, middle, nodetogether ### another Node is possible --- class: center, middle, nodetogether ![node-together-london](public/img/nodetogether_london.jpg) --- class: center, middle, nodetogether ![LA](public/img/la.jpg) --- class: center, middle, nodetogether ![bangalore](public/img/bangalore.jpg-large) --- class: center, middle, nodetogether ![paris](public/img/paris.jpg) --- class: center, middle, nodetogether ### we need your help --- class: center, middle, nodetogether # NodeTogether ## http://www.nodetogether.org ## @node_together --- class: center, middle # you don't know ![npm logo](public/img/npm.png) --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 # everyday around 1,800,000 install events occur. --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 # each install is around 70 packages. --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 # 1,800,000 * 70 --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 # .real-big[126,000,000] --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 # that's a lot of packages --- class: center, middle # hi my name is @ag_dubs ![space invader](public/img/spaceinvader.png) ![ghost](public/img/ghost.png) ![dolphin](public/img/dolphin.png) --- class: center, middle ![jeans](public/img/jeans.png) ![scissors](public/img/scissors.png) ![cool](public/img/sunglasses.png) ![escalator](public/img/escalator2.gif) --- class: center, middle # developer community and content manager --- class: center, middle # ?????lolwat ![confused malmutes](public/img/confused.gif) --- class: center, middle # if you don't understand how npm works ![fire](public/img/fire.png) ![fire](public/img/fire.png) ![fire](public/img/fire.png) --- class: center, middle # that's my problem ![grimacing](public/img/grimacing.png) --- class: center, middle # my job is to make *sense* ![money](public/img/money.png) --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 ![biggest day](public/img/biggest_day.png) --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 # more than 1.2 billion downloads over a week --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 ![one billion](public/img/billion.jpg-large) --- class: center, middle, stats background-image: url(public/img/pbn_ducks.jpg) background-color: #FFE4C4 ![numbers](public/img/numbers.png) --- class: center, middle, stats background-image: url(public/img/pbn_ocean.jpg) background-color: #FFE4C4 ![module counts](public/img/module-counts.png) .citation[source: http://modulecounts.com, accessed: 14 apr 2016] --- class: center, middle, stats background-image: url(public/img/pbn_ocean.jpg) background-color: #FFE4C4 # npm is the LARGEST PACKAGE MANAGER IN THE WORLD. --- class: center, middle ## stuff everybody knows # `npm install` --- class: center, middle ## stuff not everyone knows ![i dont know](public/img/idontknow.gif) --- class: top, left ## create a package.json # `npm init` - ### knows your deps from node_modules - ### knows your repository from git repo - ### always adds keys, never deletes ![chick](public/img/chick.png) --- class: top, left ## create a package.json with defaults # `npm init --yes` ![yes](public/img/yes.gif) --- class: top, left ## customize npm init questions # `~/.npm-init.js` ### enforce license and best practices ![question](public/img/question.png) ![art](public/img/art.png) ![question](public/img/question.png) --- class: top, left ## add deps from the CLI # `npm i --save` # `npm i --save-dev` ![disk](public/img/disk.png) ![disk](public/img/disk.png) ![disk](public/img/disk.png) --- class: top, left ## add deps from the CLI # `npm i -S` # `npm i -D` ![disk](public/img/disk.png) ![disk](public/img/haircut.png) ![disk](public/img/disk.png) --- class: center, middle ## just not connecting with npm3? ![pup fail](public/img/pup_fail.gif)
--- class: middle, center ## how npm3 works ![npm3](public/img/npm3.png) https://docs.npmjs.com/how-npm-works/npm3 --- class: middle, left ## show the dep tree # `npm ls` ![list](public/img/clipboard.png) ![tree](public/img/tree.png) ![list](public/img/clipboard.png) --- class: middle, left ## show just primary deps # `npm ls --depth=0` ![list](public/img/clipboard.png) ![list](public/img/seedling.png) ![list](public/img/clipboard.png) --- class: top, left ## npm... global cache? # `.npm/` ## modules are stored in the home directory ### ... but you can't use this offline because it still hits the network --- class: top, left ## npm install offline ### `npm install --cache-min 999999` ### we should probably just alias this to: ### `npm install --offline` ![money](public/img/cash.png) ![money](public/img/cash.png) ![money](public/img/cash.png) --- class: top, left ## npm install offline # `npm pack` ## `npm install my-pkg.tgz` ### create a tarball out of any package and then use install directly on the tarball ![shirt](public/img/shirt.png) ![soon](public/img/soon.png) ![suitcase](public/img/suitcase.png) --- class: top, left ## pack your deps! # `bundledDependencies` ### pack doesn't add your pkg's deps BUT ### bundled deps are added to the tarball! ![suitcase](public/img/suitcase.png) ![soon](public/img/soon.png) ![suitcase](public/img/suitcase.png) --- class: middle, left, dependencies - ## `dependencies` ![juggling](public/img/juggling.png) - ## `devDependencies` ![hammer wrench](public/img/hammer_wrench.png) - ## `optionalDependencies` ![ghost](public/img/shrug.png) - ## `peerDependencies` ![plug](public/img/plug.png) --- class: top, left ## lock down your deps # `npm shrinkwrap` ![shrinkwrap](public/img/shrinkwrap.gif) --- class: top, left ## lock down your deps # `npm shrinkwrap` - ### deploy to production EXACTLY what you used in dev - ### locks every version of every package and all dependencies in node_modules ![lock](public/img/lock.png) ![lock](public/img/lock.png) ![lock](public/img/lock.png) --- class: top, left ## update your shrinkwrap # `--save` and `--save-dev` ### - don't need to shrinkwrap everytime ### - new with npm3! ![lock-pen](public/img/lock-pen.png) ![new](public/img/new.png) ![lock-pen](public/img/lock-pen.png) --- class: center, middle # why not a default feature? --- class: middle, center # we believe in semver ![want to believe](public/img/wanttobelieve.jpg) --- class: top, left ## semver made easy # `npm version
` ### `types: major, minor, patch` - ### major: breaking changes - ### minor: feature add - ### patch: bug fix, docs --- class: top, left ## automate all the things # `npm run $anything` ### - `test`, `start` ### - customize! ![theater](public/img/theater.png) ![runner](public/img/runner.png) ![theater](public/img/theater.png) --- class: middle, center # lifecycle events ## automation that is context aware ![seedling](public/img/seedling.png) ![plant](public/img/plant.png) ![tree](public/img/tree.png) --- class: middle, center # run scripts are composable! ![score](public/img/score.png) ![score](public/img/score.png) ![score](public/img/score.png) --- class: middle, center # get stuff for free ### `devDependencies` are in path ### `config` and `package.json` as variables ![sparkles](public/img/sparkles.png) ![free](public/img/free.png) ![sparkles](public/img/sparkles.png) --- class: middle, center # scoped packages ## (fancy way of saying namespaced packages!) --- class: top, left ## scoped packages # `npm i @scope/name` ![telescope](public/img/telescope.png) -- ### scoped packages are private by default but you can make them public: ### `npm publish --access=public` --- class: middle, center # npm private modules ![lock](public/img/lock.png) -- ### (it's recursive! get it? get it?) -- npmnpmnpmnpmnpmnpmlolololololol --- class: top, left ## private modules ## `npm init --scope=
` ### Use your private modules side by side with modules from the public registry ![dancers](public/img/dancers.png) --- class: middle, center # managing access is hard... ![fail](public/img/fail.gif) --- class: top, left ## npm organizations # `npm team` - ### create teams and add members - ### grant and revoke access to packages via scopes ![team](public/img/team.png) --- class: top, left # npm on-site ## run your own on-premises npm registry ### `npm login` ### ` --registry=http://reg.amazing.com` ![office](public/img/office.png) ![runner](public/img/runner.png) --- class: middle, center ![npme addons](public/img/npme-addon.png) --- class: middle, center ## you want more ![insatiable](public/img/insatiable.gif) --- class: middle, center ## the npm CLI and Registry are for and by the community ![lightbulb](public/img/lightbulb.png) ![lightbulb](public/img/lightbulb.png) ![lightbulb](public/img/lightbulb.png) --- class: middle, center ## https://github.com/npm/registry/ ![registry-repo](public/img/registry-repo.png) --- class: middle, center # write a registry follower ![registry follower](public/img/follower.png) https://github.com/npm/registry/blob/master/docs/follower.md --- class: middle, center # https://replicate.npmjs.com --- class: middle, center ![npmstatus](public/img/npmstatus.png) --- class: middle, center ![the more you know](public/img/moreyouknow.jpg) --- class: middle, center # .real-big[npm
s you] --- class: center, middle # thanks! ## `me => @ag_dubs` ## bit.ly/node-live ![space invader](public/img/spaceinvader.png) ![ghost](public/img/ghost.png) ![dolphin](public/img/dolphin.png)