mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
24 lines
395 B
JavaScript
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,
|
|
};
|