Skip to content

Commit

Permalink
fix(copy-filter): add package manager lockfiles to default ignore (#1182
Browse files Browse the repository at this point in the history
)

Co-authored-by: Eddy Brown <[email protected]>
Co-authored-by: Mark Lee <[email protected]>
  • Loading branch information
3 people authored Oct 9, 2020
1 parent 6433299 commit f1c159f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package-lock.json
yarn.lock
test/fixtures/basic/main-link.js
!test/fixtures/prune-is-module/node_modules
!test/fixtures/ignore-package-lock/*
test/work
typedoc
.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions src/copy-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const prune = require('./prune')
const targets = require('./targets')

const DEFAULT_IGNORES = [
'/package-lock\\.json$',
'/yarn\\.lock$',
'/\\.git($|/)',
'/node_modules/\\.bin($|/)',
'\\.o(bj)?$'
Expand Down
6 changes: 6 additions & 0 deletions test/copy-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ test('generateIgnoredOutDirs ignores all possible platform/arch permutations', (

test('ignore default: .o files', util.testSinglePlatform(ignoreTest, null, 'ignore.o'))
test('ignore default: .obj files', util.testSinglePlatform(ignoreTest, null, 'ignore.obj'))
test('ignore default: package manager lock files', util.testSinglePlatform(async (t, opts) => {
opts.dir = util.fixtureSubdir('ignore-package-lock')
const targetDir = await copyDirToTempDirWithIgnores(t, opts)
await assertFileIgnored(t, targetDir, 'package-lock.json')
await assertFileIgnored(t, targetDir, 'yarn.lock')
}))
test('ignore: string in array', util.testSinglePlatform(ignoreTest, ['ignorethis'], 'ignorethis.txt'))
test('ignore: string', util.testSinglePlatform(ignoreTest, 'ignorethis', 'ignorethis.txt'))
test('ignore: RegExp', util.testSinglePlatform(ignoreTest, /ignorethis/, 'ignorethis.txt'))
Expand Down
Empty file.
Empty file.

0 comments on commit f1c159f

Please sign in to comment.