Frappe Books is a free desktop book-keeping software for small businesses and freelancers.
Instead of using pre-built binary releases, the Flatpak is built from source. The build process:
- Pulls the upstream source from GitHub at the tagged release commit.
- Installs all Yarn dependencies from a pre-downloaded offline mirror
(generated by
flatpak-node-generator— see below). - Compiles the TypeScript main process with esbuild and the Vue renderer
with Vite (via
yarn build --nopackage). - Runs electron-builder in directory mode to produce an unpacked Electron application, using the Electron binary that was also pre-downloaded.
Building from source means the package automatically supports every architecture that Flathub supports, without needing upstream to publish architecture-specific binary releases.
Install flatpak-node-generator
(requires Python 3.11+):
pipx install git+https://github.com/flatpak/flatpak-builder-tools.git#subdirectory=nodegenerated-sources.json contains the offline mirror of all Yarn packages and
the Electron binary for every supported architecture. It must be regenerated
whenever the upstream yarn.lock changes (i.e. on every release bump).
# Clone (or update) the upstream repo at the tagged release
git clone --depth 1 --branch v<VERSION> https://github.com/frappe/books.git /tmp/frappe-books
# Generate the sources file
# --electron-node-headers also pre-fetches the Electron node headers so that
# better-sqlite3 (a native module) can be rebuilt for the correct Electron ABI
# without network access during the Flatpak build.
flatpak-node-generator yarn /tmp/frappe-books/yarn.lock --electron-node-headersThis writes generated-sources.json in the current directory. Commit it
alongside the updated manifest.
Note: The file can be large (often 50–150 MB). If it exceeds GitHub's per-file limit, pass
-sto split it intogenerated-sources.0.json,generated-sources.1.json, etc., and list each file in the manifest.
# 1. Get the new version tag and commit SHA from upstream
VERSION=0.XX.Y
COMMIT=$(git -C /tmp/frappe-books rev-parse HEAD)
# 2. Update the tag and commit in the manifest
sed -i "s/tag: v.*/tag: v$VERSION/" io.frappe.books.yml
sed -i "s/commit: .*/commit: $COMMIT/" io.frappe.books.yml
# 3. Also update the version references in the appdata file
# (insert a new <release> entry at the top of the <releases> block)
# 4. Regenerate the offline sources
flatpak-node-generator yarn /tmp/frappe-books/yarn.lock --electron-node-headers
# 5. Commit everything
git add io.frappe.books.yml io.frappe.books.appdata.xml generated-sources.json
git commit -m "chore: update to v$VERSION"A GitHub Actions workflow runs
weekly on Mondays at 09:00 UTC and automatically checks for new upstream
releases. It will need to be updated to also run flatpak-node-generator
and commit the refreshed generated-sources.json.
chmod +x build-flatpak.sh
./build-flatpak.sh