fix(xo-server-logs): require level from level-party
This is not very clean but I dont want to add a `level` dependency to `xo-server` which might have a different version of the one provided by `level-party`.
This commit is contained in:
parent
e82eec0cd6
commit
e92960a413
@ -7,8 +7,6 @@ import parseArgs from 'minimist'
|
||||
import sublevel from 'subleveldown'
|
||||
import util from 'util'
|
||||
import { join as joinPath } from 'path'
|
||||
// eslint-disable-next-line node/no-extraneous-import
|
||||
import { repair as repairDb } from 'level'
|
||||
|
||||
import { forEach } from './utils'
|
||||
import globMatcher from './glob-matcher'
|
||||
@ -181,8 +179,12 @@ export default async function main() {
|
||||
})
|
||||
|
||||
if (args.repair) {
|
||||
// eslint-disable-next-line node/no-extraneous-require
|
||||
const { repair } = require(require.resolve('level', {
|
||||
paths: [require.resolve('level-party')],
|
||||
}))
|
||||
await new Promise((resolve, reject) => {
|
||||
repairDb(`${config.datadir}/leveldb`, error => {
|
||||
repair(`${config.datadir}/leveldb`, error => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user