Skip to content

Commit

Permalink
Fix for #50792 npm exclude doesn´t work for folder names
Browse files Browse the repository at this point in the history
  • Loading branch information
egamma committed May 30, 2018
1 parent 9ab6f34 commit 6a62a94
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions extensions/npm/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getPrePostScripts(scripts: any): Set<string> {
const script = keys[i];
const prepost = ['pre' + script, 'post' + script];
prepost.forEach(each => {
if (scripts[each] !== undefined) {
if (scripts[each]) {
prePostScripts.add(each);
}
});
Expand Down Expand Up @@ -142,15 +142,16 @@ function isExcluded(folder: WorkspaceFolder, packageJsonUri: Uri) {
}

let exclude = workspace.getConfiguration('npm', folder.uri).get<string | string[]>('exclude');
let packageJsonFolder = path.dirname(packageJsonUri.fsPath);

if (exclude) {
if (Array.isArray(exclude)) {
for (let pattern of exclude) {
if (testForExclusionPattern(packageJsonUri.fsPath, pattern)) {
if (testForExclusionPattern(packageJsonFolder, pattern)) {
return true;
}
}
} else if (testForExclusionPattern(packageJsonUri.fsPath, exclude)) {
} else if (testForExclusionPattern(packageJsonFolder, exclude)) {
return true;
}
}
Expand Down

0 comments on commit 6a62a94

Please sign in to comment.