Skip to content

Commit 2045973

Browse files
committed
Auto merge of #2901 - Turbo87:yarn, r=jtgeibel
Switch from npm to yarn As discussed in the meeting on friday, yarn currently has better UX and allows us to use `resolutions` to work around transitive dependency version conflicts. This should unblock #2699, for example. r? `@jtgeibel`
2 parents f982088 + 68dfee5 commit 2045973

File tree

8 files changed

+15136
-29231
lines changed

8 files changed

+15136
-29231
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,26 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v2
2626

27-
- uses: actions/cache@v2
28-
with:
29-
path: ~/.npm
30-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
31-
restore-keys: |
32-
${{ runner.os }}-node-
33-
3427
- uses: actions/setup-node@v1
3528
with:
36-
node-version: '12.x'
29+
node-version: '14.x'
3730

3831
- name: Install node modules
39-
run: npm ci
32+
run: yarn install
4033

4134
- name: Lint
4235
run: |
43-
npm run lint:hbs
44-
npm run lint:js
45-
npm run lint:deps
36+
yarn lint:hbs
37+
yarn lint:js
38+
yarn lint:deps
4639
4740
- name: Run percy exec
4841
if: github.repository == 'rust-lang/crates.io'
4942
run: npx percy exec -- npm run test-coverage
5043

5144
- name: test-coverage
5245
if: github.repository != 'rust-lang/crates.io'
53-
run: npm run test-coverage
46+
run: yarn test-coverage
5447

5548
backend:
5649
name: Backend

.travis.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ branches:
1010

1111
cache:
1212
cargo: true
13-
directories:
14-
- $HOME/.npm
13+
yarn: true
14+
1515
before_cache: script/ci/prune-cache.sh
1616

1717
env:
@@ -59,17 +59,17 @@ jobs:
5959
- cargo test
6060
- name: Frontend
6161
language: node_js
62-
node_js: 12
62+
node_js: 14
6363
addons:
6464
chrome: stable
6565
install:
66-
- npm ci
66+
- yarn install
6767
before_script: skip
6868
script:
69-
- npm run lint:hbs
70-
- npm run lint:js
71-
- npm run lint:deps
72-
- if [ "$TRAVIS_REPO_SLUG" == "rust-lang/crates.io" ]; then percy exec -- npm run test-coverage; fi
69+
- yarn lint:hbs
70+
- yarn lint:js
71+
- yarn lint:deps
72+
- if [ "$TRAVIS_REPO_SLUG" == "rust-lang/crates.io" ]; then percy exec -- yarn test-coverage; fi
7373
- rust: beta
7474
script:
7575
- cargo test

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636
build:
3737
context: .
3838
dockerfile: frontend.Dockerfile
39-
entrypoint: npm run start -- --proxy http://backend:8888
39+
entrypoint: yarn start -- --proxy http://backend:8888
4040
links:
4141
- backend
4242
ports:

docs/CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ as well.
8888
In order to run the frontend on Windows and macOS, you will need to have installed:
8989

9090
- [node](https://nodejs.org/en/) >= 12.9.1 (see `package.json` and `.github/workflows/ci.yml` for what we currently use)
91-
- [npm](https://www.npmjs.com/get-npm) >= 6.10.2
91+
- [yarn](https://classic.yarnpkg.com/en/docs/install) v1.x
9292

9393
Follow the links for each of these tools for their recommended installation
9494
instructions. If you already have these tools, or you have a different
@@ -105,25 +105,25 @@ into any trouble.
105105
To install the npm packages that crates.io uses, run:
106106

107107
```
108-
npm install
108+
yarn install
109109
```
110110

111111
You'll need to run these commands any time the libraries or versions of these
112112
libraries that crates.io uses change. Usually you'll know they've changed
113113
because you'll run the next step and it will fail saying it can't find some
114114
libraries.
115115

116-
To build and serve the frontend assets, use the command `npm run start`. There
116+
To build and serve the frontend assets, use the command `yarn start`. There
117117
are variations on this command that change which backend your frontend tries to
118118
talk to:
119119

120120
| Command | Backend | Use case |
121121
|---------|---------|----------|
122-
| `npm run start:live` | https://crates.io | Testing UI changes with the full live site's data |
123-
| `npm run start:staging` | https://staging-crates-io.herokuapp.com | Testing UI changes with a smaller set of realistic data |
124-
| `npm run start` | Static fixture test data in `mirage/fixtures` | Setting up particular situations, see note |
125-
| `npm run start:local` | Backend server running locally | See the Working on the backend section for setup |
126-
| `npm run start -- --proxy https://crates.io` | Whatever is specified in `--proxy` arg | If your use case is not covered here |
122+
| `yarn start:live` | https://crates.io | Testing UI changes with the full live site's data |
123+
| `yarn start:staging` | https://staging-crates-io.herokuapp.com | Testing UI changes with a smaller set of realistic data |
124+
| `yarn start` | Static fixture test data in `mirage/fixtures` | Setting up particular situations, see note |
125+
| `yarn start:local` | Backend server running locally | See the Working on the backend section for setup |
126+
| `yarn start -- --proxy https://crates.io` | Whatever is specified in `--proxy` arg | If your use case is not covered here |
127127

128128
> Note: If you want to set up a particular situation, you can edit the fixture
129129
> data used for tests in `mirage/fixtures`. The fixture data does not currently
@@ -135,7 +135,7 @@ talk to:
135135
You can run the frontend tests with:
136136

137137
```
138-
npm test
138+
yarn test
139139
```
140140

141141
### Working on the Backend
@@ -362,7 +362,7 @@ without a restart needed, and you can leave the frontend running while you
362362
restart the server):
363363
364364
```
365-
npm run start:local
365+
yarn start:local
366366
```
367367
368368
And then you should be able to visit http://localhost:4200!

frontend.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
FROM node:12.9-alpine
22

33
WORKDIR /app
4-
COPY package.json package-lock.json /app/
4+
COPY package.json yarn.lock /app/
55

6-
RUN npm install
6+
RUN yarn install
77

88
COPY . /app
99

10-
ENTRYPOINT ["npm", "run", "start:staging"]
10+
ENTRYPOINT ["yarn", "start:staging"]

0 commit comments

Comments
 (0)