Skip to content

Commit ede9e6a

Browse files
committed
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`.
1 parent 99e385b commit ede9e6a

File tree

6 files changed

+6014
-7571
lines changed

6 files changed

+6014
-7571
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: node_js
2-
cache:
3-
directories:
4-
- node_modules
2+
cache: yarn
53
notifications:
64
slack:
75
rooms:
@@ -12,8 +10,8 @@ matrix:
1210
# See https://github.com/hypothesis/client/pull/27#discussion_r70611726
1311
- env: ACTION=lint
1412
node_js: '6.2'
15-
script: npm run lint
13+
script: yarn run lint
1614
- env: ACTION=test
1715
node_js: '6.2'
1816
after_success:
19-
npm run report-coverage
17+
yarn run report-coverage

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
node {
44
checkout scm
55

6-
nodeEnv = docker.image("node:6.2")
6+
nodeEnv = docker.image("kkarczmarczyk/node-yarn:7.5")
77
workspace = pwd()
88

99
stage 'Build'
@@ -24,7 +24,7 @@ node {
2424
[$class: 'StringBinding', credentialsId: 'npm-token', variable: 'NPM_TOKEN']]) {
2525

2626
sh "echo '//registry.npmjs.org/:_authToken=${env.NPM_TOKEN}' >> \$HOME/.npmrc"
27-
sh "npm publish"
27+
sh "yarn publish"
2828
}
2929
}
3030

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ clean:
1313
## Run test suite
1414
.PHONY: test
1515
test: node_modules/.uptodate
16-
npm test
16+
yarn test
1717

1818
.PHONY: lint
1919
lint: node_modules/.uptodate
20-
npm run lint
20+
yarn run lint
2121

2222
.PHONY: docs
2323
docs:
@@ -26,8 +26,8 @@ docs:
2626
################################################################################
2727

2828
build/manifest.json: node_modules/.uptodate
29-
npm run-script build
29+
yarn run build
3030

31-
node_modules/.uptodate: package.json npm-shrinkwrap.json
32-
npm run-script deps 2>/dev/null || npm install
31+
node_modules/.uptodate: package.json yarn.lock
32+
yarn run deps 2>/dev/null || yarn install
3333
@touch $@

0 commit comments

Comments
 (0)