- Node.js >=10.0.0 <11.0.0
-
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, eitherproduction
ordevelopment
(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 ishttp://localhost:9090/
)SBGN_IMG_PATH
: cli toolsnapshot
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 once
Build 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 todownloads
foldersnapshot
: Generate PNG images for pathways listed in a PC GMT-formatted file- Requires an instance of Syblars accessible at a location defined by the configuration variable
SBGN_IMG_SERVICE_BASE_URL
- Images will be placed in directory
SBGN_IMG_PATH
(default:public/img/pathways
)
- Requires an instance of Syblars accessible at a location defined by the configuration variable
-
Retrieve a GMT file
Pathway Commons makes compressed archives of GMT files for each release available for download. For PC version 14, issue the following command:
node src/scripts/cli.js source --file pc-hgnc.gmt https://download.baderlab.org/PathwayCommons/PC2/v14/pc-hgnc.gmt.gz
-
Build and run a Syblars instance
docker build --file Dockerfile.syblars -t pathwaycommon/syblars:latest . docker run --detach --rm --publish 9090:3000 --name syblars pathwaycommon/syblars:latest
-
Generate a PNG of an SBGN representation for each pathway declared in the GMT file at
downloads/pc-hgnc.gmt
:SERVER_FETCH_TIMEOUT="60000" node src/scripts/cli.js snapshot --file pc-hgnc.gmt
- Notes
- The default timeout of fetch is normally quite brief (5 seconds).
- Images will be served via expressJS at
img/pathways/:id
, whereid
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:
- Initial preparation (only needed once)
- Make a fork on GitHub (if you haven't already) under your personal account
- Check out the fork repo:
git clone https://github.com/myusername/app-ui.git
- Change the directory to the project:
cd app-ui
- Check out the
development
branch:git checkout -b development origin/development
- Add the
pc
remote:git remote add pc https://github.com/PathwayCommons/app-ui.git
- Make sure you have the latest code on the main PathwayCommons repo:
- Using the console:
git fetch pc
- Or using GitUp:
Remotes > Fetch All Branches
,Remotes > Fetch All Tags
- Using the console:
- Make sure your
development
branch is up-to-date:- Using the console:
git checkout development && git merge pc/development
- Using GitUp:
- Right-click the commit that
pc/development
points to - Select
Merge into Current Branch
- Right-click the commit that
- Using the console:
- Make a feature branch for the new feature or change you are working on. Make sure to give your branch a clear, meaningful name.
- Using the console:
git checkout -b name-of-feature
- Using GitUp: right-click the
HEAD
commit (which should be the top commit of your localdevelopment
branch), then selectCreate Branch...
- Using the console:
- Make commits as you're working on your feature:
- Using the console:
git commit -am "My descriptive commit message"
- Using GitUp: Use the
Select View
tab (View > Commit
)- Stage the files
- Add a descriptive commit message
- Press the
Commit
button
- Using the console:
- Periodically (at least once just before making a pull request) make sure your feature branch takes into account
the latest changes other people have made:
- Make sure your
development
branch is up-to-date:- Using the console:
git checkout development && git merge pc/development
- Using GitUp:
- Right-click the commit that
pc/development
points to - Select `Merge into Current Branch
- Right-click the commit that
- Using the console:
- Make sure your feature branch is up-to-date:
- Using the console:
git checkout name-of-feature
,git merge development
- Using GitUp:
- Make sure your
HEAD
is the newest commit of your feature branch: Right-click the latest commit onname-of-feature
branch and selectCheckout "name-of-feature" Branch
- Right-click the latest commit of the
development
branch and selectMerge into Current Branch
- Make sure your
- Using the console:
- Make sure your
- Push your commits to GitHub:
- Note: You can push as often as you'd like so that your code is backed up on GitHub. You must push everything before you make a pull request.
- Using the console:
git push
- Using GitUp:
Remotes > Push Current Branch
- When your feature is done and ready to be reviewed, make a pull request:
- Go to your fork on GitHub, e.g. https://github.com/myusername/app-ui
- Select your feature branch
- Click the
New pull request
button - Give your pull request a clear title and a meaningful description
- Create a release branch off of master, e.g.
release/1.2.3
- Merge the latest dev into the release branch.
- Make sure the tests are passing:
npm test
- Make sure the linting is passing:
npm run lint
- Bump the version number with
npm version
, in accordance with semver. Theversion
command innpm
updates bothpackage.json
and git tags, but note that it uses av
prefix on the tags (e.g.v1.2.3
). - For a bug fix / patch release, run
npm version patch
. - For a new feature release, run
npm version minor
. - For a breaking API change, run
npm version major.
- For a specific version number (e.g. 1.2.3), run
npm version 1.2.3
. - Make a PR for the release branch onto master.
- Push the release:
git push origin --tags
- Publish a release for Zenodo.