mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-08 05:42:35 +00:00
27 lines
763 B
TypeScript
27 lines
763 B
TypeScript
import { PH_BIN_CACHE, PUBLIC_DEBUG, TRACE } from '$constants'
|
|
import { PocketbaseReleaseDownloadService } from '$services'
|
|
import { LoggerService } from '@pockethost/common'
|
|
// gen:import
|
|
|
|
const [major, minor, patch] = process.versions.node.split('.').map(Number)
|
|
|
|
if ((major || 0) < 18) {
|
|
throw new Error(`Node 18 or higher required.`)
|
|
}
|
|
|
|
LoggerService({ debug: PUBLIC_DEBUG, trace: TRACE, errorTrace: !PUBLIC_DEBUG })
|
|
|
|
// npm install eventsource --save
|
|
// @ts-ignore
|
|
global.EventSource = require('eventsource')
|
|
;(async () => {
|
|
const logger = LoggerService().create(`mothership.ts`)
|
|
const { dbg, error, info, warn } = logger
|
|
info(`Starting`)
|
|
|
|
const { check } = PocketbaseReleaseDownloadService({
|
|
cachePath: PH_BIN_CACHE,
|
|
})
|
|
await check()
|
|
})()
|