{"id":13766692,"url":"https://github.com/electron-userland/electron-installer-redhat","last_synced_at":"2025-04-05T07:08:05.583Z","repository":{"id":3693525,"uuid":"50600863","full_name":"electron-userland/electron-installer-redhat","owner":"electron-userland","description":"Create a Red Hat / RPM package for your Electron app.","archived":false,"fork":false,"pushed_at":"2023-10-30T17:05:38.000Z","size":1271,"stargazers_count":78,"open_issues_count":11,"forks_count":49,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-06-17T05:28:26.200Z","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/electron-userland.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-01-28T17:39:04.000Z","updated_at":"2024-05-25T01:15:26.000Z","dependencies_parsed_at":"2024-01-02T21:30:06.621Z","dependency_job_id":null,"html_url":"https://github.com/electron-userland/electron-installer-redhat","commit_stats":{"total_commits":176,"total_committers":22,"mean_commits":8.0,"dds":0.8011363636363636,"last_synced_commit":"acdfdf4c884f057cb9d483ee824b47eecbe40055"},"previous_names":["unindented/electron-installer-redhat"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-userland%2Felectron-installer-redhat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-userland%2Felectron-installer-redhat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-userland%2Felectron-installer-redhat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-userland%2Felectron-installer-redhat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electron-userland","download_url":"https://codeload.github.com/electron-userland/electron-installer-redhat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299833,"owners_count":20916190,"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":"2024-08-03T16:00:59.562Z","updated_at":"2025-04-05T07:08:05.555Z","avatar_url":"https://github.com/electron-userland.png","language":"JavaScript","funding_links":[],"categories":["Tools"],"sub_categories":["For Electron"],"readme":"![Electron Installer for Red Hat](resources/logo.png)\n\n# electron-installer-redhat [![Version](https://img.shields.io/npm/v/electron-installer-redhat.svg)](https://www.npmjs.com/package/electron-installer-redhat) [![Build Status](https://img.shields.io/travis/electron-userland/electron-installer-redhat.svg)](http://travis-ci.org/electron-userland/electron-installer-redhat)\n\n\u003e Create a Red Hat package for your Electron app.\n\n\n## Requirements\n\nThis tool requires Node 10 or greater and `rpmbuild` 4.13 or greater to build the `.rpm` package.\n\n**Note**: RPM 4.13.0 or greater is required due to the [boolean dependency feature](http://rpm.org/user_doc/boolean_dependencies.html).\n\nOn Fedora you can do something like this:\n\n```\n$ sudo dnf install rpm-build\n```\n\nWhile on Debian/Ubuntu you'll need to do this instead:\n\n```\n$ sudo apt-get install rpm\n```\n\n## Installation\n\nFor use from command-line:\n\n```\n$ npm install -g electron-installer-redhat\n```\n\nFor use in npm scripts or programmatically:\n\n```\n$ npm install --save-dev electron-installer-redhat\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\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 Red Hat:\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 Red Hat package that your users can install?\n\n### Command-Line\n\nIf you want to run `electron-installer-redhat` straight from the command-line, install the package globally:\n\n```\n$ npm install -g electron-installer-redhat\n```\n\nAnd point it to your built app:\n\n```\n$ electron-installer-redhat --src dist/app-linux-x64/ --dest dist/installers/ --arch x86_64\n```\n\nYou'll end up with the package at `dist/installers/app-0.0.1-1.x86_64.rpm`.\n\n### Scripts\n\nIf you want to run `electron-installer-redhat` through npm, install the package locally:\n\n```\n$ npm install --save-dev electron-installer-redhat\n```\n\nEdit the `scripts` section of your `package.json`:\n\n```json\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    \"rpm64\": \"electron-installer-redhat --src dist/app-linux-x64/ --dest dist/installers/ --arch x86_64\"\n  },\n  \"devDependencies\": {\n    \"electron-installer-redhat\": \"*\",\n    \"electron-packager\": \"*\",\n    \"electron-prebuilt\": \"*\"\n  }\n}\n```\n\nAnd run the script:\n\n```\n$ npm run rpm64\n```\n\nYou'll end up with the package at `dist/installers/app-0.0.1-1.x86_64.rpm`.\n\n### Programmatically\n\nInstall the package locally:\n\n```shell\n$ npm install --save-dev electron-installer-redhat\n```\n\nAnd write something like this:\n\n```javascript\nconst installer = require('electron-installer-redhat')\n\nconst options = {\n  src: 'dist/app-linux-x64/',\n  dest: 'dist/installers/',\n  arch: 'x86_64'\n}\n\nasync function main (options) {\n  console.log('Creating package (this may take a while)')\n\n  try {\n    await installer(options)\n    console.log(`Successfully created package at ${options.dest}`)\n  } catch (err) {\n    console.error(err, err.stack)\n    process.exit(1)\n  }\n}\nmain(options)\n```\n\nYou'll end up with the package at `dist/installers/app-0.0.1-1.x86_64.rpm`.\n\n_Note: As of 2.0.0, the Node-style callback pattern is no longer available. You can use [`util.callbackify`](https://nodejs.org/api/util.html#util_util_callbackify_original) if this is required for your use case._\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```javascript\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```shell\n$ electron-installer-redhat --src dist/app-linux-x64/ --arch x86_64 --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 Red Hat 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.name\nType: `String`\nDefault: `package.name`\n\nName of the package (e.g. `atom`), used in the [`Name` field of the `spec` file](https://fedoraproject.org/wiki/Packaging:NamingGuidelines).\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, one-line description of the application; do not end with a period.\nUsed in the [`Summary` field of the `spec` file](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview).\n\n#### options.productDescription\nType: `String`\nDefault: `package.productDescription || package.description`\n\nLong description of the application, used in the [`%description` tag of the `spec` file](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview).\n\n#### options.version\nType: `String`\nDefault: `package.version`\n\nVersion number of the package, used in the [`Version` field of the `spec` file](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview).\n\n#### options.revision\nType: `String`\nDefault: `package.revision || 1`\n\nRevision number of the package, used in the [`Release` field of the `spec` file](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview).\n\n#### options.license\nType: `String`\nDefault: `package.license`\n\nLicense of the package, used in the [`License` field of the `spec` file](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview).\n\n#### options.arch\nType: `String`\nDefault: `undefined`\n\nMachine architecture the package is targeted to, used to set the `--target` option.\n\n#### options.platform\nType: `String`\nDefault: Operating system platform of the host machine. For possible values see Node.js [process.platform](https://nodejs.org/api/process.html#process_process_platform)\n\nOperating system platform the package is targeted to, used to set the [`--target`](https://linux.die.net/man/8/rpmbuild) option.\n\n#### options.requires\nType: `Array[String]`\nDefault: The minimum list of packages needed for Electron to run\n\nPackages that are required when the program starts, used in the [`Requires` field of the `spec` file](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview).\n\nAll user requirements will be appended to the default array of requirements, and any duplicates will be removed.\n\n#### options.homepage\nType: `String`\nDefault: `package.homepage || package.author.url`\n\nURL of the homepage for the package, used in the [`URL` field of the `spec` specification](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview).\n\n#### options.compressionLevel\nType: `Number`\nDefault: `2`\n\nPackage compression level, from `0` to `9`.\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 ../share/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.execArguments\nType: `Array[String]`\nDefault: `[]`\n\nCommand-line arguments to pass to the executable. Will be added to the [`Exec` field of the `desktop` specification](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).\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    'scalable': 'resources/Icon.svg',\n    'symbolic': 'resources/Icon-symbolic.svg',\n  }\n}\n```\nPer the [icon theme specification](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-0.11.html), image files must either PNGs or SVGs. The SVG format can only be used for the `scalable` or `symbolic` resolutions.\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\nIf this option is specified, make sure to run `update-desktop-database \u0026\u003e /dev/null` as part of the `post` and `postun` scripts to refresh the [cached database of MIME types](https://fedoraproject.org/wiki/NewMIMESystem).\n\n\n#### options.scripts\nType: `Object[String:String]`\nDefault: `undefined`\n\nPath to [installation scripts](https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/) with their corresponding name. The files contents will be added to the spec file.\n\n```javascript\n{\n  scripts: {\n    'pre': 'resources/pre_script',\n    'post': 'resources/post_script',\n    'preun': 'resources/preun_script',\n    'postun': 'resources/postun_script'\n  }\n}\n```\n\n#### options.desktopTemplate\nType: `String`\nDefault: [`resources/desktop.ejs`](https://github.com/electron-userland/electron-installer-redhat/blob/main/resources/desktop.ejs)\n\nThe absolute path to a custom template for the generated [FreeDesktop.org desktop entry](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) file.\n\n#### options.specTemplate\nType: `String`\nDefault: [`resources/spec.ejs`](https://github.com/electron-userland/electron-installer-redhat/blob/main/resources/spec.ejs)\n\nThe absolute path to a custom template for the generated [SPEC file](https://rpm-packaging-guide.github.io/#what-is-a-spec-file).\n\n## Meta\n\n* Code: `git clone git://github.com/electron-userland/electron-installer-redhat.git`\n* Home: \u003chttps://github.com/electron-userland/electron-installer-redhat/\u003e\n\n\n## Contributors\n\n* Daniel Perez Alvarez ([unindented@gmail.com](mailto:unindented@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%2Felectron-userland%2Felectron-installer-redhat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectron-userland%2Felectron-installer-redhat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron-userland%2Felectron-installer-redhat/lists"}