Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-builder

Package Overview
Dependencies
Maintainers
3
Versions
926
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-builder

A complete solution to package and build a ready for distribution Electron app for MacOS, Windows and Linux with “auto update” support out of the box

  • 24.6.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
277K
decreased by-16.82%
Maintainers
3
Weekly downloads
 
Created

What is electron-builder?

electron-builder is a complete solution to package and build a ready-for-distribution Electron app with “auto update” support out of the box. It supports numerous target formats and platforms, making it a versatile tool for Electron app developers.

What are electron-builder's main functionalities?

Building for Multiple Platforms

This feature allows you to build your Electron app for multiple platforms such as Windows, macOS, and Linux. The code sample demonstrates how to configure and initiate a build process for a Windows target.

const builder = require('electron-builder');

builder.build({
  targets: builder.Platform.WINDOWS.createTarget(),
  config: {
    appId: 'com.example.app',
    productName: 'ExampleApp',
    directories: {
      output: 'dist'
    }
  }
}).then(() => {
  console.log('Build complete!');
}).catch((error) => {
  console.error('Error during build:', error);
});

Auto Update

The auto-update feature allows your app to automatically check for updates and install them. The code sample shows how to set up the auto-updater to check for updates when the app is ready and handle update events.

const { autoUpdater } = require('electron-updater');

app.on('ready', () => {
  autoUpdater.checkForUpdatesAndNotify();
});

autoUpdater.on('update-available', () => {
  console.log('Update available.');
});

autoUpdater.on('update-downloaded', () => {
  autoUpdater.quitAndInstall();
});

Custom Configuration

This feature allows you to customize the build configuration for your Electron app. The code sample demonstrates how to specify custom directories, files, and target formats for different platforms.

const builder = require('electron-builder');

builder.build({
  config: {
    appId: 'com.example.app',
    productName: 'ExampleApp',
    directories: {
      output: 'dist'
    },
    files: [
      'build/**/*'
    ],
    extraResources: [
      'assets/'
    ],
    win: {
      target: 'nsis'
    },
    mac: {
      target: 'dmg'
    }
  }
}).then(() => {
  console.log('Build complete!');
}).catch((error) => {
  console.error('Error during build:', error);
});

Other packages similar to electron-builder

Keywords

FAQs

Package last updated on 23 Aug 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc