Skip to content

flathub/io.frappe.books

Repository files navigation

Flatpak Build Files for Frappe Books

Frappe Books is a free desktop book-keeping software for small businesses and freelancers.

How the Build Works

Instead of using pre-built binary releases, the Flatpak is built from source. The build process:

  1. Pulls the upstream source from GitHub at the tagged release commit.
  2. Installs all Yarn dependencies from a pre-downloaded offline mirror (generated by flatpak-node-generator — see below).
  3. Compiles the TypeScript main process with esbuild and the Vue renderer with Vite (via yarn build --nopackage).
  4. 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.

Prerequisites

Install flatpak-node-generator (requires Python 3.11+):

pipx install git+https://github.com/flatpak/flatpak-builder-tools.git#subdirectory=node

Regenerating generated-sources.json

generated-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-headers

This 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 -s to split it into generated-sources.0.json, generated-sources.1.json, etc., and list each file in the manifest.

Updating to a New Release

# 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"

Automated Updates

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.

Building & Testing Locally

chmod +x build-flatpak.sh
./build-flatpak.sh

Releases

No releases published

Packages

 
 
 

Contributors

Languages