Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove cp-file module #1230

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/* global __coverage__ */

const cachingTransform = require('caching-transform')
const cpFile = require('cp-file')
const findCacheDir = require('find-cache-dir')
const fs = require('./lib/fs-promises')
const os = require('os')
Expand Down Expand Up @@ -225,13 +224,23 @@ class NYC {

const concurrency = output ? os.cpus().length : 1
if (this.config.completeCopy && output) {
const files = await glob(path.resolve(input, '**'), {
dot: true,
nodir: true,
ignore: ['**/.git', '**/.git/**', path.join(output, '**')]
})
const destDirs = new Set(
files.map(src => path.dirname(path.join(output, path.relative(input, src))))
)

await pMap(
destDirs,
dir => mkdirp(dir),
{ concurrency }
)
await pMap(
await glob(path.resolve(input, '**'), {
dot: true,
nodir: true,
ignore: ['**/.git', '**/.git/**', path.join(output, '**')]
}),
src => cpFile(src, path.join(output, path.relative(input, src))),
files,
src => fs.copyFile(src, path.join(output, path.relative(input, src))),
{ concurrency }
)
}
Expand Down
35 changes: 2 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"@istanbuljs/schema": "^0.1.1",
"caching-transform": "^4.0.0",
"convert-source-map": "^1.7.0",
"cp-file": "^7.0.0",
"decamelize": "^1.2.0",
"find-cache-dir": "=3.0.0",
"find-up": "^4.1.0",
Expand Down Expand Up @@ -96,7 +95,7 @@
"which": "^2.0.1"
},
"engines": {
"node": ">=8"
"node": ">=8.9"
},
"homepage": "https://istanbul.js.org/",
"repository": {
Expand Down
3 changes: 1 addition & 2 deletions test/instrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const { promisify } = require('util')

const t = require('tap')
const makeDir = require('make-dir')
const cpFile = require('cp-file')
const isWindows = require('is-windows')()
const rimraf = promisify(require('rimraf'))

Expand Down Expand Up @@ -243,7 +242,7 @@ t.test('can write files in place with --in-place switch', async t => {
const sourceDir = path.resolve(fixturesCLI, 'instrument-inplace')
await makeDir(outputDir)
await Promise.all(['package.json', 'file1.js', 'file2.js'].map(
file => cpFile(path.join(sourceDir, file), path.join(outputDir, file))
file => fs.copyFile(path.join(sourceDir, file), path.join(outputDir, file))
))

const { status } = await runNYC({
Expand Down