Development server and build commands for running Electron applications in development mode and packaging them for distribution.
Start the current Electron application in development mode with debugging support and process management.
/**
* Start Electron application in development mode
* Usage: electron-forge start [dir] [options] [-- app-args]
*/
interface StartOptions {
/** Directory to run the command in */
dir: string;
/** Enable interactive prompts */
interactive: boolean;
/** Enable internal Electron logging */
enableLogging?: boolean;
/** Run the Electron app as a Node.JS script */
runAsNode?: boolean;
/** Run Electron in inspect mode for debugging main process */
inspect?: boolean;
/** Run Electron in inspect-brk mode for debugging main process */
inspectBrk?: boolean;
/** Path to the Electron app to launch */
appPath?: string;
/** Arguments to pass to the Electron application */
args?: string[];
}
/**
* Electron process returned by start command
*/
interface ElectronProcess {
/** Process ID */
pid: number;
/** Whether the process has been restarted */
restarted: boolean;
/** Remove event listener */
removeListener(event: string, listener: Function): void;
/** Add event listener for process events */
on(event: 'exit', listener: (code: number) => void): void;
on(event: 'restarted', listener: (newChild: ElectronProcess) => void): void;
}Command Line Usage:
# Start current directory project
electron-forge start
# Start specific directory
electron-forge start /path/to/project
# Start with logging enabled
electron-forge start --enable-logging
# Start with debugging
electron-forge start --inspect-electron
# Start with custom app path
electron-forge start --app-path=./custom/path
# Pass arguments to Electron app
electron-forge start -- --verbose --config=dev.jsonCommand Options:
[dir] - Directory to run the command in (default: current directory)-p, --app-path <path> - Path to the Electron app to launch (default: current directory)-l, --enable-logging - Enable internal Electron logging-n, --run-as-node - Run the Electron app as a Node.JS script-i, --inspect-electron - Run Electron in inspect mode to allow debugging the main process--inspect-brk-electron - Run Electron in inspect-brk mode to allow debugging the main process--vscode - Hidden option used for VSCode debugging integrationApp Arguments:
Any arguments found after -- will be passed to the Electron app:
electron-forge start /path/to/project --enable-logging -- -d -f foo.txtPackage the current Electron application for the target platform and architecture.
/**
* Package Electron application for distribution
* Usage: electron-forge package [dir] [options]
*/
interface PackageOptions {
/** Directory to run the command in */
dir: string;
/** Enable interactive prompts */
interactive: boolean;
/** Target build architecture */
arch?: string;
/** Target build platform */
platform?: string;
}Command Line Usage:
# Package current directory
electron-forge package
# Package specific directory
electron-forge package /path/to/project
# Package for specific architecture
electron-forge package --arch=x64
# Package for specific platform
electron-forge package --platform=win32
# Package for different platform and architecture
electron-forge package --platform=darwin --arch=arm64Command Options:
[dir] - Directory to run the command in (default: current directory)-a, --arch [arch] - Target build architecture-p, --platform [platform] - Target build platform/**
* Core API functions for development workflow
*/
interface ForgeAPI {
start(options: StartOptions): Promise<ElectronProcess>;
package(options: PackageOptions): Promise<void>;
}