### PreStart Hook Example Source: https://www.electronforge.io/config/hooks.md Use the `preStart` hook to execute logic before the `start` command launches the app in development mode. This example logs the platform the app is starting on. ```javascript module.exports = { hooks: { preStart: async (forgeConfig) => { console.log(`Starting up app on platform: ${process.platform}`); } } }; ``` -------------------------------- ### Query Documentation API Example Source: https://www.electronforge.io/config/publishers/bitbucket.md Demonstrates how to query the documentation dynamically using an HTTP GET request with 'ask' and optional 'goal' query parameters. ```http GET https://www.electronforge.io/config/publishers/bitbucket.md?ask=&goal= ``` -------------------------------- ### Query Documentation API Example Source: https://www.electronforge.io/config/makers/dmg.md Example of how to query the documentation dynamically using an HTTP GET request. This is useful for retrieving information not directly present on the page. ```http GET https://www.electronforge.io/config/makers/dmg.md?ask=&goal= ``` -------------------------------- ### Query Documentation Dynamically Source: https://www.electronforge.io/config/makers/rpm.md Example of how to query the documentation dynamically using GET request with 'ask' and optional 'goal' parameters. ```http GET https://www.electronforge.io/config/makers/rpm.md?ask=&goal= ``` -------------------------------- ### PostStart Hook Example Source: https://www.electronforge.io/config/hooks.md The `postStart` hook is called after the `start` command launches the app. It provides access to the spawned child process, allowing you to attach listeners. This example logs the process ID (PID) of the spawned app. ```javascript module.exports = { hooks: { postStart: async (forgeConfig, appProcess) => { console.log(`Spawned child pid: ${appProcess.pid}`); } } }; ``` -------------------------------- ### Querying Documentation with GitBook Source: https://www.electronforge.io/advanced/extending-electron-forge/writing-templates.md This example demonstrates how to query the documentation dynamically using an HTTP GET request with `ask` and optional `goal` query parameters. ```http GET https://www.electronforge.io/advanced/extending-electron-forge/writing-templates.md?ask=&goal= ``` -------------------------------- ### Install AppX Maker Source: https://www.electronforge.io/config/makers/appx.md Install the AppX maker package using npm. This is a required step before configuring it in your Forge setup. ```bash npm install --save-dev @electron-forge/maker-appx ``` -------------------------------- ### Initialize Project with Webpack Template Source: https://www.electronforge.io/templates/webpack-template.md Use this command to create a new Electron Forge project pre-configured with the webpack template. This is the fastest way to get a working webpack setup. ```bash npx create-electron-app@latest my-new-app --template=webpack ``` -------------------------------- ### Install Snapcraft Maker Source: https://www.electronforge.io/config/makers/snapcraft.md Install the Snapcraft maker package as a development dependency. ```bash npm install --save-dev @electron-forge/maker-snap ``` -------------------------------- ### Install MSIX Maker Source: https://www.electronforge.io/config/makers/msix.md Install the MSIX maker package as a development dependency. ```bash npm install --save-dev @electron-forge/maker-msix ``` -------------------------------- ### Install Bitbucket Publisher Source: https://www.electronforge.io/config/publishers/bitbucket.md Install the Bitbucket publisher package as a development dependency. ```bash npm install --save-dev @electron-forge/publisher-bitbucket ``` -------------------------------- ### Start an Electron App Source: https://www.electronforge.io/ Navigate to your application directory and start the Electron app. This command is used after initializing a new project. ```bash cd my-app npm start ``` -------------------------------- ### Start Development Server with Logging Source: https://www.electronforge.io/cli.md Launches the app in development mode with advanced logging enabled. This command corresponds to the 'start' npm script. ```bash npm start --enable-logging ``` ```bash npx electron-forge start --enable-logging ``` -------------------------------- ### Install GitHub Publisher Source: https://www.electronforge.io/config/publishers/github.md Install the GitHub publisher package using npm. ```bash npm install --save-dev @electron-forge/publisher-github ``` -------------------------------- ### Install Nucleus Publisher Source: https://www.electronforge.io/config/publishers/nucleus.md Install the Nucleus publisher package using npm. ```bash npm install --save-dev @electron-forge/publisher-nucleus ``` -------------------------------- ### Full Forge Configuration Options in package.json Source: https://www.electronforge.io/config/configuration.md This example shows the equivalent of the comprehensive configuration options within the `package.json` file. ```json // Only the relevant section of package.json is shown, for brevity. { "config": { "forge": { "packagerConfig": { ... }, "rebuildConfig": { ... }, "makers": [ ... ], "publishers": [ ... ], "plugins": [ ... ], "hooks": { ... }, "buildIdentifier": "my-build", "outDir": "desired/outpath" } } } ``` -------------------------------- ### Query Documentation Source: https://www.electronforge.io/config/makers/deb.md Example of how to query the documentation dynamically using the `ask` and `goal` query parameters. ```http GET https://www.electronforge.io/config/makers/deb.md?ask=&goal= ``` -------------------------------- ### Install Electron Release Server Publisher Source: https://www.electronforge.io/config/publishers/electron-release-server.md Install the @electron-forge/publisher-electron-release-server package using npm. ```bash npm install --save-dev @electron-forge/publisher-electron-release-server ``` -------------------------------- ### Install S3 Publisher Source: https://www.electronforge.io/config/publishers/s3.md Install the S3 publisher package using npm. ```bash npm install --save-dev @electron-forge/publisher-s3 ``` -------------------------------- ### Install @electron-forge/maker-pkg Source: https://www.electronforge.io/config/makers/pkg.md Install the pkg maker package as a development dependency. ```bash npm install --save-dev @electron-forge/maker-pkg ``` -------------------------------- ### Install Electron Forge Dependencies Manually Source: https://www.electronforge.io/import-existing-project.md Install the Electron Forge CLI and necessary maker packages as development dependencies for manual setup. ```bash cd my-app npm install --save-dev @electron-forge/cli @electron-forge/maker-squirrel @electron-forge/maker-deb @electron-forge/maker-zip ``` -------------------------------- ### Add electron-squirrel-startup Boilerplate to Main Process Source: https://www.electronforge.io/import-existing-project.md Install and include this snippet early in your main process to handle Squirrel.Windows startup events gracefully. ```javascript if (require('electron-squirrel-startup')) app.quit(); ``` -------------------------------- ### Install GCS Publisher Source: https://www.electronforge.io/config/publishers/gcs.md Install the Google Cloud Storage publisher package using npm. ```bash npm install --save-dev @electron-forge/publisher-gcs ``` -------------------------------- ### Implementing `startLogic` for Development-Time Logic Source: https://www.electronforge.io/advanced/extending-electron-forge/writing-plugins.md Implement the `startLogic` method to customize the `electron-forge start` command. Returning a `ChildProcess` overrides Forge's default start logic, while returning `null` or `false` allows Forge to spawn its own process after your custom logic executes. ```javascript export default class MyPlugin extends Pluginbase { async startLogic (opts) { await this.compileMainProcess(); return null; } compileMainProcess () { /* ... */ } } ``` -------------------------------- ### Install Electron Forge Squirrel Maker Source: https://www.electronforge.io/config/makers/squirrel.windows.md Install the Squirrel.Windows maker package using npm. ```bash npm install --save-dev @electron-forge/maker-squirrel ``` -------------------------------- ### Install Electron Forge Snapcraft Publisher Source: https://www.electronforge.io/config/publishers/snapcraft.md Install the Snapcraft publisher package as a development dependency using npm. ```bash npm install --save-dev @electron-forge/publisher-snapcraft ``` -------------------------------- ### Install Electronegativity Plugin Source: https://www.electronforge.io/config/plugins/electronegativity.md Install the Electronegativity plugin as a development dependency using npm. ```shell npm install --save-dev @electron-forge/plugin-electronegativity ``` -------------------------------- ### Install Webpack Plugin Source: https://www.electronforge.io/config/plugins/webpack.md Install the Webpack plugin as a development dependency using npm. ```shell npm install --save-dev @electron-forge/plugin-webpack ``` -------------------------------- ### Install @electron-forge/maker-rpm Source: https://www.electronforge.io/config/makers/rpm.md Installs the RPM maker package as a development dependency. ```shell npm install --save-dev @electron-forge/maker-rpm ``` -------------------------------- ### Initialize New App with Vite Template Source: https://www.electronforge.io/templates/vite.md Use this command to create a new Electron Forge application pre-configured with Vite. Ensure you have npx installed. ```bash npx create-electron-app@latest my-new-app --template=vite ``` -------------------------------- ### Add React Dependencies Source: https://www.electronforge.io/guides/framework-integration/react-with-typescript.md Install React and its types for development. Ensure you are in your project's root directory. ```bash npm install --save react react-dom npm install --save-dev @types/react @types/react-dom ``` -------------------------------- ### Query Documentation Index Source: https://www.electronforge.io/llms.txt Use this GET request to ask specific questions about the documentation. Include the 'ask' parameter for your question and optionally the 'goal' parameter for broader context. ```http GET https://www.electronforge.io/templates/vite.md?ask=&goal= ``` -------------------------------- ### Query Documentation Dynamically Source: https://www.electronforge.io/templates/vite-%2B-typescript.md To get information not explicitly on the current page, make a GET request to the page URL with 'ask' and optional 'goal' query parameters. The response includes a direct answer and relevant documentation excerpts. ```http GET https://www.electronforge.io/templates/vite-+-typescript.md?ask=&goal= ``` -------------------------------- ### Install Deb Maker Source: https://www.electronforge.io/config/makers/deb.md Install the deb maker package as a development dependency. ```bash npm install --save-dev @electron-forge/maker-deb ``` -------------------------------- ### Query Documentation with GET Request Source: https://www.electronforge.io/guides To get information not explicitly on the page, perform an HTTP GET request to the page URL with the `ask` query parameter for your question and an optional `goal` parameter for broader context. ```http GET https://www.electronforge.io/guides.md?ask=&goal= ``` -------------------------------- ### Install Local Electron Plugin Source: https://www.electronforge.io/config/plugins/local-electron.md Install the local Electron plugin as a development dependency using npm. ```bash npm install --save-dev @electron-forge/plugin-local-electron ``` -------------------------------- ### Query Documentation API Source: https://www.electronforge.io/config/makers.md Demonstrates how to query the documentation dynamically using an HTTP GET request with `ask` and optional `goal` query parameters. ```http GET https://www.electronforge.io/config/makers.md?ask=&goal= ``` -------------------------------- ### Install DMG Maker Source: https://www.electronforge.io/config/makers/dmg.md Install the DMG maker package using npm. This command should be run in your project's root directory. ```sh npm install --save-dev @electron-forge/maker-dmg ``` -------------------------------- ### Example S3 Publisher Configuration Source: https://www.electronforge.io/config/publishers.md Configure the `@electron-forge/publisher-s3` to publish artifacts to an S3 bucket. Specify the target platforms and bucket details. ```javascript module.exports = { publishers: [ { name: '@electron-forge/publisher-s3', platforms: ['darwin', 'linux'], config: { bucket: 'my-bucket', folder: 'my/key/prefix' } } ] }; ``` -------------------------------- ### Install RPM Build Tools on Fedora Source: https://www.electronforge.io/config/makers/rpm.md Installs the necessary rpm-build package on Fedora systems. ```shell sudo dnf install rpm-build ``` -------------------------------- ### Querying Documentation with GitBook Source: https://www.electronforge.io/guides/code-signing/code-signing-macos.md Use this GET request to query the documentation dynamically. Replace `` with your specific query and optionally provide `` for tailored answers. ```http GET https://www.electronforge.io/guides/code-signing/code-signing-macos.md?ask=&goal= ``` -------------------------------- ### Querying Documentation Dynamically Source: https://www.electronforge.io/templates/typescript-%2B-webpack-template.md To get information not explicitly on the current page, make a GET request to the page URL with the 'ask' query parameter. An optional 'goal' parameter can be included to tailor the response. ```http GET https://www.electronforge.io/templates/typescript-+-webpack-template.md?ask=&goal= ``` -------------------------------- ### Querying Documentation with HTTP GET Source: https://www.electronforge.io/advanced To get information not directly on the page, perform an HTTP GET request to the page URL with the `ask` query parameter for your question and an optional `goal` parameter for broader context. The response includes a direct answer and relevant documentation excerpts. ```http GET https://www.electronforge.io/advanced.md?ask=&goal= ``` -------------------------------- ### Query Documentation Source: https://www.electronforge.io/config/publishers/github.md To ask questions about the documentation, perform an HTTP GET request to the page URL with the `ask` query parameter and an optional `goal` parameter. ```http GET https://www.electronforge.io/config/publishers/github.md?ask=&goal= ``` -------------------------------- ### Example ForgeTemplate Implementation Source: https://www.electronforge.io/advanced/extending-electron-forge/writing-templates.md This example shows a basic implementation of the `ForgeTemplate` interface, including the required `requiredForgeVersion` and optional `dependencies`, `devDependencies`, and `initializeTemplate` properties. ```javascript const path = require('path'); module.exports = { requiredForgeVersion: '^6.0.0-beta.1', dependencies: [ 'jquery', 'jquery@^3.0.0' ], devDependencies: [ 'eslint', 'eslint@^7.0.0' ], async initializeTemplate(projectDir) { // Custom initialization logic here console.log('Initializing custom template in:', projectDir); } }; ``` -------------------------------- ### Install S3 Publisher for Electron Forge Source: https://www.electronforge.io/import-existing-project.md Install the S3 publisher as a development dependency to enable uploading release artifacts to an S3 bucket. ```bash cd my-app npm install --save-dev @electron-forge/publisher-s3 ``` -------------------------------- ### Install RPM Build Tools on Debian/Ubuntu Source: https://www.electronforge.io/config/makers/rpm.md Installs the necessary rpm package on Debian or Ubuntu systems. ```shell sudo apt-get install rpm ``` -------------------------------- ### Install Babel for React Source: https://www.electronforge.io/guides/framework-integration/react.md Install Babel core, the React preset, and babel-loader as development dependencies to enable JSX and other React features. ```bash npm install --save-dev @babel/core @babel/preset-react babel-loader ``` -------------------------------- ### Querying Documentation with GitBook Source: https://www.electronforge.io/advanced/extending-electron-forge/writing-publishers.md Demonstrates how to query the documentation dynamically using an HTTP GET request. This is useful for retrieving specific information or clarification not explicitly present on the page. ```http GET https://www.electronforge.io/advanced/extending-electron-forge/writing-publishers.md?ask=&goal= ``` -------------------------------- ### Basic Forge Configuration in package.json Source: https://www.electronforge.io/config/configuration.md This example shows how to configure Electron Forge directly within the `package.json` file using the `config.forge` property. ```json { "name": "my-app", "version": "0.0.1", "config": { "forge": { "packagerConfig": {}, "makers": [ { "name": "@electron-forge/maker-zip" } ] } } } ``` -------------------------------- ### Query Documentation with GitBook Source: https://www.electronforge.io/config/publishers/electron-release-server.md Perform an HTTP GET request to query the documentation. Use the 'ask' parameter for your question and optionally the 'goal' parameter for your end goal. ```http GET https://www.electronforge.io/config/publishers/electron-release-server.md?ask=&goal= ``` -------------------------------- ### Query Documentation API Source: https://www.electronforge.io/config/plugins/auto-unpack-natives.md To get more information or clarification, you can query the documentation dynamically using an HTTP GET request. Include your question in the `ask` parameter and optionally specify your goal in the `goal` parameter. ```http GET https://www.electronforge.io/config/plugins/auto-unpack-natives.md?ask=&goal= ``` -------------------------------- ### Install Flatpak Maker Package Source: https://www.electronforge.io/config/makers/flatpak.md Install the Flatpak maker package as a development dependency for your Electron Forge project. ```bash npm install --save-dev @electron-forge/maker-flatpak ``` -------------------------------- ### Install React Dependencies Source: https://www.electronforge.io/guides/framework-integration/react.md Add React and ReactDOM to your project's dependencies to use React in your application. ```bash npm install --save react react-dom ``` -------------------------------- ### Install Electron Forge CLI Source: https://www.electronforge.io/cli.md Install the `@electron-forge/cli` module as a devDependency to use the Forge CLI. This is automatically included when using `create-electron-app`. ```bash npm install --save-dev @electron-forge/cli ``` -------------------------------- ### Example RELEASES.json Manifest for Auto-Updates Source: https://www.electronforge.io/config/makers/zip.md This JSON structure represents an example update manifest file that the ZIP maker generates for macOS auto-updates. It details the current release and available updates. ```json { "currentRelease": "1.2.1", "releases": [ { "version": "1.2.1", "updateTo": { "version": "1.2.1", "pub_date": "2013-09-18T12:29:53+01:00", "name": "my-app v1.2.1", "url": "https://my-bucket.s3.amazonaws.com/my-app-updates/darwin/arm64/my-app-1.2.1-darwin-arm64.zip" } } ] } ``` -------------------------------- ### Query Documentation with Ask Parameter Source: https://www.electronforge.io/config/makers/flatpak.md To get specific information not readily available on the page, use the `ask` query parameter in an HTTP GET request. The optional `goal` parameter helps tailor the response. ```http GET https://www.electronforge.io/config/makers/flatpak.md?ask=&goal= ``` -------------------------------- ### Install ZIP Maker Source: https://www.electronforge.io/config/makers/zip.md Install the ZIP maker package using npm. This is a required step before configuring it in your Forge setup. ```bash npm install --save-dev @electron-forge/maker-zip ``` -------------------------------- ### Initialize Electron App with Webpack + TypeScript Template Source: https://www.electronforge.io/templates/typescript-%2B-webpack-template.md Use this command to create a new Electron application pre-configured with TypeScript and Webpack. Ensure you have Node.js and npm installed. ```bash npx create-electron-app@latest my-new-app --template=webpack-typescript ``` -------------------------------- ### Customizing Electron Rebuild Options Source: https://www.electronforge.io/config/configuration.md This example demonstrates how to configure options for `@electron/rebuild`, specifically setting `force` to `true`. Forge preconfigures `buildPath` and `electronVersion`, and internally overrides the `arch` option. ```javascript module.exports = { rebuildConfig: { force: true } }; ``` -------------------------------- ### Configure Publishers for Artifact Uploads Source: https://www.electronforge.io/config/configuration.md Set up publisher configurations to specify where your distributable artifacts should be published. This example configures the GitHub publisher for draft releases. ```javascript module.exports = { publishers: [ { name: '@electron-forge/publisher-github', config: { repository: { owner: 'electron', name: 'fiddle' }, draft: true, prerelease: false, generateReleaseNotes: true } } ] }; ``` -------------------------------- ### Install Windows Binaries in WSL Source: https://www.electronforge.io/guides/developing-with-wsl.md When developing Electron apps in WSL, you need to ensure you're using Windows binaries. This involves removing existing Linux-installed node_modules and then running npm install with the platform set to win32. ```bash # If node_modules exists already that was installed in WSL: rm -r node_modules # then: npm install --platform=win32 # or: npm_config_platform=win32 npm install ``` -------------------------------- ### postPackage Hook Example Source: https://www.electronforge.io/config/hooks.md This hook is called after the 'package' step has completed. It receives the Forge configuration and build options, including the output paths of the built packages. ```javascript module.exports = { hooks: { postPackage: async (forgeConfig, options) => { console.info('Packages built at:', options.outputPaths); } } }; ``` -------------------------------- ### Basic Forge Configuration in forge.config.js Source: https://www.electronforge.io/config/configuration.md This is a basic example of how to configure Electron Forge using a JavaScript file. It specifies the packager configuration and a zip maker. ```javascript module.exports = { packagerConfig: {}, makers: [ { name: '@electron-forge/maker-zip' } ] }; ``` -------------------------------- ### Query Documentation with GET Request Source: https://www.electronforge.io/config Use this endpoint to ask specific questions or define broader goals when querying the documentation. The response includes direct answers and relevant excerpts. ```http GET https://www.electronforge.io/config.md?ask=&goal= ``` -------------------------------- ### VS Code Debug Configuration for Electron Main Process Source: https://www.electronforge.io/advanced/debugging.md Configure VS Code to debug the Electron main process. This setup uses a specific script to launch the debugger. Ensure your `package.json` has a `"start": "electron-forge start"` script. ```json5 { "configurations": [ { "type": "node", "request": "launch", "name": "Electron Main", "runtimeExecutable": "${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.sh", "windows": { "runtimeExecutable": "${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.cmd" }, "runtimeArgs": [ "foo", "bar" ], "cwd": "${workspaceFolder}", "console": "integratedTerminal" } ] } ``` -------------------------------- ### Configure Makers in package.json Source: https://www.electronforge.io/config/makers.md Example of configuring a zip maker within the `forge` section of the `package.json` file. The `platforms` property is optional as makers have logical defaults. ```json // Only showing the relevant configuration for brevity { "config": { "forge": { "makers": [ { "name": "@electron-forge/maker-zip", "platforms": ["darwin", "linux"], // optional "config": { // Config here } } ] } } } ``` -------------------------------- ### Configure DMG Maker in Forge Source: https://www.electronforge.io/config/makers/dmg.md Add the DMG maker to your Forge configuration file. This example shows how to specify a custom background image and the DMG format. ```javascript module.exports = { makers: [ { name: '@electron-forge/maker-dmg', config: { background: './assets/dmg-background.png', format: 'ULFO' } } ] }; ``` -------------------------------- ### Configure Squirrel.Windows Installer for Code Signing Source: https://www.electronforge.io/guides/code-signing/code-signing-windows.md Configure the Squirrel.Windows maker in Electron Forge to use your code signing certificate file and password. The certificate password should be stored securely, for example, in an environment variable. ```javascript module.exports = { packagerConfig: {}, makers: [ { name: '@electron-forge/maker-squirrel', config: { certificateFile: './cert.pfx', certificatePassword: process.env.CERTIFICATE_PASSWORD } } ] }; ``` -------------------------------- ### Handle Squirrel.Windows Startup Events Source: https://www.electronforge.io/config/makers/squirrel.windows.md Use the 'electron-squirrel-startup' module in your main process to handle startup events gracefully. ```javascript const { app } = require('electron'); // run this as early in the main process as possible if (require('electron-squirrel-startup')) app.quit(); ``` -------------------------------- ### Configure pkg Maker with Installation Scripts Source: https://www.electronforge.io/config/makers/pkg.md Configure the pkg maker to include preinstall and postinstall scripts by pointing the 'scripts' property to the directory containing your script files. Ensure scripts have execute permissions and no file extensions. ```javascript const path = require('node:path'); module.exports = { makers: [ { name: '@electron-forge/maker-pkg', config: { scripts: path.join(__dirname, 'scripts') } } ] }; ``` -------------------------------- ### Install Vite Plugin Source: https://www.electronforge.io/config/plugins/vite.md Install the Vite plugin for Electron Forge as a development dependency. ```shell npm install --save-dev @electron-forge/plugin-vite ``` -------------------------------- ### Query Documentation Dynamically Source: https://www.electronforge.io/advanced/debugging.md To ask questions about the documentation, use the `ask` query parameter on the page URL. An optional `goal` parameter can be provided to tailor the response. ```http GET https://www.electronforge.io/advanced/debugging.md?ask=&goal= ``` -------------------------------- ### Install @electron-forge/maker-wix Source: https://www.electronforge.io/config/makers/wix-msi.md Installs the WiX MSI maker package as a development dependency for your Electron Forge project. ```bash npm install --save-dev @electron-forge/maker-wix ``` -------------------------------- ### Full Forge Configuration Options in forge.config.js Source: https://www.electronforge.io/config/configuration.md This example demonstrates a more comprehensive set of configuration options available for Electron Forge, including packager, rebuild, makers, publishers, plugins, hooks, build identifier, and output directory. ```javascript module.exports = { packagerConfig: { /* ... */ }, rebuildConfig: { /* ... */ }, makers: [], publishers: [], plugins: [], hooks: { /* ... */ }, buildIdentifier: 'my-build', outDir: 'desired/outpath' }; ``` -------------------------------- ### Install Fuses Plugin and @electron/fuses Source: https://www.electronforge.io/config/plugins/fuses.md Install the Electron Forge Fuses plugin and its peer dependency, @electron/fuses, using npm. ```shell npm install --save-dev @electron-forge/plugin-fuses @electron/fuses ``` -------------------------------- ### Create Electron App with Vite Template Source: https://www.electronforge.io/guides/framework-integration/vue-3.md Initializes a new Electron application using Electron Forge's Vite template. ```bash npx create-electron-app@latest my-vue-app --template=vite ``` -------------------------------- ### Initialize New Electron Forge App Source: https://www.electronforge.io/cli.md Initialize a new Electron Forge application in a specified directory using a particular template. It's recommended to use `create-electron-app` instead of running this command directly. ```bash npx electron-forge init --template=webpack ``` -------------------------------- ### Install Auto Unpack Native Modules Plugin Source: https://www.electronforge.io/config/plugins/auto-unpack-natives.md Install the plugin using npm. This command adds the plugin as a development dependency to your project. ```shell npm install --save-dev @electron-forge/plugin-auto-unpack-natives ``` -------------------------------- ### Create a New Electron App Source: https://www.electronforge.io/ Use this command to initialize a new Electron project with Electron Forge. It scaffolds a basic Electron app with a full build pipeline. ```bash npx create-electron-app@latest my-app ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://www.electronforge.io/config/plugins/vite.md Use this method to ask specific questions or retrieve additional context not explicitly found on a page. The `ask` parameter is mandatory for specifying your question, while `goal` is optional for refining the answer towards a broader objective. ```http GET https://www.electronforge.io/config/plugins/vite.md?ask=&goal= ``` -------------------------------- ### Install WiX Toolset v3 via Chocolatey Source: https://www.electronforge.io/config/makers/wix-msi.md Installs WiX Toolset version 3.14.0 on Windows using Chocolatey. This is a prerequisite for building MSI files. ```bash choco install wixtoolset --version=3.14.0 ``` -------------------------------- ### Configure Installer Icons for Multiple Makers Source: https://www.electronforge.io/guides/create-and-add-icons.md Set application icons for Squirrel, deb, DMG, and Wix installers within your Electron Forge configuration. Ensure you use the correct icon file types and paths for each maker. ```javascript // forge.config.js module.exports = { // ... makers: [ { name: '@electron-forge/maker-squirrel', config: { // An URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). iconUrl: 'https://url/to/icon.ico', // The ICO file to use as the icon for the generated Setup.exe setupIcon: '/path/to/icon.ico' } }, { // Path to a single image that will act as icon for the application name: '@electron-forge/maker-deb', config: { options: { icon: '/path/to/icon.png' } } }, { // Path to the icon to use for the app in the DMG window name: '@electron-forge/maker-dmg', config: { icon: '/path/to/icon.icns' } }, { name: '@electron-forge/maker-wix', config: { icon: '/path/to/icon.ico' } } ] // ... }; ``` -------------------------------- ### Add Vue 3 Dependencies Source: https://www.electronforge.io/guides/framework-integration/vue-3.md Installs the necessary Vue 3 and Vite plugin packages for the project. ```bash npm install vue npm install --save-dev @vitejs/plugin-vue ``` -------------------------------- ### Make Distributables for Multiple Architectures Source: https://www.electronforge.io/cli.md Build distributables for multiple architectures simultaneously by providing a comma-separated list to the --arch flag. ```bash npm run make -- --arch="ia32,x64" ``` -------------------------------- ### Vue 3 App Component Source: https://www.electronforge.io/guides/framework-integration/vue-3.md Defines a basic Vue 3 component with a template and script setup for an Electron application. ```vue ``` -------------------------------- ### Custom Publisher Implementation Source: https://www.electronforge.io/advanced/extending-electron-forge/writing-publishers.md Example of a custom publisher class extending `PublisherBase` and implementing the `publish` method. This snippet demonstrates how to iterate over make results and upload distributables, ensuring versions are created if they don't exist. ```javascript export default class MyPublisher extends PublisherBase { async publish (opts) { for (const result of opts.makeResults) { await createVersionIfNotExists(); await uploadDistributable(result); } } } ``` -------------------------------- ### Configure Electron Forge Scripts in package.json Source: https://www.electronforge.io/import-existing-project.md Add these scripts to your package.json to enable Forge's start, package, make, and publish commands. ```json { // ... "scripts": { "start": "electron-forge start", "package": "electron-forge package", "make": "electron-forge make", "publish": "electron-forge publish" } // ... } ```