diff --git a/.eslintrc.json b/.eslintrc.json index 4947d302a..7bfc0ac19 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -43,7 +43,12 @@ { "files": ["**/*.ts"], "extends": ["@malept/eslint-config/src/typescript"], + "parserOptions": { + "project": ["./tsconfig.base.json"] + }, "rules": { + "no-throw-literal": "off", + "@typescript-eslint/no-throw-literal": "error", "@typescript-eslint/no-unused-vars": [ "error", { diff --git a/packages/api/cli/src/util/terminate.ts b/packages/api/cli/src/util/terminate.ts index b7c97327f..142f6bc19 100644 --- a/packages/api/cli/src/util/terminate.ts +++ b/packages/api/cli/src/util/terminate.ts @@ -7,7 +7,6 @@ function redConsoleError(msg: string) { process.on('unhandledRejection', (reason: string, promise: Promise) => { redConsoleError('\nAn unhandled rejection has occurred inside Forge:'); redConsoleError(reason.toString().trim()); - redConsoleError('\nElectron Forge was terminated. Location:'); promise.catch((err: Error) => { if ('stack' in err) { const usefulStack = err.stack; diff --git a/packages/api/core/src/api/make.ts b/packages/api/core/src/api/make.ts index d967ca6a9..f8415f1ee 100644 --- a/packages/api/core/src/api/make.ts +++ b/packages/api/core/src/api/make.ts @@ -282,15 +282,10 @@ export const listrMake = ( arch: targetArch, }); } catch (err) { - if (err instanceof Error) { - throw { - message: `An error occured while making for target: ${maker.name}`, - stack: `${err.message}\n${err.stack}`, - }; - } else if (err) { + if (err) { throw err; } else { - throw new Error(`An unknown error occured while making for target: ${maker.name}`); + throw new Error(`An unknown error occurred while making for target: ${maker.name}`); } } }, diff --git a/packages/api/core/src/util/resolve-dir.ts b/packages/api/core/src/util/resolve-dir.ts index c2192d2f9..f023a5ec0 100644 --- a/packages/api/core/src/util/resolve-dir.ts +++ b/packages/api/core/src/util/resolve-dir.ts @@ -53,7 +53,7 @@ export default async (dir: string): Promise => { return bestGuessDir; } if (lastError) { - throw lastError; + throw new Error(lastError); } return null; }; diff --git a/tools/gen-tsconfigs.ts b/tools/gen-tsconfigs.ts index ee24eeeef..2c9c67b44 100644 --- a/tools/gen-tsconfigs.ts +++ b/tools/gen-tsconfigs.ts @@ -3,25 +3,6 @@ import * as path from 'path'; import { getPackageInfo } from './utils'; -const BASE_TS_CONFIG = { - '//': '⚠️ AUTOGENERATED ⚠️ This file was automatically generated by tools/gen-tsconfigs.ts, do not edit manually.', - compilerOptions: { - module: 'commonjs', - target: 'es2019', - outDir: 'dist', - lib: ['dom', 'es2019'], - sourceMap: true, - rootDir: 'src', - experimentalDecorators: true, - strict: true, - esModuleInterop: true, - declaration: true, - composite: true, - declarationMap: true, - }, - exclude: ['node_modules', 'dist', 'test', 'index.ts', 'tmpl'], -}; - /** * Filters out non-unique items in an array. */ @@ -30,6 +11,7 @@ function filterDupes(arr: readonly T[]): T[] { } (async () => { + const BASE_TS_CONFIG = JSON.parse(await fs.readFile(path.resolve(__dirname, '../tsconfig.base.json'), 'utf-8')); const packages = await getPackageInfo(); // Do each package in parallel diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 000000000..8257a5301 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2019", + "outDir": "dist", + "lib": ["dom", "es2019"], + "sourceMap": true, + "rootDir": "src", + "experimentalDecorators": true, + "strict": true, + "esModuleInterop": true, + "declaration": true, + "composite": true, + "declarationMap": true + }, + "exclude": ["node_modules", "dist", "test", "index.ts", "tmpl"] +}