Abstractions, 2016-08-20
Laurie Voss
COO,
@seldo
...answers such questions as...
"What is this npm thing?"
"...and why should I care?"
...answers such questions as...
"What do people use npm to do?"
"What can I do besides npm install?"
...answers such questions as...
"What is npm going to do next?"
"I want to hear somebody incorrectly predict the future of JavaScript"
You may find them useful!
True story: I am literally in charge of marketing at npm.
Breaking
Feature
Fix
major
minor
patch
https://nolanlawson.com/2016/08/15/the-cost-of-small-modules/
a lot faster
npm install -g npm
npm init
npm init --yes
npm init --scope=myusername npm install @myusername/mypackage var x = require('@myusername/mypackage')
npm install --save npm install -S npm install --save-dev npm install -D
npm install --production
npm config set cache-min 60
npm install --cache-min 999999
npm start
npm stop
npm restart
npm test
npm publish
npm publish --access=public
npm publish --access=restricted
npm version major
npm version minor
npm version patch
npm version major -m "bump to version %s"
NOT A GUARANTEE
npm team
npm access
npm team create
npm team destroy
npm team add
npm team rm
npm team ls
npm access grant npm access revoke npm access ls-packages npm access ls-collaborators
npm link
Inside foo:
npm link
Inside bar:
npm link foo
npm publish --tag
npm dist-tag
npm publish --tag <tag> npm install <pkg>@<tag>
e.g. npm install npm@next
npm dist-tag add npm dist-tag rm npm dist-tag ls
npm install --tag
npm unpublish <pkg>@<version>
(duhn-duhn-duuuuuuuuuhn)
npm deprecate <pkg>@<version>
the kinder, gentler unpublish
Package Current Wanted Latest Location
domutils 1.3.0 1.3.0 1.5.1 @npm/testnpm
handlebars 1.3.0 1.3.0 4.0.5 @npm/testnpm
hbsfy 1.3.2 1.3.2 2.7.0 @npm/testnpm
"npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
"preinstall": "npm run npmcheckversion",
"prebuild": "npm run test && npm run build:clean",
"build:clean": "rimraf ./build/*",
"build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p",
"analyze": "node ./internals/scripts/analyze.js",
"start": "cross-env NODE_ENV=development node server",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
"start:production": "npm run build && npm run start:prod",
"start:prod": "cross-env NODE_ENV=production node server",
"pagespeed": "node ./internals/scripts/pagespeed.js",
"presetup": "npm i chalk",
"setup": "node ./internals/scripts/setup.js",
"clean": "shjs ./internals/scripts/clean.js",
"generate": "plop --plopfile internals/generators/index.js",
"lint": "npm run lint:js && npm run lint:css",
"lint:js": "eslint . --ignore-path .gitignore --ignore-pattern internals/scripts",
"lint:css": "stylelint ./app/**/*.css",
"lint:staged": "lint-staged",
"pretest": "npm run lint",
Don't read this. Just remember "there were lots of examples."
npm_package_name npm_package_version npm_package_dependencies_request npm_package_dependencies_express npm_config_node_version npm_config_registry
{
"name": "foo",
"config": {
"port": "80"
}
}
npm config set foo:port 8080
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
per-project: /path/to/my/project/.npmrc
per-user: ~/.npmrc
npm install wombat -g
Fired on:
wombat hook add @me/foo https://my.co/myhook some-secret
wombat hook ls
wombat hook update
wombat hook rm
node
jQuery
Grunt
Gulp
Ionic
Cordova
Nodebots
Babel
Electron
TypeScript 2
Angular
Ember
React
Pebble
Try npms.io, it's great!
Node Security Project
npm install nsp -g nsp check
Greenkeeper.io
export const sqrt = Math.sqrt;
export function square(x) {
return x * x;
}
import square from 'mylibrary'
exports.sqrt = Math.sqrt;
exports.square = function(x) {
return x * x;
}
var square = require('mylibrary').square
That's really a domain!
YOU
Slides are here:
Good hallway questions get shirts & socks!