diff --git a/scripts/index.mjs b/scripts/index.mjs index 9e9ff6b4..94845ab7 100644 --- a/scripts/index.mjs +++ b/scripts/index.mjs @@ -1,24 +1,25 @@ // @ts-check -import fs from "node:fs/promises"; +// eslint-disable-next-line n/no-unsupported-features/node-builtins +import { constants, copyFile, rm, unlink } from "node:fs/promises"; import { globby } from "globby"; const [ command, ...args ] = process.argv.slice(2); if (command === "copy") { const [ src, dest ] = args; - await fs.copyFile(src, dest); + await copyFile(src, dest, constants.COPYFILE_FICLONE); } else if (command === "delete") { await Promise.all( args.flatMap( (glob) => globby(glob) .then( - (files) => files.map((file) => fs.unlink(file)) + (files) => files.map((file) => unlink(file)) ) ) ); } else if (command === "remove") { - await Promise.all(args.map((dir) => fs.rm(dir, { "recursive": true }))); + await Promise.all(args.map((dir) => rm(dir, { "recursive": true }))); } else { throw new Error(`Unsupported command: ${command}`); }