mcpField
E
electrobun-config

electrobun-config

github.com/dexploarer開発511 回インストール34 週間前に更新
リポジトリ

electrobun-config について

electrobun-config は、Electrobun アプリを設定する開発者向けの electrobun.config.ts リファレンスです。アプリの識別情報、ビルド、リリースなど、よく変更する項目を用途別にまとめています。

主な機能

  1. 01アプリ名、識別子、バージョンの設定
  2. 02レンダラービューと GPU オプションの設定
  3. 03CEF のバンドルとデフォルトレンダラーの設定
  4. 04リリース URL とパッチ生成の設定
  5. 05署名、アセットコピー、URL スキームの設定

活用シーン

  1. 01新規アプリの識別情報の設定
  2. 02レンダラービューの追加や GPU 描画の有効化
  3. 03リリースとパッチ生成の設定
  4. 04署名、アセットコピー、URL スキームの準備

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/dexploarer/plugin-electrobun-dev --skill electrobun-config

インストール後、Claude Code で/electrobun-configを入力して読み込まれたか確認します。

詳細

electrobun.config.ts — 完全リファレンス

import type { ElectrobunConfig } from "electrobun";

export default {

  // ── App identity ────────────────────────────────────────────────────────
  app: {
    name: "MyApp",                    // Display name (default: "MyApp")
    identifier: "com.example.myapp", // Reverse DNS bundle ID (REQUIRED, must be unique)
    version: "0.1.0",                // Semver — bump for each release
    description: "My app",           // Used in Linux .desktop file
    urlSchemes: ["myapp"],           // Deep link schemes: myapp:// (macOS only currently)
  },

  // ── Build ────────────────────────────────────────────────────────────────
  build: {

    // Output directories
    buildFolder: "build",            // Where built apps go (default: "build")
    artifactFolder: "artifacts",     // Where release artifacts go (default: "artifacts")
    targets: "current",              // Target platforms; "current" = host platform (default: "current")

    // Bun main process bundle
    bun: {
      entrypoint: "src/bun/index.ts",  // Main process entry (default: "src/bun/index.ts")
      minify: false,                   // Any Bun.build() options work here
      sourcemap: "inline",
      define: { "process.env.NODE_ENV": '"development"' },
    },

    // Renderer (browser-side) bundles — one per BrowserView with a TS entrypoint
    views: {
      mainview: { entrypoint: "src/mainview/index.ts" },
      sidebar:  { entrypoint: "src/sidebar/index.ts" },
      // Each key becomes a URL scheme: mainview://index.html
    },

    // Static file copies — key: source path, value: dest path in bundle Resources
    copy: {
      "assets/": "assets/",
      "data/schema.sql": "data/schema.sql",
    },

    // ASAR archive (packs Resources into a single file — reduces file count)
    useAsar: false,                  // default: false
    asarUnpack: ["*.node", "*.dll", "*.dylib", "*.so"],  // default — native libs always unpacked

    // Version overrides (pin runtime versions — test thoroughly before use)
    cefVersion: undefined,           // e.g. "CEF_128+chromium-128.0.6613.84"
    wgpuVersion: undefined,          // e.g. "0.2.3"
    bunVersion: undefined,           // e.g. "1.4.2"

    // Locale trimming — reduces CEF bundle size on Linux/Windows
    locales: "*",                    // "*" = all locales; ["en", "de"] = only those

    // Watch mode extras
    watch: [],                       // Additional paths to watch in `dev --watch`
    watchIgnore: [],                 // Glob patterns to ignore in watch mode

    // ── Platform: macOS ───────────────────────────────────────────────────
    mac: {
      bundleCEF: false,              // Use CEF instead of WKWebView (adds ~120MB)
      bundleWGPU: false,             // Bundle Dawn for GpuWindow (adds ~8MB)
      defaultRenderer: "native",    // "native" (WKWebView) | "cef" (Chromium)
      codesign: false,               // Enable codesign (requires ELECTROBUN_DEVELOPER_ID)
      notarize: false,               // Enable notarization (requires Apple creds env vars)
      icons: "icon.iconset",         // Path to .iconset folder (must contain icon_1024x1024.png)
      entitlements: {                // Hardened runtime entitlements
        "com.apple.security.cs.allow-jit": true,
        "com.apple.security.cs.allow-unsigned-executable-memory": true,
      },
      chromiumFlags: {               // CEF Chromium flags (CEF only)
        "disable-web-security": true,
        "allow-running-insecure-content": true,
      },
    },

    // ── Platform: Windows ─────────────────────────────────────────────────
    win: {
      bundleCEF: false,
      bundleWGPU: false,
      defaultRenderer: "native",    // "native" (WebView2) | "cef"
      icon: "assets/icon.ico",      // .ico file path
      chromiumFlags: {},
    },

    // ── Platform: Linux ───────────────────────────────────────────────────
    linux: {
      bundleCEF: false,
      bundleWGPU: false,
      defaultRenderer: "native",    // "native" (GTKWebKit) | "cef"
      icon: "assets/icon.png",      // .png file path
      chromiumFlags: {},
    },
  },

  // ── Runtime config ───────────────────────────────────────────────────────
  runtime: {
    exitOnLastWindowClosed: true,   // Quit app when last window closes (default: true)
    // Any additional keys are accessible via BuildConfig at runtime
    apiEndpoint: "https://api.example.com",
  },

  // ── Build lifecycle hooks ─────────────────────────────────────────────────
  scripts: {
    preBuild: "bun run scripts/pre-build.ts",   // Runs before bundling
    postBuild: "bun run scripts/post-build.ts", // Runs after bundle, before codesign
    postWrap: "echo Done wrapping",              // Runs after .app is assembled
    postPackage: "bun run scripts/upload.ts",    // Runs after DMG/installer created
  },

  // ── Release / auto-update ─────────────────────────────────────────────────
  release: {
    baseUrl: "https://cdn.example.com/releases/myapp",
    generatePatch: true,            // Generate bsdiff patch (default: true)
  },

} satisfies ElectrobunConfig;

タスク別の変更頻度が高いフィールド

新しいプロジェクトを開始する場合: app.name、app.identifier、app.version

新しいレンダラービューを追加する場合: build.views.<viewname>

GPU レンダリングを有効にする場合: build.mac.bundleWGPU: true(対象とするすべてのプラットフォーム)

CEF を有効にする場合: build.mac.bundleCEF: true、build.mac.defaultRenderer: "cef"

リリースを設定する場合: release.baseUrl、release.generatePatch: true

コード署名: build.mac.codesign: true、build.mac.notarize: true、環境変数を設定

静的アセットを追加する場合: build.copy

ディープリンク: app.urlSchemes

コメント