Skip to content

Commit 2ef285e

Browse files
committed
Move from npm cli -> yarn
yarn is a new cli for the npm registry from Facebook, Google, and Tilde. It's patterned after Cargo, and @wycats was involved in making it. The big things we care about here: 1. It is faster. 30s vs 45 for npm cli on my mcahine. 2. It has a lockfile. Cargo has a lockfile. Lockfiles are good. This commit moves development over to yarn. Some changes: Instead of needing to `npm install -g` things, we can instead include them in our `package.json`, and use `yarn run`. This doesn't pollute the global environment, which is a win! The README and .travis.yml are updated accordingly.
1 parent 6bf8da3 commit 2ef285e

File tree

5 files changed

+5737
-27
lines changed

5 files changed

+5737
-27
lines changed

.travis.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,26 @@ sudo: false
44

55
cache:
66
directories:
7-
- node_modules
7+
- $HOME/.yarn-cache
88

99
before_install:
1010
- nvm install 4.6.0
1111
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
12-
- "npm config set spin false"
13-
- "npm install -g npm@^2"
12+
- npm config set spin false
13+
- npm install -g yarn
1414

1515
install:
1616
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
17-
- npm install -g bower
18-
- npm install
19-
- bower install
17+
- yarn
18+
- yarn run bower install
2019

2120
before_script:
2221
- psql -c 'create database cargo_registry_test;' -U postgres
2322

2423
script:
2524
- cargo build
2625
- cargo test
27-
- npm test
26+
- yarn run ember test
2827

2928
after_success:
3029
- travis-cargo coveralls --no-sudo

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ This project is built on ember-cli and cargo, visit
99

1010
## Working on the Frontend
1111

12-
```
12+
```bash
1313
git clone https://github.com/rust-lang/crates.io.git
1414
cd crates.io/
15-
npm install
16-
npm install -g ember-cli bower
17-
bower install
15+
npm install -g yarn # if you don't have yarn
16+
yarn
17+
yarn run bower install
1818
```
1919

2020
The website's frontend is built with [Ember.js](http://emberjs.com/). This
2121
makes it possible to work on the frontend without running a local backend.
2222
To start the frontend run:
2323

2424
```bash
25-
npm run start:staging
25+
yarn run start:staging
2626
```
2727

2828
This will run a local frontend using the staging backend (hosted on Heroku at
@@ -37,9 +37,9 @@ specify arguments to `npm start`. For example you can set the proxy to
3737
To do this, run:
3838

3939
```bash
40-
npm start -- --proxy https://crates.io
40+
yarn start -- --proxy https://crates.io
4141
# or
42-
npm run start:live
42+
yarn run start:live
4343
```
4444

4545
**Note**: This requires npm 2.
@@ -52,8 +52,8 @@ phantomjs-prebuilt`.
5252
Then run the tests with:
5353

5454
```
55-
ember test
56-
ember test --server
55+
yarn run ember test
56+
yarn run ember test --server
5757
```
5858

5959
## Working on the Backend
@@ -97,7 +97,7 @@ follows:
9797
6. **Optionally** start a local frontend:
9898
9999
```
100-
npm run start:local
100+
yarn run start:local
101101
```
102102
103103
### Running Tests

bower.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "cargo",
33
"dependencies": {
4+
"Faker": "~3.0.0",
45
"ember": "~2.6.0",
6+
"ember-cli-moment-shim": "~0.1.0",
57
"ember-cli-shims": "0.1.1",
68
"ember-cli-test-loader": "0.2.2",
79
"ember-load-initializers": "0.1.7",
@@ -10,13 +12,11 @@
1012
"ember-resolver": "~0.1.20",
1113
"jquery": "1.11.3",
1214
"loader.js": "ember-cli/loader.js#3.4.0",
13-
"qunit": "~1.20.0",
14-
"ember-cli-moment-shim": "~0.1.0",
15+
"lodash": "~3.7.0",
1516
"moment": ">= 2.8.0",
1617
"moment-timezone": ">= 0.1.0",
1718
"normalize-css": "~3.0.3",
1819
"pretender": "~1.1.0",
19-
"lodash": "~3.7.0",
20-
"Faker": "~3.0.0"
20+
"qunit": "~1.20.0"
2121
}
2222
}

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
"test": "tests"
88
},
99
"scripts": {
10-
"build": "ember build",
11-
"start": "ember server",
12-
"start:local": "ember server --proxy http://127.0.0.1:8888",
13-
"start:staging": "ember server --proxy https://staging-crates-io.herokuapp.com",
14-
"start:live": "ember server --proxy https://crates.io",
15-
"test": "ember test"
10+
"build": "yarn run ember build",
11+
"start": "yarn run ember server",
12+
"start:local": "yarn run ember server --proxy http://127.0.0.1:8888",
13+
"start:staging": "yarn run ember server --proxy https://staging-crates-io.herokuapp.com",
14+
"start:live": "yarn run ember server --proxy https://crates.io",
15+
"test": "yarn run ember test"
1616
},
1717
"repository": "",
1818
"engines": {
@@ -21,6 +21,7 @@
2121
"author": "",
2222
"license": "MIT",
2323
"devDependencies": {
24+
"bower": "^1.7.9",
2425
"broccoli-asset-rev": "^2.4.2",
2526
"ember-ajax": "^2.0.1",
2627
"ember-cli": "2.8.0",

0 commit comments

Comments
 (0)