Introduction
Complete type definitions for ee-bin configuration. The ./cmd/bin.js file follows the BinConfig interface structure, which ee-bin deep-merges with defaults from bin_default.ts to produce the final configuration.
See also:Default Values | bin CLI
BinConfig
Top-level configuration interface — the full structure of ./cmd/bin.js.
interface BinConfig {
dev: DevConfig;
build: BuildConfig;
move: Record<string, MoveConfig>;
start: ExecConfig;
encrypt: Record<string, EncryptConfig>;
exec: Record<string, ExecConfig>;
updater?: Record<string, UpdaterConfig>;
ohos?: OhosConfig;
}| Field | Type | Required | Description |
|---|---|---|---|
dev | DevConfig | Yes | Dev mode subprocess configs (frontend + electron) |
build | BuildConfig | Yes | Build configs (electron bundle + platform packaging) |
move | Record<string, MoveConfig> | Yes | Resource move configs (e.g. frontend dist → public/dist) |
start | ExecConfig | Yes | Production start configuration |
encrypt | Record<string, EncryptConfig> | Yes | Encryption configs (frontend + electron, each independent) |
exec | Record<string, ExecConfig> | Yes | Custom command configs (empty by default, user-defined) |
updater | Record<string, UpdaterConfig> | No | Incremental update configs (per-platform) |
ohos | OhosConfig | No | HarmonyOS resource extraction config |
ExecConfig
Command execution config — defines parameters for launching a subprocess.
interface ExecConfig {
directory: string;
cmd: string;
args?: string[];
stdio?: 'inherit' | 'pipe' | 'ignore';
sync?: boolean;
protocol?: string;
watch?: boolean;
delay?: number;
hostname?: string;
port?: number;
indexPath?: string;
force?: boolean;
loadingPage?: string;
}| Field | Type | Required | Description |
|---|---|---|---|
directory | string | Yes | Process working directory (relative to project root) |
cmd | string | Yes | Command to execute (e.g. npm, electron, electron-builder) |
args | string[] | No | Command argument array |
stdio | 'inherit' | 'pipe' | 'ignore' | No | Child process stdio mode. Default: 'inherit' |
sync | boolean | No | Execute synchronously. Default: false |
protocol | string | No | Frontend protocol. 'http://' = dev server, 'file://' = skip frontend |
watch | boolean | No | Watch for file changes and auto-restart (electron only). Default: false |
delay | number | No | Debounce delay in watch mode (ms). Default: 1000 |
hostname | string | No | Frontend dev server hostname |
port | number | No | Frontend dev server port |
indexPath | string | No | Frontend index page filename |
force | boolean | No | Force refresh the page. Default: false |
loadingPage | string | No | Electron loading page path (shows loading page before main content) |
DevConfig
Dev mode configuration — frontend and electron subprocess configs.
interface DevConfig {
frontend: DevFrontendConfig;
electron: DevElectronConfig;
[key: string]: ExecConfig | undefined;
}DevFrontendConfig
Extends ExecConfig with required defaults for the frontend dev server.
interface DevFrontendConfig extends ExecConfig {
args: string[];
protocol: string;
hostname: string;
port: number;
indexPath: string;
force: boolean;
sync: boolean;
}| Field | Type | Required | Description |
|---|---|---|---|
directory | string | Yes | Frontend directory. Default: './frontend' |
cmd | string | Yes | Command. Default: 'npm' |
args | string[] | Yes | Arguments. Default: ['run', 'dev'] |
protocol | string | Yes | Protocol. Default: 'http://' |
hostname | string | Yes | Hostname. Default: 'localhost' |
port | number | Yes | Port. Default: 8080 |
indexPath | string | Yes | Index page. Default: 'index.html' |
force | boolean | Yes | Force refresh. Default: false |
sync | boolean | Yes | Sync mode. Default: false |
DevElectronConfig
Extends ExecConfig with required defaults for the Electron process.
interface DevElectronConfig extends ExecConfig {
args: string[];
loadingPage: string;
watch: boolean;
sync: boolean;
delay: number;
}| Field | Type | Required | Description |
|---|---|---|---|
directory | string | Yes | Directory. Default: './' |
cmd | string | Yes | Command. Default: 'electron' |
args | string[] | Yes | Arguments. Default: ['.', '--env=local'] |
loadingPage | string | Yes | Loading page path. Default: ''/public/html/loading.html' |
watch | boolean | Yes | Watch mode. Default: false |
sync | boolean | Yes | Sync mode. Default: false |
delay | number | Yes | Debounce delay (ms). Default: 1000 |
BuildConfig
Build configuration. The electron key must be BundleConfig; all other keys are ExecConfig.
interface BuildConfig {
electron: BundleConfig;
[key: string]: ExecConfig | BundleConfig | undefined;
}BundleConfig
esbuild bundle config — controls Electron main process code bundling.
interface BundleConfig {
bundleType?: 'bundle' | 'copy';
external?: string[];
sourcemap?: boolean | 'inline' | 'external';
minify?: boolean;
drop?: ('console' | 'debugger')[];
keepNames?: boolean;
legalComments?: 'inline' | 'eof' | 'none';
define?: Record<string, string>;
copy?: string[];
format?: 'cjs' | 'esm';
}| Field | Type | Required | Description |
|---|---|---|---|
bundleType | 'bundle' | 'copy' | No | Bundle mode. 'bundle' = esbuild single-file, 'copy' = directory copy. Default: 'bundle' |
external | string[] | No | User-defined esbuild external packages (framework externals added automatically). Default: [] |
sourcemap | boolean | 'inline' | 'external' | No | Sourcemap config. false = auto (dev→inline, prod→off). Default: false |
minify | boolean | No | Minify code. Default: false |
drop | ('console' | 'debugger')[] | No | Statement types to remove. Default: [] |
keepNames | boolean | No | Preserve function/class names when minifying. Default: false |
legalComments | 'inline' | 'eof' | 'none' | No | License comment handling. Default: 'none' |
define | Record<string, string> | No | Compile-time constants (e.g. { 'process.env.X': '"value"' }). Default: {} |
copy | string[] | No | Extra files/dirs from electron/ to copy to output (scripts transpiled, others verbatim). Default: [] |
format | 'cjs' | 'esm' | No | Output format. 'cjs' recommended for Electron. Default: 'cjs' |
Sourcemap Auto Mode
When sourcemap is false (default), ee-bin automatically selects:
- Dev: inline sourcemap (for debugging)
- Prod: no sourcemap (for production)
Set 'inline' or 'external' to override this auto behavior.
EncryptConfig
Encryption strategy config for a target (frontend or electron).
interface EncryptConfig {
type: 'confusion' | 'bytecode' | 'strict' | 'none';
files?: string[];
fileExt?: string[];
specificFiles?: string[];
entryFiles?: string[];
cleanFiles?: string[];
encryptDir?: string;
silent?: boolean;
confusionOptions?: ConfusionOptions;
bytecodeOptions?: BytecodeOptions;
}| Field | Type | Required | Description |
|---|---|---|---|
type | 'confusion' | 'bytecode' | 'strict' | 'none' | Yes | Encryption type. See table below |
files | string[] | No | Globby patterns for files to encrypt |
fileExt | string[] | No | Only process these extensions. Default: ['.js'] |
specificFiles | string[] | No | Files forced to use confusion even in bytecode mode (e.g. preload scripts) |
entryFiles | string[] | No | Entry files that must stay as .js (becomes bytenode loader shell in bytecode mode) |
cleanFiles | string[] | No | Directory paths to clean after encryption |
encryptDir | string | No | Base directory for encryption. Default: './' |
silent | boolean | No | Suppress javascript-obfuscator promotional banner. Default: false |
confusionOptions | ConfusionOptions | No | Obfuscation options (only for confusion / strict types) |
bytecodeOptions | BytecodeOptions | No | Bytecode compilation options (only for bytecode / strict types) |
Encryption types:
| Type | Description | Frontend | Electron |
|---|---|---|---|
confusion | Obfuscation only (javascript-obfuscator) | ✅ | ✅ |
bytecode | Bytecode only (bytenode) | ❌ | ✅ |
strict | Obfuscation + bytecode combined | ❌ | ✅ |
none | No encryption | ✅ | ✅ |
Bytecode on Frontend
Frontend only supports confusion. Bytecode compiles to V8 bytecode, but the browser renderer runs a different V8 version than the compile-time V8, making bytecode incompatible.
ConfusionOptions
javascript-obfuscator configuration options.
interface ConfusionOptions {
compact?: boolean;
stringArray?: boolean;
stringArrayThreshold?: number;
stringArrayEncoding?: Array<'none' | 'base64' | 'rc4'>;
stringArrayCallsTransform?: boolean;
deadCodeInjection?: boolean;
numbersToExpressions?: boolean;
target?: 'browser' | 'node';
}| Field | Type | Description |
|---|---|---|
compact | boolean | Remove line breaks. Default: true |
stringArray | boolean | Move strings to an array. Default: true |
stringArrayThreshold | number | Probability of string being moved to array (0–1). |
stringArrayEncoding | Array<'none' | 'base64' | 'rc4'> | String encoding method. 'none' = no encoding, 'base64' = Base64, 'rc4' = RC4 encryption |
stringArrayCallsTransform | boolean | Transform string array calls. Default: true |
deadCodeInjection | boolean | Inject dead code blocks. Default: false |
numbersToExpressions | boolean | Replace numbers with expressions. Default: true |
target | 'browser' | 'node' | Obfuscation target runtime. Frontend: 'browser', Electron: 'node' |
BytecodeOptions
bytenode compilation options.
interface BytecodeOptions {
filename?: string;
output?: string;
electron?: boolean;
}| Field | Type | Description |
|---|---|---|
filename | string | Input source file path (auto-set by encrypt module) |
output | string | Output .jsc file path (defaults to filename + 'c') |
electron | boolean | Compile for Electron V8. Default: true for electron target |
MoveConfig
Resource move/copy config — defines source and destination paths.
interface MoveConfig {
src: string;
dest: string;
dist?: string;
target?: string;
}| Field | Type | Required | Description |
|---|---|---|---|
src | string | Yes | Source path (relative to project root) |
dest | string | Yes | Destination path (relative to project root) |
dist | string | No | Override for src (takes priority if set) |
target | string | No | Override for dest (takes priority if set) |
UpdaterConfig
Incremental update config — for generating update packages.
interface UpdaterConfig {
metadata: string;
appFile?: string;
builderConfig?: string;
output: {
directory: string;
zip: string;
file: string;
};
extraResources?: string[];
asarUnpacked?: string[];
cleanCache?: boolean;
}| Field | Type | Required | Description |
|---|---|---|---|
metadata | string | Yes | Path to metadata YAML file (version, releaseDate, SHA512 hashes) |
appFile | string | No | Path to app package (asar or directory). .asar extension auto-stripped when builder has asar:false. Can override via CLI --app-file |
builderConfig | string | No | Builder config path (detects asar:true/false to auto-adjust appFile) |
output.directory | string | Yes | Output directory |
output.zip | string | Yes | Zip filename template (platform/version suffixes auto-appended) |
output.file | string | Yes | JSON metadata filename template (platform suffix auto-appended) |
extraResources | string[] | No | Glob patterns for extra resources to include in zip |
asarUnpacked | string[] | No | Native module list from asarUnpacked to include in zip |
cleanCache | boolean | No | Clean per-platform temp dirs after generation |
OhosConfig
HarmonyOS resource extraction config.
interface OhosConfig {
resources: OhosResourceConfig[];
}OhosResourceConfig
Single resource entry — follows electron-builder's FileSet pattern.
interface OhosResourceConfig {
from: string;
to: string;
filter?: string[];
}| Field | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Source path (relative to project root) |
to | string | Yes | Destination path (relative to project root) |
filter | string[] | No | Glob filter patterns with negation (e.g. "!compiled"). Default: ["**/*"] |
