ruoyi-plus-soybean/build/utils/index.ts
2022-06-16 01:17:31 +08:00

21 lines
402 B
TypeScript

import path from 'path';
/**
* 获取项目根路径
* @descrition 结尾不带斜杠
*/
export function getRootPath() {
return path.resolve(process.cwd());
}
/**
* 获取项目src路径
* @param srcName - src目录名称(默认: "src")
* @descrition 结尾不带斜杠
*/
export function getSrcPath(srcName = 'src') {
const rootPath = getRootPath();
return `${rootPath}/${srcName}`;
}