Skip to content

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.

typescript
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;
}
FieldTypeRequiredDescription
devDevConfigYesDev mode subprocess configs (frontend + electron)
buildBuildConfigYesBuild configs (electron bundle + platform packaging)
moveRecord<string, MoveConfig>YesResource move configs (e.g. frontend dist → public/dist)
startExecConfigYesProduction start configuration
encryptRecord<string, EncryptConfig>YesEncryption configs (frontend + electron, each independent)
execRecord<string, ExecConfig>YesCustom command configs (empty by default, user-defined)
updaterRecord<string, UpdaterConfig>NoIncremental update configs (per-platform)
ohosOhosConfigNoHarmonyOS resource extraction config

ExecConfig ​

Command execution config — defines parameters for launching a subprocess.

typescript
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;
}
FieldTypeRequiredDescription
directorystringYesProcess working directory (relative to project root)
cmdstringYesCommand to execute (e.g. npm, electron, electron-builder)
argsstring[]NoCommand argument array
stdio'inherit' | 'pipe' | 'ignore'NoChild process stdio mode. Default: 'inherit'
syncbooleanNoExecute synchronously. Default: false
protocolstringNoFrontend protocol. 'http://' = dev server, 'file://' = skip frontend
watchbooleanNoWatch for file changes and auto-restart (electron only). Default: false
delaynumberNoDebounce delay in watch mode (ms). Default: 1000
hostnamestringNoFrontend dev server hostname
portnumberNoFrontend dev server port
indexPathstringNoFrontend index page filename
forcebooleanNoForce refresh the page. Default: false
loadingPagestringNoElectron loading page path (shows loading page before main content)

DevConfig ​

Dev mode configuration — frontend and electron subprocess configs.

typescript
interface DevConfig {
  frontend: DevFrontendConfig;
  electron: DevElectronConfig;
  [key: string]: ExecConfig | undefined;
}

DevFrontendConfig ​

Extends ExecConfig with required defaults for the frontend dev server.

typescript
interface DevFrontendConfig extends ExecConfig {
  args: string[];
  protocol: string;
  hostname: string;
  port: number;
  indexPath: string;
  force: boolean;
  sync: boolean;
}
FieldTypeRequiredDescription
directorystringYesFrontend directory. Default: './frontend'
cmdstringYesCommand. Default: 'npm'
argsstring[]YesArguments. Default: ['run', 'dev']
protocolstringYesProtocol. Default: 'http://'
hostnamestringYesHostname. Default: 'localhost'
portnumberYesPort. Default: 8080
indexPathstringYesIndex page. Default: 'index.html'
forcebooleanYesForce refresh. Default: false
syncbooleanYesSync mode. Default: false

DevElectronConfig ​

Extends ExecConfig with required defaults for the Electron process.

typescript
interface DevElectronConfig extends ExecConfig {
  args: string[];
  loadingPage: string;
  watch: boolean;
  sync: boolean;
  delay: number;
}
FieldTypeRequiredDescription
directorystringYesDirectory. Default: './'
cmdstringYesCommand. Default: 'electron'
argsstring[]YesArguments. Default: ['.', '--env=local']
loadingPagestringYesLoading page path. Default: ''/public/html/loading.html'
watchbooleanYesWatch mode. Default: false
syncbooleanYesSync mode. Default: false
delaynumberYesDebounce delay (ms). Default: 1000

BuildConfig ​

Build configuration. The electron key must be BundleConfig; all other keys are ExecConfig.

typescript
interface BuildConfig {
  electron: BundleConfig;
  [key: string]: ExecConfig | BundleConfig | undefined;
}

BundleConfig ​

esbuild bundle config — controls Electron main process code bundling.

typescript
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';
}
FieldTypeRequiredDescription
bundleType'bundle' | 'copy'NoBundle mode. 'bundle' = esbuild single-file, 'copy' = directory copy. Default: 'bundle'
externalstring[]NoUser-defined esbuild external packages (framework externals added automatically). Default: []
sourcemapboolean | 'inline' | 'external'NoSourcemap config. false = auto (dev→inline, prod→off). Default: false
minifybooleanNoMinify code. Default: false
drop('console' | 'debugger')[]NoStatement types to remove. Default: []
keepNamesbooleanNoPreserve function/class names when minifying. Default: false
legalComments'inline' | 'eof' | 'none'NoLicense comment handling. Default: 'none'
defineRecord<string, string>NoCompile-time constants (e.g. { 'process.env.X': '"value"' }). Default: {}
copystring[]NoExtra files/dirs from electron/ to copy to output (scripts transpiled, others verbatim). Default: []
format'cjs' | 'esm'NoOutput 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).

typescript
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;
}
FieldTypeRequiredDescription
type'confusion' | 'bytecode' | 'strict' | 'none'YesEncryption type. See table below
filesstring[]NoGlobby patterns for files to encrypt
fileExtstring[]NoOnly process these extensions. Default: ['.js']
specificFilesstring[]NoFiles forced to use confusion even in bytecode mode (e.g. preload scripts)
entryFilesstring[]NoEntry files that must stay as .js (becomes bytenode loader shell in bytecode mode)
cleanFilesstring[]NoDirectory paths to clean after encryption
encryptDirstringNoBase directory for encryption. Default: './'
silentbooleanNoSuppress javascript-obfuscator promotional banner. Default: false
confusionOptionsConfusionOptionsNoObfuscation options (only for confusion / strict types)
bytecodeOptionsBytecodeOptionsNoBytecode compilation options (only for bytecode / strict types)

Encryption types:

TypeDescriptionFrontendElectron
confusionObfuscation only (javascript-obfuscator)✅✅
bytecodeBytecode only (bytenode)❌✅
strictObfuscation + bytecode combined❌✅
noneNo 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.

typescript
interface ConfusionOptions {
  compact?: boolean;
  stringArray?: boolean;
  stringArrayThreshold?: number;
  stringArrayEncoding?: Array<'none' | 'base64' | 'rc4'>;
  stringArrayCallsTransform?: boolean;
  deadCodeInjection?: boolean;
  numbersToExpressions?: boolean;
  target?: 'browser' | 'node';
}
FieldTypeDescription
compactbooleanRemove line breaks. Default: true
stringArraybooleanMove strings to an array. Default: true
stringArrayThresholdnumberProbability of string being moved to array (0–1).
stringArrayEncodingArray<'none' | 'base64' | 'rc4'>String encoding method. 'none' = no encoding, 'base64' = Base64, 'rc4' = RC4 encryption
stringArrayCallsTransformbooleanTransform string array calls. Default: true
deadCodeInjectionbooleanInject dead code blocks. Default: false
numbersToExpressionsbooleanReplace numbers with expressions. Default: true
target'browser' | 'node'Obfuscation target runtime. Frontend: 'browser', Electron: 'node'

BytecodeOptions ​

bytenode compilation options.

typescript
interface BytecodeOptions {
  filename?: string;
  output?: string;
  electron?: boolean;
}
FieldTypeDescription
filenamestringInput source file path (auto-set by encrypt module)
outputstringOutput .jsc file path (defaults to filename + 'c')
electronbooleanCompile for Electron V8. Default: true for electron target

MoveConfig ​

Resource move/copy config — defines source and destination paths.

typescript
interface MoveConfig {
  src: string;
  dest: string;
  dist?: string;
  target?: string;
}
FieldTypeRequiredDescription
srcstringYesSource path (relative to project root)
deststringYesDestination path (relative to project root)
diststringNoOverride for src (takes priority if set)
targetstringNoOverride for dest (takes priority if set)

UpdaterConfig ​

Incremental update config — for generating update packages.

typescript
interface UpdaterConfig {
  metadata: string;
  appFile?: string;
  builderConfig?: string;
  output: {
    directory: string;
    zip: string;
    file: string;
  };
  extraResources?: string[];
  asarUnpacked?: string[];
  cleanCache?: boolean;
}
FieldTypeRequiredDescription
metadatastringYesPath to metadata YAML file (version, releaseDate, SHA512 hashes)
appFilestringNoPath to app package (asar or directory). .asar extension auto-stripped when builder has asar:false. Can override via CLI --app-file
builderConfigstringNoBuilder config path (detects asar:true/false to auto-adjust appFile)
output.directorystringYesOutput directory
output.zipstringYesZip filename template (platform/version suffixes auto-appended)
output.filestringYesJSON metadata filename template (platform suffix auto-appended)
extraResourcesstring[]NoGlob patterns for extra resources to include in zip
asarUnpackedstring[]NoNative module list from asarUnpacked to include in zip
cleanCachebooleanNoClean per-platform temp dirs after generation

OhosConfig ​

HarmonyOS resource extraction config.

typescript
interface OhosConfig {
  resources: OhosResourceConfig[];
}

OhosResourceConfig ​

Single resource entry — follows electron-builder's FileSet pattern.

typescript
interface OhosResourceConfig {
  from: string;
  to: string;
  filter?: string[];
}
FieldTypeRequiredDescription
fromstringYesSource path (relative to project root)
tostringYesDestination path (relative to project root)
filterstring[]NoGlob filter patterns with negation (e.g. "!compiled"). Default: ["**/*"]