From 0fc93d9b00a763f1260ee9362c56fa0496ee669c Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Tue, 24 Sep 2019 13:35:38 -0400 Subject: [PATCH] chore: Create npm-run-clean.js script (#1177) This allows use of globs without risk of shell interference, makes it easier to read the list of delete targets. --- npm-run-clean.js | 19 +++++++++++++++++++ package.json | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 npm-run-clean.js diff --git a/npm-run-clean.js b/npm-run-clean.js new file mode 100644 index 000000000..589dac3eb --- /dev/null +++ b/npm-run-clean.js @@ -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 }))) diff --git a/package.json b/package.json index e348aea7b..e0d96732a 100644 --- a/package.json +++ b/package.json @@ -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"