Files
Ncurator/scripts/postinstall.mjs
T
hy 9fd64c7eb6 feat(storage): implement SQLite utility functions and integrate with document management
- Added utility functions for SQLite operations in `sqliteUtils.ts`, including row manipulation and JSON parsing.
- Enhanced `WorkspaceKnowledgePrepareService` to manage document generations and content hashes.
- Updated constants for chunk write batch size to improve performance.
- Modified types to include generation IDs and content hashes in document records.
- Introduced SQLite database path configuration in `paths.ts`.
- Refactored `ChatPage` component to optimize rendering and handle file changes.
- Created unit tests for SQLite storage and document metadata management.
- Updated chat run service tests to reflect changes in event handling and data persistence.
2026-07-09 18:16:24 +08:00

28 lines
765 B
JavaScript

import { existsSync } from 'node:fs'
import path from 'node:path'
import { spawnSync } from 'node:child_process'
const root = process.cwd()
const electronInstall = path.join(root, 'node_modules', 'electron', 'install.js')
const run = (command, args) => {
const result = spawnSync(command, args, {
cwd: root,
stdio: 'inherit',
env: process.env
})
if (result.status !== 0) {
process.exit(result.status || 1)
}
}
if (existsSync(electronInstall)) {
run(process.execPath, [electronInstall])
}
if (process.env.NCURATOR_REBUILD_NATIVE === '1') {
run(process.execPath, [path.join(root, 'scripts', 'rebuild-better-sqlite3-electron.mjs')])
} else {
console.log('[postinstall] skip native rebuild; set NCURATOR_REBUILD_NATIVE=1 to run it')
}