diff --git a/src/aquire-installers.ts b/src/aquire-installers.ts index 0a90d1a..78f0a1c 100644 --- a/src/aquire-installers.ts +++ b/src/aquire-installers.ts @@ -1,7 +1,11 @@ +import chalk from 'chalk'; + import { OFFLINE_PATH } from './constants'; import { download } from './download'; +import { log } from './logging'; import { copyInstallers } from './offline'; + /** * Aquire the installers, either by copying them from * their offline location or by downloading them. @@ -10,11 +14,26 @@ import { copyInstallers } from './offline'; * @returns {Promise.void} */ export async function aquireInstallers(cb: () => void): Promise { + const handleFailure = (error: Error) => { + log(chalk.bold.red(`Downloading installers failed. Error:`), error); + log(chalk.bold.red(`windows-build-tools will now exit.`)); + + process.exit(1); + }; + if (OFFLINE_PATH) { - await copyInstallers(); + try { + await copyInstallers(); - cb(); + cb(); + } catch (error) { + handleFailure(error); + } } else { - download(cb); + try { + await download(cb); + } catch (error) { + handleFailure(error); + } } } diff --git a/tsconfig.json b/tsconfig.json index 6c03d2d..7322819 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "module": "commonjs", "moduleResolution": "node", "sourceMap": true, - "outDir": "dist", "baseUrl": ".", "paths": { "*" : ["./node_modules/@types/*", "*"] diff --git a/tslint.json b/tslint.json index 118f58f..e95536c 100644 --- a/tslint.json +++ b/tslint.json @@ -92,9 +92,7 @@ "single", "avoid-escape" ], - "max-classes-per-file": [ - false - ], + "max-classes-per-file": false, "semicolon": [ true, "always"