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

[package-extractor] Fix package extractor filter for subdirectories of non-matching folders #4217

Merged
merged 2 commits into from
Jun 26, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/package-extractor",
"comment": "Fix patternsToInclude and patternsToExclude filters when provided patterns target subdirectories of folders that do not match the provided patterns",
"type": "patch"
}
],
"packageName": "@rushstack/package-extractor"
}
10 changes: 6 additions & 4 deletions libraries/package-extractor/src/PackageExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,18 @@ export class PackageExtractor {
queue,
async ([sourcePath, callback]: [string, () => void]) => {
const relativeSourcePath: string = path.relative(sourceFolderPath, sourcePath);
if (
relativeSourcePath !== '' &&
(ignoreFilter.ignores(relativeSourcePath) || isFileExcluded(relativeSourcePath))
) {
if (relativeSourcePath !== '' && ignoreFilter.ignores(relativeSourcePath)) {
callback();
return;
}

const sourcePathNode: PathNode = await state.symlinkAnalyzer.analyzePathAsync(sourcePath);
if (sourcePathNode.kind === 'file') {
if (relativeSourcePath !== '' && isFileExcluded(relativeSourcePath)) {
callback();
return;
}

const targetPath: string = path.join(targetFolderPath, relativeSourcePath);
if (!options.createArchiveOnly) {
// Manually call fs.copyFile to avoid unnecessary stat calls.
Expand Down