{"id":13188,"library":"flatpak-bundler","title":"Flatpak Bundler","description":"flatpak-bundler is a Node.js utility designed to programmatically create Flatpak application bundles. Version 0.1.3, last updated in January 2017, acts as a wrapper around the system's `flatpak-builder` command-line tool. It aims to simplify the Flatpak creation process by offering features like automatic installation of Flatpak runtimes and dependencies, direct export to single-file bundles, and streamlined file copying and symlink management. This module was particularly useful for packaging applications built with frameworks like Electron or NW.js, which often involve prebuilt binaries rather than traditional autotools-style build processes. Given its last update was over nine years ago and its dependency on Node.js versions 4.0.0 or greater (a long-unsupported runtime), the package is considered abandoned, with no active development or maintenance. Modern Flatpak tooling for Node.js or Electron has since evolved significantly, often utilizing more direct `flatpak-builder` manifest generation or alternative Electron-specific bundlers.","status":"abandoned","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/endlessm/flatpak-bundler","tags":["javascript","flatpak"],"install":[{"cmd":"npm install flatpak-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add flatpak-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add flatpak-bundler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required system utility for building and managing Flatpak applications. The library is a wrapper around Flatpak commands.","package":"flatpak","optional":false},{"reason":"Required system utility for orchestrating Flatpak builds. flatpak-bundler internally calls this tool.","package":"flatpak-builder","optional":false}],"imports":[{"note":"This package is CommonJS-only and was developed for Node.js versions before ES modules were standardized. Direct ES module import syntax will not work.","wrong":"import { bundle } from 'flatpak-bundler';","symbol":"bundle","correct":"const bundler = require('flatpak-bundler');\nbundler.bundle(manifest, buildOptions, callback);"}],"quickstart":{"code":"const path = require('path');\nconst fs = require('fs');\nconst bundler = require('flatpak-bundler');\n\n// Create a dummy manifest file and a simple executable script\nconst manifestContent = {\n  \"id\": \"org.example.BundledApp\",\n  \"runtime\": \"org.freedesktop.Platform\",\n  \"sdk\": \"org.freedesktop.Sdk\",\n  \"runtime-version\": \"23.08\", // May need to adjust based on your Flatpak setup's support\n  \"finish-args\": [\n    \"--share=ipc\", \"--socket=x11\", \"--share=network\",\n    \"--filesystem=home\", \"--device=all\"\n  ],\n  \"command\": \"hello\",\n  \"modules\": [\n    {\n      \"name\": \"hello-module\",\n      \"buildsystem\": \"simple\",\n      \"build-commands\": [\n        \"install -D hello.sh /app/bin/hello\"\n      ],\n      \"sources\": [\n        {\n          \"type\": \"file\",\n          \"path\": \"hello.sh\"\n        }\n      ]\n    }\n  ]\n};\n\nconst helloScriptContent = `#!/bin/sh\\necho \"Hello from Flatpak bundle created by flatpak-bundler!\"\\n`;\nconst manifestPath = path.join(__dirname, 'hello.json');\nconst helloScriptPath = path.join(__dirname, 'hello.sh');\n\nfs.writeFileSync(manifestPath, JSON.stringify(manifestContent, null, 2));\nfs.writeFileSync(helloScriptPath, helloScriptContent, { mode: 0o755 });\n\nconsole.log('Manifest and script created.');\n\n// Define build options\nconst buildOptions = {\n  bundlePath: path.join(process.cwd(), 'output.flatpak'), // Output the flatpak bundle\n  workingDir: path.join(process.cwd(), 'flatpak-build-temp'), // Temporary build directory\n  cleanTmpdirs: true,\n  autoInstallRuntime: true,\n  autoInstallSdk: true\n};\n\nconsole.log('Starting Flatpak bundle creation...');\n\nbundler.bundle(manifestContent, buildOptions, (err, finalBuildOptions) => {\n  if (err) {\n    console.error('Error creating Flatpak bundle:', err);\n  } else {\n    console.log('Flatpak bundle created successfully!');\n    console.log('Bundle path:', finalBuildOptions.bundlePath);\n    console.log(`To install: flatpak install --user --bundle ${finalBuildOptions.bundlePath}`);\n    console.log(`To run: flatpak run ${manifestContent.id}`);\n  }\n  // Clean up temporary files\n  fs.unlinkSync(manifestPath);\n  fs.unlinkSync(helloScriptPath);\n});","lang":"javascript","description":"This quickstart demonstrates how to programmatically create a Flatpak bundle using `flatpak-bundler`. It defines a basic Flatpak manifest and a simple executable script, then uses the `bundle` function to generate a `.flatpak` file. Requires Flatpak and flatpak-builder installed system-wide."},"warnings":[{"fix":"Consider using actively maintained Flatpak packaging tools like `@electron-forge/maker-flatpak` for Electron apps, or directly generating `flatpak-builder` manifests with tools like `flatpak-node-generator` for Node.js projects, or using Flatpak GitHub Actions for CI/CD.","message":"This package is effectively abandoned. The last update was in January 2017 (9 years ago), and it targets Node.js >= 4.0.0, which is an End-of-Life runtime. Using this package in modern Node.js environments is not recommended and may lead to compatibility issues or security vulnerabilities.","severity":"breaking","affected_versions":"all"},{"fix":"Ensure `flatpak` and `flatpak-builder` are installed on your system. Refer to the official Flatpak documentation for installation instructions: `https://flatpak.org/setup/`.","message":"The package requires external system dependencies: `flatpak` and `flatpak-builder` to be installed and available in the system's PATH. Specifically, `flatpak >= 0.6.13` is a stated requirement, but newer versions of `flatpak-builder` (e.g., >= 0.8.2) may be expected by modern Flatpak runtimes.","severity":"gotcha","affected_versions":"all"},{"fix":"Experiment with `runtime` and `runtime-version` in your manifest, potentially using older versions if newer ones cause issues. However, the fundamental recommendation is to migrate to a newer Flatpak build tool.","message":"Due to the package's age, it may not be compatible with the latest Flatpak runtimes, SDKs, or modern Flatpak manifest specifications and best practices. Building Flatpaks with very old tools can result in unstable or non-functional bundles.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Install `flatpak-builder` via your system's package manager. For example, on Debian/Ubuntu: `sudo apt install flatpak-builder`.","cause":"The `flatpak-builder` command-line utility is not installed on the system or is not in the system's PATH.","error":"Error: Command failed: flatpak-builder ...\nsh: 1: flatpak-builder: not found"},{"fix":"Install `flatpak` via your system's package manager. For example, on Debian/Ubuntu: `sudo apt install flatpak`.","cause":"The `flatpak` command-line utility is not installed on the system or is not in the system's PATH.","error":"Error: Command failed: flatpak ...\nsh: 1: flatpak: not found"},{"fix":"Ensure the user account running the script has write permissions to the output and working directories. For Flatpak itself, sometimes running `flatpak repair` or ensuring Flatpak's internal directories have correct permissions might help.","cause":"The Node.js process running `flatpak-bundler` does not have sufficient permissions to write to the specified output or temporary directories, or to create files/symlinks in Flatpak's build environment.","error":"Error: EACCES: permission denied, open '...' (during file copy or symlink creation)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}