super-productivity/electron-builder.yaml
Johannes Millan ddc01ab6cf build(electron): exclude uuidv7 and guard against future asar regressions
uuidv7 is imported only from src/app/util/uuid-v7.ts; the Angular
bundler inlines it (verified via chunk-65AEYVPY.js.map source
attribution). Adding it to the three electron-builder configs drops
another ~80 KB from the asar.

Extend tools/verify-electron-requires.js to also flag bare require()
targets in electron/ that match a `\!**/<pkg>/**` exclusion in
electron-builder.yaml. Without this, adding `require('@noble/ciphers')`
or similar in electron/main.ts would pass dev (which resolves against
on-disk node_modules) and only crash with MODULE_NOT_FOUND on packaged
releases. The script is already invoked from .github/workflows/
electron-smoke.yml, so the new check runs in CI automatically.

Manual verification covers 14 cases (8 excluded, 6 allowed) including
@noble/ciphers, @noble/hashes, scoped-vs-bare resolution, and Node
built-ins.
2026-05-13 21:22:59 +02:00

215 lines
7.5 KiB
YAML

appId: superProductivity
productName: Super Productivity
artifactName: ${name}-${arch}.${ext}
files:
- electron/**/*
- '!electron/**/*.ts'
- '!electron/**/*.js.map'
- .tmp/angular-dist/**/*
- 'embedded.provisionprofile'
# Exclude Nx binaries - they're build tools, not runtime dependencies
- '!**/@nx/nx-darwin-*/**'
- '!**/@nx/nx-linux-*/**'
- '!**/@nx/nx-win32-*/**'
# Capacitor (mobile shim) - never required from electron/ at runtime
- '!**/@capacitor/**'
- '!**/@capawesome/**'
- '!**/capacitor-plugin-safe-area/**'
# sharp + libvips native binaries - only used by tools/generate-*-icon.js
# during local dev; ~33 MB of unused weight in the asar otherwise
- '!**/sharp/**'
- '!**/@img/**'
# Nx LMDB cache and Rollup pulled in transitively by build tooling
- '!**/@lmdb/**'
- '!**/@rollup/**'
# Compiled into the Angular CSS bundle; the node_modules copy is unused
- '!**/@material-symbols/**'
# @noble/ciphers and hash-wasm are imported by the Angular bundle and
# inlined by the bundler (WASM is base64-embedded). The node_modules
# copies are dead weight at runtime.
- '!**/@noble/**'
- '!**/hash-wasm/**'
# uuidv7 is imported by src/ (Angular bundle inlines it); not used by electron/
- '!**/uuidv7/**'
#afterSign: ./tools/notarizeMacApp.js
directories:
output: './.tmp/app-builds'
# Post-pack hook that installs a shell wrapper for Linux builds to force
# --ozone-platform=x11 in Snap+Wayland sessions.
# See tools/afterPack.js + build/linux/snap-wrapper.sh and
# docs/research/snap-wayland-gpu-fix-research.md §18.
afterPack: ./tools/afterPack.js
win:
target:
- target: nsis
arch:
- arm64
- x64
- target: portable
arch:
- arm64
- x64
publish:
- github
nsis:
# Hardcoded to avoid spaces (SignPath converts spaces to dots). Also referenced in build.yml.
artifactName: Super-Productivity-Setup-${arch}.${ext}
# allow to install to custom location
oneClick: false
allowToChangeInstallationDirectory: true
portable:
artifactName: ${name}-${arch}.${ext}
appx:
applicationId: SuperProductivity
displayName: Super Productivity
publisherDisplayName: johannesjo
publisher: CN=___-___
identityName: ___johannesjo.SuperProductivity
linux:
# Fix for issue #5259: Set executable name without spaces for snap compatibility
executableName: superproductivity
category: Office;ProjectManagement
mimeTypes:
- x-scheme-handler/superproductivity
desktop:
entry:
StartupWMClass: superproductivity
target:
- AppImage
- deb
- snap
- rpm
publish:
- github
rpm:
# Fix for issue #5368: Prevent /usr/lib/.build-id/ collisions with other Electron apps
fpm: ['--rpm-rpmbuild-define=_build_id_links none']
# leads to Error: Please specify executable name as linux.executableName instead of linux.desktop.Exec
# desktop:
# Name: Super Productivity
# Comment: A todo list and time tracking app
# Exec: superProductivity
# Terminal: false
# Type: Application
# Icon: build/icon.png
# GenericName: ToDo List and Time Tracker
snap:
# We upload the .snap to the Snap Store ourselves via Canonical's snapcraft
# container in CI (build.yml). electron-builder's snap target has a
# hard-coded fallback to `snapStore` in `findSnapPublishConfig` (snap.js):
# if `snap.publish` is unset, it falls through `linux.publish`/`config.publish`
# to `{ provider: "snapStore" }`, then invokes `snapcraft` on the runner
# during upload — and we no longer install snapcraft there (it was an
# unreliable `sudo snap install`). Setting `snap.publish: github` overrides
# that fallback. The .snap also lands on the GitHub release as a side effect,
# which is harmless (and a useful manual-download fallback).
publish: github
grade: stable
allowNativeWayland: true
autoStart: true
base: core22
confinement: strict
environment:
# Fix for issue #4920: Isolate fontconfig cache to prevent GTK dialog rendering issues
# https://github.com/super-productivity/super-productivity/issues/4920
FC_CACHEDIR: $SNAP_USER_DATA/.cache/fontconfig
# Fix for issue #7298: tray icon renders as three dots on Ubuntu 24.04+ snap.
# Chromium's StatusIconLinuxDbus writes the tray PNG to TMPDIR and sends
# its path to gnome-shell via the SNI IconThemePath property. The default
# /tmp inside a strict snap is bind-mounted to
# /tmp/snap-private-tmp/snap.<name>/tmp with mode 0700 on the parent, so
# gnome-shell (outside the mount namespace) cannot stat the file and
# falls back to 'image-loading-symbolic' (three dots). $XDG_RUNTIME_DIR
# (= /run/user/$UID) is visible to both sides, so redirecting Chromium's
# temp writes there restores icon rendering. Matches Signal Desktop's
# snap and the official Electron snapcraft guide. electron-builder's
# SnapOptions docstring claims this as a default but snap.js no longer
# injects it (see node_modules/app-builder-lib/out/targets/snap.js).
TMPDIR: $XDG_RUNTIME_DIR
plugs:
- default # Includes: home, desktop, desktop-legacy, x11, wayland, etc.
- password-manager-service
- system-observe
- login-session-observe
# Fix for issue #6031: Add filesystem access for local file sync
# https://github.com/super-productivity/super-productivity/issues/6031
- removable-media # Allows sync to external drives/USB storage
# Override electron-builder's hardcoded gnome-3-28-1804 content snap (core20 era)
# with gnome-42-2204 (core22 era) for up-to-date Mesa drivers and GSettings schemas.
# The plug name must match the template key to replace it rather than duplicate it.
# The explicit `content` attribute tells snapd to match the gnome-42-2204 slot.
# Pattern from Tidal HiFi: https://github.com/Mastermindzh/tidal-hifi
# gnome-42-2204 has global auto-connect (granted June 2022).
# Ref: electron-builder#9452, electron-builder#8548 (closed, not planned)
- gnome-3-28-1804:
interface: content
content: gnome-42-2204
target: $SNAP/gnome-platform
default-provider: gnome-42-2204
flatpak:
runtimeVersion: '25.08'
finishArgs:
- --share=network
- --share=ipc
- --socket=x11
- --socket=wayland
- --socket=fallback-x11
- --socket=pulseaudio
- --device=dri
- --filesystem=home
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.kde.StatusNotifierWatcher
- --talk-name=org.gnome.Mutter.IdleMonitor
- --talk-name=org.freedesktop.secrets
- --system-talk-name=org.freedesktop.login1
- --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons
- --env=ELECTRON_TRASH=gio
mac:
appId: com.super-productivity.app
type: distribution
category: public.app-category.productivity
entitlements: build/entitlements.mac.plist
entitlementsInherit: build/entitlements.mac.plist
hardenedRuntime: true
gatekeeperAssess: false
provisioningProfile: embedded.provisionprofile
darkModeSupport: true
notarize: true
extendInfo:
ITSAppUsesNonExemptEncryption: false
publish:
- github
target:
# - zip
- target: dmg
arch:
- arm64
- x64
- universal
dmg:
sign: true
publish:
- github
pkg:
publish: never
# HERE: electron-builder.mas.yaml
#mas:
# type: distribution
# category: public.app-category.productivity
# entitlements: build/entitlements.mas.plist
# entitlementsInherit: build/entitlements.mas.inherit.plist
# provisioningProfile: prod.provisionprofile
# icon: build/icon.icns
# hardenedRuntime: true
# publish: never