Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/app/electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import type { Plugin } from 'vite'

const coreAlias = { '@spool/core': resolve(__dirname, '../core/dist/index.js') }
const coreAlias = {
'@spool/core': resolve(__dirname, '../core/dist/index.js'),
}

// better-sqlite3 uses 'bindings' at runtime to locate the .node native addon.
// It must NOT be bundled — it must stay as a real require() in the output.
Expand Down Expand Up @@ -37,7 +39,7 @@ export default defineConfig({
resolve: { alias: coreAlias },
},
preload: {
plugins: [externalizeDepsPlugin()],
plugins: [externalizeDepsPlugin({ exclude: ['@spool/core'] })],
build: {
rollupOptions: {
input: { index: resolve(__dirname, 'src/preload/index.ts') },
Expand Down
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"bindings": "^1.5.0",
"electron-updater": "^6.8.3",
"file-uri-to-path": "^2.0.0",
"lucide-react": "^1.8.0",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"ws": "^8.20.0",
Expand Down
31 changes: 31 additions & 0 deletions packages/app/src/main/dev-connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,37 @@ export function ensureSymlink(target: string, linkPath: string): void {
symlinkSync(target, linkPath)
}

/**
* Try to install a connector package from the workspace by symlinking.
* Returns the resolved name+version on success, or null if the package
* isn't in the workspace (caller should fall through to npm install).
*/
export function installFromWorkspace(
packageName: string,
spoolDir: string,
workspaceRoot: string,
): { name: string; version: string } | null {
const connectorsParent = join(workspaceRoot, 'packages', 'connectors')
if (!existsSync(connectorsParent)) return null

for (const entry of readdirSync(connectorsParent)) {
const pkgDir = join(connectorsParent, entry)
const pkgJsonPath = join(pkgDir, 'package.json')
if (!existsSync(pkgJsonPath)) continue
let pkg: { name?: string; version?: string; spool?: { type?: string } }
try { pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf8')) } catch { continue }
if (pkg.name !== packageName || pkg.spool?.type !== 'connector') continue

const nodeModules = join(spoolDir, 'connectors', 'node_modules')
const segments = packageName.startsWith('@') ? packageName.split('/') : [packageName]
mkdirSync(join(nodeModules, ...segments.slice(0, -1)), { recursive: true })
ensureSymlink(pkgDir, join(nodeModules, ...segments))
console.log(`[dev] symlinked workspace connector ${packageName}`)
return { name: packageName, version: pkg.version ?? '0.0.0' }
}
return null
}

export function linkDevConnectors(spoolDir: string, workspaceRoot: string): void {
const connectorsParent = join(workspaceRoot, 'packages', 'connectors')
if (!existsSync(connectorsParent)) return
Expand Down
Loading