Files
NapCatQQ/.pnpm-store/v3/files/3b/ad6a27e5ed58ec2edfc7e08ff321b62fbb6317d9f0f14f96bd8e64a7727d5705250b7fca8abf9325e70277237b6e4933e8ef3dce4c208ec541ae6594e5d933
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

21 lines
605 B
Plaintext

import fs from 'node:fs';
import path from 'node:path';
function findUp(filename, cwd) {
let dir = path.resolve(cwd || '');
const root = path.parse(dir).root;
const filenames = [filename].flat();
while (true) {
const file = filenames.find(el => fs.existsSync(path.resolve(dir, el)));
if (file) {
return path.resolve(dir, file);
}
if (dir === root) {
return null;
}
dir = path.dirname(dir);
}
}
export function pkgUp(opts) {
return findUp('package.json', opts && opts.cwd);
}
//# sourceMappingURL=pkg-up.js.map