Skip to content

MobilityData/mobilitydatabase-web

Repository files navigation

Mobility Feeds API UI

This project was bootstrapped with Create React App. Using node v18.16.0 (npm v9.5.1)

Installing packages

It is preferred to install the packages using yarn over npm install

Configuration variables

React scripts can inject all necessary environment variables into the application in development mode and the JS bundle files. Steps to set environment variables:

  • Create a file based on src/.env.rename_me with the name src/.env.{environment}. Example, src/.env.dev.
  • Replace all key values with the desired content.
  • Done! You can now start or build the application with the commands described below.

Adding a new environment variable

To add a new environment variable, add the variable name to the src/.env.{environment} and modify the GitHub actions injecting the value per environment. When adding a new variable, make sure that the variable name is prefixed with REACT_APP; otherwise, the react app will not read the variable.

Available Scripts

In the project directory, you can run:

  • Runs the app in the development mode:
yarn start:dev

Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

  • Launches the test runner in the interactive watch mode:
yarn test

See the section about running tests for more information.

  • Builds the app locally to the build folder:
yarn build:dev

It bundles React in production mode for a target Firebase environment.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

  • Linter check
yarn lint

Executes linter on sources to review warnings and errors

  • Linter fix
yarn lint --fix

Firebase integration

This application is powered by Firebase.

To access Firebase commands and features you need to create your own firebase project. Only MobilityData internal engineers have access to MobilityData's firebase projects

Firebase useful commands

  • Switch project
npx firebase use {project_name_or_alias}
  • Deploy to a preview channel
npx firebase hosting:channel:deploy {channel_name}

Component and E2E tests

Component and E2E tests are executed with Cypress. Cypress tests are located in the cypress folder.

Cypress useful commands:

  • Run the firebase emulator in a separate terminal
yarn run firebase:auth:emulator:dev
  • Run local headless tests
yarn start:dev

In a different terminal,

yarn cypress-run
  • Opens Cypress in the interactive GUI
yarn cypress-open

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 11

Languages