Skip to content

Snap build for landscape-ui#620

Open
marqode wants to merge 6 commits into
mainfrom
feat/snap-packaging
Open

Snap build for landscape-ui#620
marqode wants to merge 6 commits into
mainfrom
feat/snap-packaging

Conversation

@marqode
Copy link
Copy Markdown
Contributor

@marqode marqode commented May 14, 2026

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 to ppa-build-dev
  • main — next beta → publishes to ppa-build
  • release/YY.MM — point release on a maintained cycle → publishes to ppa-build-YY.MM (and to ppa-build-stable if this is the currently-promoted branch). Specify cycle: release/____

Change type (tick one):

  • Patch (fix)
  • Minor (feature)
  • Major (breaking)

The change-type label is informational and only affects how the entry is rendered in the CHANGELOG. The actual version is computed from the branch and CalVer cycle — pnpm changeset's patch/minor choice does not influence it.

Checklist

  • Changeset added — I have run pnpm changeset (or pnpm changeset --empty if no CHANGELOG line is warranted) and committed the resulting .md file. Required for PRs targeting main and release/*; enforced by the Changeset check workflow.
  • UI verified — I have verified the changes locally.
  • Linting clean — No linting errors are present (especially in scripts/).

Versioning Reminder

Important

Landscape UI uses CalVer (YY.MM.Point.Build). Version derivation by branch:

  • main / point/*YY.MM.0.<run>-beta
  • devYY.MM.0.<run>-dev
  • release/YY.MMYY.MM.1.<run> (cycle pinned by branch name)

@marqode marqode marked this pull request as ready for review May 14, 2026 20:10
Copilot AI review requested due to automatic review settings May 14, 2026 20:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with snapcraft.yaml, nginx template + start/cert scripts, configure hook, Linux/Multipass build scripts, README, and a shell-based template-render test.
  • main.tsx/vite.config.ts adjusted so MSW can be enabled in production builds via VITE_MSW_ENABLED=true.
  • .gitignore updated to ignore built snap/*.snap artifacts.

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 thread src/main.tsx
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();
}
@github-actions
Copy link
Copy Markdown
Contributor

TICS Quality Gate

❌ Failed

landscape-ui

Coding Standards: ❌ 9 Blocking Issues

❌ Condition “No new Coding Standard Violations for level 1, 2, 3 with respect to Previous analysis” failed 1 time.
FileIssues
🪲 Total❌ Blocking

src/main.tsx

14+9

See the results in the TICS Viewer

The following files have been checked for this project
  • src/main.tsx

Run-tests-and-TICS-report / tics-report / TICS report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants