Nuxt/packages/bridge/src/dirs.ts

12 lines
336 B
TypeScript
Raw Normal View History

import { fileURLToPath } from 'url'
import { existsSync } from 'fs'
import { join } from 'path'
import { dirname } from 'pathe'
2021-09-05 21:21:33 +00:00
let dir = dirname(fileURLToPath(import.meta.url))
while (dir !== '/' && !existsSync(join(dir, 'package.json'))) {
dir = dirname(dir)
}
export const pkgDir = dir
export const distDir = join(pkgDir, 'dist')