Skip to content

Commit

Permalink
chore: Create npm-run-clean.js script (#1177)
Browse files Browse the repository at this point in the history
This allows use of globs without risk of shell interference, makes it
easier to read the list of delete targets.
  • Loading branch information
coreyfarrell authored Sep 24, 2019
1 parent b59fc8f commit 0fc93d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions npm-run-clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env node
'use strict'

const { promisify } = require('util')
const rimraf = promisify(require('rimraf'))

Promise.all([
'**/.nyc_output',
'node_modules/.cache',
'.self_coverage',
'test/**/.cache',
'test/fixtures/cli/coverage',
'test/fixtures/cli/fakebin/node',
'test/fixtures/cli/fakebin/npm',
'test/fixtures/cli/foo-cache',
'test/fixtures/cli/nyc-config-js/node_modules',
'test/temp-dir-*',
'self-coverage'
].map(f => rimraf(f, { cwd: __dirname })))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "tap",
"snap": "npm test -- --snapshot",
"posttest": "npm run report",
"clean": "rimraf ./.nyc_output ./node_modules/.cache ./.self_coverage ./test/fixtures/.nyc_output ./test/fixtures/node_modules/.cache ./test/fixtures/cli/foo-cache ./test/temp-dir-* ./self-coverage",
"clean": "node ./npm-run-clean.js",
"instrument": "node ./build-self-coverage.js",
"report": "node ./bin/nyc report --temp-dir ./.self_coverage/ -r text -r lcov",
"release": "standard-version"
Expand Down

0 comments on commit 0fc93d9

Please sign in to comment.