Before you can build the UV, we assume the following list of software is already installed in your system
- Git
- Node 8 or higher
- Npm 6.0 or higher
In order to contribute to the UV, you must have a github account so you can push code and create a new Pull Request (PR).
Once you are all setup, following the Github's guide of how to fork a repository: https://guides.github.com/activities/forking/
All command-line operations for building the UV are scripted using Grunt which is based on Node.js. To get set up:
-
Install Node.js, if you haven't already
-
Install the grunt command line interface:
npm install -g grunt-cli
-
Clone the
universalviewer
repository andexamples
sub module:git clone https://github.com/UniversalViewer/universalviewer.git --recursive
-
On the command line, go in to the
universalviewer
folder
cd universalviewer
-
Run
npm install
If switching between branches, ensure that you check out the correct branch in the
examples
sub-repository too. By default this should begh-pages
.
To build the debug version of the viewer, just run (on the command line, in the universalviewer
folder):
grunt build
This will compile the .less files into .css and .ts files into .js.
To build the distribution version of the UV, just run (on the command line, in the universalviewer
folder):
grunt build --dist
To view the examples run:
grunt examples
UV source code lives inside the /src/
folder.
Here is a diagram showing the overall architecture of the project.
The UV aims to be "framework agnostic", as it needs to be used in a variety of contexts. Therefore it is written in "plain" TypeScript and doesn't use a framework such as React or AngularJS. However, StencilJS is now being used to develop parts of the UV as generic Web Components, e.g. https://github.com/UniversalViewer/uv-ebook-components
Before commiting your changes make sure tests are passing:
npm test
Note: the development server must be running (
grunt examples
)
Tests are written using Jest
# Create a git branch
git checkout -b my-improvement
# Add changes
git add .
# Create commit
git commit -m "fix(component): message"
Create a PR: https://guides.github.com/activities/forking/