diff --git a/build-utils.js b/build-utils.js index dba6eb33..76558b10 100644 --- a/build-utils.js +++ b/build-utils.js @@ -1,5 +1,7 @@ -const dotenv = require('dotenv'); +const dotenv = require("dotenv"); const path = require("path"); +const childProcess = require("child_process"); +const fs = require("fs"); function defineEnvVars() { dotenv.config({ path: '.env.local' }); @@ -32,8 +34,11 @@ module.exports.defineEnvVars = defineEnvVars; * @param globalName {string|undefined} the name of the global to define in the output IIFE * @param entryPoint {string} the entrypoint path, as an absolute path * @param outFile {string} the output file path, as a path relative to the root of the repository + * @param tsConfigDir {string?} the directory containing the tsconfig.json file to use, optionally + * + * @returns {import('esbuild').BuildOptions} */ -function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile) { +function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile, tsConfigDir) { const isProductionBuild = process.env.A32NX_PRODUCTION_BUILD === '1'; process.chdir(projectRoot); @@ -43,6 +48,12 @@ function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile) { define: { DEBUG: 'false', ...defineEnvVars() }, + plugins: [ + typecheckingPlugin(), + ], + + tsconfig: tsConfigDir !== undefined ? path.join(tsConfigDir, 'tsconfig.json') : undefined, + entryPoints: [entryPoint], bundle: true, treeShaking: false, @@ -60,4 +71,75 @@ function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile) { }; } -module.exports.esbuildModuleBuild = esbuildModuleBuild; \ No newline at end of file +module.exports.createModuleBuild = esbuildModuleBuild; + +/** + * Returns an esbuild plugin which runs `tsc` typechecking + * + * @returns {import('esbuild').Plugin} + */ +function typecheckingPlugin() { + return { + name: 'typecheck', + /** + * @param build {import('esbuild').PluginBuild} + */ + setup(build) { + build.onStart(() => { + if (!(process.env.FBW_TYPECHECK === '1' || process.env.FBW_TYPECHECK?.toLowerCase() === 'true')) { + return; + } + + const { entryPoints } = build.initialOptions; + const entryPointDir = path.dirname(entryPoints[0]); + + const tsConfigInEntryPointDir = fs.existsSync(path.join(entryPointDir, 'tsconfig.json')); + + let tsConfigDir; + if (tsConfigInEntryPointDir) { + tsConfigDir = entryPointDir; + } else if (build.initialOptions.tsconfig !== undefined) { + tsConfigDir = path.dirname(build.initialOptions.tsconfig); + } + + if (tsConfigDir === undefined) { + throw new Error(`Cannot run typechecking: no tsconfig.json file found in '${entryPointDir}' and tsconfig path not specified`); + } + + /** + * @type {import('esbuild').PartialMessage[]} + */ + const errors = [] + + try { + childProcess.execSync('npx tsc --noEmit -p .', { cwd: tsConfigDir }); + } catch (e) { + if (!('stdout' in e) || !e.stdout) { + throw e; + } + + const tscErrors = e.stdout.toString().split('\n').filter((err) => err.trim() !== ''); + + errors.push(...tscErrors.map((err) => { + const match = /(.+)\((\d+),(\d+)\):\s+(.+)/.exec(err.trim()); + + if (match) { + const [, file, line, column, text] = match; + + const filePath = path.resolve(tsConfigDir, file); + const lineText = fs.readFileSync(filePath).toString().split('\n')[line - 1]; + + return { text, location: { file, line: parseInt(line), column: parseInt(column) - 1, lineText } } + } else { + return { text: err }; + } + })); + } + + return { errors }; + }) + } + } +} + +module.exports.typecheckingPlugin = typecheckingPlugin; \ No newline at end of file diff --git a/hsim-a21n-common/src/systems/tsconfig.json b/hsim-a21n-common/src/systems/tsconfig.json index 1d19f251..6ba5e014 100644 --- a/hsim-a21n-common/src/systems/tsconfig.json +++ b/hsim-a21n-common/src/systems/tsconfig.json @@ -1,15 +1,15 @@ { "compilerOptions": { - "target": "ESNext", + "target": "ES2017", "baseUrl": ".", "resolveJsonModule" : true, "typeRoots": [ - "../typings", - "../../../node_modules/@types" + "../typings" ], "moduleResolution": "node", "allowSyntheticDefaultImports": true, "jsx": "react", + "skipLibCheck": true, "paths": { "@datalink/aoc": ["datalink/aoc/src/index.ts"], "@datalink/atc": ["datalink/atc/src/index.ts"], @@ -20,5 +20,5 @@ "@typings/*": ["../typings/*"], "@flybywiresim/fbw-sdk": ["./index.ts"] } - }, + } } \ No newline at end of file diff --git a/hsim-a318-common/src/systems/tsconfig.json b/hsim-a318-common/src/systems/tsconfig.json index 3887e778..8783fed5 100644 --- a/hsim-a318-common/src/systems/tsconfig.json +++ b/hsim-a318-common/src/systems/tsconfig.json @@ -1,15 +1,15 @@ { "compilerOptions": { - "target": "ESNext", + "target": "ES2017", "baseUrl": ".", "resolveJsonModule" : true, "typeRoots": [ - "../typings", - "../../../node_modules/@types" + "../typings" ], "moduleResolution": "node", "allowSyntheticDefaultImports": true, "jsx": "react", + "skipLibCheck": true, "paths": { "@datalink/aoc": ["datalink/aoc/src/index.ts"], "@datalink/atc": ["datalink/atc/src/index.ts"], @@ -20,5 +20,5 @@ "@typings/*": ["../typings/*"], "@flybywiresim/fbw-sdk": ["./index.ts"] } - }, + } } \ No newline at end of file diff --git a/hsim-a318ceo/mach.config.js b/hsim-a318ceo/mach.config.js index 79b4b38e..40ff7956 100644 --- a/hsim-a318ceo/mach.config.js +++ b/hsim-a318ceo/mach.config.js @@ -3,6 +3,9 @@ const postCssPlugin = require('esbuild-style-plugin'); const tailwind = require('tailwindcss'); const postCssColorFunctionalNotation = require('postcss-color-functional-notation'); const postCssInset = require('postcss-inset'); +const { typecheckingPlugin } = require("#build-utils"); + +// process.env.FBW_TYPECHECK = "1"; /** @type { import('@synaptic-simulations/mach').MachConfig } */ module.exports = { @@ -24,6 +27,7 @@ module.exports = { ], } }), + typecheckingPlugin(), ], instruments: [ msfsAvionicsInstrument('PFD'), diff --git a/hsim-a318ceo/src/systems/atsu/common/build.js b/hsim-a318ceo/src/systems/atsu/common/build.js index 61ac483a..6602d70d 100644 --- a/hsim-a318ceo/src/systems/atsu/common/build.js +++ b/hsim-a318ceo/src/systems/atsu/common/build.js @@ -2,9 +2,10 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); -const rootDir = path.join(__dirname, '..', '..', '..', '..'); +const rootDir = path.join(__dirname, '..', '..', '..', '..', '..'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/JS/A318HS/atsu/common.js'; +const srcDir = 'fbw-common/src/systems/datalink/common'; -esbuild.build(esbuildModuleBuild('build-a318ceo', 'AtsuCommon', path.join(rootDir, '../fbw-common/src/systems/datalink/common/src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a318ceo', 'AtsuCommon', path.join(rootDir, srcDir, '/src/index.ts'), outFile, path.join(rootDir, srcDir))); diff --git a/hsim-a318ceo/src/systems/atsu/fmsclient/build.js b/hsim-a318ceo/src/systems/atsu/fmsclient/build.js index 18a34527..1412c792 100644 --- a/hsim-a318ceo/src/systems/atsu/fmsclient/build.js +++ b/hsim-a318ceo/src/systems/atsu/fmsclient/build.js @@ -2,8 +2,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/JS/A318HS/atsu/fmsclient.js'; -esbuild.build(esbuildModuleBuild('build-a318ceo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild ('build-a318ceo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a318ceo/src/systems/extras-host/build.js b/hsim-a318ceo/src/systems/extras-host/build.js index 7f8ca929..917f748b 100644 --- a/hsim-a318ceo/src/systems/extras-host/build.js +++ b/hsim-a318ceo/src/systems/extras-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/Pages/VCockpit/Instruments/A318HS/ExtrasHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a318ceo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a318ceo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a318ceo/src/systems/fmgc/build.js b/hsim-a318ceo/src/systems/fmgc/build.js index 5b34ec3a..b9c5e70f 100644 --- a/hsim-a318ceo/src/systems/fmgc/build.js +++ b/hsim-a318ceo/src/systems/fmgc/build.js @@ -6,8 +6,7 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); - +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/JS/A318HS/fmgc/fmgc.js'; -esbuild.build(esbuildModuleBuild('build-a318ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a318ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a318ceo/src/systems/instruments/src/Clock/rollup.config.js b/hsim-a318ceo/src/systems/instruments/src/Clock/rollup.config.js deleted file mode 100644 index e7fdfbab..00000000 --- a/hsim-a318ceo/src/systems/instruments/src/Clock/rollup.config.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -import ts from 'rollup-plugin-typescript2'; -import resolve from '@rollup/plugin-node-resolve'; -import scss from 'rollup-plugin-scss'; - -const { join } = require('path'); - -const root = join(__dirname, '..', '..', '..', '..', '..', '..'); - -export default { - input: join(__dirname, 'instrument.tsx'), - output: { - file: join(root, 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/Pages/VCockpit/Instruments/A318HS/Clock/instrument.js'), - format: 'es', - }, - plugins: [ - scss({ output: join(root, 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/Pages/VCockpit/Instruments/A318HS/Clock/clock.css') }), - resolve(), - ts(), - ], -}; diff --git a/hsim-a318ceo/src/systems/sentry-client/build.js b/hsim-a318ceo/src/systems/sentry-client/build.js index 0d17661c..881fa65f 100644 --- a/hsim-a318ceo/src/systems/sentry-client/build.js +++ b/hsim-a318ceo/src/systems/sentry-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/JS/A318HS/sentry-client/sentry-client.js'; -esbuild.build(esbuildModuleBuild('build-a318ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild ('build-a318ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a318ceo/src/systems/simbridge-client/build.js b/hsim-a318ceo/src/systems/simbridge-client/build.js index c885a15b..670dc2f1 100644 --- a/hsim-a318ceo/src/systems/simbridge-client/build.js +++ b/hsim-a318ceo/src/systems/simbridge-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/JS/A318HS/simbridge-client/simbridge-client.js'; -esbuild.build(esbuildModuleBuild('build-a318ceo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a318ceo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a318ceo/src/systems/systems-host/build.js b/hsim-a318ceo/src/systems/systems-host/build.js index 292481d8..1d5af7b7 100644 --- a/hsim-a318ceo/src/systems/systems-host/build.js +++ b/hsim-a318ceo/src/systems/systems-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/Pages/VCockpit/Instruments/A318HS/SystemsHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a318ceo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a318ceo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a318ceo/src/systems/tcas/build.js b/hsim-a318ceo/src/systems/tcas/build.js index 4870534f..4923c45d 100644 --- a/hsim-a318ceo/src/systems/tcas/build.js +++ b/hsim-a318ceo/src/systems/tcas/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a318ceo/out/lvfr-horizonsim-airbus-a318-ceo/html_ui/JS/A318HS/tcas/tcas.js'; -esbuild.build(esbuildModuleBuild('build-a318ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a318ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a319-common/src/systems/tsconfig.json b/hsim-a319-common/src/systems/tsconfig.json index a48f21d1..d374a6da 100644 --- a/hsim-a319-common/src/systems/tsconfig.json +++ b/hsim-a319-common/src/systems/tsconfig.json @@ -1,15 +1,15 @@ { "compilerOptions": { - "target": "ESNext", + "target": "ES2017", "baseUrl": ".", "resolveJsonModule" : true, "typeRoots": [ - "../typings", - "../../../node_modules/@types" + "../typings" ], "moduleResolution": "node", "allowSyntheticDefaultImports": true, "jsx": "react", + "skipLibCheck": true, "paths": { "@datalink/aoc": ["datalink/aoc/src/index.ts"], "@datalink/atc": ["datalink/atc/src/index.ts"], @@ -20,5 +20,5 @@ "@typings/*": ["../typings/*"], "@flybywiresim/fbw-sdk": ["./index.ts"] } - }, + } } \ No newline at end of file diff --git a/hsim-a319ceo/mach.config.js b/hsim-a319ceo/mach.config.js index 0e933d69..8fb83c0a 100644 --- a/hsim-a319ceo/mach.config.js +++ b/hsim-a319ceo/mach.config.js @@ -3,6 +3,9 @@ const postCssPlugin = require('esbuild-style-plugin'); const tailwind = require('tailwindcss'); const postCssColorFunctionalNotation = require('postcss-color-functional-notation'); const postCssInset = require('postcss-inset'); +const { typecheckingPlugin } = require("#build-utils"); + +// process.env.FBW_TYPECHECK = "1"; /** @type { import('@synaptic-simulations/mach').MachConfig } */ module.exports = { @@ -24,6 +27,7 @@ module.exports = { ], } }), + typecheckingPlugin(), ], instruments: [ msfsAvionicsInstrument('PFD'), diff --git a/hsim-a319ceo/src/systems/atsu/common/build.js b/hsim-a319ceo/src/systems/atsu/common/build.js index 447c839f..cab55cae 100644 --- a/hsim-a319ceo/src/systems/atsu/common/build.js +++ b/hsim-a319ceo/src/systems/atsu/common/build.js @@ -2,9 +2,10 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); -const rootDir = path.join(__dirname, '..', '..', '..', '..'); +const rootDir = path.join(__dirname, '..', '..', '..', '..', '..'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/atsu/common.js'; +const srcDir = 'fbw-common/src/systems/datalink/common'; -esbuild.build(esbuildModuleBuild('build-a319ceo', 'AtsuCommon', path.join(rootDir, '../fbw-common/src/systems/datalink/common/src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a319ceo', 'AtsuCommon', path.join(rootDir, srcDir, '/src/index.ts'), outFile, path.join(rootDir, srcDir))); diff --git a/hsim-a319ceo/src/systems/atsu/fmsclient/build.js b/hsim-a319ceo/src/systems/atsu/fmsclient/build.js index 81c46efd..93f91b84 100644 --- a/hsim-a319ceo/src/systems/atsu/fmsclient/build.js +++ b/hsim-a319ceo/src/systems/atsu/fmsclient/build.js @@ -2,8 +2,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/atsu/fmsclient.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild ('build-a319ceo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a319ceo/src/systems/extras-host/build.js b/hsim-a319ceo/src/systems/extras-host/build.js index d3b0ad88..7e34af48 100644 --- a/hsim-a319ceo/src/systems/extras-host/build.js +++ b/hsim-a319ceo/src/systems/extras-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/Pages/VCockpit/Instruments/A319HS/ExtrasHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a319ceo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a319ceo/src/systems/fmgc/build.js b/hsim-a319ceo/src/systems/fmgc/build.js index 866882a8..3c905020 100644 --- a/hsim-a319ceo/src/systems/fmgc/build.js +++ b/hsim-a319ceo/src/systems/fmgc/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/fmgc/fmgc.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a319ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a319ceo/src/systems/fmgcIAE/build.js b/hsim-a319ceo/src/systems/fmgcIAE/build.js index b3b0a382..2eb1436d 100644 --- a/hsim-a319ceo/src/systems/fmgcIAE/build.js +++ b/hsim-a319ceo/src/systems/fmgcIAE/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/fmgc/fmgcIAE.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a319ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a319ceo/src/systems/fmgcSL/build.js b/hsim-a319ceo/src/systems/fmgcSL/build.js index 9a548699..6803081e 100644 --- a/hsim-a319ceo/src/systems/fmgcSL/build.js +++ b/hsim-a319ceo/src/systems/fmgcSL/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/fmgc/fmgcSL.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a319ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a319ceo/src/systems/instruments/src/Clock/rollup.config.js b/hsim-a319ceo/src/systems/instruments/src/Clock/rollup.config.js deleted file mode 100644 index 1a7d9105..00000000 --- a/hsim-a319ceo/src/systems/instruments/src/Clock/rollup.config.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -import ts from 'rollup-plugin-typescript2'; -import resolve from '@rollup/plugin-node-resolve'; -import scss from 'rollup-plugin-scss'; - -const { join } = require('path'); - -const root = join(__dirname, '..', '..', '..', '..', '..', '..'); - -export default { - input: join(__dirname, 'instrument.tsx'), - output: { - file: join(root, 'build-a321neo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/Pages/VCockpit/Instruments/A319HS/Clock/instrument.js'), - format: 'es', - }, - plugins: [ - scss({ output: join(root, 'build-a321neo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/Pages/VCockpit/Instruments/A319HS/Clock/clock.css') }), - resolve(), - ts(), - ], -}; diff --git a/hsim-a319ceo/src/systems/sentry-client/build.js b/hsim-a319ceo/src/systems/sentry-client/build.js index 0a7dbd6b..8eb3b0f6 100644 --- a/hsim-a319ceo/src/systems/sentry-client/build.js +++ b/hsim-a319ceo/src/systems/sentry-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/sentry-client/sentry-client.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild ('build-a319ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a319ceo/src/systems/simbridge-client/build.js b/hsim-a319ceo/src/systems/simbridge-client/build.js index bc43271d..9c824066 100644 --- a/hsim-a319ceo/src/systems/simbridge-client/build.js +++ b/hsim-a319ceo/src/systems/simbridge-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/simbridge-client/simbridge-client.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a319ceo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a319ceo/src/systems/systems-host/build.js b/hsim-a319ceo/src/systems/systems-host/build.js index 6d760092..9e6ee24b 100644 --- a/hsim-a319ceo/src/systems/systems-host/build.js +++ b/hsim-a319ceo/src/systems/systems-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/Pages/VCockpit/Instruments/A319HS/SystemsHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a319ceo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a319ceo/src/systems/tcas/build.js b/hsim-a319ceo/src/systems/tcas/build.js index 79db1ea5..d0f4fc86 100644 --- a/hsim-a319ceo/src/systems/tcas/build.js +++ b/hsim-a319ceo/src/systems/tcas/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a319ceo/out/lvfr-horizonsim-airbus-a319-ceo/html_ui/JS/A319HS/tcas/tcas.js'; -esbuild.build(esbuildModuleBuild('build-a319ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a319ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a320-common/src/systems/tsconfig.json b/hsim-a320-common/src/systems/tsconfig.json index 39469b3a..c79ebe25 100644 --- a/hsim-a320-common/src/systems/tsconfig.json +++ b/hsim-a320-common/src/systems/tsconfig.json @@ -1,15 +1,15 @@ { "compilerOptions": { - "target": "ESNext", + "target": "ES2017", "baseUrl": ".", "resolveJsonModule" : true, "typeRoots": [ - "../typings", - "../../../node_modules/@types" + "../typings" ], "moduleResolution": "node", "allowSyntheticDefaultImports": true, "jsx": "react", + "skipLibCheck": true, "paths": { "@datalink/aoc": ["datalink/aoc/src/index.ts"], "@datalink/atc": ["datalink/atc/src/index.ts"], @@ -20,5 +20,5 @@ "@typings/*": ["../typings/*"], "@flybywiresim/fbw-sdk": ["./index.ts"] } - }, + } } \ No newline at end of file diff --git a/hsim-a320ceo/mach.config.js b/hsim-a320ceo/mach.config.js index 390d9901..61eb99c0 100644 --- a/hsim-a320ceo/mach.config.js +++ b/hsim-a320ceo/mach.config.js @@ -3,6 +3,9 @@ const postCssPlugin = require('esbuild-style-plugin'); const tailwind = require('tailwindcss'); const postCssColorFunctionalNotation = require('postcss-color-functional-notation'); const postCssInset = require('postcss-inset'); +const { typecheckingPlugin } = require("#build-utils"); + +// process.env.FBW_TYPECHECK = "1"; /** @type { import('@synaptic-simulations/mach').MachConfig } */ module.exports = { @@ -24,6 +27,7 @@ module.exports = { ], } }), + typecheckingPlugin(), ], instruments: [ msfsAvionicsInstrument('PFD'), diff --git a/hsim-a320ceo/src/systems/atsu/common/build.js b/hsim-a320ceo/src/systems/atsu/common/build.js index 45a52431..553c634d 100644 --- a/hsim-a320ceo/src/systems/atsu/common/build.js +++ b/hsim-a320ceo/src/systems/atsu/common/build.js @@ -2,9 +2,10 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); -const rootDir = path.join(__dirname, '..', '..', '..', '..'); +const rootDir = path.join(__dirname, '..', '..', '..', '..', '..'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/atsu/common.js'; +const srcDir = 'fbw-common/src/systems/datalink/common'; -esbuild.build(esbuildModuleBuild('build-a320ceo', 'AtsuCommon', path.join(rootDir, '../fbw-common/src/systems/datalink/common/src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a320ceo', 'AtsuCommon', path.join(rootDir, srcDir, '/src/index.ts'), outFile, path.join(rootDir, srcDir))); diff --git a/hsim-a320ceo/src/systems/atsu/fmsclient/build.js b/hsim-a320ceo/src/systems/atsu/fmsclient/build.js index 322f0823..59031f30 100644 --- a/hsim-a320ceo/src/systems/atsu/fmsclient/build.js +++ b/hsim-a320ceo/src/systems/atsu/fmsclient/build.js @@ -2,8 +2,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/atsu/fmsclient.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild ('build-a320ceo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a320ceo/src/systems/extras-host/build.js b/hsim-a320ceo/src/systems/extras-host/build.js index 3fb789b6..8ae8f0bb 100644 --- a/hsim-a320ceo/src/systems/extras-host/build.js +++ b/hsim-a320ceo/src/systems/extras-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/Pages/VCockpit/Instruments/A320HS/ExtrasHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a320ceo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a320ceo/src/systems/fmgc/build.js b/hsim-a320ceo/src/systems/fmgc/build.js index ec46b7df..d2f51a99 100644 --- a/hsim-a320ceo/src/systems/fmgc/build.js +++ b/hsim-a320ceo/src/systems/fmgc/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/fmgc/fmgc.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a320ceo/src/systems/fmgcCFMSL/build.js b/hsim-a320ceo/src/systems/fmgcCFMSL/build.js index 3ba1dcd5..4e18bfa0 100644 --- a/hsim-a320ceo/src/systems/fmgcCFMSL/build.js +++ b/hsim-a320ceo/src/systems/fmgcCFMSL/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/fmgc/fmgcCFMSL.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a320ceo/src/systems/fmgcIAE/build.js b/hsim-a320ceo/src/systems/fmgcIAE/build.js index e078559a..4a2f7c95 100644 --- a/hsim-a320ceo/src/systems/fmgcIAE/build.js +++ b/hsim-a320ceo/src/systems/fmgcIAE/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/fmgc/fmgcIAE.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a320ceo/src/systems/fmgcIAESL/build.js b/hsim-a320ceo/src/systems/fmgcIAESL/build.js index 97bbb934..68aa3536 100644 --- a/hsim-a320ceo/src/systems/fmgcIAESL/build.js +++ b/hsim-a320ceo/src/systems/fmgcIAESL/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/fmgc/fmgcIAESL.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a320ceo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a320ceo/src/systems/instruments/src/Clock/rollup.config.js b/hsim-a320ceo/src/systems/instruments/src/Clock/rollup.config.js deleted file mode 100644 index 8b44f0bb..00000000 --- a/hsim-a320ceo/src/systems/instruments/src/Clock/rollup.config.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -import ts from 'rollup-plugin-typescript2'; -import resolve from '@rollup/plugin-node-resolve'; -import scss from 'rollup-plugin-scss'; - -const { join } = require('path'); - -const root = join(__dirname, '..', '..', '..', '..', '..', '..'); - -export default { - input: join(__dirname, 'instrument.tsx'), - output: { - file: join(root, 'build-a321neo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/Pages/VCockpit/Instruments/A320HS/Clock/instrument.js'), - format: 'es', - }, - plugins: [ - scss({ output: join(root, 'build-a321neo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/Pages/VCockpit/Instruments/A320HS/Clock/clock.css') }), - resolve(), - ts(), - ], -}; diff --git a/hsim-a320ceo/src/systems/sentry-client/build.js b/hsim-a320ceo/src/systems/sentry-client/build.js index 81cf9d73..74b8d55d 100644 --- a/hsim-a320ceo/src/systems/sentry-client/build.js +++ b/hsim-a320ceo/src/systems/sentry-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/sentry-client/sentry-client.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild ('build-a320ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a320ceo/src/systems/simbridge-client/build.js b/hsim-a320ceo/src/systems/simbridge-client/build.js index e3a185ed..bc93b972 100644 --- a/hsim-a320ceo/src/systems/simbridge-client/build.js +++ b/hsim-a320ceo/src/systems/simbridge-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/simbridge-client/simbridge-client.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a320ceo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a320ceo/src/systems/systems-host/build.js b/hsim-a320ceo/src/systems/systems-host/build.js index 9fc7ccb2..6121ad49 100644 --- a/hsim-a320ceo/src/systems/systems-host/build.js +++ b/hsim-a320ceo/src/systems/systems-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/Pages/VCockpit/Instruments/A320HS/SystemsHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a320ceo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a320ceo/src/systems/tcas/build.js b/hsim-a320ceo/src/systems/tcas/build.js index 5e772e13..b9266aae 100644 --- a/hsim-a320ceo/src/systems/tcas/build.js +++ b/hsim-a320ceo/src/systems/tcas/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a320ceo/out/lvfr-horizonsim-airbus-a320-ceo/html_ui/JS/A320HS/tcas/tcas.js'; -esbuild.build(esbuildModuleBuild('build-a320ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a320ceo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a321neo/mach.config.js b/hsim-a321neo/mach.config.js index eff3bb09..a75b8005 100644 --- a/hsim-a321neo/mach.config.js +++ b/hsim-a321neo/mach.config.js @@ -3,6 +3,9 @@ const postCssPlugin = require('esbuild-style-plugin'); const tailwind = require('tailwindcss'); const postCssColorFunctionalNotation = require('postcss-color-functional-notation'); const postCssInset = require('postcss-inset'); +const { typecheckingPlugin } = require("#build-utils"); + +// process.env.FBW_TYPECHECK = "1"; /** @type { import('@synaptic-simulations/mach').MachConfig } */ module.exports = { @@ -24,6 +27,7 @@ module.exports = { ], } }), + typecheckingPlugin(), ], instruments: [ msfsAvionicsInstrument('PFD'), diff --git a/hsim-a321neo/src/systems/atsu/common/build.js b/hsim-a321neo/src/systems/atsu/common/build.js index 2070040a..4b54734e 100644 --- a/hsim-a321neo/src/systems/atsu/common/build.js +++ b/hsim-a321neo/src/systems/atsu/common/build.js @@ -2,9 +2,10 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); -const rootDir = path.join(__dirname, '..', '..', '..', '..'); +const rootDir = path.join(__dirname, '..', '..', '..', '..', '..'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/JS/A21NHS/atsu/common.js'; +const srcDir = 'fbw-common/src/systems/datalink/common'; -esbuild.build(esbuildModuleBuild('build-a321neo', 'AtsuCommon', path.join(rootDir, '../fbw-common/src/systems/datalink/common/src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a321neo', 'AtsuCommon', path.join(rootDir, srcDir, '/src/index.ts'), outFile, path.join(rootDir, srcDir))); diff --git a/hsim-a321neo/src/systems/atsu/fmsclient/build.js b/hsim-a321neo/src/systems/atsu/fmsclient/build.js index 0f8f3ddc..2325f0f7 100644 --- a/hsim-a321neo/src/systems/atsu/fmsclient/build.js +++ b/hsim-a321neo/src/systems/atsu/fmsclient/build.js @@ -2,8 +2,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/JS/A21NHS/atsu/fmsclient.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild ('build-a321neo', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a321neo/src/systems/extras-host/build.js b/hsim-a321neo/src/systems/extras-host/build.js index e5745883..e6d5aa1f 100644 --- a/hsim-a321neo/src/systems/extras-host/build.js +++ b/hsim-a321neo/src/systems/extras-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/Pages/VCockpit/Instruments/A21NHS/ExtrasHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a321neo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a321neo/src/systems/fmgc/build.js b/hsim-a321neo/src/systems/fmgc/build.js index d1a07b24..ec08f1cf 100644 --- a/hsim-a321neo/src/systems/fmgc/build.js +++ b/hsim-a321neo/src/systems/fmgc/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/JS/A21NHS/fmgc/fmgc.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a321neo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a321neo/src/systems/fmgcPW/build.js b/hsim-a321neo/src/systems/fmgcPW/build.js index 3efa944f..6c06a090 100644 --- a/hsim-a321neo/src/systems/fmgcPW/build.js +++ b/hsim-a321neo/src/systems/fmgcPW/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/JS/A21NHS/fmgc/fmgcPW.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile)); \ No newline at end of file +esbuild.build(createModuleBuild('build-a321neo', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); \ No newline at end of file diff --git a/hsim-a321neo/src/systems/instruments/src/Clock/rollup.config.js b/hsim-a321neo/src/systems/instruments/src/Clock/rollup.config.js deleted file mode 100644 index d079398f..00000000 --- a/hsim-a321neo/src/systems/instruments/src/Clock/rollup.config.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -import ts from 'rollup-plugin-typescript2'; -import resolve from '@rollup/plugin-node-resolve'; -import scss from 'rollup-plugin-scss'; - -const { join } = require('path'); - -const root = join(__dirname, '..', '..', '..', '..', '..', '..'); - -export default { - input: join(__dirname, 'instrument.tsx'), - output: { - file: join(root, 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/Pages/VCockpit/Instruments/A21NHS/Clock/instrument.js'), - format: 'es', - }, - plugins: [ - scss({ output: join(root, 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/Pages/VCockpit/Instruments/A21NHS/Clock/clock.css') }), - resolve(), - ts(), - ], -}; diff --git a/hsim-a321neo/src/systems/sentry-client/build.js b/hsim-a321neo/src/systems/sentry-client/build.js index 9616790b..153704a2 100644 --- a/hsim-a321neo/src/systems/sentry-client/build.js +++ b/hsim-a321neo/src/systems/sentry-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/JS/A21NHS/sentry-client/sentry-client.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild ('build-a321neo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a321neo/src/systems/simbridge-client/build.js b/hsim-a321neo/src/systems/simbridge-client/build.js index 0a1cf06c..ce77c66d 100644 --- a/hsim-a321neo/src/systems/simbridge-client/build.js +++ b/hsim-a321neo/src/systems/simbridge-client/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/JS/A21NHS/simbridge-client/simbridge-client.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a321neo', 'SimBridgeClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/hsim-a321neo/src/systems/systems-host/build.js b/hsim-a321neo/src/systems/systems-host/build.js index df774e47..78b01cae 100644 --- a/hsim-a321neo/src/systems/systems-host/build.js +++ b/hsim-a321neo/src/systems/systems-host/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/Pages/VCockpit/Instruments/A21NHS/SystemsHost/index.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', undefined, path.join(__dirname, './index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a321neo', undefined, path.join(__dirname, './index.ts'), outFile, __dirname)); diff --git a/hsim-a321neo/src/systems/tcas/build.js b/hsim-a321neo/src/systems/tcas/build.js index 2c385ca1..1545b7c8 100644 --- a/hsim-a321neo/src/systems/tcas/build.js +++ b/hsim-a321neo/src/systems/tcas/build.js @@ -6,8 +6,8 @@ const esbuild = require('esbuild'); const path = require('path'); -const { esbuildModuleBuild } = require('#build-utils'); +const { createModuleBuild } = require('#build-utils'); const outFile = 'build-a321neo/out/lvfr-horizonsim-airbus-a321-neo/html_ui/JS/A21NHS/tcas/tcas.js'; -esbuild.build(esbuildModuleBuild('build-a321neo', undefined, path.join(__dirname, 'src/index.ts'), outFile)); +esbuild.build(createModuleBuild('build-a321neo', undefined, path.join(__dirname, 'src/index.ts'), outFile, __dirname)); diff --git a/package.json b/package.json index 13ecb9eb..c2d9e735 100644 --- a/package.json +++ b/package.json @@ -190,7 +190,6 @@ }, "devDependencies": { "@babel/core": "^7.12.3", - "@babel/eslint-parser": "^7.12.1", "@babel/plugin-proposal-class-properties": "~7.12.1", "@babel/plugin-transform-runtime": "~7.12.1", "@babel/preset-env": "^7.12.1", @@ -198,9 +197,8 @@ "@babel/preset-typescript": "~7.12.7", "@flybywiresim/eslint-config": "~0.1.0", "@flybywiresim/fragmenter": "^0.7.0", - "@flybywiresim/igniter": "^1.2.2", + "@flybywiresim/igniter": "^1.2.3", "@flybywiresim/rnp": "^2.1.0", - "@flybywiresim/rollup-plugin-msfs": "~0.3.0", "@navigraph/pkce": "^1.0.0", "@rollup/plugin-babel": "^5.2.1", "@rollup/plugin-commonjs": "^15.1.0", @@ -208,32 +206,28 @@ "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^9.0.0", "@rollup/plugin-replace": "^2.3.3", - "@rollup/plugin-typescript": "~8.0.0", "@sentry/types": "^6.17.7", - "@synaptic-simulations/mach": "^1.0.0", + "@synaptic-simulations/mach": "^1.0.3", "@types/jest": "^27.0.2", "@types/react": "~17.0.11", "@types/react-dom": "~17.0.8", "@types/react-router-dom": "~5.1.7", "@types/semver": "^7.3.13", - "@typescript-eslint/eslint-plugin": "~4.14.2", - "@typescript-eslint/parser": "~4.14.2", + "@typescript-eslint/eslint-plugin": "~6.7.4", + "@typescript-eslint/parser": "~6.7.4", "@vitejs/plugin-react": "^1.2.0", "autoprefixer": "^10.4.2", - "babel-plugin-module-resolver": "^4.1.0", "dotenv": "^8.2.0", - "es5lib": "^0.1.1", - "esbuild-sass-plugin": "^2.4.0", + "esbuid": "^0.19.4", "eslint": "^7.21.0", - "eslint-plugin-import": "^2.25.3", - "eslint-plugin-jest": "^24.4.0", - "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-react": "7.28.0", - "eslint-plugin-react-hooks": "^4.3.0", - "eslint-plugin-tailwindcss": "^1.17.0", - "file-loader": "^6.2.0", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jest": "^27.4.2", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-tailwindcss": "^3.13.0", "fs-extra": "^10.1.0", - "jest": "^27.4.7", + "jest": "^29.7.0", "jsdom": "^16.4.0", "lint-staged": "10.4.0", "postcss": "^8.4.5", @@ -247,21 +241,13 @@ "rollup-plugin-css-only": "^2.1.0", "rollup-plugin-livereload": "~2.0.0", "rollup-plugin-postcss": "^4.0.2", - "rollup-plugin-serve": "~1.1.0", "rollup-plugin-typescript-paths": "^1.3.0", - "rollup-plugin-typescript2": "^0.31.2", - "sass-loader": "^10.1.0", - "style-loader": "^2.0.0", "tailwindcss": "^3.0.23", - "ts-jest": "^27.0.4", - "ts-loader": "^9.2.2", - "typescript": "^4.3.2", - "vite": "^2.8.6", - "vite-plugin-replace": "^0.1.1", - "vite-tsconfig-paths": "^3.4.1", - "webpack": "^5.12.2", - "webpack-cli": "^4.3.1", - "webpack-dev-server": "^3.11.1" + "ts-jest": "^29.1.1", + "typescript": "^5.2.2", + "vite": "^4.4.9", + "vite-plugin-replace": "^0.1.12", + "vite-tsconfig-paths": "^4.2.1", }, "dependencies": { "@flybywiresim/api-client": "^0.16.2", @@ -281,15 +267,11 @@ "esbuild-style-plugin": "^1.6.0", "geolib": "^3.3.3", "i18next": "^21.6.14", - "immer": "^9.0.3", "lodash": "^4.17.20", "msfs-geo": "^0.1.0-alpha3", "@microsoft/msfs-sdk": "^0.4.0", "nanoid": "^3.3.1", "network": "^0.6.1", - "pdf-to-printer": "^5.1.1", - "pdfkit": "^0.13.0", - "pkg": "^5.1.0", "qrcode.react": "^1.0.1", "rc-slider": "^9.7.5", "react": "^17.0.0", @@ -314,7 +296,6 @@ "semver": "^7.3.8", "simple-keyboard-layouts": "^3.1.32", "tailwindcss": "^2.2.2", - "type-to-reducer": "^1.2.0", "use-long-press": "^1.1.2", "uuid": "^9.0.0", "ws": "^7.4.5"