mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* fix(build-utils): fn excludeFiles has bug if path with 'test' in win32 * fix: update * chore: rename slash to normalizePath --------- Co-authored-by: btea <2356281422@qq.com> Co-authored-by: qiang <qw13131wang@gmail.com>
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import { resolve } from 'path'
|
|
|
|
export const projRoot = resolve(__dirname, '..', '..', '..')
|
|
export const pkgRoot = resolve(projRoot, 'packages')
|
|
export const compRoot = resolve(pkgRoot, 'components')
|
|
export const themeRoot = resolve(pkgRoot, 'theme-chalk')
|
|
export const hookRoot = resolve(pkgRoot, 'hooks')
|
|
export const localeRoot = resolve(pkgRoot, 'locale')
|
|
export const directiveRoot = resolve(pkgRoot, 'directives')
|
|
export const epRoot = resolve(pkgRoot, 'element-plus')
|
|
export const utilRoot = resolve(pkgRoot, 'utils')
|
|
export const buildRoot = resolve(projRoot, 'internal', 'build')
|
|
|
|
// Docs
|
|
export const docsDirName = 'docs'
|
|
export const docRoot = resolve(projRoot, docsDirName)
|
|
export const vpRoot = resolve(docRoot, '.vitepress')
|
|
|
|
/** `/dist` */
|
|
export const buildOutput = resolve(projRoot, 'dist')
|
|
/** `/dist/element-plus` */
|
|
export const epOutput = resolve(buildOutput, 'element-plus')
|
|
|
|
export const projPackage = resolve(projRoot, 'package.json')
|
|
export const compPackage = resolve(compRoot, 'package.json')
|
|
export const themePackage = resolve(themeRoot, 'package.json')
|
|
export const hookPackage = resolve(hookRoot, 'package.json')
|
|
export const localePackage = resolve(localeRoot, 'package.json')
|
|
export const directivePackage = resolve(directiveRoot, 'package.json')
|
|
export const epPackage = resolve(epRoot, 'package.json')
|
|
export const utilPackage = resolve(utilRoot, 'package.json')
|
|
export const docPackage = resolve(docRoot, 'package.json')
|
|
|
|
const windowsSlashRE = /\\/g
|
|
/**
|
|
* Normalize a path to use forward slashes.
|
|
* This is useful for ensuring consistent path formatting across different platforms.
|
|
*/
|
|
export function normalizePath(p: string): string {
|
|
if (typeof process !== 'undefined' && process.platform === 'win32') {
|
|
return p.replace(windowsSlashRE, '/')
|
|
}
|
|
return p
|
|
}
|