Skip to content

Commit

Permalink
Migrate to yarn package manager
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Jan 22, 2019
1 parent 403b7ba commit 4c72cb5
Show file tree
Hide file tree
Showing 12 changed files with 16,734 additions and 22,349 deletions.
30 changes: 15 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ jobs:
<<: *defaults
steps:
- run:
name: "Show npm and node versions"
name: "Show yarn and node versions"
command: |
node --version
npm --version
yarn --version
- checkout
# Download and cache dependencies
- run: npm ci
- run: yarn
- run:
name: "Make sure lock file is still the same"
command: 'git diff --exit-code package-lock.json > /dev/null || (echo -e "New package lock file at $(cat package-lock.json | curl -F c=@- https://ptpb.pw | grep url) (include this file in your PR to fix this test)"; git diff --exit-code package-lock.json; exit 1)'
command: 'git diff --exit-code yarn.lock > /dev/null || (echo -e "New package lock file at $(cat yarn.lock | curl -F c=@- https://ptpb.pw | grep url) (include this file in your PR to fix this test)"; git diff --exit-code yarn.lock; exit 1)'
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package-lock.json" }}
key: v1-dependencies-{{ checksum "yarn.lock" }}
- run:
name: "Run build"
command: 'npm run build'
command: 'yarn run build'

api_sync:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}
- v1-dependencies-{{ checksum "yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
# check that all api responses are still the same
Expand All @@ -50,15 +50,15 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}
- v1-dependencies-{{ checksum "yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: "Run build"
command: 'npm run build'
command: 'yarn run build'
# run tests!
- run:
command: "npm test"
command: "yarn run test"
environment:
JUNIT_REPORT_PATH: ./junit/
JUNIT_REPORT_NAME: test-results.xml
Expand All @@ -74,21 +74,21 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}
- v1-dependencies-{{ checksum "yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: "Run build"
command: 'npm run build'
command: 'yarn run build'
- run:
name: "Install http server"
command: "npm i http-server"
command: "yarn add http-server"
- run:
name: "Spin up frontend repo and run end to end tests"
command: |
./node_modules/http-server/bin/http-server --cors dist/ -p 3000 & \
cd end-to-end-tests && \
npm ci && \
yarn install --frozen-lockfile && \
./node_modules/webdriver-manager/bin/webdriver-manager update --versions.chrome '2.42' && \
./node_modules/webdriver-manager/bin/webdriver-manager start --versions.chrome '2.42' & \
./scripts/env_vars.sh && \
Expand All @@ -102,7 +102,7 @@ jobs:
curl http://localhost:3000 > /dev/null && \
sleep 1s && \
cd end-to-end-tests && \
npm run test-webdriver-manager
yarn run test-webdriver-manager
environment:
JUNIT_REPORT_PATH: ./junit/
FRONTEND_TEST_USE_LOCAL_DIST: true
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ Remove old compiled `node_modules` if exists
rm -rf node_modules
```

To install all app and dev dependencies
To install all app and dev dependencies
```
npm install
yarn install --frozen-lockfile
```

To build DLLs in common-dist folder (must be done prior to start of dev server)
```
npm run buildDLL:dev
yarn run buildDLL:dev
```

To start dev server with hot reload enabled
Expand All @@ -44,7 +44,7 @@ To start dev server with hot reload enabled
# from
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs by editing env/custom.sh
npm run start
yarn run start
```

Example pages:
Expand All @@ -53,22 +53,22 @@ Example pages:

To run unit/integration tests (need to have API URL defined in `.env`)
```
npm run test
yarn run test
```

To run unit/integration tests in watch mode
```
npm run test:watch
yarn run test:watch
```

To run unit/integration tests in watch mode (where specName is a fragment of the name of the spec file (before .spec.))
```
npm run test:watch -- --grep=#specName#
yarn run test:watch -- --grep=#specName#
```

To run linting
```
npm run lint
yarn run lint
```

## precommit hook
Expand All @@ -88,8 +88,8 @@ endpoint works with the checked in client by changing the API URL in
# from
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs by editing env/custom.sh
npm run updateAPI
npm run test
yarn run updateAPI
yarn run test
```

## Check in cBioPortal context
Expand Down Expand Up @@ -117,7 +117,7 @@ Change `x` to the number of your pull request.

Install webdriver-manager, which manages standalone Selenium installation:
```
npm install -g webdriver-manager
yarn install -g webdriver-manager
```
Run updater to get necessary binaries
```
Expand All @@ -134,7 +134,7 @@ In one terminal run frontend (this will get mounted inside whatever
# from
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs by editing env/custom.sh
npm run start
yarn run start
```
In another terminal run the e2e tests
```bash
Expand All @@ -143,6 +143,6 @@ In another terminal run the e2e tests
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs in env/custom.sh
cd end-to-end-tests
npm install
npm run test-webdriver-manager
yarn install
yarn run test-webdriver-manager
```
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"keywords": ["react", "redux", "cancer", "genomics"],
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-nodejs#v91"
"url": "https://github.com/heroku/heroku-buildpack-nodejs#v134"
}
],
"env": {
Expand Down
Loading

0 comments on commit 4c72cb5

Please sign in to comment.