From 1d1e63a329fb11a6381e45a82105b5b6fcf36e57 Mon Sep 17 00:00:00 2001 From: Adam Lippai Date: Sat, 3 Nov 2018 11:14:31 +0100 Subject: [PATCH] Prevent emit upon errors --- build.js | 10 ++++++++-- tsconfig.json | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/build.js b/build.js index f16e3a9..39becb4 100644 --- a/build.js +++ b/build.js @@ -19,8 +19,14 @@ import * as rollup from 'rollup'; const program_es5 = ts.createProgram(['src/entry-export_all.ts'], options_es5.options); const program_es8 = ts.createProgram(['src/entry-export_all.ts'], options_es8.options); - program_es5.emit(); - program_es8.emit(); + const result_es5 = program_es5.emit(); + if (result_es5.emitSkipped) { + throw new Error(result_es5.diagnostics[0].messageText); + } + const result_es8 = program_es8.emit(); + if (result_es8.emitSkipped) { + throw new Error(result_es8.diagnostics[0].messageText); + } // Copy non-ts resources await fs.copy('src/aes/aes.asm.js', 'dist_es5/aes/aes.asm.js'); diff --git a/tsconfig.json b/tsconfig.json index 4b6424b..18e789e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "target": "es2017", "lib": ["es5", "dom", "dom.iterable", "es6"], "noEmit": false, + "noEmitOnError": true, "strict": true, "sourceMap": false, "declaration": true,