Skip to content

Commit a697c4e

Browse files
committed
Use console-ui for TS diagnostics
1 parent 4510b0a commit a697c4e

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ module.exports = {
2424
}
2525

2626
try {
27-
registry.add('js', new TsPreprocessor());
27+
registry.add('js', new TsPreprocessor({
28+
ui: this.ui
29+
}));
2830
} catch (ex) {
2931
this.ui.write(
3032
'Missing or invalid tsconfig.json, please fix or run `ember generate ember-cli-typescript`.'

lib/typescript-preprocessor.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
const fs = require('fs');
33
const path = require('path');
44

5-
const debug = require('debug')('ember-cli-typescript');
65
const funnel = require('broccoli-funnel');
76
const mergeTrees = require('broccoli-merge-trees');
8-
const tsc = require('broccoli-typescript-compiler').typescript;
7+
const TypeScriptPlugin = require('broccoli-typescript-compiler').TypeScriptPlugin;
98

109
const BroccoliDebug = require('broccoli-debug');
1110

@@ -16,6 +15,7 @@ class TypeScriptPreprocessor {
1615
this.name = 'ember-cli-typescript';
1716
this._tag = tag++;
1817
this.ext = 'ts';
18+
this.ui = options.ui;
1919

2020
// Update the config for how Broccoli handles the file system: no need for
2121
// includes, always emit, and let Broccoli manage any outDir.
@@ -42,13 +42,16 @@ class TypeScriptPreprocessor {
4242
`${this._tag}`
4343
);
4444

45+
const tsc = new TypeScriptPlugin(uncompiledTs, {
46+
throwOnError: this.config.compilerOptions.noEmitOnError,
47+
annotation: 'Compiled TS files',
48+
include: ['**/*'],
49+
tsconfig: this.config,
50+
});
51+
tsc.setDiagnosticWriter(this.ui.writeWarnLine.bind(this.ui));
52+
4553
const ts = debugTree(
46-
tsc(uncompiledTs, {
47-
throwOnError: this.config.compilerOptions.noEmitOnError,
48-
annotation: 'Compiled TS files',
49-
include: ['**/*'],
50-
tsconfig: this.config,
51-
}),
54+
tsc,
5255
`${this._tag}`
5356
);
5457

0 commit comments

Comments
 (0)