{"id":13457614,"url":"https://github.com/electron/windows-installer","last_synced_at":"2025-05-13T00:30:25.334Z","repository":{"id":3716778,"uuid":"49976795","full_name":"electron/windows-installer","owner":"electron","description":"Build Windows Installers for Electron apps","archived":false,"fork":false,"pushed_at":"2025-04-05T15:46:37.000Z","size":67464,"stargazers_count":1608,"open_issues_count":116,"forks_count":261,"subscribers_count":72,"default_branch":"main","last_synced_at":"2025-04-20T06:19:16.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-19T19:19:46.000Z","updated_at":"2025-04-19T11:34:26.000Z","dependencies_parsed_at":"2024-01-27T03:40:54.326Z","dependency_job_id":"7ec783bf-a4f5-4a30-8a14-5e14fd1705a2","html_url":"https://github.com/electron/windows-installer","commit_stats":{"total_commits":497,"total_committers":54,"mean_commits":9.203703703703704,"dds":0.5653923541247485,"last_synced_commit":"c61590587f2c94ea5ffaaa88ed70800851232e64"},"previous_names":["electronjs/windows-installer"],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fwindows-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fwindows-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fwindows-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fwindows-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electron","download_url":"https://codeload.github.com/electron/windows-installer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249879468,"owners_count":21339116,"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-07-31T09:00:31.578Z","updated_at":"2025-04-23T18:52:22.712Z","avatar_url":"https://github.com/electron.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Electron Installer\n\n[![Test](https://github.com/electron/windows-installer/actions/workflows/test.yml/badge.svg)](https://github.com/electron/windows-installer/actions/workflows/test.yml)\n[![NPM package](https://img.shields.io/npm/v/electron-winstaller)](https://npm.im/electron-winstaller)\n\nNPM module that builds Windows installers for\n[Electron](https://github.com/electron/electron) apps using\n[Squirrel](https://github.com/Squirrel/Squirrel.Windows).\n\n## Installing\n\n```sh\nnpm install --save-dev electron-winstaller\n```\n\n## Usage\n\nRequire the package:\n\n```javascript\nconst electronInstaller = require('electron-winstaller');\n```\n\nThen do a build like so..\n\n```javascript\ntry {\n  await electronInstaller.createWindowsInstaller({\n    appDirectory: '/tmp/build/my-app-64',\n    outputDirectory: '/tmp/build/installer64',\n    authors: 'My App Inc.',\n    exe: 'myapp.exe'\n  });\n  console.log('It worked!');\n} catch (e) {\n  console.log(`No dice: ${e.message}`);\n}\n```\n\nAfter running you will have an `.nupkg`, a\n`RELEASES` file, and a `.exe` installer file in the `outputDirectory` folder\nfor each multi task target given under the config entry.\n\nThere are several configuration settings supported:\n\n| Config Name           | Required | Description |\n| --------------------- | -------- | ----------- |\n| `appDirectory`        | Yes      | The folder path of your Electron app |\n| `outputDirectory`     | No       | The folder path to create the `.exe` installer in. Defaults to the `installer` folder at the project root. |\n| `loadingGif`          | No       | The local path to a `.gif` file to display during install. |\n| `authors`             | Yes      | The authors value for the nuget package metadata. Defaults to the `author` field from your app's package.json file when unspecified. |\n| `owners`              | No       | The owners value for the nuget package metadata. Defaults to the `authors` field when unspecified. |\n| `exe`                 | No       | The name of your app's main `.exe` file. This uses the `name` field in your app's package.json file with an added `.exe` extension when unspecified. |\n| `description`         | No       | The description value for the nuget package metadata. Defaults to the `description` field from your app's package.json file when unspecified. |\n| `version`             | No       | The version value for the nuget package metadata. Defaults to the `version` field from your app's package.json file when unspecified. |\n| `title`               | No       | The title value for the nuget package metadata. Defaults to the `productName` field and then the `name` field from your app's package.json file when unspecified. |\n| `name`                | No      | Windows Application Model ID (appId). Defaults to the `name` field in your app's package.json file. |\n| `certificateFile`     | No       | The path to an Authenticode Code Signing Certificate |\n| `certificatePassword` | No       | The password to decrypt the certificate given in `certificateFile` |\n| `signWithParams`      | No       | Params to pass to signtool.  Overrides `certificateFile` and `certificatePassword`. |\n| `iconUrl`             | No       | A URL to an ICO file to use as the application icon (displayed in Control Panel \u003e Programs and Features). Defaults to the Atom icon. |\n| `setupIcon`           | No       | The ICO file to use as the icon for the generated Setup.exe |\n| `skipUpdateIcon`      | No       | Disables setting the icon of `Update.exe`. This can solve installation errors with the following message: \"This application could not be started\", when the setup is built on a non-Windows system. |\n| `setupExe`            | No       | The name to use for the generated Setup.exe file |\n| `setupMsi`            | No       | The name to use for the generated Setup.msi file |\n| `noMsi`               | No       | Should Squirrel.Windows create an MSI installer? |\n| `noDelta`             | No       | Should Squirrel.Windows delta packages? (disable only if necessary, they are a Good Thing) |\n| `remoteReleases`      | No       | A URL to your existing updates. If given, these will be downloaded to create delta updates |\n| `remoteToken`         | No       | Authentication token for remote updates |\n| `frameworkVersion`    | No       | Set the required .NET framework version, e.g. `net461` |\n| `windowsSign`         | No       | Use [@electron/windows-sign][@electron/windows-sign] for advanced codesigning. See [documentation](#advanced-codesigning-with-electronwindows-sign) for details. |\n\n## Sign your installer or else bad things will happen\n\nFor development / internal use, creating installers without a signature is okay, but for a production app you need to sign your application. Internet Explorer's SmartScreen filter will block your app from being downloaded, and many anti-virus vendors will consider your app as malware unless you obtain a valid cert.\n\nAny certificate valid for \"Authenticode Code Signing\" will work here, but if you get the right kind of code certificate, you can also opt-in to [Windows Error Reporting](http://en.wikipedia.org/wiki/Windows_Error_Reporting). [This MSDN page](http://msdn.microsoft.com/en-us/library/windows/hardware/hh801887.aspx) has the latest links on where to get a WER-compatible certificate. The \"Standard Code Signing\" certificate is sufficient for this purpose.\n\n## Handling Squirrel Events\n\nSquirrel will spawn your app with command line flags on first run, updates,\nand uninstalls. it is **very** important that your app handle these events as _early_\nas possible, and quit **immediately** after handling them. Squirrel will give your\napp a short amount of time (~15sec) to apply these operations and quit.\n\nThe [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) module will handle\nthe most common events for you, such as managing desktop shortcuts. Add the following to the top\nof your `main.js` and you're good to go:\n\n```javascript\nif (require('electron-squirrel-startup')) return;\n```\n\nYou should handle these events in your app's `main` entry point with something\nsuch as:\n\n```javascript\nconst app = require('app');\n\n// this should be placed at top of main.js to handle setup events quickly\nif (handleSquirrelEvent()) {\n  // squirrel event handled and app will exit in 1000ms, so don't do anything else\n  return;\n}\n\nfunction handleSquirrelEvent() {\n  if (process.argv.length === 1) {\n    return false;\n  }\n\n  const ChildProcess = require('child_process');\n  const path = require('path');\n\n  const appFolder = path.resolve(process.execPath, '..');\n  const rootAtomFolder = path.resolve(appFolder, '..');\n  const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));\n  const exeName = path.basename(process.execPath);\n\n  const spawn = function(command, args) {\n    let spawnedProcess, error;\n\n    try {\n      spawnedProcess = ChildProcess.spawn(command, args, {detached: true});\n    } catch (error) {}\n\n    return spawnedProcess;\n  };\n\n  const spawnUpdate = function(args) {\n    return spawn(updateDotExe, args);\n  };\n\n  const squirrelEvent = process.argv[1];\n  switch (squirrelEvent) {\n    case '--squirrel-install':\n    case '--squirrel-updated':\n      // Optionally do things such as:\n      // - Add your .exe to the PATH\n      // - Write to the registry for things like file associations and\n      //   explorer context menus\n\n      // Install desktop and start menu shortcuts\n      spawnUpdate(['--createShortcut', exeName]);\n\n      setTimeout(app.quit, 1000);\n      return true;\n\n    case '--squirrel-uninstall':\n      // Undo anything you did in the --squirrel-install and\n      // --squirrel-updated handlers\n\n      // Remove desktop and start menu shortcuts\n      spawnUpdate(['--removeShortcut', exeName]);\n\n      setTimeout(app.quit, 1000);\n      return true;\n\n    case '--squirrel-obsolete':\n      // This is called on the outgoing version of your app before\n      // we update to the new version - it's the opposite of\n      // --squirrel-updated\n\n      app.quit();\n      return true;\n  }\n};\n```\n\nNotice that the first time the installer launches your app, your app will see a `--squirrel-firstrun` flag. This allows you to do things like showing up a splash screen or presenting a settings UI. Another thing to be aware of is that, since the app is spawned by squirrel and squirrel acquires a file lock during installation, you won't be able to successfully check for app updates till a few seconds later when squirrel releases the lock.\n\n## Advanced codesigning with [@electron/windows-sign][@electron/windows-sign]\n\nThis package supports two different ways to codesign your application and the installer:\n\n1) Modern: By passing a `windowsSign` option, which will be passed to [@electron/windows-sign]. This method allows full customization of the code-signing process - and supports more complicated scenarios like cloud-hosted EV certificates, custom sign pipelines, and per-file overrides. It also supports all existing \"simple\" codesigning scenarios, including just passing a certificate file and password. Please see https://github.com/electron/windows-sign for all possible configuration options.\n  \n    When passing `windowsSign`, do not pass any other available parameters at the top level (like `certificateFile`, `certificatePassword`, or `signWithParams`).\n\n2) Legacy: By passing the top-level settings (`certificateFile`, `certificatePassword`, and `signWithParams`). For simple codesigning scenarios, there's no reason not to use this method - it'll work just as fine as the modern method.\n\n## Debugging this package\n\nYou can get debug messages from this package by running with the environment variable `DEBUG=electron-windows-installer:main` e.g.\n\n```shell\nDEBUG=electron-windows-installer:main node tasks/electron-winstaller.js\n```\n\n[@electron/windows-sign]: https://github.com/electron/windows-sign/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Fwindows-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectron%2Fwindows-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Fwindows-installer/lists"}