Skip to content

Commit

Permalink
Move from npm cli -> yarn
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
steveklabnik committed Oct 11, 2016
1 parent 6bf8da3 commit 955462c
Show file tree
Hide file tree
Showing 5 changed files with 5,737 additions and 27 deletions.
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@ sudo: false

cache:
directories:
- node_modules
- $HOME/.yarn-cache

before_install:
- nvm install 4.6.0
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
- "npm config set spin false"
- "npm install -g npm@^2"
- npm config set spin false
- npm install -g yarn

install:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
- npm install -g bower
- npm install
- bower install
- yarn
- yarn run bower install

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

script:
- cargo build
- cargo test
- npm test
- yarn test

after_success:
- travis-cargo coveralls --no-sudo
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ This project is built on ember-cli and cargo, visit

## Working on the Frontend

```
```bash
git clone https://github.com/rust-lang/crates.io.git
cd crates.io/
npm install
npm install -g ember-cli bower
bower install
npm install -g yarn # if you don't have yarn
yarn
yarn run bower install
```

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

```bash
npm run start:staging
yarn run start:staging
```

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

```bash
npm start -- --proxy https://crates.io
yarn start -- --proxy https://crates.io
# or
npm run start:live
yarn run start:live
```

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

```
ember test
ember test --server
yarn run ember test
yarn run ember test --server
```

## Working on the Backend
Expand Down Expand Up @@ -97,7 +97,7 @@ follows:
6. **Optionally** start a local frontend:

```
npm run start:local
yarn run start:local
```

### Running Tests
Expand Down
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "cargo",
"dependencies": {
"Faker": "~3.0.0",
"ember": "~2.6.0",
"ember-cli-moment-shim": "~0.1.0",
"ember-cli-shims": "0.1.1",
"ember-cli-test-loader": "0.2.2",
"ember-load-initializers": "0.1.7",
Expand All @@ -10,13 +12,11 @@
"ember-resolver": "~0.1.20",
"jquery": "1.11.3",
"loader.js": "ember-cli/loader.js#3.4.0",
"qunit": "~1.20.0",
"ember-cli-moment-shim": "~0.1.0",
"lodash": "~3.7.0",
"moment": ">= 2.8.0",
"moment-timezone": ">= 0.1.0",
"normalize-css": "~3.0.3",
"pretender": "~1.1.0",
"lodash": "~3.7.0",
"Faker": "~3.0.0"
"qunit": "~1.20.0"
}
}
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"test": "tests"
},
"scripts": {
"build": "ember build",
"start": "ember server",
"start:local": "ember server --proxy http://127.0.0.1:8888",
"start:staging": "ember server --proxy https://staging-crates-io.herokuapp.com",
"start:live": "ember server --proxy https://crates.io",
"test": "ember test"
"build": "yarn run ember build",
"start": "yarn run ember server",
"start:local": "yarn run ember server --proxy http://127.0.0.1:8888",
"start:staging": "yarn run ember server --proxy https://staging-crates-io.herokuapp.com",
"start:live": "yarn run ember server --proxy https://crates.io",
"test": "yarn run ember test"
},
"repository": "",
"engines": {
Expand All @@ -21,6 +21,7 @@
"author": "",
"license": "MIT",
"devDependencies": {
"bower": "^1.7.9",
"broccoli-asset-rev": "^2.4.2",
"ember-ajax": "^2.0.1",
"ember-cli": "2.8.0",
Expand Down
Loading

0 comments on commit 955462c

Please sign in to comment.