mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(cli): failed to find root dir (#7755)
This commit is contained in:
parent
27cf2d60ef
commit
4af658e67a
@ -3,15 +3,16 @@ import { existsSync } from 'fs-extra';
|
|||||||
import { join, dirname, isAbsolute } from 'path';
|
import { join, dirname, isAbsolute } from 'path';
|
||||||
|
|
||||||
function findRootDir(dir: string): string {
|
function findRootDir(dir: string): string {
|
||||||
if (dir === '/') {
|
|
||||||
return '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (existsSync(join(dir, 'vant.config.js'))) {
|
if (existsSync(join(dir, 'vant.config.js'))) {
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
return findRootDir(dirname(dir));
|
const parentDir = dirname(dir);
|
||||||
|
if (dir === parentDir) {
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
return findRootDir(parentDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user