- a GitHub account
- Node.js and npm available in your environment
- git available in your environment
GitHub is a development platform that developers commonly use for open source development. You can sign up for free.
git is a distributed version control system that developers use to collaborate on and share code. You can install it via your package manager of choice or download it from git-scm.com.
Node.js is a JavaScript runtime that runs on the server and your local development machine. You can install it via your package manager of choice or download and install it manually from nodejs.org. Node.js comes with its own package manager called npm.
node --version
# v13.11.0
npm --version
# 6.14.3
git --version
# git version 2.26.0
The recommended way of developing your custom CovApp-version is to fork this repository. A GitHub fork gives you the possibility to make a "copy" of the original repository and perform changes while keeping the chance to receive future updates. To find more information about the concept of a fork, visit GitHub's documentation.
After you forked the repository and have a copy of the application code stored in your personal GitHub account, clone your fork to your local machine.
git clone https://github.com/YOUR-USERNAME/covapp
> Cloning into `covapp`...
> remote: Counting objects: 10, done.
> remote: Compressing objects: 100% (8/8), done.
> remove: Total 10 (delta 1), reused 10 (delta 1)
> Unpacking objects: 100% (10/10), done.
Navigate into the new directory.
cd covapp
The application heavily relies on dependencies that are served via npm with install-scripts enabled. To install all dependencies run npm ci
inside of the covapp
directory.
npm ci
To develop and build the application, two primary commands are available. Both commands build and bundle the application in the www
directory.
Use npm start
for main development. The command bundles the code and starts a local webserver at localhost:3333
. The start
command reacts to file changes inside of the repository and rebuilds the updated application.
Its output should look as follows:
npm start
> [email protected] prestart /Users/stefan/Sites/infection-risk-assessment
> npm run prepare-customization
> [email protected] prepare-customization /Users/stefan/Sites/infection-risk-assessment
> node ./scripts/prepare-customization.js
> [email protected] start /Users/stefan/Sites/infection-risk-assessment
> stencil build --dev --watch --serve --no-open
[52:54.4] @stencil/core v1.11.0 🍿
[52:56.6] build, app, dev mode, started ...
[52:56.6] transpile started ...
[53:01.7] transpile finished in 5.03 s
[53:01.7] copy started ...
[53:01.7] generate lazy started ...
[53:01.9] copy finished (12 files) in 236 ms
[53:03.3] generate lazy finished in 1.65 s
[53:03.3] build finished, watching for changes... in 6.73 s
www
directory after running npm start
. Use npm run build
instead.
Use npm run build
to build a release-ready application. The command prepares and minifies the source code for a production environment.
Its output should look as follows:
npm run build
> [email protected] prebuild /Users/stefan/Sites/infection-risk-assessment
> npm run prepare-customization
> [email protected] prepare-customization /Users/stefan/Sites/infection-risk-assessment
> node ./scripts/prepare-customization.js
> [email protected] build /Users/stefan/Sites/infection-risk-assessment
> stencil build
[54:33.4] @stencil/core v1.11.0 🍿
[54:35.0] build, app, prod mode, started ...
[54:35.0] transpile started ...
[54:39.4] transpile finished in 4.45 s
[54:39.4] copy started ...
[54:39.4] generate lazy started ...
[54:39.7] copy finished (12 files) in 240 ms
[54:50.6] generate lazy finished in 11.13 s
[54:50.6] build finished in 15.67 s
After a successful npm run build
the www
directory includes a JavaScript application that is deployable and completely works by itself.
index.html
file with a 200
HTTP status code for different routes (/
, /imprint
, ...).
There is no additional server-side logic needed and you can upload the directory to any hosting services that support static file hosting and serving the base index.html
file to all URL paths. Uploading files via FTP works fine as well as using modern hosting services like Netlify.
After a successful npm run build
command you can start customizing your CovApp.
For advanced development, the application includes several other commands. You only need these commands if you want to perform changes going further than the provided customization options.
# Run the unit tests once
npm test
# Run a production build and visualize the generated bundle
npm run analyze
# Run the unit tests and watch for file changes during development
npm run test:watch
# Automatically fix potential code formatting issues
npm run code-format
We're relying on Prettier as our code formatter tool of choice. You can find the defined rules in the .prettierrc
file and the ignored files at .prettierignore
.
To check and automatically fix potential code formatting issues, use the npm run code-format
command.