mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
Add tables, indexes, FTS5 virtual table, and triggers to support EPG (electronic program guide) data in the shared SQLite connection. The changes introduce epg_channels and epg_programs tables, multiple indexes for efficient lookups (by source, name, channel, start, and time range), and an epg_programs_fts virtual table with triggers to keep the full-text index synchronized with epg_programs. Register EPG database event handlers in the Electron backend and add an IPC handler for bulk-saving channels. The handler deletes existing channels for a source and inserts new channels in chunks to avoid large single inserts, returning the inserted count. These changes enable storing, querying, and full-text searching EPG data and prepare backend IPC endpoints for importing program guide data.
55 lines
1.9 KiB
JavaScript
55 lines
1.9 KiB
JavaScript
const esbuild = require('esbuild');
|
|
const path = require('path');
|
|
|
|
// Node.js built-in modules that should be externalized
|
|
const nodeBuiltins = [
|
|
'assert', 'async_hooks', 'buffer', 'child_process', 'cluster',
|
|
'console', 'constants', 'crypto', 'dgram', 'dns', 'domain',
|
|
'events', 'fs', 'http', 'http2', 'https', 'inspector', 'module',
|
|
'net', 'os', 'path', 'perf_hooks', 'process', 'punycode',
|
|
'querystring', 'readline', 'repl', 'stream', 'string_decoder',
|
|
'sys', 'timers', 'tls', 'trace_events', 'tty', 'url', 'util',
|
|
'v8', 'vm', 'worker_threads', 'zlib'
|
|
];
|
|
|
|
// Native modules that must be externalized (loaded at runtime)
|
|
const nativeModules = [
|
|
'better-sqlite3',
|
|
];
|
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
|
|
async function buildWorker() {
|
|
try {
|
|
console.log(`Building EPG parser worker with esbuild (${isProduction ? 'production' : 'development'})...`);
|
|
|
|
await esbuild.build({
|
|
entryPoints: [path.join(__dirname, 'src/app/workers/epg-parser.worker.ts')],
|
|
bundle: true,
|
|
platform: 'node',
|
|
target: 'node18',
|
|
format: 'cjs',
|
|
outfile: path.join(__dirname, '../../dist/apps/electron-backend/workers/epg-parser.worker.js'),
|
|
external: [
|
|
...nodeBuiltins.map(m => `node:${m}`),
|
|
...nodeBuiltins,
|
|
...nativeModules,
|
|
],
|
|
sourcemap: !isProduction,
|
|
minify: isProduction,
|
|
// Resolve workspace libraries from tsconfig paths
|
|
alias: {
|
|
'shared-interfaces': path.join(__dirname, '../../libs/shared/interfaces/src/index.ts'),
|
|
'database': path.join(__dirname, '../../libs/shared/database/src/index.ts'),
|
|
},
|
|
});
|
|
|
|
console.log('✅ Worker built successfully!');
|
|
} catch (error) {
|
|
console.error('❌ Worker build failed:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
buildWorker();
|