{"_id":"@alanlin-powered/electron-winstaller","name":"@alanlin-powered/electron-winstaller","dist-tags":{"latest":"5.4.0"},"versions":{"5.4.0":{"name":"@alanlin-powered/electron-winstaller","version":"5.4.0","description":"Module to generate Windows installers for Electron apps","main":"lib/index.js","types":"lib/index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/electron/windows-installer.git"},"scripts":{"install":"node ./script/select-7z-arch.js","build":"tsc","docs":"npx typedoc","prepublish":"npm run build","lint":"eslint --ext .ts src spec","ava":"ava --timeout=60s","test":"npm run lint && npm run ava","tdd":"ava --watch"},"dependencies":{"@electron/asar":"^3.2.1","debug":"^4.1.1","fs-extra":"^7.0.1","lodash":"^4.17.21","semver":"^7.6.3","temp":"^0.9.0"},"devDependencies":{"@types/fs-extra":"^5.0.5","@types/lodash":"^4.17.0","@types/node":"^20.6.0","@types/temp":"^0.8.34","@typescript-eslint/eslint-plugin":"^5.62.0","@typescript-eslint/parser":"^5.62.0","ava":"^5.1.1","eslint":"^8.49.0","eslint-plugin-ava":"^14.0.0","ts-node":"^10.9.1","typedoc":"0.25.13","typescript":"^4.9.3"},"optionalDependencies":{"@electron/windows-sign":"^1.1.2"},"engines":{"node":">=8.0.0"},"publishConfig":{"provenance":true},"ava":{"extensions":["ts"],"files":["spec/*.ts"],"require":["ts-node/register/transpile-only"]},"_id":"@alanlin-powered/electron-winstaller@5.4.0","gitHead":"6b5a64d524ee5a8a48e95adf7b1dc7662492ed53","bugs":{"url":"https://github.com/electron/windows-installer/issues"},"homepage":"https://github.com/electron/windows-installer#readme","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-Dl214bRteflHtkEEgDc8PB+Rsoui9OSpAdI/5oEtbE6TbUiZ974sjJZR1npO29wDfiIb4paoZUAvsoZijdzjMw==","shasum":"548c098194e7c5f40aa4e970456ca6969389e69f","tarball":"https://registry.npmjs.org/@alanlin-powered/electron-winstaller/-/electron-winstaller-5.4.0.tgz","fileCount":52,"unpackedSize":29988646,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF6/Qsl25OaIa9e49mDruEktAB8XOHUd1/4S2V7UltTNAiBFHKJjFN8E/X64TssL9IsVG0t48HaWfcch8yjIINDNDg=="}]},"_npmUser":{"name":"alanlin","email":"alanlin@aosc.io"},"directories":{},"maintainers":[{"name":"alanlin","email":"alanlin@aosc.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/electron-winstaller_5.4.0_1768550446836_0.4643716034476275"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-16T08:00:46.622Z","5.4.0":"2026-01-16T08:00:47.251Z","modified":"2026-01-16T08:00:47.479Z"},"maintainers":[{"name":"alanlin","email":"alanlin@aosc.io"}],"description":"Module to generate Windows installers for Electron apps","homepage":"https://github.com/electron/windows-installer#readme","repository":{"type":"git","url":"git+https://github.com/electron/windows-installer.git"},"bugs":{"url":"https://github.com/electron/windows-installer/issues"},"license":"MIT","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 > 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","readmeFilename":"README.md","_rev":"1-25f92515a0f2a3e3e856c2abec28328a"}