[ci] yarn format

This commit is contained in:
FredKSchott 2021-07-20 01:56:54 +00:00 committed by GitHub Actions
parent d45431d246
commit 15cd6c1708

View file

@ -21,21 +21,23 @@ export function mkdirp(dir: string) {
} }
/** /**
* Delete all files, subdirectories, and symlinks in a given * Delete all files, subdirectories, and symlinks in a given
* directory. * directory.
* *
* @param dir the directory to empty * @param dir the directory to empty
* @returns a promise for emptying a given directory * @returns a promise for emptying a given directory
*/ */
export async function emptyDir(dir: string) { export async function emptyDir(dir: string) {
const items = await fs.promises.readdir(dir); const items = await fs.promises.readdir(dir);
return Promise.all(items.map(async (item) => { return Promise.all(
const itemPath = path.join(dir, item); items.map(async (item) => {
const stat = await fs.promises.stat(itemPath); const itemPath = path.join(dir, item);
return stat.isDirectory() const stat = await fs.promises.stat(itemPath);
? fs.promises.rm(itemPath, { recursive: true, force: true }) // To remove directories return stat.isDirectory()
: fs.promises.unlink(itemPath); // Remove files and symlinks ? fs.promises.rm(itemPath, { recursive: true, force: true }) // To remove directories
})); : fs.promises.unlink(itemPath); // Remove files and symlinks
})
);
} }
const { version } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8')); const { version } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));