Skip to content

Commit 309a89d

Browse files
committed
Ensure ember-try directories are propertly excluded from watching
1 parent 19b03e7 commit 309a89d

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

ember-cli-build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
44

55
module.exports = function(defaults) {
66
let app = new EmberAddon(defaults, {
7-
// Add options here
7+
babel: {
8+
sourceMaps: 'inline'
9+
}
810
});
911

1012
/*

lib/utilities/compile.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,24 @@ module.exports = function compile(project, tsOptions, callbacks) {
1616
noEmit: false
1717
}, tsOptions);
1818

19+
let configPath = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
20+
let createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
21+
let host = ts.createWatchCompilerHost(
22+
configPath,
23+
fullOptions,
24+
buildWatchHooks(ts.sys),
25+
createProgram,
26+
callbacks.reportDiagnostic,
27+
callbacks.reportWatchStatus
28+
);
29+
30+
return ts.createWatchProgram(host);
31+
};
32+
33+
function buildWatchHooks(sys) {
1934
let watchedFiles = new Map();
20-
let sys = Object.assign({}, ts.sys, {
35+
36+
return Object.assign({}, sys, {
2137
watchFile(file, callback) {
2238
watchedFiles.set(file, callback);
2339

@@ -31,27 +47,19 @@ module.exports = function compile(project, tsOptions, callbacks) {
3147
watchDirectory(dir, callback) {
3248
if (!fs.existsSync(dir)) return;
3349

34-
let ignored = /\.\w+\/|dist\/|node_modules\/|tmp\//;
50+
let ignored = /\/(\..*?|dist|node_modules|tmp)\//;
3551
let watcher = chokidar.watch(dir, { ignored });
3652

37-
let invoke = (type, path) => {
53+
watcher.on('all', (type, path) => {
3854
path = path.replace(/\\/g, '/'); // Normalize Windows
3955
if (type === 'add') {
4056
callback(path);
4157
} else if (watchedFiles.has(path)) {
4258
watchedFiles.get(path)(path, type === 'change' ? 1 : 2);
4359
}
44-
};
45-
46-
watcher.on('all', invoke);
60+
});
4761

4862
return watcher;
4963
}
5064
});
51-
52-
let configPath = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
53-
let createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
54-
let host = ts.createWatchCompilerHost(configPath, fullOptions, sys, createProgram, callbacks.reportDiagnostic, callbacks.reportWatchStatus);
55-
56-
return ts.createWatchProgram(host);
57-
};
65+
}

tests/dummy/app/controllers/application.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import Ember from 'ember';
33
export default Ember.Controller.extend({
44
// Just a very roundabout way of using some ES6 features
55
value: ((test = 'Test') => `${test} ${'Value'}`)(),
6+
foo: 'hello'
67
});

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"allowJs": false,
55
"moduleResolution": "node",
66
"noEmitOnError": true,
7+
"inlineSourceMap": true,
8+
"inlineSources": true,
79
"baseUrl": ".",
810
"paths": {
911
"dummy/tests/*": ["tests/*"],

0 commit comments

Comments
 (0)