Skip to content

Commit

Permalink
remove rimraf dependency (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Jul 4, 2024
1 parent 13d4ac7 commit e882b7e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
9 changes: 3 additions & 6 deletions lib/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = exports = clean;

exports.usage = 'Removes the entire folder containing the compiled .node module';

const { rimraf } = require('rimraf');
const exists = require('fs').exists || require('path').exists;
const fs = require('fs');
const exists = fs.exists || require('path').exists;
const versioning = require('./util/versioning.js');
const napi = require('./util/napi.js');
const path = require('path');
Expand All @@ -23,10 +23,7 @@ function clean(gyp, argv, callback) {
exists(to_delete, (found) => {
if (found) {
if (!gyp.opts.silent_clean) console.log('[' + package_json.name + '] Removing "%s"', to_delete);
return rimraf(to_delete).then(
(result) => callback(null, result),
(err) => callback(err)
);
return fs.rm(to_delete, { recursive: true, force: true }, callback);
}
return callback();
});
Expand Down
6 changes: 2 additions & 4 deletions lib/util/napi.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,14 @@ module.exports.get_napi_build_version_from_command_args = function(command_args)

module.exports.swap_build_dir_out = function(napi_build_version) {
if (napi_build_version) {
const { rimrafSync } = require('rimraf');
rimrafSync(module.exports.get_build_dir(napi_build_version));
fs.rmSync(module.exports.get_build_dir(napi_build_version), { recursive: true, force: true });
fs.renameSync('build', module.exports.get_build_dir(napi_build_version));
}
};

module.exports.swap_build_dir_in = function(napi_build_version) {
if (napi_build_version) {
const { rimrafSync } = require('rimraf');
rimrafSync('build');
fs.rmSync('build', { recursive: true, force: true });
fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build');
}
};
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"node-fetch": "^2.6.7",
"nopt": "^7.2.1",
"npmlog": "^7.0.1",
"rimraf": "^5.0.5",
"semver": "^7.3.5",
"tar": "^7.4.0"
},
Expand Down

0 comments on commit e882b7e

Please sign in to comment.