mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Remove the rimraf
dependency in favor of the built-in Node.js fs.rmSync
in the test folder
In Node.js 14.14.0 the `fs.rmSync` function was added that removes files and directories. The `recursive` option is used to remove directories and their contents, making it a drop-in replacement for the `rimraf` dependency we use. Given that PDF.js now requires Node.js 18+ we can be sure that this option is available, so we can safely remove `rimraf` and reduce the number of project dependencies in the test folder. This commit also gets rid of the indirection via the `removeDirSync` test helper function by simply calling `fs.rmSync` directly. Co-authored-by: Wojciech Maj <kontakt@wojtekmaj.pl>
This commit is contained in:
parent
e08de772ff
commit
a562c41e12
2 changed files with 7 additions and 20 deletions
|
@ -16,16 +16,6 @@
|
|||
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import rimraf from "rimraf";
|
||||
|
||||
const rimrafSync = rimraf.sync;
|
||||
|
||||
function removeDirSync(dir) {
|
||||
fs.readdirSync(dir); // Will throw if dir is not a directory
|
||||
rimrafSync(dir, {
|
||||
disableGlob: true,
|
||||
});
|
||||
}
|
||||
|
||||
function copySubtreeSync(src, dest) {
|
||||
const files = fs.readdirSync(src);
|
||||
|
@ -63,4 +53,4 @@ function ensureDirSync(dir) {
|
|||
}
|
||||
}
|
||||
|
||||
export { copySubtreeSync, ensureDirSync, removeDirSync };
|
||||
export { copySubtreeSync, ensureDirSync };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue