vant/packages/vant-cli/cjs/shared.cjs
2021-10-28 20:09:00 +08:00

24 lines
395 B
JavaScript

const { join, dirname } = require('path');
const { existsSync } = require('fs');
function findRootDir(dir) {
if (existsSync(join(dir, 'vant.config.mjs'))) {
return dir;
}
const parentDir = dirname(dir);
if (dir === parentDir) {
return dir;
}
return findRootDir(parentDir);
}
const CWD = process.cwd();
const ROOT = findRootDir(CWD);
module.exports = {
CWD,
ROOT,
};