{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreia3dvl3xo5cj5kbjj2o5axvpjindlz5zbup4yewxmjmqczgxgwju4",
    "uri": "at://did:plc:yrn4rbgwenb6lfhhzjegbtnc/app.bsky.feed.post/3mievdk5frff2"
  },
  "path": "/t/how-can-i-build-a-flatpak-from-a-bunjs-app/11949#post_1",
  "publishedAt": "2026-03-31T11:47:04.000Z",
  "site": "https://discourse.flathub.org",
  "tags": [
    "Bun",
    "Flatpak Bun Generator",
    "@codemirror"
  ],
  "textContent": "so, i am kind of in the worst situation right now,\ni have created a monorepo project for a tauri app using a new tool called Bun as the package manager. i wanted to build it with inside of the manifest workflow in order to submit to flathub\n\n## Hit and Trial with Bun\n\nso, i am utilizing the bun’s workspaces (which is simmilar to npm workspaces) and bun’s catalogs (there no npm/yarn counter to that)\n\nso, my goal was to create a flatpak builder workflow that can build a tauri app managed by bun. but the thing is that i can’t figure out how to get the nodejs dependecies to be pre downloaded in a way that `bun install` can recognize it when running in the manifest workflow.\n\nto generate the `node-sources.json`, i used a new tool called Flatpak Bun Generator, which can take a bun.lock file and generate a `node-sources.json` file which i can provide to the flatpak builder.\n\nso this is by best attempt that **didn’t work** for bun\n\n\n    id: io.github.keshav_writes_code.cherit\n\n    runtime: org.gnome.Platform\n    runtime-version: \"49\"\n    sdk: org.gnome.Sdk\n\n    command: cherit\n    finish-args:\n      - --socket=wayland\n      - --socket=fallback-x11\n      - --device=dri\n      - --share=ipc\n      - --env=GTK_USE_PORTAL=1\n    sdk-extensions:\n      - org.freedesktop.Sdk.Extension.node24\n      - org.freedesktop.Sdk.Extension.rust-stable\n    build-options:\n      append-path: /usr/lib/sdk/node24/bin:/usr/lib/sdk/rust-stable/bin:/app/bin\n\n    modules:\n      - name: bun\n        buildsystem: simple\n        build-commands:\n          - install -Dm755 bun /app/bin/bun\n        sources:\n          - type: archive\n            url: https://github.com/oven-sh/bun/releases/download/bun-v1.3.11/bun-linux-x64.zip\n            sha256: 8611ba935af886f05a6f38740a15160326c15e5d5d07adef966130b4493607ed\n\n      - name: cherit\n        buildsystem: simple\n        build-options:\n          env:\n            CARGO_HOME: /run/build/cherit/cargo\n            XDG_CACHE_HOME: /run/build/cherit/flatpak-node/cache\n            CARGO_NET_OFFLINE: \"true\"\n            BUN_INSTALL_CACHE_DIR: /run/build/cherit/flatpak-node/npm-cache\n        sources:\n          - type: git\n            url: https://github.com/Keshav-writes-code/Cherit.git\n            branch: refac/site-seperation\n\n          - cargo-sources.json\n          - node-sources.json\n\n        build-commands:\n          - bun i\n          - bun run tauri build --workspace=cherit -- --no-bundle\n\n          - install -Dm755 -t /app/bin/ apps/app/src-tauri/target/release/cherit\n          - install -Dm644 -t /app/share/metainfo/ apps/app/distribute/linux/flatpak/io.github.keshav_writes_code.cherit.metainfo.xml\n          - install -Dm644 -t /app/share/applications/ apps/app/distribute/linux/flatpak/io.github.keshav_writes_code.cherit.desktop\n\n          - desktop-file-edit --set-key=Icon --set-value=\"io.github.keshav_writes_code.cherit\"\n            /app/share/applications/io.github.keshav_writes_code.cherit.desktop\n\n          # Install Icons\n          - install -Dm644 apps/app/src-tauri/icons/32x32.png /app/share/icons/hicolor/32x32/apps/io.github.keshav_writes_code.cherit.png\n          - install -Dm644 apps/app/src-tauri/icons/64x64.png /app/share/icons/hicolor/64x64/apps/io.github.keshav_writes_code.cherit.png\n          - install -Dm644 apps/app/src-tauri/icons/128x128.png /app/share/icons/hicolor/128x128/apps/io.github.keshav_writes_code.cherit.png\n          - install -Dm644 apps/app/src-tauri/icons/128x128@2x.png /app/share/icons/hicolor/256x256/apps/io.github.keshav_writes_code.cherit.png\n\n\n\n## Hit and Trial with NPM\n\ni also tried to simply do a `npm i --offline` instead of `bun install` in the builder workflow\nbut in my `package.json`, some of the dependecies use the catalog feature from bun :\n\n`package.json` :\n\n\n    {\n      \"name\": \"cherit\",\n      ...\n      ...\n      \"workspaces\": {\n        \"packages\": [\n          \"apps/*\",\n        ],\n        \"catalog\": {      <-- Define shared dependencies in bun's root package.json\n          \"@codemirror/commands\": \"^6.10.1\",\n          \"@codemirror/lang-markdown\": \"^6.5.0\",\n          \"@codemirror/language\": \"^6.12.1\",\n        }\n      }\n      ...\n      ...\n    }\n\n\n`apps/app/package.json` :\n\n\n    {\n        ...\n        \"@codemirror/commands\": \"catalog:\", <-- reference the shared depenecy\n        \"@codemirror/lang-markdown\": \"catalog:\",\n        \"@codemirror/language\": \"catalog:\",\n        ...\n    }\n\n\n## Other Ideas\n\ni also though about giving the manifest a tar.gz of the node_modules folder and then just extracting in and running the usual tauri build command, but the problem is\n\n  * its probably highly discouraged by flathub\n  * some packages are platform speciifc (x64. Arm64, etc).\n\n",
  "title": "How can i build a flatpak from a bunjs app"
}