Skip to content

Commit 438fd7a

Browse files
authored
Merge eb8e139 into 8d3379a
2 parents 8d3379a + eb8e139 commit 438fd7a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/cmd/build.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function defaultPackageCreator(
5252

5353
export default function build(
5454
{sourceDir, artifactsDir, asNeeded=false}: Object,
55-
{manifestData, fileFilter=new FileFilter(),
55+
{manifestData, fileFilter=new FileFilter({filePathsToIgnore: [path.resolve(artifactsDir)]}),
5656
onSourceChange=defaultSourceWatcher,
5757
packageCreator=defaultPackageCreator}
5858
: Object = {}): Promise {
@@ -95,14 +95,16 @@ export function safeFileName(name: string): string {
9595
*/
9696
export class FileFilter {
9797
filesToIgnore: Array<string>;
98-
99-
constructor({filesToIgnore}: Object = {}) {
98+
filePathsToIgnore : Array<String>;
99+
constructor({filesToIgnore,filePathsToIgnore}: Object = {}) {
100100
this.filesToIgnore = filesToIgnore || [
101101
'**/*.xpi',
102102
'**/*.zip',
103103
'**/.*', // any hidden file
104-
'**/node_modules',
104+
'**/node_modules',
105105
];
106+
107+
this.filePathsToIgnore = filePathsToIgnore;
106108
}
107109

108110
/*
@@ -118,6 +120,13 @@ export class FileFilter {
118120
return false;
119121
}
120122
}
123+
for (const filePath of this.filePathsToIgnore) {
124+
if (filePath === path){
125+
log.debug(`FileFilter: ignoring file ${path}`);
126+
return false;
127+
}
128+
}
121129
return true;
122-
}
130+
}
131+
123132
}

src/watcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function onSourceChange(
3333
export function proxyFileChanges(
3434
{artifactsDir, onChange, filePath, shouldWatchFile}: Object) {
3535
if (!shouldWatchFile) {
36-
const fileFilter = new FileFilter();
36+
const fileFilter = new FileFilter({filePathsToIgnore: [path.resolve(artifactsDir)]});
3737
shouldWatchFile = (...args) => fileFilter.wantFile(...args);
3838
}
3939
if (filePath.indexOf(artifactsDir) === 0 || !shouldWatchFile(filePath)) {

0 commit comments

Comments
 (0)