or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-electron-forge--maker-squirrel

Squirrel.Windows maker for Electron Forge that creates Windows installers and update packages

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@electron-forge/maker-squirrel@7.8.x

To install, run

npx @tessl/cli install tessl/npm-electron-forge--maker-squirrel@7.8.0

index.mddocs/

Electron Forge Maker Squirrel

The @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.

Package Information

  • Package Name: @electron-forge/maker-squirrel
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @electron-forge/maker-squirrel

Core Imports

import 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");

Basic Usage

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'
      }
    }
  ]
};

Architecture

The MakerSquirrel class extends the base Maker class from @electron-forge/maker-base and wraps the electron-winstaller functionality. Key components include:

  • Configuration Interface: MakerSquirrelConfig type that extends electron-winstaller options
  • Platform Support: Specifically targets win32 platform with cross-platform support via wine/mono
  • Artifact Generation: Creates multiple distribution files including installers, update packages, and manifest files
  • Code Signing: Integrates with Windows code signing certificates for trusted distribution

Capabilities

MakerSquirrel Class

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 Options

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;
}

Make Options

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 Types

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 Types

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 interface

Utility Functions

Functions 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>;

Generated Artifacts

The maker generates the following artifacts in the output directory:

  1. RELEASES - Squirrel update manifest file
  2. {appName} Setup.exe - Main installer executable (or custom name via setupExe)
  3. {appName}-{version}-full.nupkg - Full NuGet update package
  4. {appName}-{version}-delta.nupkg - Delta update package (if remoteReleases specified and noDelta is false)
  5. {appName}Setup.msi - MSI installer (if noMsi is false)

Platform Requirements

  • Primary Platform: Windows
  • Cross-platform Support: Linux with mono and wine installed
  • Dependencies: electron-winstaller package must be available
  • Signing: Windows code signing certificate recommended for production

Usage Examples

Basic Configuration

// In forge.config.js
module.exports = {
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {}  // Use defaults
    }
  ]
};

Advanced Configuration with Code Signing

// 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
      }
    }
  ]
};

Programmatic Usage

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);
}