Skip to content

fix: build the snap on core24 with Node 22, npm ci and the package.json version - #54

Merged
sorenwacker merged 2 commits into
mainfrom
fix/snap-build
Nov 18, 2026
Merged

sorenwacker merged 2 commits into
mainfrom
fix/snap-build

Conversation

@sorenwacker

@sorenwacker sorenwacker commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Why

The Snapcraft workflow has failed on every tag since v1.2.0 (January). The core22 build environment installs Ubuntu's nodejs package, which is Node 12.22, and electron-builder dies on require('fs/promises') before anything is packed. On top of that the yaml hard-coded version: '1.5.0' while package.json is at 1.5.1, used npm install instead of the lockfile, pointed desktop: at a file electron-builder never produces, and copied from dist/linux-*-unpacked, a glob that does not match the x64 output directory linux-unpacked.

What

snap/snapcraft.yaml

  • base: core24 with platforms: amd64.
  • Node 22 from the node snap (build-snaps: [node/22/stable]), the same LTS the app's engines field and the other workflows use.
  • npm ci, then bundle:editor, then electron-builder --linux dir --publish never.
  • adopt-info + craftctl set version=$(node -p "require('./package.json').version"), so a release bumps the version in one place.
  • Electron runs with --no-sandbox and the browser-support plug, as the Electron snapcraft guide does: the Chromium setuid sandbox cannot start under strict confinement. GTK comes from the gnome extension, so libgtk-3-0 is gone from stage-packages; libnspr4 and libasound2t64 (Electron needs both) are added.
  • The desktop: key is dropped; snapcraft picks up snap/gui/markdown-viewer.desktop by app name.

.github/workflows/snap.yml

  • Also runs on pull requests that touch snap/** or the workflow, so a broken snap is caught before a release tag. This PR is the first such run.
  • The publish step is skipped when SNAPCRAFT_TOKEN is not set, so the build stays green and the .snap is kept as a workflow artifact.

Docs: CHANGELOG entry, a sentence in the README build section.

Verified

  • The Snapcraft workflow on this PR packs markdown-viewer_1.5.1_amd64.snap (151 MB, version taken from package.json) in about 4 minutes; meta/snap.yaml carries the gnome extension's plugs and meta/gui/ the desktop file and icon.
  • The snap's payload, unsquashed and launched with --no-sandbox on a sample file, shows the document with its heading, bold text and a rendered mermaid diagram (Playwright _electron, screenshot in the session). Installing the snap itself needs sudo snap install --dangerous, which I did not run here.
  • Snapcraft's own linters: only "unused library" notes for libraries Electron loads at runtime (libsecret, libnotify, libXss, libXtst), plus metadata fields that the second commit fills in (title, license, website, source-code, issues, contact).
  • npm run lint clean; both YAML files parse.

Not in this PR

The Snap Store name markdown-viewer is registered to another publisher (namdev, version 1.1.0 published 2026-10-03), and the repository has no SNAPCRAFT_TOKEN secret. Publishing to the store therefore needs a different snap name registered to this account plus the token; until then the snap is only a build artifact.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JDCcDD9po1tXPPSsKy3xDv

@sorenwacker
sorenwacker merged commit 65de840 into main Nov 18, 2026
5 checks passed
@sorenwacker
sorenwacker deleted the fix/snap-build branch November 18, 2026 18:08
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.

1 participant