Skip to content

Commit

Permalink
Update release
Browse files Browse the repository at this point in the history
  • Loading branch information
ivogabe committed Dec 30, 2017
1 parent 2c160e2 commit 67d8963
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions release/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var ProjectCompiler = /** @class */ (function () {
ProjectCompiler.prototype.inputDone = function () {
var _this = this;
if (!this.project.input.firstSourceFile) {
this.project.output.finish(reporter_1.emptyCompilationResult());
this.project.output.finish(reporter_1.emptyCompilationResult(this.project.options.noEmit));
return;
}
var rootFilenames = this.project.input.getFileNames(true);
Expand All @@ -36,7 +36,7 @@ var ProjectCompiler = /** @class */ (function () {
var currentDirectory = utils.getCommonBasePathOfArray(rootFilenames.map(function (fileName) { return _this.project.input.getFile(fileName).gulp.cwd; }));
this.host = new host_1.Host(this.project.typescript, currentDirectory, this.project.input, this.project.options);
this.program = this.project.typescript.createProgram(rootFilenames, this.project.options, this.host, this.program);
var result = reporter_1.emptyCompilationResult();
var result = reporter_1.emptyCompilationResult(this.project.options.noEmit);
result.optionsErrors = this.reportDiagnostics(this.program.getOptionsDiagnostics());
result.syntaxErrors = this.reportDiagnostics(this.program.getSyntacticDiagnostics());
result.globalErrors = this.reportDiagnostics(this.program.getGlobalDiagnostics());
Expand Down Expand Up @@ -165,7 +165,7 @@ var FileCompiler = /** @class */ (function () {
FileCompiler.prototype.prepare = function (project) {
this.project = project;
this.project.input.noParse = true;
this.compilationResult = reporter_1.emptyCompilationResult();
this.compilationResult = reporter_1.emptyCompilationResult(this.project.options.noEmit);
};
FileCompiler.prototype.write = function (file, fileName, diagnostics, content, sourceMap) {
this.output[file.fileNameNormalized] = { fileName: fileName, diagnostics: diagnostics, content: content, sourceMap: sourceMap };
Expand Down
3 changes: 2 additions & 1 deletion release/reporter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ export interface CompilationResult {
semanticErrors: number;
declarationErrors: number;
emitErrors: number;
noEmit: boolean;
emitSkipped: boolean;
}
export declare function emptyCompilationResult(): CompilationResult;
export declare function emptyCompilationResult(noEmit: boolean): CompilationResult;
export interface Reporter {
error?: (error: TypeScriptError, typescript: typeof ts) => void;
finish?: (results: CompilationResult) => void;
Expand Down
15 changes: 9 additions & 6 deletions release/reporter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var colors = require("ansi-colors");
function emptyCompilationResult() {
function emptyCompilationResult(noEmit) {
return {
transpileErrors: 0,
optionsErrors: 0,
Expand All @@ -10,6 +10,7 @@ function emptyCompilationResult() {
semanticErrors: 0,
declarationErrors: 0,
emitErrors: 0,
noEmit: noEmit,
emitSkipped: false
};
}
Expand All @@ -29,11 +30,13 @@ function defaultFinishHandler(results) {
showErrorCount(results.semanticErrors, 'semantic');
showErrorCount(results.declarationErrors, 'declaration');
showErrorCount(results.emitErrors, 'emit');
if (results.emitSkipped) {
console.log('TypeScript: emit', colors.red('failed'));
}
else if (hasError) {
console.log('TypeScript: emit', colors.cyan('succeeded'), '(with errors)');
if (!results.noEmit) {
if (results.emitSkipped) {
console.log('TypeScript: emit', colors.red('failed'));
}
else if (hasError) {
console.log('TypeScript: emit', colors.cyan('succeeded'), '(with errors)');
}
}
}
function nullReporter() {
Expand Down

0 comments on commit 67d8963

Please sign in to comment.