From 5bd89edbbec6827fc919a87c2053ee8858b8f5d8 Mon Sep 17 00:00:00 2001 From: Matias Lopez Date: Wed, 31 Mar 2021 19:40:32 -0400 Subject: [PATCH 1/2] feat: promisify clean In the effort of modernizing the code --- lib/clean.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/clean.js b/lib/clean.js index dbfa4dbb99..ef50310d50 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -2,14 +2,17 @@ const rm = require('rimraf') const log = require('npmlog') +const util = require('util') -function clean (gyp, argv, callback) { +async function clean (gyp, argv) { // Remove the 'build' dir - var buildDir = 'build' + const buildDir = 'build' log.verbose('clean', 'removing "%s" directory', buildDir) - rm(buildDir, callback) + return util.promisify(rm)(buildDir) } -module.exports = clean +module.exports = function (gyp, argv, callback) { + clean(gyp, argv).then(callback.bind(undefined, null), callback) +} module.exports.usage = 'Removes any generated build files and the "out" dir' From 9d3d7d967c71c7065fc83c01c463cec6defc2535 Mon Sep 17 00:00:00 2001 From: Matias Lopez Date: Sun, 11 Apr 2021 12:46:43 -0400 Subject: [PATCH 2/2] fix: no response expected --- lib/clean.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/clean.js b/lib/clean.js index ef50310d50..68c5508be7 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -13,6 +13,7 @@ async function clean (gyp, argv) { } module.exports = function (gyp, argv, callback) { - clean(gyp, argv).then(callback.bind(undefined, null), callback) + // no response expected + clean(gyp, argv).then(() => callback(), callback) } module.exports.usage = 'Removes any generated build files and the "out" dir'