Skip to content

Commit

Permalink
Replace rimraf dev dependency with fs.rmSync (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
orgads committed Feb 1, 2024
1 parent 9acb80f commit 571867c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"devDependencies": {
"a-native-module": "^1.0.0",
"rimraf": "^4.4.1",
"standard": "^14.3.4",
"tape": "^5.7.4"
},
Expand Down
7 changes: 3 additions & 4 deletions test/integration-cmake-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ var test = require('tape')
var exec = require('child_process').exec
var path = require('path')
var fs = require('fs')
var rm = require('rimraf')

var cwd = path.join(__dirname, 'native-module-cmake')

test('can prebuild a cmake-js native module for node', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-node-v57-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild', { cwd: cwd }, function (error, stdout, stderr) {
Expand All @@ -18,7 +17,7 @@ test('can prebuild a cmake-js native module for node', function (t) {
})

test('can prebuild a cmake-js native module for electron', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-electron-v50-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild-electron', { cwd: cwd }, function (error, stdout, stderr) {
Expand All @@ -29,7 +28,7 @@ test('can prebuild a cmake-js native module for electron', function (t) {
})

test('can prebuild a cmake-js native module for node with silent argument', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-node-v57-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild-silent', { cwd: cwd }, function (error, stdout, stderr) {
Expand Down
9 changes: 4 additions & 5 deletions test/integration-gyp-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ var test = require('tape')
var exec = require('child_process').exec
var path = require('path')
var fs = require('fs')
var rm = require('rimraf')

var cwd = path.join(__dirname, 'native-module-gyp')

test('can prebuild a gyp native module for node', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-node-v57-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild', { cwd: cwd }, function (error, stdout, stderr) {
Expand All @@ -18,7 +17,7 @@ test('can prebuild a gyp native module for node', function (t) {
})

test('can prebuild a gyp native module for electron', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-electron-v50-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild-electron', { cwd: cwd }, function (error, stdout, stderr) {
Expand All @@ -29,7 +28,7 @@ test('can prebuild a gyp native module for electron', function (t) {
})

test.skip('can prebuild a gyp native module for node-webkit', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-node-webkit-v59-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild-node-webkit', { cwd: cwd }, function (error, stdout, stderr) {
Expand All @@ -40,7 +39,7 @@ test.skip('can prebuild a gyp native module for node-webkit', function (t) {
})

test('can prebuild a gyp native module for node with prepack script', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-node-v57-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild-prepack', { cwd: cwd }, function (error, stdout, stderr) {
Expand Down
5 changes: 2 additions & 3 deletions test/integration-napi-cmake-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ var test = require('tape')
var exec = require('child_process').exec
var path = require('path')
var fs = require('fs')
var rm = require('rimraf')

var cwd = path.join(__dirname, 'native-module-napi-cmake')

test('can prebuild a cmake napi module for node', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-napi-v1-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild', { cwd: cwd }, function (error, stdout, stderr) {
Expand All @@ -18,7 +17,7 @@ test('can prebuild a cmake napi module for node', function (t) {
})

test('can prebuild a cmake napi module for node with prepack script', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-napi-v1-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild-prepack', { cwd: cwd }, function (error, stdout, stderr) {
Expand Down
5 changes: 2 additions & 3 deletions test/integration-napi-gyp-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ var test = require('tape')
var exec = require('child_process').exec
var path = require('path')
var fs = require('fs')
var rm = require('rimraf')

var cwd = path.join(__dirname, 'native-module-napi-gyp')

test('can prebuild a gyp napi module for node', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-napi-v1-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild', { cwd: cwd }, function (error, stdout, stderr) {
Expand All @@ -18,7 +17,7 @@ test('can prebuild a gyp napi module for node', function (t) {
})

test('can prebuild a gyp napi module for node with prepack script', function (t) {
rm.sync(path.join(cwd, 'prebuilds'))
fs.rmSync(path.join(cwd, 'prebuilds'), { recursive: true, force: true })
var file = 'native-v1.0.0-napi-v1-' + process.platform + '-' + process.arch + '.tar.gz'
var prebuild = path.join(cwd, 'prebuilds', file)
exec('npm run prebuild-prepack', { cwd: cwd }, function (error, stdout, stderr) {
Expand Down
3 changes: 1 addition & 2 deletions test/pack-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var test = require('tape')
var fs = require('fs')
var rmrf = require('rimraf')
var path = require('path')
var pack = require('../pack')
var zlib = require('zlib')
Expand All @@ -17,7 +16,7 @@ test('missing file calls back with error', function (t) {

test('resulting file is a gzipped tar archive', function (t) {
t.plan(17)
rmrf.sync(output)
fs.rmSync(output, { recursive: true, force: true })

t.equal(fs.existsSync(output), false, 'no output folder')

Expand Down

0 comments on commit 571867c

Please sign in to comment.