Commit e8f08d46 authored by Robert Knight's avatar Robert Knight

Switch from npm to yarn for package management

Yarn provides much faster package installation, better resilience to npm
registry connection issues and most importantly for us, a much better
lockfile format.

This commit:

1. Replaces the npm shrinkwrap with the yarn lockfile using the
   following steps:

   1. Checkout latest version of master

   2. Remove node_modules folder and re-run `npm install`

   3. Run `yarn import` to generate a lockfile

2. Modifies the Makefile, Jenkinsfile, package.json and .travis.yml
   scripts to run `yarn` instead of `npm`.
parent 7d041803
language: node_js
cache:
directories:
- node_modules
cache: yarn
notifications:
slack:
rooms:
......@@ -12,8 +10,8 @@ matrix:
# See https://github.com/hypothesis/client/pull/27#discussion_r70611726
- env: ACTION=lint
node_js: '6.2'
script: npm run lint
script: yarn run lint
- env: ACTION=test
node_js: '6.2'
after_success:
npm run report-coverage
yarn run report-coverage
......@@ -3,7 +3,7 @@
node {
checkout scm
nodeEnv = docker.image("node:6.2")
nodeEnv = docker.image("kkarczmarczyk/node-yarn:7.5")
workspace = pwd()
stage 'Build'
......@@ -24,7 +24,7 @@ node {
[$class: 'StringBinding', credentialsId: 'npm-token', variable: 'NPM_TOKEN']]) {
sh "echo '//registry.npmjs.org/:_authToken=${env.NPM_TOKEN}' >> \$HOME/.npmrc"
sh "npm publish"
sh "yarn publish"
}
}
......
......@@ -13,11 +13,11 @@ clean:
## Run test suite
.PHONY: test
test: node_modules/.uptodate
npm test
yarn test
.PHONY: lint
lint: node_modules/.uptodate
npm run lint
yarn run lint
.PHONY: docs
docs:
......@@ -26,8 +26,8 @@ docs:
################################################################################
build/manifest.json: node_modules/.uptodate
npm run-script build
yarn run build
node_modules/.uptodate: package.json npm-shrinkwrap.json
npm run-script deps 2>/dev/null || npm install
node_modules/.uptodate: package.json yarn.lock
yarn run deps 2>/dev/null || yarn install
@touch $@
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -150,6 +150,6 @@
"preversion": "./scripts/preversion.sh",
"version": "make clean all && ./scripts/update-changelog.js && git add CHANGELOG.md",
"postversion": "./scripts/postversion.sh",
"prepublish": "npm run-script build"
"prepublish": "yarn run build"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment