HakobuHakobu

Package.json Config

Configure Hakobu through the "hakobu" field in your package.json.

Overview

The primary way to configure Hakobu is through the "hakobu" field in your project's package.json. CLI flags override these values when both are provided.

package.json
{
  "name": "my-app",
  "version": "1.0.0",
  "main": "src/index.js",
  "hakobu": {
    "entry": "src/index.js",
    "target": "node24-linux-x64",
    "output": "./dist/my-app",
    "assets": ["templates/**", "public/**"],
    "compress": "brotli"
  }
}

Config Fields

Core Options

FieldTypeDefaultDescription
entrystring"main" field in package.jsonEntry file relative to the project root.
targetstringHost platformTarget specification (e.g., "node24-linux-x64").
targetsstring[]Multiple targets (e.g., ["node24-linux-x64", "node24-win-x64"]).
outputstringOutput executable path (single target) or directory (multi-target).
assetsstring[][]Glob patterns for extra files to include in the snapshot filesystem.
externalsstring[][]Artifact names to keep outside the executable (e.g., native binaries that cannot be embedded).

Bundle Mode

FieldTypeDefaultDescription
bundleboolean | stringfalseEnable bundle mode. Set to true or "rolldown" to pre-bundle with Rolldown before packaging. Useful for TypeScript and monorepo projects.
bundleExternalstring[][]Modules to keep external when bundling (not resolved into the bundle).

Compilation and Compression

FieldTypeDefaultDescription
bytecodebooleanfalseCompile JS to V8 bytecode before packaging. Source maps are not available in bytecode mode.
compress"brotli" | "gzip"None (uncompressed)Compression algorithm for the snapshot payload.
optionsstring[]V8 flags to bake into the executable. Each flag should be prefixed with -- (e.g., ["--expose-gc", "--max-heap-size=34"]).

Windows PE Metadata

The metadata object sets Windows VERSIONINFO fields and the application icon.

FieldTypeDescription
metadata.productNamestringProduct name shown in file properties.
metadata.fileDescriptionstringDescription shown in Task Manager.
metadata.companyNamestringCompany or publisher name.
metadata.legalCopyrightstringCopyright notice.
metadata.fileVersionstringFile version (e.g., "1.2.3").
metadata.productVersionstringProduct version (defaults to file version).
metadata.iconstringPath to a .ico file to embed as the application icon.

macOS App Bundle

FieldTypeDefaultDescription
appBundlebooleanfalseWrap macOS output in a .app bundle. Only valid for macOS targets.

The macos object provides metadata for Info.plist generation when appBundle is true.

FieldTypeDescription
macos.bundleIdstringCFBundleIdentifier (e.g., "com.example.my-app").
macos.displayNamestringCFBundleDisplayName.
macos.bundleVersionstringCFBundleVersion (e.g., "1.2.3").
macos.shortVersionstringCFBundleShortVersionString (defaults to bundleVersion).
macos.copyrightstringNSHumanReadableCopyright.
macos.iconstringPath to a .icns file for the app icon.

Linux AppDir / AppImage

FieldTypeDefaultDescription
appDirbooleanfalseWrap Linux output in an AppDir. Only valid for Linux targets.
appImagebooleanfalseBuild an AppImage from the AppDir. Implies appDir. Requires appimagetool in PATH.

The linux object provides metadata for .desktop file and AppStream metainfo generation.

FieldTypeDescription
linux.namestringApplication name in the .desktop file.
linux.commentstringShort description / tooltip.
linux.categoriesstringSemicolon-separated categories (e.g., "Utility;Development;").
linux.terminalbooleanWhether the app needs a terminal (default: true).
linux.iconstringIcon name for the .desktop file.
linux.iconPathstringPath to a .png file for the application icon.
linux.summarystringOne-line summary for AppStream metainfo.
linux.descriptionstringLonger description for AppStream metainfo.
linux.urlstringHomepage URL for AppStream metainfo.
linux.licensestringSPDX license identifier (e.g., "MIT", "Apache-2.0").
linux.versionstringApplication version for AppStream metainfo.

Complete Example

package.json
{
  "name": "my-app",
  "version": "2.0.0",
  "type": "module",
  "main": "src/index.js",
  "hakobu": {
    "entry": "src/cli.js",
    "target": "node24-linux-x64",
    "output": "./dist/my-app",
    "assets": [
      "templates/**",
      "public/**/*.html",
      "locales/*.json"
    ],
    "externals": ["better-sqlite3"],
    "compress": "brotli",
    "options": ["--expose-gc", "--max-heap-size=512"],
    "metadata": {
      "productName": "My App",
      "fileDescription": "My App CLI Tool",
      "companyName": "My Company",
      "fileVersion": "2.0.0",
      "icon": "assets/icon.ico"
    },
    "macos": {
      "bundleId": "com.mycompany.my-app",
      "displayName": "My App",
      "bundleVersion": "2.0.0",
      "copyright": "Copyright 2026 My Company",
      "icon": "assets/icon.icns"
    },
    "linux": {
      "name": "My App",
      "comment": "A CLI tool for doing things",
      "categories": "Utility;Development;",
      "terminal": true,
      "iconPath": "assets/icon.png",
      "license": "MIT"
    }
  }
}

Legacy "pkg" Field

The "pkg" field from @yao-pkg/pkg is still accepted, but it is deprecated. Hakobu reads it and emits migration warnings explaining how to update each option. Migrate to the "hakobu" field for long-term compatibility.

When Hakobu encounters a "pkg" field, it maps supported options automatically:

pkg fieldMaps toNotes
pkg.scriptshakobu.assetsMerged into the assets list. In pkg, "scripts" were extra JS files to compile; Hakobu includes all reachable files automatically.
pkg.assetshakobu.assetsDirect mapping.
pkg.targetshakobu.targetHakobu builds one target at a time. The first target is used.
pkg.outputPathhakobu.outputDirect mapping.
pkg.patchesNot supportedHakobu does not support source patching.
pkg.dictionaryNot supportedHakobu resolves dependencies directly.
pkg.deployFileshakobu.assets or hakobu.externalsUse assets for files to embed, externals for files kept outside.
pkg.ignoreNot neededHakobu only includes files reachable from the entry point.

If both "hakobu" and "pkg" fields exist in the same package.json, the "hakobu" field takes priority and "pkg" is ignored entirely.

Example migration warnings you will see:

[config] Reading config from "pkg" field. Migrate to "hakobu" field for future compatibility.
[config] "pkg.scripts" mapped to "hakobu.assets". In Hakobu, use "assets" for extra files to include.

Config Priority

Hakobu resolves configuration in the following order (highest priority first):

  1. CLI flags -- Always override everything else.
  2. "hakobu" field -- The modern configuration source.
  3. "pkg" field -- Legacy fallback, used only when "hakobu" is absent.

On this page