mirror of
https://github.com/cita-777/metapi.git
synced 2026-11-03 14:26:12 +08:00
feat: add run-server script to manage server execution and compatibility checks feat: create main application logic for desktop with window management, server handling, and auto-updater test: add unit tests for desktop runtime helpers feat: implement desktop server environment configuration and health check test: add tests for server configuration and desktop routes feat: add native module guard for better-sqlite3 compatibility test: add tests for native module guard functionality test: add comprehensive tests for account verification feedback handling feat: implement account verification feedback helpers chore: add TypeScript configuration for desktop builds
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
type RebuildCommandInput = {
|
|
npmExecPath?: string;
|
|
};
|
|
|
|
type RebuildCommand = {
|
|
command: string;
|
|
args: string[];
|
|
};
|
|
|
|
export function isNodeModuleVersionMismatch(error: unknown): boolean {
|
|
if (!error || typeof error !== 'object') return false;
|
|
const code = 'code' in error ? String((error as { code?: unknown }).code || '') : '';
|
|
const message = 'message' in error ? String((error as { message?: unknown }).message || '') : '';
|
|
return code === 'ERR_DLOPEN_FAILED' && message.includes('NODE_MODULE_VERSION');
|
|
}
|
|
|
|
export function buildBetterSqliteRebuildCommand(input: RebuildCommandInput = {}): RebuildCommand {
|
|
const npmExecPath = input.npmExecPath || process.env.npm_execpath;
|
|
if (npmExecPath && npmExecPath.length > 0) {
|
|
return {
|
|
command: process.execPath,
|
|
args: [
|
|
npmExecPath,
|
|
'rebuild',
|
|
'better-sqlite3',
|
|
'--no-audit',
|
|
'--fund=false',
|
|
],
|
|
};
|
|
}
|
|
|
|
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
return {
|
|
command: npmCommand,
|
|
args: ['rebuild', 'better-sqlite3', '--no-audit', '--fund=false'],
|
|
};
|
|
}
|