This script sorts translation files in the app/translations directory.
See the sort-translations and format scripts in package.json.
scripts/dev.sh (run via yarn run dev) reads env vars to pick which API/config to run against.
See the themeMap in server/configs/config.default.js for CONFIG options.
CONFIG— deployment config to use, e.g.hsl,matka(default:default).API_TYPE—development(default,dev-api.digitransit.fi),production(api.digitransit.fi), orlocal(OTP athttp://localhost:9080/otp/).API_SUBSCRIPTION_TOKEN— subscription key for map tiles/geocoding/etc.
Using the UI with the development API:
CONFIG=hsl API_TYPE=development API_SUBSCRIPTION_TOKEN=<your_subscription_key> yarn run dev
Using the UI with the production API:
CONFIG=hsl API_TYPE=production API_SUBSCRIPTION_TOKEN=<your_subscription_key> yarn run dev
Using the UI with a local instance of OTP on port 9080 (still needs a dev subscription key for
map tiles and similar features):
CONFIG=matka API_TYPE=local API_SUBSCRIPTION_TOKEN=<your_subscription_key> yarn run dev
A pure build helper, imported directly (not run standalone):
contextHelper.js is used by
webpack.config.js to compute webpack theme entries
and favicon plugins for every configured deployment (or just $CONFIG if set).
Populates the served _static/ directory from static/, run via yarn static (which both
prebuild and dev.sh invoke):
yarn static
It copies every config's assets regardless of $CONFIG (a deployment with no $CONFIG set
picks its config per request from the Host header, and ASSEMBLE_GEOJSON deployments
reference every region's zone layer), minifies .geojson files and writes precompressed
.gz/.br siblings for them. Deliberately kept outside webpack so it survives a bundler
migration; note that _static is populated once at startup, so static/ edits during
yarn dev need a re-run. See docs/Webpack.md.
Builds the SVG sprite sheets _static/assets/svg-sprite.<theme>.svg from the per-icon files in
app/assets/icons/, run via yarn sprites (which both prebuild and
dev.sh invoke):
yarn sprites
yarn sprites --watch
default/ holds every icon and other theme directories hold only their overrides and additions;
each file's name becomes its symbol id. A malformed icon file fails the build. --watch (used by
dev.sh) rebuilds on every change under app/assets/icons/ and only logs errors, so a
half-saved file doesn't stop yarn dev. See docs/Webpack.md.
Scaffolds a new theme: creates styles/themes/<name>, a config file at
server/configs/config.<name>.js (from theme/template.waltti.js), and registers the theme
in config.default.js's host-name mapping. See docs/Themes.md.
yarn add-theme <name> '#RRGGBB' <optional navbar logo>
Runs two checks against the packages (digitransit-component,
digitransit-search-util, digitransit-store, digitransit-util); both are enforced in CI on
pull requests.
-
Internal reference protocol. Every
@digitransit-*dependencies/peerDependenciesentry that points at another package must be declared as exactly"workspace:^".lerna versiononly rewrites/cascades an internal cross-reference (andyarnonly links the local copy instead of pulling a stale published one) when it uses theworkspace:protocol; a plain semver pin is silently left behind on version bumps.lerna publishresolves"workspace:^"to"^<version>"in the published tarball, so consumers outside the monorepo are unaffected. This check always runs, regardless ofBASE_SHA. -
Version bumps. Fails if a package changed since a given base commit but its
package.jsonversionwasn't bumped accordingly (or was bumped in the wrong direction).lerna publish from-packageonly republishes a package when its committed version is greater than what's already on npm, so a changed-but-unbumped package would otherwise silently never get published. This check runs only whenBASE_SHAis set. Runyarn bump-versions-workspaces(lerna version) to bump the changed packages and cascade bumps to their dependents.
BASE_SHA=<git ref> yarn packages-version-check
Checks each package's dependencies/peerDependencies against the code it publishes
(the module graph reachable from its build entry point, parsed with Babel, so tests don't count;
a relative import that doesn't resolve fails the check). Wired into yarn lint; the rules are
documented in docs/Packages.md ("Dependency Classification"):
- Every imported package (JS/JSX, and
~-prefixed SCSS imports) is declared. - Every declared dependency/peer is imported, except peers passed through for a sibling
@digitransit-*dependency's own peers (the bundle packages). - Every peer of a sibling
@digitransit-*dependency is declared too (passed through). - Nothing is both a dependency and a peer.
- Every non-
workspace:peer is exactly^<version the root package.json's dependencies declare>. @hsl-fi/*packages are peers (@hsl-fi/hooksis the one allowed exception).
yarn packages-dependencies-check
Regenerates a package's README.md from its JSDoc via
documentation.js. Needs no family/package argument: run from
inside a package's directory to regenerate just that one, or from anywhere else (e.g. the
repository root) to regenerate every package in every family. See the packages-docs
script in package.json. Never hand-edit a generated README.md — fix the
source JSDoc and regenerate instead.
node scripts/packages/generate-readmes.js
Sorts and checks digitransit-component packages' own translation bundles
(src/{helpers,utils}/translations.js) — a different shape from app/translations, so
separate from the sort-translations.js script above. Flags any key missing from a fi/sv/en
locale. See the packages-translations-check/-fix scripts in
package.json.
Regenerates packages/private/schema/schema.graphql (the GraphQL schema used by relay-compiler and
graphql-eslint) from the OTP repo. digitransit-search-util-query-utils references this same
file via a relative path (../../private/schema/schema.graphql) rather than keeping its own copy.
node scripts/generate-schema.js
Use SCHEMA_SRC=<url-or-local-path> to fetch/copy from a non-default location, e.g. from a
local OTP clone:
SCHEMA_SRC=~/OpenTripPlanner/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls node scripts/generate-schema.js