Skip to content

Commit ff6f642

Browse files
committed
fix EEXIST error when rebuilding mirage sources
1 parent 42e6a20 commit ff6f642

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/incremental-typescript-compiler.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ module.exports = class IncrementalTypescriptCompiler {
5050
});
5151

5252
let triggerTree = new Funnel(this._triggerDir, { destDir: 'app' });
53-
let sourceDirectories = {
54-
[`${this._relativeAppRoot()}/app`]: 'app',
55-
};
5653

57-
this._maybeIncludeMirage(sourceDirectories);
54+
let appTree = new TypescriptOutput(this, {
55+
[`${this._relativeAppRoot()}/app`]: 'app',
56+
});
5857

59-
let appTree = new TypescriptOutput(this, sourceDirectories);
58+
let mirage = this._mirageDirectory();
59+
let mirageTree = mirage && new TypescriptOutput(this, {
60+
[mirage]: 'app/mirage',
61+
});
6062

61-
let tree = new MergeTrees(addonAppTrees.concat([triggerTree, appTree]), { overwrite: true });
63+
let tree = new MergeTrees(addonAppTrees.concat([triggerTree, appTree, mirageTree].filter(Boolean)), { overwrite: true });
6264
return new Funnel(tree, { srcDir: 'app' });
6365
}
6466

@@ -162,7 +164,7 @@ module.exports = class IncrementalTypescriptCompiler {
162164
this._buildDeferred.resolve();
163165
}
164166

165-
_maybeIncludeMirage(sourceDirectories) {
167+
_mirageDirectory() {
166168
let mirage = this.project.addons.find(addon => addon.name === 'ember-cli-mirage');
167169
if (mirage) {
168170
// Be a little defensive, since we're using an internal Mirage API
@@ -182,7 +184,7 @@ module.exports = class IncrementalTypescriptCompiler {
182184
if (source.indexOf(this.project.root) === 0) {
183185
source = source.substring(this.project.root.length + 1);
184186
}
185-
sourceDirectories[source] = 'app/mirage';
187+
return source;
186188
}
187189
}
188190
}

0 commit comments

Comments
 (0)