UNPKG

@mieweb/wikigdrive

Version:

Google Drive to MarkDown synchronization

21 lines (20 loc) 813 B
import { EventEmitter } from 'node:events'; import process from 'node:process'; import { FileContentService } from '../utils/FileContentService.js'; import { createLogger } from '../utils/logger/logger.js'; import { ContainerEngine } from '../ContainerEngine.js'; export async function initEngine(workdir) { const mainFileService = new FileContentService(workdir); await mainFileService.mkdir('/'); const eventBus = new EventEmitter(); eventBus.setMaxListeners(0); eventBus.on('panic:invalid_grant', () => { process.exit(1); }); eventBus.on('panic', (error) => { throw error; }); const logger = createLogger(workdir, eventBus); const containerEngine = new ContainerEngine(logger, mainFileService); return { mainFileService, containerEngine, logger }; }