Snap build for landscape-ui#620
Open
marqode wants to merge 6 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for packaging Landscape UI as a snap that serves the SPA via nginx and reverse-proxies API/debarchive traffic to a configurable backend, with optional MSW (mock) build mode. To enable MSW in production builds, the isDevEnv guard is removed from the MSW startup path in main.tsx and the Vite exclude-msw plugin is conditionally bypassed.
Changes:
- New
snap/directory withsnapcraft.yaml, nginx template + start/cert scripts, configure hook, Linux/Multipass build scripts, README, and a shell-based template-render test. main.tsx/vite.config.tsadjusted so MSW can be enabled in production builds viaVITE_MSW_ENABLED=true..gitignoreupdated to ignore builtsnap/*.snapartifacts.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Skip deleting mockServiceWorker.js from dist/ when VITE_MSW_ENABLED=true. |
| src/main.tsx | Drop isDevEnv option/guard so MSW can start in production builds when enabled. |
| src/main.test.tsx | Not updated — still references the removed isDevEnv option (see comment). |
| snap/snapcraft.yaml | Snap definition: builds frontend with pnpm/vite, stages nginx + wrappers, runs as a simple daemon. |
| snap/local/start-landscape-ui.sh | Reads snap config into env vars, generates cert if needed, renders nginx config, execs nginx. |
| snap/local/nginx.conf.tmpl | nginx template with envsubst placeholders for listen port, certs, backend, and debarchive proxy. |
| snap/local/generate-cert.sh | Idempotent self-signed TLS cert generation in $SNAP_COMMON/ssl. |
| snap/hooks/configure | Restarts the service when snap config changes. |
| snap/build-snap.sh | macOS build helper that drives a Multipass VM to run snapcraft pack. |
| snap/build-snap-linux.sh | Native Linux build helper using snapcraft --destructive-mode. |
| snap/tests/test-nginx-config-render.sh | Shell tests covering envsubst rendering of nginx.conf.tmpl. |
| snap/README.md | Documentation: build, install, run, configure, MSW trade-offs. |
| .gitignore | Ignore snap/*.snap artifacts. |
Comment on lines
62
to
77
| @@ -73,7 +71,7 @@ export const startApp = async ({ | |||
| return; | |||
| } | |||
|
|
|||
| if (isDevEnv && isMswEnabled) { | |||
| if (isMswEnabled) { | |||
| const { worker } = await loadWorker(); | |||
| await worker.start(); | |||
| } | |||
Contributor
TICS Quality Gate❌ Failedlandscape-ui
❌ Condition “No new Coding Standard Violations for level 1, 2, 3 with respect to Previous analysis” failed 1 time.
|
||||||||
| File | Issues | |
|---|---|---|
| 🪲 Total | ❌ Blocking | |
| 14 | +9 | |
See the results in the TICS Viewer
The following files have been checked for this project
- src/main.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for packaging landscape-ui as a snap. Build options include selfHosted or saas, mocks enabled or disabled. Backend service URLs are set at runtime.
Including support for MSWs meant making changes to vite.config.ts, main.tsx and main.test.tsx to allow mocks to run on a build created with
vite build. If the snap doesn't need to support MSWs then those changes can be removed. See end of README for more details.Release Impact
Pick the target branch (see RELEASES.md for the full model):
dev— internal testing → publishes toppa-build-devmain— next beta → publishes toppa-buildrelease/YY.MM— point release on a maintained cycle → publishes toppa-build-YY.MM(and toppa-build-stableif this is the currently-promoted branch). Specify cycle:release/____Change type (tick one):
Checklist
pnpm changeset(orpnpm changeset --emptyif no CHANGELOG line is warranted) and committed the resulting.mdfile. Required for PRs targetingmainandrelease/*; enforced by theChangeset checkworkflow.scripts/).Versioning Reminder
Important
Landscape UI uses CalVer (
YY.MM.Point.Build). Version derivation by branch:main/point/*→YY.MM.0.<run>-betadev→YY.MM.0.<run>-devrelease/YY.MM→YY.MM.1.<run>(cycle pinned by branch name)