Update client development documentation (#1504)

Update documentation
* on installing the server
* on how to get nodejs hot-reloading to work
* on running standard and annotations smoke tests with hot-reloading
This commit is contained in:
Matt Weiden
2020-06-04 12:34:46 -07:00
committed by GitHub
parent 101f446f8d
commit df6b42f5d6
+19 -10
View File
@@ -51,11 +51,17 @@ JEST_ENV=prod make pydist install-dist dev-env smoke-test
## Server dev ## Server dev
### Install ### Install
To install from the source tree
* Build the client and put static files in place: `make build-for-server-dev` * Build the client and put static files in place: `make build-for-server-dev`
* Install from local files: `make install-dev` * Install from local files: `make install-dev`
To install from a candidate python distribution
* Make the distribution: `make pydist`
* Install it: `make install-dist`
### Launch ### Launch
* `cellxgene launch [options] <datafile>` * `cellxgene launch [options] <datafile>` or `make start-server`
### Reloading ### Reloading
If you install cellxgene using `make install-dev` the server will be restarted every time you make changes on the server code. If changes affects the client, the browser must be reloaded. If you install cellxgene using `make install-dev` the server will be restarted every time you make changes on the server code. If changes affects the client, the browser must be reloaded.
@@ -78,13 +84,13 @@ If you would like to run the server tests individually, follow the steps below
## Client dev ## Client dev
### Install ### Install
1. Install prereqs for client: `make dev-env` 1. Install prereqs for client: `make dev-env`
2. Install cellxgene server: `make install-dev` Caveat: this will not build the production client package - you must use the [server install](#install) instructions above to serve web assets. 2. Install cellxgene server as described in the [server install](#install) instructions above.
### Launch ### Launch
To launch with hot reloading you need to launch the server and the client separately. Node's hot reloading starts the client on its own node server and auto-refreshes when changes are made. To launch with hot reloading, you need to launch the server and the client separately. Node's hot reloading starts the client on its own node server and auto-refreshes when changes are made to source files.
1. Launch server (the client relies on the REST API being available): `cellxgene launch [options] <datafile>` 1. Launch server (the client relies on the REST API being available): `cellxgene launch --debug [other_options] <datafile>` or `make start-server`
2. Launch client: in `client/` directory run `npm run start` 2. Launch client: in `client/` directory run `make start-frontend`
3. Client will be served on localhost:3000 3. Client will be served on `localhost:3000`
### Build ### Build
To build only the client: `make build-client` To build only the client: `make build-client`
@@ -95,10 +101,13 @@ We use `eslint` to lint the code and `prettier` as our code formatter.
### Test ### Test
If you would like to run the client tests individually, follow the steps below in the `client` directory If you would like to run the client tests individually, follow the steps below in the `client` directory
1. For unit tests run `npm run unit-test` or `make unit-test` 1. For unit tests run `make unit-test`
1. For the smoke test run `npm run smoke-test` or `make smoke-test` 1. For the smoke test run `make smoke-test` for the standard smoke test suite and `make smoke-test-annotations` for the annotations test suite.
If you would like to run the smoke tests against a hot-reloaded version of the client:
1. Start the hot-reloading servers as described in the [Client dev section](#client-dev). If you plan to run the standard test suite (without annotations), you'll have to start the backend server with annotations disabled (e.g. `CXG_OPTIONS='--debug --disable-annotations' make start-server`).
1. From the project root, `cd client`
1. Run either the standard E2E test suite with `CXG_CLIENT_PORT=3000 make e2e` or the annotations test suite with `CXG_CLIENT_PORT=3000 make e2e-annotations`
### Tips ### Tips
* You can also install/launch the server side code from npm scrips (requires python3.6 with virtualenv) with the `scripts/backend_dev` script. * You can also install/launch the server side code from npm scrips (requires python3.6 with virtualenv) with the `scripts/backend_dev` script.