diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 0000000000..ceeec5689c
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+v10.13.0
diff --git a/.travis.yml b/.travis.yml
index 5bad631f24..5dde716b7e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,6 @@
sudo: required
dist: trusty
language: node_js
-node_js:
- - '10.13.0'
services:
- postgresql
jdk:
@@ -12,41 +10,41 @@ cache:
directories:
# we also need to cache folder with Cypress binary
- ~/.cache
-env:
- global:
- - WEBSERVICE_VERSION="1.6.0-beta.4"
addons:
firefox: "latest"
postgresql: "9.6"
chrome: stable
install:
- - ./scripts/install-travis-script.sh
+ - npm ci
jobs:
include:
- stage: unit test
name: "Lint, Unit Test, and Prod Test"
script:
- - ng lint
- - ng test --watch=false --code-coverage --browsers ChromeHeadless
- - ng version
+ - npx ng lint
- npm run build.prod
+ - npx ng test --watch=false --code-coverage --browsers ChromeHeadless
+ - npm install --no-save codecov
- stage: integration test
name: "Cypress Group 1"
env:
- TEST='cypress/integration/group1/**/*'
- script: ./scripts/run-travis-script.sh
+ script:
+ - ./scripts/run-travis-script.sh
- stage: integration test
name: "Cypress Group 2"
env:
- TEST='cypress/integration/group2/**/*'
- script: ./scripts/run-travis-script.sh
+ script:
+ - ./scripts/run-travis-script.sh
- stage: integration test
name: "Cypress Group 3"
env:
- TEST='cypress/integration/group3/**/*'
- script: ./scripts/run-travis-script.sh
+ script:
+ - ./scripts/run-travis-script.sh
script: echo "overriding test"
diff --git a/README.md b/README.md
index 6f79b82ac8..22934e2cde 100644
--- a/README.md
+++ b/README.md
@@ -28,19 +28,21 @@ This project was generated with [Angular CLI](https://github.com/angular/angular
### Prerequisites
-Angular CLI requires Node and NPM. See [.travis.yml](.travis.yml) for the correct versions of Node, NPM and Angular CLI.
-Then make sure Angular CLI has been properly set up.
+- Java 8+
+- Node and its included NPM (see [.nvmrc](.nvmrc) for the correct version of node to install)
+- wget
-[Install NPM and Node](https://nodejs.org/en/download/package-manager/)
+Install NPM and Node using nvm:
```
-$curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
-$sudo apt-get install -y nodejs
-$nodejs -v
-v7.10.0
-$npm -v
-4.2.0
+wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
```
-Follow https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-two-change-npms-default-directory to fix permissions and then...
+Close current terminal and open a new one or `source ~/.bashrc`
+```
+nvm install 10.13.0
+```
+Optionally, install a global Angular CLI in order to execute `ng` commands without prepending `npx`.
+Otherwise, prepend `npx` to every command in this README if a global @angular/cli was not installed.
+Before installing, follow https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-two-change-npms-default-directory to fix permissions if needed.
```
$npm i -g @angular/cli@1.3.1
@@ -55,7 +57,7 @@ cd dockstore-ui2
git checkout develop
git pull
-npm ci
+CI=true npm ci
```
Check to make sure Angular CLI has been properly set up
@@ -94,18 +96,6 @@ The Dockstore class in [src/app/shared/dockstore.model.ts](src/app/shared/dockst
In `dockstore-webservice`, the `dockstore.yml` being served must be edited to include the client IDs.
-## Pre-build/serve
-
-Run `export WEBSERVICE_VERSION=`[dockstore release version](https://github.com/dockstore/dockstore-ui2/blob/develop/.travis.yml#L12), for example `export WEBSERVICE_VERSION=1.5.3`.
-
-Run `npm run prebuild` before running or building the project. This command will:
-- generate a file which contains the UI tag version
-- download the openapi codegen
-- generate code from the swagger.yaml
-
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. Run `ng serve --host 0.0.0.0` in order to serve your site to other computers on the same network.
@@ -121,7 +111,8 @@ Run `ng g component component-name` to generate a new component. You can also us
## Build
-Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
+Optionally override the webservice version using `npm config set dockstore-ui2:webservice_version ${WEBSERVICE_VERSION}
+Run `npm run build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `npm run build.prod` for a production build.
## Running unit tests
@@ -131,9 +122,9 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
Run `$(npm bin)/cypress open` or `$(npm bin)/cypress run` to execute the end-to-end tests via Cypress.io.
Before running the tests make sure you:
+- have a postgresql database
- serve the app via `ng serve`.
-- run the Dockstore webservice
-- have a webservice jar in the root directory
+- have the Dockstore webservice jar in the root directory and run it (see scripts/run-webservice-script.sh for guideline)
## Documentation Generation
@@ -143,7 +134,7 @@ To manually run it:
npm install -g @compodoc/compodoc
npm run compodoc
```
-Then go to `docs/index.html`
+Then open `docs/index.html` with browser
## Further help
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts
index 4b9d70f253..a0d56242a3 100644
--- a/cypress/support/commands.ts
+++ b/cypress/support/commands.ts
@@ -34,7 +34,7 @@ export function resetDB() {
before(() => {
cy.exec('PGPASSWORD=dockstore psql -h localhost -f scripts/resetDb.sql -U dockstore -d webservice_test');
cy.exec('PGPASSWORD=dockstore psql -h localhost -f travisci/db_dump.sql webservice_test -U dockstore');
- cy.exec('java -jar dockstore-webservice-*.jar db migrate -i 1.5.0,1.6.0 travisci/web.yml');
+ cy.exec('java -jar dockstore-webservice.jar db migrate -i 1.5.0,1.6.0 travisci/web.yml');
});
}
export function setTokenUserViewPort() {
diff --git a/git.version.ts b/git.version.ts
index cb57864ebc..17b1698c93 100644
--- a/git.version.ts
+++ b/git.version.ts
@@ -28,11 +28,11 @@ const tag$ = new Observable(s => {
});
observableCombineLatest(revision$, tag$)
- .subscribe(([revision, tag]) => {
- console.log(`tag: '${tag}', version: '${process.env.WEBSERVICE_VERSION}', revision: '${revision}'`);
+.subscribe(([revision, tag]) => {
+ console.log(`tag: '${tag}', version: '${process.env.npm_package_config_webservice_version}', revision: '${revision}'`);
const content = '// this file is automatically generated by git.version.ts script\n' +
- `export const versions = {tag: '${tag}', version: '${process.env.WEBSERVICE_VERSION}', revision: '${revision}'};\n`;
+ `export const versions = {tag: '${tag}', version: '${process.env.npm_package_config_webservice_version}', revision: '${revision}'};\n`;
fs.writeFileSync(
'src/app/footer/versions.ts',
diff --git a/package.json b/package.json
index d266cc5f77..937c7339f6 100644
--- a/package.json
+++ b/package.json
@@ -2,20 +2,21 @@
"name": "dockstore-ui2",
"version": "2.3.0",
"license": "Apache License 2.0",
+ "config": {
+ "webservice_version": "1.6.0"
+ },
"scripts": {
- "ng": "ng",
- "start": "ng serve",
- "prebuild:tsnode": "ts-node git.version.ts",
- "prebuild:downloadcodegen": "wget --no-verbose http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.4/openapi-generator-cli-3.3.4.jar -O openapi-generator-cli-3.3.4.jar",
- "prebuild:generatecode": "rm -Rf src/app/shared/swagger && java -jar openapi-generator-cli-3.3.4.jar generate -i https://raw.githubusercontent.com/ga4gh/dockstore/${WEBSERVICE_VERSION}/dockstore-webservice/src/main/resources/swagger.yaml -l typescript-angular -o src/app/shared/swagger -c swagger-config.json",
- "prebuild": "npm run prebuild:tsnode && npm run prebuild:downloadcodegen && npm run prebuild:generatecode",
- "prebuild.prod": "npm run prebuild:tsnode && npm run prebuild:downloadcodegen && npm run prebuild:generatecode",
- "build.prod": "ng build --progress false --prod",
- "build": "ng build --progress false",
+ "ng": "npx ng",
+ "start": "npx ng serve --progress=false",
+ "webservice": "./scripts/run-webservice-script.sh",
+ "prebuild": "ts-node git.version.ts && ./scripts/generate-openapi-script.sh",
+ "prebuild.prod": "npm run prebuild",
+ "build.prod": "npx ng build --progress false --prod",
+ "build": "npx ng build --progress false",
"compodoc": "npx compodoc -p src/tsconfig.compodoc.json --output docs",
- "test": "ng test",
- "lint": "ng lint",
- "e2e": "ng e2e"
+ "test": "npx ng test",
+ "lint": "npx ng lint",
+ "e2e": "npx ng e2e"
},
"private": true,
"dependencies": {
diff --git a/scripts/generate-openapi-script.sh b/scripts/generate-openapi-script.sh
new file mode 100755
index 0000000000..36101913bc
--- /dev/null
+++ b/scripts/generate-openapi-script.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -o errexit
+set -o pipefail
+set -o nounset
+set -o xtrace
+
+GENERATOR_VERSION="3.3.4"
+wget --no-verbose http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/${GENERATOR_VERSION}/openapi-generator-cli-${GENERATOR_VERSION}.jar -O openapi-generator-cli.jar
+rm -Rf src/app/shared/swagger
+java -jar openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/ga4gh/dockstore/$npm_package_config_webservice_version/dockstore-webservice/src/main/resources/swagger.yaml -l typescript-angular -o src/app/shared/swagger -c swagger-config.json
diff --git a/scripts/install-travis-script.sh b/scripts/install-travis-script.sh
deleted file mode 100755
index 6dc7a5d1ba..0000000000
--- a/scripts/install-travis-script.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-set -o errexit
-set -o pipefail
-set -o nounset
-set -o xtrace
-
-npm ci
-
-wget --no-verbose --tries=10 https://artifacts.oicr.on.ca/artifactory/collab-release/io/dockstore/dockstore-webservice/${WEBSERVICE_VERSION}/dockstore-webservice-${WEBSERVICE_VERSION}.jar
-chmod u+x dockstore-webservice-${WEBSERVICE_VERSION}.jar
-ng version
-npm install codecov
-
-npm run prebuild
diff --git a/scripts/run-travis-script.sh b/scripts/run-travis-script.sh
index 11b3ce7540..b0287452af 100755
--- a/scripts/run-travis-script.sh
+++ b/scripts/run-travis-script.sh
@@ -4,14 +4,8 @@ set -o pipefail
set -o nounset
set -o xtrace
-psql -c "create user dockstore with password 'dockstore' createdb;" -U postgres
-psql -c "ALTER USER dockstore WITH superuser;" -U postgres
-psql -c 'create database webservice_test with owner = dockstore;' -U postgres
-psql -f travisci/db_dump.sql webservice_test
-java -jar dockstore-webservice-${WEBSERVICE_VERSION}.jar db migrate -i 1.5.0,1.6.0 travisci/web.yml
-java -jar dockstore-webservice-${WEBSERVICE_VERSION}.jar server travisci/web.yml 1>/dev/null &
-
+npm run webservice
npm run build
-ng serve --progress=false &
+npm run start &
./scripts/wait-for.sh
cypress run --record --config defaultCommandTimeout=10000 --spec ${TEST}
diff --git a/scripts/run-webservice-script.sh b/scripts/run-webservice-script.sh
new file mode 100755
index 0000000000..4721145bf9
--- /dev/null
+++ b/scripts/run-webservice-script.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+set -o errexit
+set -o pipefail
+set -o nounset
+set -o xtrace
+
+wget -O dockstore-webservice.jar --no-verbose --tries=10 https://artifacts.oicr.on.ca/artifactory/collab-release/io/dockstore/dockstore-webservice/${npm_package_config_webservice_version}/dockstore-webservice-${npm_package_config_webservice_version}.jar
+chmod u+x dockstore-webservice.jar
+psql -c "create user dockstore with password 'dockstore' createdb;" -U postgres
+psql -c "ALTER USER dockstore WITH superuser;" -U postgres
+psql -c 'create database webservice_test with owner = dockstore;' -U postgres
+psql -f travisci/db_dump.sql webservice_test
+java -jar dockstore-webservice.jar db migrate -i 1.5.0,1.6.0 travisci/web.yml
+java -jar dockstore-webservice.jar server travisci/web.yml 1>/dev/null &
+