diff --git a/.gitignore b/.gitignore index 61f5f951..df0b9a1d 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,9 @@ common/autoinstallers/*/.npmrc # MikroORM temporary directory modules/*/temp -test/temp -# moon -.moon/cache -.moon/docker +test/temp +# moon +.moon/cache +.moon/docker + +*.tsbuildinfo diff --git a/modules/_abandoned/bigquery/tsconfig.build.json b/modules/_abandoned/bigquery/tsconfig.build.json index 28255d08..65be6db9 100644 --- a/modules/_abandoned/bigquery/tsconfig.build.json +++ b/modules/_abandoned/bigquery/tsconfig.build.json @@ -8,5 +8,5 @@ "removeComments": true }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/_abandoned/dareboost/tsconfig.build.json b/modules/_abandoned/dareboost/tsconfig.build.json index 52c4e3f9..9443796c 100644 --- a/modules/_abandoned/dareboost/tsconfig.build.json +++ b/modules/_abandoned/dareboost/tsconfig.build.json @@ -7,5 +7,5 @@ "outDir": "lib" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/api/tsconfig.build.json b/modules/api/tsconfig.build.json index 52c4e3f9..55e1ee6e 100644 --- a/modules/api/tsconfig.build.json +++ b/modules/api/tsconfig.build.json @@ -4,8 +4,9 @@ "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/api/tsconfig.json b/modules/api/tsconfig.json index 8ae4b51d..8b8d48be 100644 --- a/modules/api/tsconfig.json +++ b/modules/api/tsconfig.json @@ -1,7 +1,23 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "extends": "../../tsconfig.options.json", + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../cli" + }, + { + "path": "../common" + } + ] } diff --git a/modules/cli/tsconfig.build.json b/modules/cli/tsconfig.build.json index 52c4e3f9..55e1ee6e 100644 --- a/modules/cli/tsconfig.build.json +++ b/modules/cli/tsconfig.build.json @@ -4,8 +4,9 @@ "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/cli/tsconfig.json b/modules/cli/tsconfig.json index e3459aad..fb98d747 100644 --- a/modules/cli/tsconfig.json +++ b/modules/cli/tsconfig.json @@ -1,12 +1,22 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - + "extends": "../../tsconfig.options.json", "compilerOptions": { "esModuleInterop": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "outDir": "lib", + "rootDir": "src" }, - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../common" + } + ] } diff --git a/modules/common/src/error/InputError.ts b/modules/common/src/error/InputError.ts index c2d56f7e..916641c5 100644 --- a/modules/common/src/error/InputError.ts +++ b/modules/common/src/error/InputError.ts @@ -1,7 +1,7 @@ import type { ErrorObject } from "ajv" export class InputError extends Error { - cause: ErrorObject[] = [] + override cause: ErrorObject[] = [] constructor(errors: ErrorObject[]) { super("Something went wrong with the input validation") diff --git a/modules/common/src/time/timeout.ts b/modules/common/src/time/timeout.ts index 0d90729d..6167b6cf 100644 --- a/modules/common/src/time/timeout.ts +++ b/modules/common/src/time/timeout.ts @@ -1,5 +1,6 @@ /** * This is Promise wrapper of the setTimeout() function. */ -export const timeout = (delay: number): Promise => - new Promise((resolve) => setTimeout(resolve, delay)) +export const timeout = (delay: number): Promise => + new Promise((resolve) => setTimeout(() => { + resolve() }, delay)) diff --git a/modules/common/src/validation/input/analysis/AnalysisInputValidation.ts b/modules/common/src/validation/input/analysis/AnalysisInputValidation.ts index 39204832..87af6d9a 100644 --- a/modules/common/src/validation/input/analysis/AnalysisInputValidation.ts +++ b/modules/common/src/validation/input/analysis/AnalysisInputValidation.ts @@ -1,9 +1,9 @@ import type { SchemaObject } from "ajv" import type { ModuleMetadata, ValidatedAnalysisInput } from "../../../index.js" import { validateInput } from "../InputValidation.js" -import configSchema from "./schema/config.json" assert { type: "json" } -import thresholdSchema from "./schema/threshold.json" assert { type: "json" } -import verboseSchema from "../schema/verbose.json" assert { type: "json" } +import configSchema from "./schema/config.json" with { type: "json" } +import thresholdSchema from "./schema/threshold.json" with { type: "json" } +import verboseSchema from "../schema/verbose.json" with { type: "json" } export function getAnalysisValidationSchema(listenerModulesIds: ModuleMetadata["id"][]): SchemaObject { const listenerSchema = { diff --git a/modules/common/src/validation/input/server/ServerInputValidation.ts b/modules/common/src/validation/input/server/ServerInputValidation.ts index 46e052c0..8205a80a 100644 --- a/modules/common/src/validation/input/server/ServerInputValidation.ts +++ b/modules/common/src/validation/input/server/ServerInputValidation.ts @@ -1,9 +1,9 @@ import type { SchemaObject } from "ajv" import type { ValidatedServerInput } from "../../../input/ServerInput.js" import { validateInput } from "../InputValidation.js" -import corsSchema from "./schema/cors.json" assert { type: "json" } -import portSchema from "./schema/port.json" assert { type: "json" } -import verboseSchema from "../schema/verbose.json" assert { type: "json" } +import corsSchema from "./schema/cors.json" with { type: "json" } +import portSchema from "./schema/port.json" with { type: "json" } +import verboseSchema from "../schema/verbose.json" with { type: "json" } function getValidationSchema(): SchemaObject { return { diff --git a/modules/common/tsconfig.build.json b/modules/common/tsconfig.build.json index 52c4e3f9..cabd906e 100644 --- a/modules/common/tsconfig.build.json +++ b/modules/common/tsconfig.build.json @@ -4,8 +4,9 @@ "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts", "*.json"] } diff --git a/modules/common/tsconfig.json b/modules/common/tsconfig.json index b476366d..c95558bd 100644 --- a/modules/common/tsconfig.json +++ b/modules/common/tsconfig.json @@ -1,14 +1,20 @@ { "$schema": "http://json.schemastore.org/tsconfig", - "extends": "../tsconfig.json", + "extends": "../../tsconfig.options.json", "compilerOptions": { "emitDecoratorMetadata": true, "esModuleInterop": true, "experimentalDecorators": true, - "resolveJsonModule": true + "resolveJsonModule": true, }, - "include": ["src/**/*.ts", "tests/**/*.ts"] -} + "references": [ + { + "path": "./tsconfig.build.json" + } + ], + + "include": ["src/**/*", "tests/**/*", "*.ts", "*.json"] +} \ No newline at end of file diff --git a/modules/greenit/tests/GreenITModule.test.ts b/modules/greenit/tests/GreenITModule.test.ts index 8f7d212e..a387cbc8 100644 --- a/modules/greenit/tests/GreenITModule.test.ts +++ b/modules/greenit/tests/GreenITModule.test.ts @@ -1,7 +1,7 @@ import type { ModuleMetadata } from "@fabernovel/heart-common" import { jest } from "@jest/globals" import { Conf } from "./data/Conf.js" -import SuccessResult from "./data/SuccessResult.json" assert { type: "json" } +import SuccessResult from "./data/SuccessResult.json" with { type: "json" } jest.unstable_mockModule("greenit-cli/cli-core/analysis.js", () => ({ createJsonReports: jest.fn(), diff --git a/modules/greenit/tsconfig.build.json b/modules/greenit/tsconfig.build.json index 52c4e3f9..55e1ee6e 100644 --- a/modules/greenit/tsconfig.build.json +++ b/modules/greenit/tsconfig.build.json @@ -4,8 +4,9 @@ "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/greenit/tsconfig.json b/modules/greenit/tsconfig.json index c7f3f3b0..0929d7a1 100644 --- a/modules/greenit/tsconfig.json +++ b/modules/greenit/tsconfig.json @@ -1,12 +1,25 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - + "extends": "../../tsconfig.options.json", "compilerOptions": { "resolveJsonModule": true, - "esModuleInterop": true + "esModuleInterop": true, + "outDir": "lib", + "rootDir": "src" }, - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../cli" + }, + { + "path": "../common" + } + ] } diff --git a/modules/lighthouse/tsconfig.build.json b/modules/lighthouse/tsconfig.build.json index edcfd3de..ed4d6754 100644 --- a/modules/lighthouse/tsconfig.build.json +++ b/modules/lighthouse/tsconfig.build.json @@ -5,8 +5,9 @@ "compilerOptions": { "esModuleInterop": false, - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/lighthouse/tsconfig.json b/modules/lighthouse/tsconfig.json index e547d27e..51834d5e 100644 --- a/modules/lighthouse/tsconfig.json +++ b/modules/lighthouse/tsconfig.json @@ -1,11 +1,24 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - + "extends": "../../tsconfig.options.json", "compilerOptions": { - "esModuleInterop": true + "esModuleInterop": true, + "outDir": "lib", + "rootDir": "src" }, - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../cli" + }, + { + "path": "../common" + } + ] } diff --git a/modules/mysql/tsconfig.build.json b/modules/mysql/tsconfig.build.json index 52c4e3f9..55e1ee6e 100644 --- a/modules/mysql/tsconfig.build.json +++ b/modules/mysql/tsconfig.build.json @@ -4,8 +4,9 @@ "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/mysql/tsconfig.json b/modules/mysql/tsconfig.json index 8e2b231a..e97c7b75 100644 --- a/modules/mysql/tsconfig.json +++ b/modules/mysql/tsconfig.json @@ -1,13 +1,26 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - + "extends": "../../tsconfig.options.json", "compilerOptions": { "emitDecoratorMetadata": true, "esModuleInterop": true, - "experimentalDecorators": true + "experimentalDecorators": true, + "outDir": "lib", + "rootDir": "src" }, - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../cli" + }, + { + "path": "../common" + } + ] } diff --git a/modules/observatory/tsconfig.build.json b/modules/observatory/tsconfig.build.json index edcfd3de..ed4d6754 100644 --- a/modules/observatory/tsconfig.build.json +++ b/modules/observatory/tsconfig.build.json @@ -5,8 +5,9 @@ "compilerOptions": { "esModuleInterop": false, - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/observatory/tsconfig.json b/modules/observatory/tsconfig.json index e547d27e..51834d5e 100644 --- a/modules/observatory/tsconfig.json +++ b/modules/observatory/tsconfig.json @@ -1,11 +1,24 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - + "extends": "../../tsconfig.options.json", "compilerOptions": { - "esModuleInterop": true + "esModuleInterop": true, + "outDir": "lib", + "rootDir": "src" }, - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../cli" + }, + { + "path": "../common" + } + ] } diff --git a/modules/slack/tsconfig.build.json b/modules/slack/tsconfig.build.json index 52c4e3f9..55e1ee6e 100644 --- a/modules/slack/tsconfig.build.json +++ b/modules/slack/tsconfig.build.json @@ -4,8 +4,9 @@ "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/slack/tsconfig.json b/modules/slack/tsconfig.json index 8ae4b51d..8b8d48be 100644 --- a/modules/slack/tsconfig.json +++ b/modules/slack/tsconfig.json @@ -1,7 +1,23 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "extends": "../../tsconfig.options.json", + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../cli" + }, + { + "path": "../common" + } + ] } diff --git a/modules/ssllabs-server/tsconfig.build.json b/modules/ssllabs-server/tsconfig.build.json index 52c4e3f9..55e1ee6e 100644 --- a/modules/ssllabs-server/tsconfig.build.json +++ b/modules/ssllabs-server/tsconfig.build.json @@ -4,8 +4,9 @@ "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/modules/ssllabs-server/tsconfig.json b/modules/ssllabs-server/tsconfig.json index 8ae4b51d..8b8d48be 100644 --- a/modules/ssllabs-server/tsconfig.json +++ b/modules/ssllabs-server/tsconfig.json @@ -1,7 +1,23 @@ { "$schema": "http://json.schemastore.org/tsconfig", - - "extends": "../tsconfig.json", - - "include": ["src/**/*.ts", "tests/**/*.ts"] + "extends": "../../tsconfig.options.json", + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../cli" + }, + { + "path": "../common" + } + ] } diff --git a/modules/tpl/tsconfig.build.json b/modules/tpl/tsconfig.build.json index 52c4e3f9..9443796c 100644 --- a/modules/tpl/tsconfig.build.json +++ b/modules/tpl/tsconfig.build.json @@ -7,5 +7,5 @@ "outDir": "lib" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*", "*.ts"] } diff --git a/package.json b/package.json index 05e0afb0..3ea42065 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,18 @@ { - "devDependencies": { - "@ecocode/eslint-plugin": "^1.4.0", - "@jest/globals": "^29.7.0", - "@types/jest": "^29.5.11", - "@typescript-eslint/eslint-plugin": "^6.18.1", - "@typescript-eslint/parser": "^6.18.1", - "eslint": "8.56.0", - "jest": "^29.7.0", - "ts-jest": "^29.1.1", - "typescript": "^5.3.3" - } + "devDependencies": { + "@ecocode/eslint-plugin": "^1.4.0", + "@jest/globals": "^29.7.0", + "@types/jest": "^29.5.11", + "@typescript-eslint/eslint-plugin": "^6.18.1", + "@typescript-eslint/parser": "^6.18.1", + "eslint": "8.56.0", + "jest": "^29.7.0", + "ts-jest": "^29.1.1", + "tsconfig-moon": "^1.3.0", + "typescript": "^5.3.3" + }, + "packageManager": "pnpm@~8", + "engines": { + "node": "~18" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1ff5722f..f299b905 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ importers: ts-jest: specifier: ^29.1.1 version: 29.1.4(@babel/core@7.24.6)(jest@29.7.0)(typescript@5.4.5) + tsconfig-moon: + specifier: ^1.3.0 + version: 1.3.0 typescript: specifier: ^5.3.3 version: 5.4.5 @@ -6182,6 +6185,10 @@ packages: yn: 3.1.1 dev: true + /tsconfig-moon@1.3.0: + resolution: {integrity: sha512-OVa+cjaKIsXIQqEWVqvF3xH6xmFOjKnbwiCmAKx2J8uq7M1KTX/NFFi/YXZdKb6YjHJhq8tvg2JsGSBTxTANcQ==} + dev: true + /tsconfig-paths@4.2.0: resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==} engines: {node: '>=6'} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..8372164a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json.schemastore.org/tsconfig", + "extends": "./tsconfig.options.json", + "files": [], + "references": [ + { + "path": "modules/api" + }, + { + "path": "modules/cli" + }, + { + "path": "modules/common" + }, + { + "path": "modules/greenit" + }, + { + "path": "modules/lighthouse" + }, + { + "path": "modules/mysql" + }, + { + "path": "modules/observatory" + }, + { + "path": "modules/slack" + }, + { + "path": "modules/ssllabs-server" + } + ] +} diff --git a/modules/tsconfig.json b/tsconfig.options.json similarity index 94% rename from modules/tsconfig.json rename to tsconfig.options.json index 8862c85c..c1198564 100644 --- a/modules/tsconfig.json +++ b/tsconfig.options.json @@ -1,6 +1,8 @@ { "$schema": "http://json.schemastore.org/tsconfig", + "extends": "tsconfig-moon/tsconfig.json", + "compilerOptions": { // Disable error reporting for unreachable code. "allowUnreachableCode": false, @@ -22,7 +24,5 @@ "module": "NodeNext", "moduleResolution": "nodenext", "target": "ESNext" - }, - - "exclude": ["node_modules", "lib"] -} + } +} \ No newline at end of file