Use the Electron Forge Core API
mainThe @electron-forge/core module provides the base Electron Forge API as a set of asynchronous JavaScript functions. This allows you to execute Forge commands directly in Node.js without using the CLI.
Note that all user-side configuration is still managed via your Forge configuration file or the config.forge section in your package.json.
import { api } from '@electron-forge/core';
// Package the current directory as an Electron app
api.package(__dirname);