Squirrel.Windows maker for Electron Forge that creates Windows installers and update packages
npx @tessl/cli install tessl/npm-electron-forge--maker-squirrel@7.8.0The @electron-forge/maker-squirrel package is a Squirrel.Windows maker for Electron Forge that generates Windows installers and update packages. It creates essential distribution files including the main installer, NuGet packages for updates, and RELEASES files for application updates.
npm install @electron-forge/maker-squirrelimport MakerSquirrel from "@electron-forge/maker-squirrel";
// or for named import
import { MakerSquirrel } from "@electron-forge/maker-squirrel";For CommonJS:
const MakerSquirrel = require("@electron-forge/maker-squirrel").default;
// or for named import
const { MakerSquirrel } = require("@electron-forge/maker-squirrel");import MakerSquirrel from "@electron-forge/maker-squirrel";
// Create a maker instance with configuration
const squirrelMaker = new MakerSquirrel({
certificateFile: "./cert.pfx",
certificatePassword: "your-certificate-password"
});
// The maker is typically used within Electron Forge configuration
// In your forge.config.js:
module.exports = {
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
certificateFile: './cert.pfx',
certificatePassword: 'your-certificate-password'
}
}
]
};The MakerSquirrel class extends the base Maker class from @electron-forge/maker-base and wraps the electron-winstaller functionality. Key components include:
Main maker class that creates Squirrel.Windows installers and update packages.
export default class MakerSquirrel extends MakerBase<MakerSquirrelConfig> {
/** Name identifier for this maker - always 'squirrel' */
name: 'squirrel';
/** Default platforms this maker supports - ['win32'] */
defaultPlatforms: ForgePlatform[];
/** List of required external binaries - empty for this maker */
requiredExternalBinaries: string[];
/**
* Create a new MakerSquirrel instance
* @param configOrConfigFetcher - Configuration object or function that returns config for target architecture
* @param platformsToMakeOn - Optional override for supported platforms
*/
constructor(
configOrConfigFetcher?: MakerSquirrelConfig | ((arch: ForgeArch) => MakerSquirrelConfig),
platformsToMakeOn?: ForgePlatform[]
);
/**
* Check if maker can run on current platform
* @returns true if electron-winstaller is available and not disabled by DISABLE_SQUIRREL_TEST env var
*/
isSupportedOnCurrentPlatform(): boolean;
/**
* Prepare the configuration for a specific target architecture
* @param targetArch - Target architecture to prepare config for
*/
prepareConfig(targetArch: ForgeArch): Promise<void>;
/**
* Create Windows installer artifacts
* @param options - Make options containing app directory, output directory, and metadata
* @returns Array of absolute paths to generated artifacts including RELEASES, setup exe, and nupkg files
*/
make(options: MakerOptions): Promise<string[]>;
}
// Named export - same as default export
export { MakerSquirrel };Configuration type for customizing the Squirrel maker behavior.
export type MakerSquirrelConfig = Omit<ElectronWinstallerOptions, 'appDirectory' | 'outputDirectory'>;
// ElectronWinstallerOptions includes all the following properties:
interface ElectronWinstallerOptions {
/** Application directory (excluded from MakerSquirrelConfig - set by Forge) */
appDirectory: string;
/** Output directory (excluded from MakerSquirrelConfig - set by Forge) */
outputDirectory: string;
/** Path to code signing certificate file (.pfx) */
certificateFile?: string;
/** Password for the certificate file */
certificatePassword?: string;
/** Disable MSI generation (default: true in maker) */
noMsi?: boolean;
/** Custom name for setup executable (default: {appName}-{version} Setup.exe) */
setupExe?: string;
/** URL for update server to enable delta updates */
remoteReleases?: string;
/** Disable delta package generation (default: false) */
noDelta?: boolean;
/** Custom MSI setup file name (default: {appName}Setup.msi) */
setupMsi?: string;
/** Application name - hyphens automatically converted to underscores */
name?: string;
/** Application title for installer */
title?: string;
/** Executable name within the app */
exe?: string;
/** Icon file (.ico) to use for the setup executable */
iconUrl?: string;
/** Directory containing the app icon files */
iconDirectory?: string;
/** Setup icon file (.ico) for the installer */
setupIcon?: string;
/** Load a gif file and play it while installing (Windows only) */
loadingGif?: string;
/** Skip MSI generation completely */
skipUpdateIcon?: boolean;
/** Squirrel.Windows version to use */
version?: string;
/** Additional metadata files to include */
metadata?: Record<string, any>;
/** Sign the installer with given certificate */
signWithParams?: string;
/** Use machine-wide installation */
usePackageJson?: boolean;
/** Product version for the installer */
productVersion?: string;
/** Company name for installer metadata */
companyName?: string;
/** Copyright information */
copyright?: string;
/** License URL for the application */
licenseUrl?: string;
/** URL for more info about the application */
projectUrl?: string;
/** Description of the application */
description?: string;
/** Array of additional files to include */
additionalFiles?: string[];
/** Custom welcome message */
welcomeMessage?: string;
/** Disable directory selection in installer */
noDirectorySelection?: boolean;
}Options passed to the make method from Electron Forge.
interface MakerOptions {
/** Directory containing the packaged Electron application */
dir: string;
/** Directory to output artifacts (potentially in sub folders) */
makeDir: string;
/** Human-friendly name of the project */
appName: string;
/** Target platform to make for */
targetPlatform: ForgePlatform;
/** Target architecture to make for */
targetArch: ForgeArch;
/** Fully resolved forge configuration */
forgeConfig: ResolvedForgeConfig;
/** Application's package.json file */
packageJSON: any;
}Platform and architecture type definitions from Electron Forge shared types.
/** Supported platforms for Electron applications */
type ForgePlatform = 'win32' | 'darwin' | 'linux' | 'mas';
/** Supported architectures for Electron applications */
type ForgeArch = 'ia32' | 'x64' | 'armv7l' | 'arm64' | 'mips64el' | 'universal';Base classes and types from dependencies.
/**
* Base maker class that all Electron Forge makers extend
* Provides common functionality for maker implementations
*/
abstract class MakerBase<C> {
/** Configuration for this maker instance */
config: C;
/** Name identifier for this maker */
abstract name: string;
/** Default platforms this maker supports */
abstract defaultPlatforms: ForgePlatform[];
/** Required external binaries for this maker */
requiredExternalBinaries: string[];
/** Internal marker for type checking */
readonly __isElectronForgeMaker: true;
constructor(
configOrConfigFetcher?: C | ((arch: ForgeArch) => C),
platformsToMakeOn?: ForgePlatform[]
);
/** Get the platforms this maker will run on */
get platforms(): ForgePlatform[];
/** Prepare configuration for target architecture */
prepareConfig(targetArch: ForgeArch): Promise<void>;
/** Create a copy of this maker instance */
clone(): MakerBase<C>;
/** Check if maker is supported on current platform */
abstract isSupportedOnCurrentPlatform(): boolean;
/** Create artifacts for the given options */
abstract make(options: MakerOptions): Promise<string[]>;
/** Ensure directory exists and is empty */
ensureDirectory(dir: string): Promise<void>;
/** Ensure file path exists and file is removed */
ensureFile(file: string): Promise<void>;
/** Check if external binaries exist */
externalBinariesExist(): boolean;
/** Throw error if external binaries don't exist */
ensureExternalBinariesExist(): void;
/** Check if a module is installed and available */
isInstalled(module: string): boolean;
/** Normalize Windows version string for Squirrel compatibility */
normalizeWindowsVersion(version: string): string;
}
/** Forge configuration that's fully resolved */
interface ResolvedForgeConfig {
/** Build identifier for output directory generation */
buildIdentifier?: string | (() => string);
/** Output directory for build artifacts */
outDir?: string;
/** Configuration for the Electron packager */
packagerConfig: ForgePackagerOptions;
/** Array of configured makers */
makers: ForgeConfigMaker[];
/** Array of configured publishers */
publishers: ForgeConfigPublisher[];
/** Array of configured plugins */
plugins: ForgeConfigPlugin[];
/** Configuration for rebuilding native modules */
rebuildConfig: ForgeRebuildOptions;
/** Hook functions for various lifecycle events */
hooks?: ForgeHookMap;
/** Internal plugin interface */
pluginInterface: IForgePluginInterface;
}
// Supporting type definitions
type ForgeConfigMaker = IForgeResolvableMaker | IForgeMaker;
type ForgeConfigPublisher = IForgeResolvablePublisher | IForgePublisher;
type ForgeConfigPlugin = IForgeResolvablePlugin | IForgePlugin;
type ForgeRebuildOptions = any; // From @electron/rebuild
type ForgePackagerOptions = any; // From @electron/packager
type ForgeHookMap = any; // Hook system types
type IForgePluginInterface = any; // Plugin interfaceFunctions from electron-winstaller used internally by the maker.
/** Convert a semver version to Squirrel-compatible format */
declare function convertVersion(version: string): string;
/** Create Windows installer using provided options */
declare function createWindowsInstaller(options: ElectronWinstallerOptions): Promise<void>;The maker generates the following artifacts in the output directory:
mono and wine installed// In forge.config.js
module.exports = {
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {} // Use defaults
}
]
};// In forge.config.js
module.exports = {
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
certificateFile: './certificates/code-signing.pfx',
certificatePassword: process.env.CERTIFICATE_PASSWORD,
setupExe: 'MyAppInstaller.exe',
remoteReleases: 'https://updates.myapp.com/',
noMsi: false
}
}
]
};import MakerSquirrel from "@electron-forge/maker-squirrel";
import { MakerOptions } from "@electron-forge/maker-base";
const maker = new MakerSquirrel({
certificateFile: './cert.pfx',
certificatePassword: 'password'
});
// Check platform support
if (maker.isSupportedOnCurrentPlatform()) {
// Prepare configuration for target architecture
await maker.prepareConfig('x64');
// Generate artifacts
const artifacts = await maker.make({
dir: './packaged-app',
makeDir: './dist',
appName: 'My App',
targetPlatform: 'win32',
targetArch: 'x64',
forgeConfig: resolvedConfig,
packageJSON: require('./package.json')
});
console.log('Generated artifacts:', artifacts);
}