{"id":24443597,"url":"https://github.com/endlessm/electron-installer-flatpak","last_synced_at":"2025-07-09T13:39:17.626Z","repository":{"id":57221668,"uuid":"68976835","full_name":"endlessm/electron-installer-flatpak","owner":"endlessm","description":"Create a flatpak for your Electron app","archived":false,"fork":false,"pushed_at":"2019-11-01T13:43:52.000Z","size":1105,"stargazers_count":59,"open_issues_count":6,"forks_count":17,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-07T13:05:19.293Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/endlessm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-23T01:29:13.000Z","updated_at":"2024-08-10T12:58:59.000Z","dependencies_parsed_at":"2022-08-29T04:01:52.947Z","dependency_job_id":null,"html_url":"https://github.com/endlessm/electron-installer-flatpak","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endlessm%2Felectron-installer-flatpak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endlessm%2Felectron-installer-flatpak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endlessm%2Felectron-installer-flatpak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endlessm%2Felectron-installer-flatpak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endlessm","download_url":"https://codeload.github.com/endlessm/electron-installer-flatpak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633783,"owners_count":21136914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-20T22:16:50.132Z","updated_at":"2025-04-12T21:27:45.912Z","avatar_url":"https://github.com/endlessm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-installer-flatpak [![Version](https://img.shields.io/npm/v/electron-installer-flatpak.svg)](https://www.npmjs.com/package/electron-installer-flatpak) [![Build Status](https://img.shields.io/travis/endlessm/electron-installer-flatpak/master.svg)](http://travis-ci.org/endlessm/electron-installer-flatpak)\n\nCreate a flatpak for your Electron app. This is based off the\n[electron-installer-debian](https://github.com/unindented/electron-installer-debian)\ntool. Add flatpak support to an electron app using [electron-packager](https://github.com/electron-userland/electron-packager)\nwith minimal configuration.\n\n## Requirements\n\nThis tool requires `flatpak` and `flatpak-builder` \u003e= 0.8.2 to be installed on\nyour system. See http://flatpak.org/getting.html\n\nBuilding an electron flatpak requires installing a \"base\" flatpak\napplication with electron library dependencies. That base will be autoinstalled\nduring an app build.\n\nActually running the apps will require the freedesktop runtime to be installed.\nIf you already are running flatpak apps you may have the freedesktop runtime\ninstalled. The following example will install the freedesktop runtime for both\ni386 and x86_64.\n```\nflatpak --user remote-add --from gnome https://sdk.gnome.org/gnome.flatpakrepo\nflatpak --user install gnome org.freedesktop.Platform/x86_64/1.4 org.freedesktop.Platform/i386/1.4\n```\n\n## Installation\n\nFor use from command-line:\n\n```\n$ npm install -g electron-installer-flatpak\n```\n\nFor use in npm scripts or programmatically:\n\n```\n$ npm install --save-dev electron-installer-flatpak\n```\n\n\n## Usage\n\nSay your Electron app lives in `path/to/app`, and has a structure like this:\n\n```\n.\n├── LICENSE\n├── README.md\n├── node_modules\n│   ├── electron-packager\n│   └── electron-prebuilt\n├── package.json\n├── resources\n│   ├── Icon.png\n│   ├── IconTemplate.png\n│   └── IconTemplate@2x.png\n└── src\n    ├── index.js\n    ├── main\n    │   └── index.js\n    └── renderer\n        ├── index.html\n        └── index.js\n```\n\nYou now run `electron-packager` to build the app for flatpak:\n\n```\n$ electron-packager . app --platform linux --arch x64 --out dist/\n```\n\nAnd you end up with something like this in your `dist` folder:\n\n```\n.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── natives_blob.bin\n        ├── resources\n        ├── snapshot_blob.bin\n        └── version\n```\n\nHow do you turn that into a flatpak package that your users can install?\n\n### Command-Line\n\nIf you want to run `electron-installer-flatpak` straight from the command-line, install the package globally:\n\n```\n$ npm install -g electron-installer-flatpak\n```\n\nAnd point it to your built app:\n\n```\n$ electron-installer-flatpak --src dist/app-linux-x64/ --dest dist/installers/ --arch x64\n```\n\nYou'll end up with the package at `dist/installers/io.atom.electron.app_master_x64.flatpak`.\n\n### Scripts\n\nIf you want to run `electron-installer-flatpak` through npm, install the package locally:\n\n```\n$ npm install --save-dev electron-installer-flatpak\n```\n\nEdit the `scripts` section of your `package.json`:\n\n```js\n{\n  \"name\": \"app\",\n  \"description\": \"An awesome app!\",\n  \"version\": \"0.0.1\",\n  \"scripts\": {\n    \"start\": \"electron .\",\n    \"build\": \"electron-packager . app --platform linux --arch x64 --out dist/\",\n    \"flatpak64\": \"electron-installer-flatpak --src dist/app-linux-x64/ --dest dist/installers/ --arch x64\"\n  },\n  \"devDependencies\": {\n    \"electron-installer-flatpak\": \"*\",\n    \"electron-packager\": \"*\",\n    \"electron-prebuilt\": \"*\"\n  }\n}\n```\n\nAnd run the script:\n\n```\n$ npm run flatpak64\n```\n\nYou'll end up with the package at `dist/installer/io.atom.electron.app_master_x64.flatpak`.\n\n### Programmatically\n\nInstall the package locally:\n\n```\n$ npm install --save-dev electron-installer-flatpak\n```\n\nAnd write something like this:\n\n```js\nvar installer = require('electron-installer-flatpak')\n\nvar options = {\n  src: 'dist/app-linux-x64/',\n  dest: 'dist/installers/',\n  arch: 'x64'\n}\n\nconsole.log('Creating package (this may take a while)')\n\ninstaller(options, function (err) {\n  if (err) {\n    console.error(err, err.stack)\n    process.exit(1)\n  }\n\n  console.log('Successfully created package at ' + options.dest)\n})\n```\n\nYou'll end up with the package at `dist/installers/io.atom.electron.app_master_x64.flatpak`.\n\n### Options\n\nEven though you can pass most of these options through the command-line interface, it may be easier to create a configuration file:\n\n```js\n{\n  \"dest\": \"dist/installers/\",\n  \"icon\": \"resources/Icon.png\",\n  \"categories\": [\n    \"Utility\"\n  ]\n}\n```\n\nAnd pass that instead with the `config` option:\n\n```\n$ electron-installer-flatpak --src dist/app-linux-x64/ --arch x64 --config config.json\n```\n\nAnyways, here's the full list of options:\n\n#### src\nType: `String`\nDefault: `undefined`\n\nPath to the folder that contains your built Electron application.\n\n#### dest\nType: `String`\nDefault: `undefined`\n\nPath to the folder that will contain your flatpak installer.\n\n#### rename\nType: `Function`\nDefault: `function (dest, src) { return path.join(dest, src); }`\n\nFunction that renames all files generated by the task just before putting them in your `dest` folder.\n\n#### options.id\nType: `String`\nDefault: the inverted hostname of `package.homepage` plus the santized `package.name`, or `io.atom.electron`\n\nApp ID of the flatpak, used in the [`id` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder) and the flatpak filename.\n\n#### options.productName\nType: `String`\nDefault: `package.productName || package.name`\n\nName of the application (e.g. `Atom`), used in the [`Name` field of the `desktop` specification](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).\n\n#### options.genericName\nType: `String`\nDefault: `package.genericName || package.productName || package.name`\n\nGeneric name of the application (e.g. `Text Editor`), used in the [`GenericName` field of the `desktop` specification](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).\n\n#### options.description\nType: `String`\nDefault: `package.description`\n\nShort description of the application, used in the [`Comment` field of the `desktop` specification](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).\n\n#### options.branch\nType: `String`\nDefault: `master`\n\nRelease branch of the flatpak, used in the [`branch` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder) and the flatpak filename, after the sanitized [app ID](#optionsid).\n\n#### options.base\nType: `String`\nDefault: `io.atom.electron.BaseApp`\n\nBase app to use when building the flatpak, used in the [`base` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder).\n\n#### options.baseVersion\nType: `String`\nDefault: `master`\n\nBase app version, used in the [`base-version` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder).\n\n\n#### options.baseFlatpakref\nType: `String`\nDefault: `https://s3-us-west-2.amazonaws.com/electron-flatpak.endlessm.com/electron-base-app-master.flatpakref`\n\nUrl of a flatpakref to use to auto install the base application.\n\n#### options.runtime\nType: `String`\nDefault: `org.freedesktop.Platform`\n\nRuntime id, used in the [`runtime` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder).\n\n#### options.runtimeVersion\nType: `String`\nDefault: `1.4`\n\nRuntime version, used in the [`runtime-version` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder).\n\n#### options.sdk\nType: `String`\nDefault: `org.freedesktop.Sdk`\n\nSdk id, used in the [`sdk` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder).\n\n#### options.arch\nType: `String`\nDefault: `undefined`\n\nMachine architecture the package is targeted to. Suggested to use node style\narches here ('ia32', 'x64'), which will be converted to flatpak style arches\n('i386', 'x86_64') when calling into the actual flatpak commands. Directly\nusing flatpak style arches is also supported.\n\n#### options.finishArgs\nType: `Array[String]`\nDefault:\n```js\n[\n  // X Rendering\n  '--socket=x11', '--share=ipc',\n  // Open GL\n  '--device=dri',\n  // Audio output\n  '--socket=pulseaudio',\n  // Read/write home directory access\n  '--filesystem=home',\n  // Chromium uses a socket in tmp for its singleton check\n  '--filesystem=/tmp',\n  // Allow communication with network\n  '--share=network',\n  // System notifications with libnotify\n  '--talk-name=org.freedesktop.Notifications'\n],\n```\n\nArguments to use when call `flatpak build-finish`, use in the [`finish-args` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder).\n\nChanging this can be used to customize permissions of the sandbox the flatpak will run in.\n\n#### options.files\nType: `Array[Array[source, dest]]`\nDefault:\n```js\n[],\n```\n\nFiles to copy directly into the app. Should be a list of [source, dest] tuples.\nSource should be a relative/absolute path to a file/directory to copy into the\nflatpak, and dest should be the path inside the app install prefix (e.g.\n/share/applications/)\n\nApplication assets and code will be fully handled by `electron-packager`, but\nthis is a useful way to install things such as appstream metadata for an app,\nor dbus configuration files.\n\n#### options.symlinks\nType: `Array[Array[target, location]]`\nDefault:\n```js\n[],\n```\n\nSymlinks to create in the app files. Should be a list of [target, location]\nsymlink tuples. Target can be either a relative or absolute path inside the app\ninstall prefix, and location should be a absolute path inside the prefix to\ncreate the symlink at.\n\n#### options.modules\nType: `Array[Object]`\nDefault: `[]`\n\nThis option can be used to build extra software modules into the flatpak\napplication sandbox. Most electron applications will not need this, but if you\nare using native node modules that require certain libraries on the system, this\nmay be necessary. For example, to build [libgit2](https://libgit2.github.com/)\nto use with [nodegit](https://github.com/nodegit/nodegit), add the following to\nyour modules list.\n```\nmodules: [\n  {\n    name: 'libgit2',\n    cmake: true,\n    configOpts: [ '-DBUILD_SHARED_LIBS:BOOL=ON', '-DTHREADSAFE=ON' ],\n    sources: [{\n      type: 'git',\n      url: 'https://github.com/libgit2/libgit2.git',\n      branch: 'maint/v0.24'\n    }]\n  }\n]\n```\n\nSee the [`modules` field of a flatpak-builder manifest](http://flatpak.org/flatpak/flatpak-docs.html#flatpak-builder) for more details.\n\n#### options.bin\nType: `String`\nDefault: `package.name`\n\nRelative path to the executable that will act as binary for the application, used in the [`Exec` field of the `desktop` specification](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).\n\nThe generated package will contain a symlink `/usr/bin/\u003c%= options.name %\u003e` pointing to the path provided here.\n\nFor example, providing this configuration:\n\n```js\n{\n  src: '...',\n  dest: '...',\n  name: 'foo',\n  bin: 'resources/cli/launcher.sh'\n}\n```\n\nWill create a package with the following symlink:\n\n```\nusr/bin/foo@ -\u003e ../lib/foo/resources/cli/launcher.sh\n```\n\nAnd a desktop specification with the following `Exec` key:\n\n```\nExec=foo %U\n```\n\n#### options.icon\nType: `String` or `Object[String:String]`\nDefault: `undefined`\n\nPath to a single image that will act as icon for the application:\n\n```js\n{\n  icon: 'resources/Icon.png'\n}\n```\n\nOr multiple images with their corresponding resolutions:\n\n```js\n{\n  icon: {\n    '48x48': 'resources/Icon48.png',\n    '64x64': 'resources/Icon64.png',\n    '128x128': 'resources/Icon128.png',\n    '256x256': 'resources/Icon256.png'\n  }\n}\n```\n\n#### options.categories\nType: `Array[String]`\nDefault: `[]`\n\nCategories in which the application should be shown in a menu, used in the [`Categories` field of the `desktop` specification](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).\n\nFor possible values check out the [Desktop Menu Specification](http://standards.freedesktop.org/menu-spec/latest/apa.html).\n\n#### options.mimeType\nType: `Array[String]`\nDefault: `[]`\n\nMIME types the application is able to open, used in the [`MimeType` field of the `desktop` specification](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).\n\n\n## Meta\n\n* Code: `git clone git://github.com/endlessm/electron-installer-flatpak.git`\n* Home: \u003chttps://github.com/endlessm/electron-installer-flatpak/\u003e\n\n\n## Contributors\n\n* Daniel Perez Alvarez ([unindented@gmail.com](mailto:unindented@gmail.com))\n* Matt Watson ([mattdangerw@gmail.com](mailto:mattdangerw@gmail.com))\n\n\n## License\n\nCopyright (c) 2016 Daniel Perez Alvarez ([unindented.org](https://unindented.org/)). This is free software, and may be redistributed under the terms specified in the LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendlessm%2Felectron-installer-flatpak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendlessm%2Felectron-installer-flatpak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendlessm%2Felectron-installer-flatpak/lists"}