feat(config): enhance Electron Vite configuration and package management

- Updated the Electron Vite configuration to dynamically exclude production dependencies, improving build performance and compatibility.
- Modified the output format in the Rollup options to CommonJS, ensuring compatibility with bundled dependencies.
- Adjusted the main entry point in package.json to reflect the new output format.
- Enhanced the README to clarify notification triggers for system notifications.

This commit optimizes the build configuration and improves documentation clarity, facilitating better dependency management and user understanding.
This commit is contained in:
matt 2026-02-13 00:36:34 +09:00
parent d9e5db106f
commit b656246658
5 changed files with 48 additions and 13 deletions

View file

@ -63,6 +63,11 @@ jobs:
node-version: 20
cache: pnpm
- name: Setup Python for node-gyp
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
@ -98,6 +103,11 @@ jobs:
node-version: 20
cache: pnpm
- name: Setup Python for node-gyp
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile

View file

@ -68,7 +68,7 @@ Every tool call is paired with its result in an expandable card. Specialized vie
### :bell: Custom Notification Triggers
Define rules for when you want to be notified. Match on regex patterns, assign colors, and filter your inbox by trigger. Built-in triggers catch common errors out of the box; add your own for project-specific patterns.
Define rules for when you want to receive **system notifications**. Match on regex patterns, assign colors, and filter your inbox by trigger. Built-in triggers catch common errors out of the box; add your own for project-specific patterns.
### :busts_in_silhouette: Team & Subagent Visualization

View file

@ -1,21 +1,40 @@
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import { readFileSync } from 'fs'
import { resolve } from 'path'
import type { Plugin } from 'vite'
// Read all production dependencies from package.json
// so they get bundled into the main process output.
// This avoids pnpm symlink issues with electron-builder's asar packaging.
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'))
const prodDeps = Object.keys(pkg.dependencies || {})
// Rollup plugin: stub out native .node addon imports with empty modules.
// ssh2 and cpu-features use optional native bindings that can't be bundled,
// but they have pure JS fallbacks when the native module isn't available.
function nativeModuleStub(): Plugin {
const STUB_ID = '\0native-stub'
return {
name: 'native-module-stub',
resolveId(source) {
if (source.endsWith('.node')) return STUB_ID
return null
},
load(id) {
if (id === STUB_ID) return 'export default {}'
return null
}
}
}
export default defineConfig({
main: {
plugins: [
externalizeDepsPlugin({
exclude: [
'unified',
'remark-parse',
'remark-gfm',
'mdast-util-to-hast',
'fastify',
'@fastify/cors',
'@fastify/static'
]
})
exclude: prodDeps
}),
nativeModuleStub()
],
resolve: {
alias: {
@ -29,6 +48,12 @@ export default defineConfig({
rollupOptions: {
input: {
index: resolve(__dirname, 'src/main/index.ts')
},
output: {
// CJS format so bundled deps can use __dirname/require.
// Use .cjs extension since package.json has "type": "module".
format: 'cjs',
entryFileNames: '[name].cjs'
}
}
}

View file

@ -13,7 +13,7 @@
"bugs": {
"url": "https://github.com/matt1398/claude-devtools/issues"
},
"main": "dist-electron/main/index.js",
"main": "dist-electron/main/index.cjs",
"scripts": {
"dev": "electron-vite dev",
"build": "electron-vite build",
@ -125,7 +125,7 @@
],
"asar": true,
"extraMetadata": {
"main": "dist-electron/main/index.js"
"main": "dist-electron/main/index.cjs"
},
"mac": {
"category": "public.app-category.developer-tools",

Binary file not shown.