Documentation
¶
Index ¶
- Variables
- func ApplyDevBranding(ctx context.Context, le *logrus.Entry, electronDistPath string, ...) (string, error)
- func BuildAsar(ctx context.Context, le *logrus.Entry, stateDir, buildDir, outPath string) error
- func BuildElectronBundle(ctx context.Context, le *logrus.Entry, ...) error
- func BuildElectronRendererIndex(buildDir string, importMap web_entrypoint_index.ImportMap) error
- func BuildMainBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) error
- func BuildPreloadBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) error
- func BuildRendererBundle(ctx context.Context, le *logrus.Entry, ...) error
- func BuildServiceWorkerBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) (string, error)
- func BuildServiceWorkerBundleWithRuntimeDeps(le *logrus.Entry, bldrDistRoot, buildDir, buildPkgsDir string, ...) (string, error)
- func DownloadElectronRedist(ctx context.Context, le *logrus.Entry, stateDir string, ...) error
- func ElectronBuildOpts(bldrDistRoot string, minify, devMode bool) esbuild.BuildOptions
- func ElectronDefine(devMode bool) map[string]string
- func FixEsbuildIssue1921(opts *esbuild.BuildOptions)
- func GetElectronBinName(plat bldr_platform.Platform) string
- func WriteElectronStableBootFiles(buildDir, serviceWorkerFilename, sharedWorkerFilename string) error
Constants ¶
This section is empty.
Variables ¶
var EsbuildLogLevel = esbuild.LogLevelWarning
EsbuildLogLevel is the log level when bundling the electron entrypoint_browser_bundle.
Functions ¶
func ApplyDevBranding ¶
func ApplyDevBranding( ctx context.Context, le *logrus.Entry, electronDistPath string, stateDir string, plat bldr_platform.Platform, appName string, iconPath string, ) (string, error)
ApplyDevBranding applies NativeAppConfig branding to an extracted Electron.
electronDistPath is the directory containing the extracted Electron. stateDir is used for downloading tools (resedit-cli on Windows). appName is the display name from NativeAppConfig.AppName. iconPath is the absolute path to the source icon PNG (empty to skip icon).
Returns the new electron binary path relative to electronDistPath. Idempotent: skips if marker file matches appName.
func BuildAsar ¶
BuildAsar builds the app asar using the @electron/asar tool.
stateDir is the directory where bun will be downloaded if not found in PATH. buildDir should be pre-prepared using BuildElectronBundle. outPath should be the path to the output .asar file
func BuildElectronBundle ¶
func BuildElectronBundle(ctx context.Context, le *logrus.Entry, stateDir, bldrDistRoot, buildDir, startupFilename string, minify, devMode bool) error
BuildElectronBundle builds and outputs the web & service worker files.
stateDir is the directory where bun will be downloaded if not found in PATH. startupFilename is the path to the react component to load on startup (can be empty). minify enables file minification in esbuild devMode enables devMode extensions in Electron entrypointHash, if set, uses /entrypoint/{entrypointHash}/pkgs/...
func BuildElectronRendererIndex ¶ added in v0.51.8
func BuildElectronRendererIndex(buildDir string, importMap web_entrypoint_index.ImportMap) error
func BuildMainBundle ¶
BuildMainBundle builds the electron Main bundle files.
func BuildPreloadBundle ¶
func BuildPreloadBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) error
BuildPreloadBundle builds the web renderer bundle files.
func BuildRendererBundle ¶
func BuildRendererBundle( ctx context.Context, le *logrus.Entry, bldrDistRoot, buildDir, runtimeJsPath, runtimeSwPath, runtimeShwPath, webStartupSrcPath string, minify, devMode bool, ) error
BuildRendererBundle builds the web renderer bundle files.
runtimeSwPath is the path to the service worker js for the entrypoint to load. runtimeShwPath is the path to the service worker js for the entrypoint to load. webStartupSrcPath is the path to the startup js module to load for the react app entrypoint (can be empty).
func BuildServiceWorkerBundle ¶
func BuildServiceWorkerBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) (string, error)
BuildServiceWorkerBundle builds specifically the service worker files.
Returns the path to the service worker .mjs file
func BuildServiceWorkerBundleWithRuntimeDeps ¶ added in v0.52.0
func DownloadElectronRedist ¶
func DownloadElectronRedist(ctx context.Context, le *logrus.Entry, stateDir string, plat bldr_platform.Platform, buildDir, destDir string, npmPkg string) error
DownloadElectronRedist downloads the electron redistributable to the destination dir.
stateDir is the directory where bun will be downloaded if not found in PATH. If npmPkg is empty, defaults to latest.
When plat is a NativePlatform whose goos/goarch differ from the host, npm_config_* and ELECTRON_INSTALL_* are set so Electron's installer fetches the target redistributable instead of the host's. Without this, cross-platform release builds land with a host-arch electron in dist/, which then fails downstream branding / packaging steps that expect target-arch layout.
func ElectronBuildOpts ¶
func ElectronBuildOpts(bldrDistRoot string, minify, devMode bool) esbuild.BuildOptions
ElectronBuildOpts are general options for building for Electron.
func ElectronDefine ¶
ElectronDefine returns the define mapping for Electron.
devMode enables devMode mode.
func FixEsbuildIssue1921 ¶
func FixEsbuildIssue1921(opts *esbuild.BuildOptions)
FixEsbuildIssue1921 fixes dynamic esbuild imports failing under node.js.
func GetElectronBinName ¶
func GetElectronBinName(plat bldr_platform.Platform) string
GetElectronBinName returns the name of the electron binary.
Returns just "electron" if not known.
func WriteElectronStableBootFiles ¶ added in v0.51.8
Types ¶
This section is empty.