Install the project dependencies by typing:
npm install
Run the project using one of the defined package scripts:
For development:
npm run watch
For a production build:
npm run build-prod
npm start
The following environment variables can be used to configure the server (also docker image):
NODE_ENV
: the environment mode, either production
or development
(default)PORT
: the port on which the server runs (default 3000)PC_URL
: Pathway Commons homepage URL (default: 'http://www.pathwaycommons.org/'; cPath2 service should be there available at /pc2/ path)NCBI_API_KEY
: NCBI E-Utilities API key (read more)FACTOID_URL
: the Factoid app URL (default: 'https://biofactoid.org/')SBGN_IMG_SERVICE_BASE_URL
: URL for service that converts SBGN to an image (i.e. Syblars; default is http://localhost:9090/
)SBGN_IMG_PATH
: cli tool snapshot
output folder for images (default: public/img/pathways
)npm start
: start the servernpm stop
: stop the servernpm run build
: build projectnpm run build-prod
: build the project for productionnpm run bundle-profile
: visualise the bundle dependenciesnpm run clean
: clean the projectnpm run watch
: watch mode (debug mode enabled, autorebuild, autoreload)npm test
: run testsnpm run lint
: lint the projectnpm run ci
: run the tests and lint and build-prod at onceBuild the image.
docker build -t pathwaycommons/app-ui .
Run the container:
docker run --detach --rm --publish 3000:3000 --env "NODE_ENV=production" --name "app-ui" pathwaycommons/app-ui
All files /test
will be run by Mocha. You can npm test
to run all tests, or you
can run npm run test ./test/path/to/test
to run specific tests.
Chai is included to make the tests easier to read and write.
The scripts/cli.js
file contains app-ui command line tools:
source
: Download and extract a file to downloads
foldersnapshot
: Generate PNG images for pathways listed in a PC GMT-formatted file
SBGN_IMG_SERVICE_BASE_URL
(see docker-compose.yml
service syblars
)SBGN_IMG_PATH
(default: public/img/pathways
)Usage: To generate a PNG of an SBGN representation for each pathway declared in the GMT file at downloads/pc-hgnc.gmt.gz
:
$ docker-compose up -d syblars
$ SERVER_FETCH_TIMEOUT="60000" node src/scripts/cli.js snapshot --file pc-hgnc.gmt
NB: The default timeout of fetch is normally quite brief (5 seconds).
In this way, images will be served via expressJS at img/pathways/:id
, where id
is the pathway URI with anything that is not a letter (a-z) or digit (0-9) is replaced with underscores (_
).
Students who work on the repo should follow these instructions for each feature that they work on:
git clone https://github.com/myusername/app-ui.git
cd app-ui
development
branch: git checkout -b development origin/development
pc
remote: git remote add pc https://github.com/PathwayCommons/app-ui.git
git fetch pc
Remotes > Fetch All Branches
, Remotes > Fetch All Tags
development
branch is up-to-date:
git checkout development && git merge pc/development
pc/development
points toMerge into Current Branch
git checkout -b name-of-feature
HEAD
commit (which should be the top commit of your local development
branch),
then select Create Branch...
git commit -am "My descriptive commit message"
Select View
tab (View > Commit
)
Commit
buttondevelopment
branch is up-to-date:
git checkout development && git merge pc/development
pc/development
points togit checkout name-of-feature
, git merge development
HEAD
is the newest commit of your feature branch: Right-click the latest commit
on name-of-feature
branch and select Checkout "name-of-feature" Branch
development
branch and select Merge into Current Branch
git push
Remotes > Push Current Branch
New pull request
buttonrelease/1.2.3
npm test
npm run lint
npm version
, in accordance with semver. The version
command
in npm
updates both package.json
and git tags, but note that it uses a v
prefix on the tags (e.g. v1.2.3
).
npm version patch
.npm version minor
.npm version major.
npm version 1.2.3
.git push origin --tags