Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Test if entries are directories before mandatorily including them #10445

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions lib/utils/tar.js
Expand Up @@ -62,17 +62,19 @@ function BundledPacker (props) {
inherits(BundledPacker, Packer)

BundledPacker.prototype.applyIgnores = function (entry, partial, entryObj) {
// package.json files can never be ignored.
if (entry === 'package.json') return true
if (!entryObj || entryObj.type !== 'Directory') {
// package.json files can never be ignored.
if (entry === 'package.json') return true

// readme files should never be ignored.
if (entry.match(/^readme(\.[^\.]*)$/i)) return true
// readme files should never be ignored.
if (entry.match(/^readme(\.[^\.]*)$/i)) return true

// license files should never be ignored.
if (entry.match(/^(license|licence)(\.[^\.]*)?$/i)) return true
// license files should never be ignored.
if (entry.match(/^(license|licence)(\.[^\.]*)?$/i)) return true

// changelogs should never be ignored.
if (entry.match(/^(changes|changelog|history)(\.[^\.]*)?$/i)) return true
// changelogs should never be ignored.
if (entry.match(/^(changes|changelog|history)(\.[^\.]*)?$/i)) return true
}

// special rules. see below.
if (entry === 'node_modules' && this.packageRoot) return true
Expand Down