12 lines
294 B
TypeScript
Executable File
12 lines
294 B
TypeScript
Executable File
import { existsSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
export function getExistFile({ cwd, files, returnRelative }) {
|
|
for (const file of files) {
|
|
const absFilePath = join(cwd, file);
|
|
if (existsSync(absFilePath)) {
|
|
return returnRelative ? file : absFilePath;
|
|
}
|
|
}
|
|
}
|