mirror of
https://github.com/home-assistant/frontend.git
synced 2026-08-03 04:47:54 +00:00
1de7230d9e
* Fall back to English when nightly translations cannot be fetched Local builds no longer fail when the nightly translations fetch errors (offline or invalid GitHub credentials); they warn and continue with English only, like the existing no-token path. CI still fails so releases cannot silently ship without translations. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3oj5uaCRRaoXRd5iEffhi * Record fetched artifact only after successful extraction A failure mid-fetch previously left a fresh artifact.json next to wiped translations, so builds within the next 24 hours skipped the fetch and silently built English only. Writing the artifact file last means a failed fetch is retried by the next build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3oj5uaCRRaoXRd5iEffhi * Update build-scripts/gulp/fetch-nightly-translations.js Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
Bundling Home Assistant Frontend
The Home Assistant build pipeline contains various steps to prepare a build.
- Generating icon files to be included
- Generating translation files to be included
- Converting TypeScript, CSS and JSON files to JavaScript
- Bundling
- Minifying the files
- Generating the HTML entrypoint files
- Generating the service worker
- Compressing the files
Converting files
Currently in Home Assistant we use a bundler to convert TypeScript, CSS and JSON files to JavaScript files that the browser understands.
We currently rely on Webpack. Both of these programs bundle the converted files in both production and development.
For development, bundling is optional. We just want to get the right files in the browser.
Responsibilities of the converter during development:
- Convert TypeScript to JavaScript
- Convert CSS to JavaScript that sets the content as the default export
- Convert JSON to JavaScript that sets the content as the default export
- Make sure import, dynamic import and web worker references work
- Add extensions where missing
- Resolve absolute package imports
- Filter out specific imports/packages
- Replace constants with values
In production, the following responsibilities are added:
- Minify HTML
- Bundle multiple imports so that the browser can fetch less files
- Generate a second version that is ES5 compatible
Configuration for all these steps are specified in bundle.js.