Oh, the things

you can do!

WaffleJS, 2017-09-06

npm: it's popular!

How does npm make money?

Private package hosting: $7/user/month

This is about what's new in npm 5

1: npm 5 is hella fast

5 fast facts about npm 5

npm i npm -g

2: it locks by default

5 fast facts about npm 5

package-lock.json

3: it saves by default

5 fast facts about npm 5

  • no more --save
  • you can use --no-save to over-ride

4: the cache

is way better

5 fast facts about npm 5

5: it works offline

5 fast facts about npm 5

npm is for front-end

bonus fact

Front-end development is a focus for npm

Using npm 5

npm init

npx?

> npm install -g cat-fact
> cat-fact

The biggest wildcat today is the Siberian Tiger

Old and busted:

> npx cat-fact

A cat has 230 bones in its body

New hotness:

Let's create a react app!

> npx create-react-app
> npm start

next.js

Angular

npx -p yo -p generator-karma -p generator-angular -- yo angular

What?

Who?

npx -p

npx -p yo -p generator-karma -p generator-angular -- yo angular

pkg1

pkg2

pkg3

npx pkg -- --some-args

npx -p yo -p generator-karma -p generator-angular -- yo angular

args

Vue

npx vue-cli init pwa myapp
cd ./myapp
npm install
npm run dev

or

npx vue-cli init pwa myapp && cd ./myapp && npm install && npm run dev

Ember

npx ember-cli new foo
cd ./foo
npx ember-cli serve

Node.js

npx -p yo -p generator-node -- yo node
  • Jest unit testing
  • ESLint linting
  • NSP security checking
  • Travis CI integration

Serve static files

npx serve

Dev Dependencies

npm install --save-dev grunt
npm install -D grunt

Exclude dev dependencies in production:

npm install --production

Keep your dependencies close

(and your dev dependencies closer)

npx runs dev deps

npx grunt

Just as fast as a global install!

run scripts

npm update

npx npm-check -u

updates within semver ranges

asks you if you want breaking changes too

npm in CI

Could npm be better in CI?

cipm

Shout out to @mikesherov for his work on this!

Just getting started

Thank you!

Come find me for stickers or questions!