Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nextjs-to-electron

БесплатноЗапускает вложенные скриптыНе проверен

Use when converting a Next.js static export into a Windows Electron desktop app, especially for offline machines without WebView2. Next.js 转 Windows Electron…

rockbenbenот rockbenben1 251 установка в других каталогах

Об этом скилле

Next.js → Electron Desktop App

Overview

Wrap a static-exportable Next.js (App Router) app in a thin Electron shell. Electron bundles its own Chromium, so unlike Tauri it needs no system WebView2 — the reason to pick it for locked-down/intranet machines. Keep the web behavior intact and put shell-specific behavior in electron/. Make the source or configuration changes required for a working export.

Core principle: Serve the export over a custom app:// protocol, NOT file://. Almost all migration pain is path/origin resolution, not React — and file:// silently breaks both. (See electron-files.md for all copy-paste code.)

When to use

  • The app is (or can be) a static export (output: "export") — diff/format/calculator/viewer tools, no SSR or API-at-runtime.
  • Export prerequisites: output: "export" in next.config.*. The default next/image optimizer needs a server; use images.unoptimized: true for the offline template, or retain an export-compatible custom loader after verifying its network requirements.
  • You want a Windows desktop build that runs fully offline, especially where WebView2 is absent (LTSC/Server images, air-gapped intranet) so Tauri won't launch.

Check platform and toolchain compatibility. Confirm the target Windows version and architecture against the selected Electron release. Use a supported stable Electron line and compatible builder/updater versions from the project's package source; old release asset inventories do not establish current support.

For CI, select a supported Node version that satisfies the build tools' engines. An explicit Active LTS major is a reproducible default; retain a deliberate project pin policy. engines.node expresses compatibility, not simply the CI version. See Electron releases and the Node schedule.

Runtime API routes, SSR and server actions need a separately assessed server/sidecar design. Consider nextjs-to-tauri when a system WebView is acceptable; measure package sizes from actual artifacts. Maintenance of an existing Electron app uses desktop-app-standard rather than repeating this migration.

Build-time Server Components and statically generated GET handlers can remain; do not convert them all to "use client". Verify that their data is emitted into the export and does not need a runtime Next.js server. See static-export support.

This playbook targets Windows (--win dir/portable, SmartScreen, WebView2-less boxes). macOS/Linux packaging (.dmg/.AppImage, notarization, codesigning) is out of scope.

Local migration covers the necessary source/configuration changes. Remote tags, public releases and signing-service setup follow the user's authorized scope; a read-only assessment reports blockers and proposed checks without installing or building.

Procedure

Adapt the following steps to the repository. Full code is in electron-files.md. Preserve existing web behavior and make only necessary export or desktop integration changes. Commands use yarn; in an npm or pnpm repo substitute the equivalent (npm ci for yarn install --frozen-lockfile) and match setup-node's cache: to the lockfile you actually have — cache: yarn fails the job outright when there is no yarn.lock.

  1. Confirm the export is client-side and check its shape. yarn build, then ls out/ — you'll see flat files (index.html, en.html, zh.html) and _next/. trailingSlash: false (flat files) is fine; the resolver handles both layouts (gotcha #2). If the build stops on the default image loader, that is the images.unoptimized prerequisite above — set it and rebuild.

  2. Add the toolchain (after the version check above): yarn add -D electron electron-builder. In package.json add "main": "electron/main.js" and scripts: electron:dev (node scripts/electron-dev.cjs, which sets ELECTRON_DEV=1 and spawns electron), electron:build (next build && electron-builder --win dir), test:electron (list the test files explicitly — node --test electron/resolvePath.test.js electron/store.test.js …; choose a glob only when the project Node/shell supports it, gotcha #5). Add electron/package.json with {"type":"commonjs"} so the shell and its tests also run when the Next.js project's root declares "type": "module".

  3. Create the electron/ layer (copy from electron-files.md). Split into pure modules that must NOT require("electron") (so node --test runs them) and Electron-bound ones:

    • constants.js — SCHEME="app", LOCALES[]. resolvePath.js — resolveAssetPath(outDir, pathname, exists) with .html→/index.html→404.html fallback. store.js — dependency-free JSON store in userData. locale.js — startUrl/parseLocale/`track
Полный SKILL.md на ClawHub

Установить nextjs-to-electron в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл nextjs-to-electron?

Use when converting a Next.js static export into a Windows Electron desktop app, especially for offline machines without WebView2. Next.js 转 Windows Electron / 将 Next.js 静态导出打包成 exe. Confirm the project supports static export and Windows Electron is the intended target.

Как установить скилл nextjs-to-electron?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nextjs-to-electron запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить nextjs-to-electron с