-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove external-dependency rimraf
- Loading branch information
Showing
7 changed files
with
63 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = function (dir, cb, platform) { | ||
/* | ||
* this function will async 'rm -rf' <dir> using platform's native rm/rd command | ||
*/ | ||
// win32 | ||
if ((platform || process.platform) === 'win32') { | ||
require('child_process').spawn(( | ||
'rd /s /q ' + JSON.stringify(require('path').normalize(dir)) | ||
), { | ||
// in win32, 'rd' is bultin-shell-command that cannot run outside shell | ||
shell: true, | ||
stdio: 'ignore' | ||
}).on('error', cb).on('exit', cb.bind(undefined, undefined)) | ||
return | ||
} | ||
// posix | ||
require('child_process').spawn('rm', ['-rf', dir], { | ||
stdio: 'ignore' | ||
}).on('error', cb).on('exit', cb.bind(undefined, undefined)) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* global describe, it */ | ||
|
||
const rmrf = require('../lib/rmrf') | ||
|
||
describe('rmrf', () => { | ||
/* | ||
* dummy test to mock rmrf in win32 and posix for code-coverage-completion | ||
*/ | ||
it('rmrf in win32', (done) => { | ||
rmrf('undefined', done.bind(undefined, undefined), 'win32') | ||
}) | ||
it('rmrf in posix', (done) => { | ||
rmrf('undefined', done.bind(undefined, undefined), 'linux') | ||
}) | ||
}) |