Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
electron-installer-windows
Advanced tools
Create a Windows package for your Electron app.
For use from command-line:
$ npm install -g electron-installer-windows
For use in npm scripts or programmatically:
$ npm install --save-dev electron-installer-windows
Say your Electron app lives in path/to/app
, and has a structure like this:
.
├── LICENSE
├── README.md
├── node_modules
│ ├── electron-packager
│ └── electron-prebuilt
├── package.json
├── resources
│ ├── Icon.png
│ ├── IconTemplate.png
│ └── IconTemplate@2x.png
└── src
├── index.js
├── main
│ └── index.js
└── renderer
├── index.html
└── index.js
You now run electron-packager
to build the app for Windows:
$ electron-packager . app --platform win32 --arch x64 --out dist/
And you end up with something like this in your dist
folder:
.
└── dist
└── app-win32-x64
├── LICENSE
├── LICENSES.chromium.html
├── content_shell.pak
├── app
├── icudtl.dat
├── libgcrypt.so.11
├── libnode.so
├── locales
├── natives_blob.bin
├── resources
├── snapshot_blob.bin
└── version
How do you turn that into a Windows package that your users can install?
If you want to run electron-installer-windows
straight from the command-line, install the package globally:
$ npm install -g electron-installer-windows
And point it to your built app:
$ electron-installer-windows --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64
You'll end up with the package at dist/installers/app_0.0.1_amd64.deb
.
If you want to run electron-installer-windows
through npm, install the package locally:
$ npm install --save-dev electron-installer-windows
Edit the scripts
section of your package.json
:
{
"name": "app",
"description": "An awesome app!",
"version": "0.0.1",
"scripts": {
"start": "electron .",
"build": "electron-packager . app --platform linux --arch x64 --out dist/",
"deb64": "electron-installer-windows --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64"
},
"devDependencies": {
"electron-installer-windows": "*",
"electron-packager": "*",
"electron-prebuilt": "*"
}
}
And run the script:
$ npm run deb64
You'll end up with the package at dist/installers/app_0.0.1_amd64.deb
.
Install the package locally:
$ npm install --save-dev electron-installer-windows
And write something like this:
var installer = require('electron-installer-windows')
var options = {
src: 'dist/app-linux-x64/',
dest: 'dist/installers/',
arch: 'amd64'
}
console.log('Creating package (this may take a while)')
installer(options, function (err) {
if (err) {
console.error(err, err.stack)
process.exit(1)
}
console.log('Successfully created package at ' + options.dest)
})
You'll end up with the package at dist/installers/app_0.0.1_amd64.deb
.
Even though you can pass most of these options through the command-line interface, it may be easier to create a configuration file:
{
"dest": "dist/installers/",
"icon": "resources/Icon.png",
"tags": [
"Utility"
]
}
And pass that instead with the config
option:
$ electron-installer-windows --src dist/app-linux-x64/ --arch amd64 --config config.json
Anyways, here's the full list of options:
Type: String
Default: undefined
Path to the folder that contains your built Electron application.
Type: String
Default: undefined
Path to the folder that will contain your Windows installer.
Type: Function
Default: function (dest, src) { return path.join(dest, src); }
Function that renames all files generated by the task just before putting them in your dest
folder.
Type: String
Default: package.name
Name of the package (e.g. atom
), used in the id
field of the nuspec
file.
Type: String
Default: package.productName || package.name
Name of the application (e.g. Atom
), used in the title
field of the nuspec
file.
Type: String
Default: package.description
Short description of the application, used in the summary
field of the nuspec
file.
Type: String
Default: package.productDescription || package.description
Long description of the application, used in the description
field of the nuspec
file.
Type: String
Default: package.version
Long description of the application, used in the version
field of the nuspec
file.
Type: String
Default: package.copyright
Copyright details for the package, used in the copyright
field of the nuspec
file.
Type: Array[String]
Default: package.author
List of authors of the package, used in the authors
field of the spec
file.
Type: Array[String]
Default: package.author
List of owners of the package, used in the authors
field of the spec
file.
Type: String
Default: package.homepage || package.author.url
URL of the homepage for the package, used in the projectUrl
field of the spec
file.
Type: String
Default: undefined
URL for the image to use as the icon for the package in the Manage NuGet Packages dialog box, used in the iconUrl
field of the spec
file.
Type: String
Default: undefined
URL for the license that the package is under, used in the licenseUrl
field of the spec
file.
Type: String
Default: false
Whether the client needs to ensure that the package license (described by licenseUrl
) is accepted before the package is installed, used in the requireLicenseAcceptance
field of the spec
file.
Type: Array[String]
Default: []
List of tags and keywords that describe the package, used in the tags
field of the spec
file.
Current version: 1.2.3
To update Squirrel to the latest version:
$ rm vendor/squirrel/*
$ mono vendor/nuget/NuGet.exe install squirrel.windows -OutputDirectory vendor/tmp/
$ cp -r vendor/tmp/squirrel.windows.1.2.3/tools/* vendor/squirrel/
$ rm -rf vendor/tmp/
Current version: 2.8.5
To update NuGet to the latest version, head over to the releases page.
git clone git://github.com/unindented/electron-installer-windows.git
Copyright (c) 2016 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.
FAQs
Create a Windows package for your Electron app.
The npm package electron-installer-windows receives a total of 458 weekly downloads. As such, electron-installer-windows popularity was classified as not popular.
We found that electron-installer-windows demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.