Nodevember, 2017-11-27
COO & co-founder, npm Inc.
@seldo
aka Your Grandfather's Axe
(If ancient Greeks had computers, would they have had a year 100 bug?)
50% of npm's users have been using it for less than a year.
npm's goal:
Part 1:
npm install npm -g
Get npm 5 right now:
If you aren't using it already, you should.
package-lock.json produces perfectly reproducible builds, every time.
Breaking
Feature
Fix
major
minor
patch
dependencies: {
"abbrev": "1.1.1",
"lodash": "~1.4.1",
"mysql": "^2.3.5",
"qs": "*"
}
Not so great for shipping software
Shrinkwrap is for never.
Do not use shrinkwrap.
No more need for npm install --save
npm install --offline
npm install --prefer-offline
Learn more:
npm install @yourname/yourpkg
@yourname/yourpkg
var yourpkg = require('@yourname/yourpkg')
Install:
Use:
Search was a gift from the community!
Most commonly asked question:
"How do you folks make money, exactly?"
You should try them. You'll like them.
publish: prepublish, publish, postpublish install: preinstall, install, postinstall uninstall: preuninstall, uninstall, postuninstall version: preversion, version, postversion test: pretest, test, posttest stop: prestop, stop, poststop start: prestart, start, poststart restart: prerestart, restart, postrestart
Because they have to yell at each other less often
npx create-react-app
npx serve
npx npm-check -u
🌟
😮
Part 2:
This is why npm is so popular!
exports = function() {
...
}
var mod = require('filename')
Define:
Use:
So naturally, we have to change everything.
I was just getting the hang of this!
export function square(x) {
return x * x;
}
import {square} from 'filename'
Define:
Use:
<script type="module">
import './lib' import 'lib'
Webpack + Babel | ES6 modules | |
---|---|---|
ES6 syntax |
Yes | Yes |
Static analysis | Yes | Yes |
Code splitting | Hard | Hard |
Transpilation | Required | Required |
Bundling | Required | Recommended |
How to get:
by writing some terrible software
It's only a website.
One more thing...
@seldo
These slides
Talk to me