Skip to content

Commit

Permalink
Switch to yarn for installing dependencies
Browse files Browse the repository at this point in the history
This seems more intuitive to me today, and I hope will make it easier
for contributors who want to add or upgrade plugins.

Note: this is using nightly yarn, because there's a fix for Circle CI +
Docker + Yarn compatibility that is made but not officially released
yet. We can switch to stable yarn once 0.18.0 leaves pre-release. The
fix was PR 1837 on the Yarn repo.
  • Loading branch information
maxjacobson committed Dec 14, 2016
1 parent bff5918 commit 2677b13
Show file tree
Hide file tree
Showing 6 changed files with 1,362 additions and 1,055 deletions.
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# Contributing

## Adding and upgrading plugins

When adding or upgrading a plugin, we should see changes in both `package.json`
and `yarn.lock`.

Make sure to run `make image` before running these commands.

Add a plugin:

```
bin/yarn add eslint-config-google
```

Upgrade a plugin:

```
bin/yarn upgrade eslint-config-google
```

## Testing Changes

Changes made to the engine can be tested locally.

1. Install [the CodeClimate CLI](https://github.com/codeclimate/codeclimate).
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ FROM node:6.5.0-slim
MAINTAINER Code Climate <[email protected]>

WORKDIR /usr/src/app
COPY package.json npm-shrinkwrap.json /usr/src/app/
COPY package.json yarn.lock /usr/src/app/

RUN apt-get update && \
apt-get install -y git jq && \
npm install && \
RUN apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg && \
echo "deb http://nightly.yarnpkg.com/debian/ nightly main" | tee /etc/apt/sources.list.d/yarn-nightly.list && \
apt-get update && \
apt-get install -y git jq yarn && \
yarn install && \
git clone https://github.com/eslint/eslint.git && \
ESLINT_DOCS_VERSION=`npm -j ls eslint | jq -r .dependencies.eslint.version` && \
cd eslint && \
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: image test citest shrinkwrap
.PHONY: image test citest

IMAGE_NAME ?= codeclimate/codeclimate-eslint

Expand All @@ -10,7 +10,3 @@ test: image

citest:
docker run --rm $(IMAGE_NAME) sh -c "cd /usr/src/app && npm run test"

shrinkwrap: image
docker run --rm --workdir /usr/src/app $(IMAGE_NAME) sh -c \
'npm shrinkwrap >/dev/null && cat npm-shrinkwrap.json' > npm-shrinkwrap.json
6 changes: 6 additions & 0 deletions bin/yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

IMAGE_NAME=${IMAGE_NAME:-codeclimate/codeclimate-eslint}
docker run --rm --volume "$PWD:/usr/src/app" "$IMAGE_NAME" sh -c "cd /usr/src/app && yarn $*"
Loading

0 comments on commit 2677b13

Please sign in to comment.