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 6c4bfa4 commit 5fd86c5
Show file tree
Hide file tree
Showing 6 changed files with 1,224 additions and 938 deletions.
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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).
1. Create the image (customizing the `IMAGE_NAME` as needed):
```bash
IMAGE_NAME=codeclimate/codeclimate-eslint-test make image
```
1. Add the engine to your test `.codeclimate.yml`:
```yaml
engines:
eslint-test:
enabled: true
```
1. Run analyze via the CLI:
```bash
codeclimate analyze --dev
```
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ FROM node:6.3.1-slim
MAINTAINER Code Climate <[email protected]>

WORKDIR /usr/src/app
COPY npm-shrinkwrap.json /usr/src/app/
COPY package.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 5fd86c5

Please sign in to comment.