This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
755bc9a
commit 2a1802f
Showing
8 changed files
with
112 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import path from 'path'; | ||
import { normalizePath } from 'vite'; | ||
import fs from 'fs'; | ||
|
||
export function resolveNodeModules(root: string, ...dir: string[]) { | ||
return normalizePath(path.join(root, 'node_modules', ...dir)); | ||
} | ||
|
||
export function isRegExp(value: unknown) { | ||
return Object.prototype.toString.call(value) === '[object RegExp]'; | ||
} | ||
|
||
// export function judgeResultFun(arr1: readonly string[], arr2: string[]) { | ||
// let flag = true; | ||
// if (arr1.length !== arr2.length) { | ||
// flag = false; | ||
// } else { | ||
// arr1.forEach((item) => { | ||
// if (arr2.indexOf(item) === -1) { | ||
// flag = false; | ||
// } | ||
// }); | ||
// } | ||
// return flag; | ||
// } | ||
|
||
export function fileExists(f: string) { | ||
try { | ||
fs.accessSync(f, fs.constants.W_OK); | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters