You need Node, Yarn (or npm) and watchman.
node -vshould be >= 24.14.1- We recommend that you use
nvmto install a specific Node.js version. Optionally, you can also set up its automatic version switching shell integration.
- We recommend that you use
yarn --versionshould be the in-tree4.13.0version. See instructions on how to use it on your OS. For example, you might need to run:corepack enable.
You also need a C compiler:
- Linux: GCC 4.6 or later
- OS X: Xcode 5.0 or later
To use Windows Subsystem for Linux in digitransit-ui development you may need to do at least the following
- Add the following to your
/etc/hosts. This is because the project uses ipv6 compliant::1instead of ipv4 style0.0.0.0:
::1 ip6-localhost ip6-loopback localhost
- Add the following to your
/etc/wsl.confif not yet present. This prevents WSL from regenerating the/etc/hostsas well as the/etc/resolv.conf:
[network]
generateResolvConf=false
generateHosts = false
A bit newer version of watchman is now required and 4.9.0 is no longer supported. Working versions include at least
- 20220320.140531.0
- 20240407.093313.0
brew install watchman
It's possible to run prebuilt binaries from some release with these instructions or in some systems to build the binaries from code following these instructions.
yarn install && yarn setup
- OSX / Linux:
yarn run dev - open: http://localhost:8080
- First run:
yarn run build, then run:yarn run start - open: http://localhost:8080
After you have changed the files in digitransit-components you have to re-run yarn setup to build those modules
and apply the changes.
- run:
webpack -p --json > digitransit.json - Upload
digitransit.jsontohttp://webpack.github.io/analyse/
Or you can also use this:
Husky (npm-package) is used for setting up the git hooks (.git/hooks/) that will allow custom scripts to be run on the repository.
Look up 'husky' in package.json to see the details.
Digitransit ui can be configured in multiple ways. You can
- Change between National and Regional versions using
CONFIGparameter- Alternatively, use
BASE_CONFIGif server is supposed to serve multiple configurations which have same base configuration. It is used server side at start up and request's host specific config based onhostorx-forwarded-hostheader is merged into it before returning config to client.
- Alternatively, use
- Switch API backend using
API_URLparameter
Note that you can combine multiple configuration parameters.
Start national version
yarn run buildyarn run start
Start HSL version
yarn run buildCONFIG=hsl yarn run start
By default digitransit-ui uses services from https://dev-api.digitransit.fi but you can override API server like so:
yarn run buildAPI_URL=https://api.digitransit.fi yarn run start
If you want to specify different URL (not just base URL) for individual services, you can define variables OTP_URL, MAP_URL and/or GEOCODING_BASE_URL (URL path before /search or /reverse).
yarn run buildGEOCODING_BASE_URL=https://api.digitransit.fi/geocoding/v1 OTP_URL=https://api.digitransit.fi/routing/v2/finland/ yarn run start
STATIC_MESSAGE_URL=https://dev-yleisviesti.digitransit.fi yarn run start