measure large distances with device gps
- Node and npm are used to build the code
- React is the javascript library that makes the site functional
- Testing-Library is for testing
- Workbox generates the service worker that allows users to install the site as a progressive web application and function offline
- geolocation-utils is used for geographic coordinate distance and heading calculations
The scripts in the package.json file perform build tasks.
npm install
downloads build dependenciesnpm run build
compiles a production build to the build/ foldernpm start
serves a development version of the sitenpm test
runs the tests in interactive mode, runCI=true npm test -- --coverage
to generate test coverage to the coverage/ folder. To debug tests in Visual Studio Code, runnpm test
in a separate terminal and then run the commandDebug: Attach to Node Process
. The attach command can be searched for with ctrl+shift+p. Ifnpm clean
removes dependencies, the production build, test coverage reports, and generated code, excluding user certificates and environment configuration filesnpm eject
removes react plugins that manage the majority of dependencies
The app must be run with TLS so the device location can be accessed. Use a fake certificate when running in development. Generate and install the public and private certificates using mkcert. Move the certificates to the project root directory and create an environment configuration file named .env
with the contents below.
To create the certificates, the commands below are useful. This will create public and private certificates, localhost.pem
and localhost-key.pem
. Move them to the project root directory.
commands to create certificates:
mkcert -install
mkcert localhost
.env file contents:
HTTPS=true
SSL_CRT_FILE=localhost.pem
SSL_KEY_FILE=localhost-key.pem