`
### `types: major, minor, patch`
- ### major: breaking changes
- ### minor: feature add
- ### patch: bug fix, docs
---
class: center, middle
# npm wants to make your life easy
---
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
![lifecycle events](public/img/lifecycleevents.png)
![seedling](public/img/seedling.png)
![plant](public/img/plant.png)
![tree](public/img/tree.png)
---
class: middle, center
## `npm i --save-dev husky`
![husky](public/img/husky.png)
![husky](public/img/husky2.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
# `npm run env`
### `config` and `package.json` as variables
![sparkles](public/img/sparkles.png)
![free](public/img/free.png)
![sparkles](public/img/sparkles.png)
---
class: middle, center
# `npm i -D shelljs`
![shelljs](public/img/shelljs.png)
---
class: center, middle
# never install something globally again
---
class: middle, center
# why run scripts?
--
# because they are **versioned**
---
class: top, left
# let's look at an example
{
"...": "...",
"scripts": {
"test": "npm run test:backend && npm run test:frontend",
"posttest": "standard",
"test:backend": "lab --verbose --assert code --timeout 5000",
"test:frontend": "karma start",
"...": "..."
},
"devDependencies": {
"...": "...",
"karma": "^1.1.1",
"lab": "^13.0.1",
"standard": "^10.0.2",
"...": "..."
}
}
---
class: center, middle
background-image: url(public/img/pbn_barn.jpg)
background-color: #FFE4C4
![publishes](public/img/publishes.png)
---
class: center, middle
background-image: url(public/img/pbn_barn.jpg)
background-color: #FFE4C4
# 39,692 publishes/week
---
class: center, middle
background-image: url(public/img/pbn_barn.jpg)
background-color: #FFE4C4
![new packages](public/img/new_pkgs.png)
---
class: center, middle
background-image: url(public/img/pbn_barn.jpg)
background-color: #FFE4C4
# 4,685 new packages last week
---
class: center, middle
background-image: url(public/img/pbn_horses.jpg)
background-color: #FFE4C4
# ~160 people publish their first package every week
---
class: center, middle
background-image: url(public/img/pbn_horses.jpg)
background-color: #FFE4C4
# 102,460 publishers
---
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: center, middle
# check your package before you publish!
# `npm pack`
# `tar xvzf pkg.tar.gz`
---
class: center, middle
# `np` by sindresorhus
![np](public/img/np.gif)
.citation[https://github.com/sindresorhus/np]
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
# unpublishes
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
# left-pad
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
![left-pad](public/img/left-pad.png)
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
![policy](public/img/policy.png)
#### [http://blog.npmjs.org/post/141905368000/changes-to-npms-unpublish-policy](http://blog.npmjs.org/post/141905368000/changes-to-npms-unpublish-policy)
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
# you can only unpublish within 24hrs
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
![meta issue](public/img/metaissue.png)
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
# dissociate and deprecate
---
class: middle, center
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
![npm deprecate](public/img/npm-deprecate.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: center, middle
# we now have search and download stat support for scopes!
![](public/img/sparkles.png)
![](public/img/new.png)
![](public/img/sparkles.png)
---
class: center, middle
![old bug](public/img/oldbug.png)
---
class: center, middle
# you *already* have a scope!
## (hint: it's your user name!)
---
class: top, left
## private packages
## `npm init --scope=`
### Use your private modules side by side with modules from the public registry
![lock](public/img/lock.png)
![dancers](public/img/dancers.png)
![lock](public/img/lock.png)
---
class: top, left
## npm organizations
# `npm team`
- ### create teams and add members
- ### grant and revoke access to packages via teams
![team](public/img/team.png)
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
# the registry is immutable
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
# the registry is reliable
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
![reliable](public/img/reliable.png)
# [http://ping.npmjs.com/](http://ping.npmjs.com/)
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
# the registry is fast
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
![fast](public/img/fast.png)
---
class: center, middle
background-image: url(public/img/pbn_swans.jpg)
background-color: #FFE4C4
## on an empty cache
# the registry is ~75% faster than git
---
class: center, middle
background-image: url(public/img/pbn_ocean.jpg)
background-color: #FFE4C4
# the registry is HUGE
---
class: center, middle
background-image: url(public/img/pbn_ocean.jpg)
background-color: #FFE4C4
![module counts](public/img/module-counts.png)
.citation[source: http://modulecounts.com, accessed: 29 nov 2016]
---
class: center, middle
background-image: url(public/img/pbn_ocean.jpg)
background-color: #FFE4C4
# npm is the largest package registry IN THE WORLD
---
class: top, left
# npm on-site
## run your own on-premises npm registry
### `npm login`
### ` --registry=http://reg.amazing.com`
![runner](public/img/runner.png)
![office](public/img/office.png)
![runner](public/img/runner.png)
---
class: middle, center
![npme addons](public/img/npme-addon.png)
---
class: center, middle
background-image: url(public/img/pbn_field.jpg)
background-color: #FFE4C4
# npm is being used for a lot of things we never expected
---
class: center, middle
background-image: url(public/img/pbn_field.jpg)
background-color: #FFE4C4
![greenkeeper](public/img/greenkeeper.png)
---
class: center, middle
background-image: url(public/img/pbn_field.jpg)
background-color: #FFE4C4
![npms](public/img/npms.png)
---
class: center, middle
background-image: url(public/img/pbn_field.jpg)
background-color: #FFE4C4
![yarn](public/img/yarn.jpg)
---
class: center, middle
background-image: url(public/img/pbn_field.jpg)
background-color: #FFE4C4
![cnpm](public/img/cnpm.png)
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
# and so can you!
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
# public APIs
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
# downloads API
![blog downloads](public/img/blogdownloads.png)]
.citation[http://blog.npmjs.org/post/92574016600/numeric-precision-matters-how-npm-download-counts]
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
![](public/img/downloadsapi1.png)
![](public/img/downloadsapi2.png)
![](public/img/downloadsapi3.png)
.citation[https://github.com/npm/registry/blob/master/docs/download-counts.md]
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
# search API
![search api](public/img/searchapi.png)
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
# registry changes-stream
# [https://replicate.npmjs.com](https://replicate.npmjs.com)
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
## write a registry follower
![follower](public/img/follower.png)
#### [https://github.com/npm/registry/blob/master/docs/follower.md](https://github.com/npm/registry/blob/master/docs/follower.md)
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
# webhooks
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
## [https://github.com/npm/registry/](https://github.com/npm/registry/)
![registry repo](public/img/registry-repo.png)
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
# we are so excited to see what you build
---
class: center, middle
# update your npm!
# `npm i npm@latest -g`
---
class: center, middle
# you can use any npm with any node version
--
# so you should always use the most up to date version
---
class: center, middle
background-image: url(public/img/pbn_ship.jpg)
background-color: #FFE4C4
![npm](public/img/npm.png)
---
class: center, middle
# thanks!
## `me => @ag_dubs`
## bit.ly/fwdays-2017
![space invader](public/img/spaceinvader.png)
![ghost](public/img/ghost.png)
![dolphin](public/img/dolphin.png)