mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
refactor: Consolidate tsconfig and eslintrc files (no-changelog) (#6816)
Co-authored-by: Csaba Tuncsik <csaba@n8n.io>
This commit is contained in:
parent
31d8f478ee
commit
34df8b6238
|
@ -3,7 +3,7 @@ ARG NODE_VERSION=18
|
|||
# 1. Create an image to build n8n
|
||||
FROM n8nio/base:${NODE_VERSION} as builder
|
||||
|
||||
COPY --chown=node:node turbo.json package.json .npmrc pnpm-lock.yaml pnpm-workspace.yaml jest.config.js tsconfig.json ./
|
||||
COPY --chown=node:node turbo.json package.json .npmrc pnpm-lock.yaml pnpm-workspace.yaml jest.config.js tsconfig*.json ./
|
||||
COPY --chown=node:node scripts ./scripts
|
||||
COPY --chown=node:node packages ./packages
|
||||
COPY --chown=node:node patches ./patches
|
||||
|
|
|
@ -6,10 +6,11 @@ const tsJestOptions = {
|
|||
...compilerOptions,
|
||||
declaration: false,
|
||||
sourceMap: true,
|
||||
skipLibCheck: true,
|
||||
},
|
||||
};
|
||||
|
||||
const { baseUrl, paths } = require('get-tsconfig').getTsconfig().config?.compilerOptions;
|
||||
|
||||
/** @type {import('jest').Config} */
|
||||
const config = {
|
||||
verbose: true,
|
||||
|
@ -19,9 +20,14 @@ const config = {
|
|||
transform: {
|
||||
'^.+\\.ts$': ['ts-jest', tsJestOptions],
|
||||
},
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
},
|
||||
// This resolve the path mappings from the tsconfig relative to each jest.config.js
|
||||
moduleNameMapper: Object.entries(paths || {}).reduce((acc, [path, [mapping]]) => {
|
||||
path = `^${path.replace(/\/\*$/, '/(.*)$')}`;
|
||||
mapping = mapping.replace(/^\.\/(?:(.*)\/)?\*$/, '$1');
|
||||
mapping = mapping ? `/${mapping}` : '';
|
||||
acc[path] = '<rootDir>' + (baseUrl ? `/${baseUrl.replace(/^\.\//, '')}` : '') + mapping + '/$1';
|
||||
return acc;
|
||||
}, {}),
|
||||
setupFilesAfterEnv: ['jest-expect-message'],
|
||||
collectCoverage: true,
|
||||
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
|
||||
|
|
|
@ -58,7 +58,9 @@
|
|||
"start-server-and-test": "^2.0.0",
|
||||
"supertest": "^6.3.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"tsc-alias": "^1.8.7",
|
||||
"tsc-watch": "^6.0.4",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"turbo": "1.10.12",
|
||||
"typescript": "*",
|
||||
"vite": "^4.4.7",
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": ["./tsconfig.json", "../../../tsconfig.build.json"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"types": ["node"],
|
||||
"noEmit": false,
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["test/**"]
|
||||
|
|
|
@ -7,10 +7,6 @@ module.exports = {
|
|||
globalSetup: '<rootDir>/test/setup.ts',
|
||||
globalTeardown: '<rootDir>/test/teardown.ts',
|
||||
setupFilesAfterEnv: ['<rootDir>/test/setup-mocks.ts', '<rootDir>/test/extend-expect.ts'],
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
'^@db/(.*)$': '<rootDir>/src/databases/$1',
|
||||
},
|
||||
coveragePathIgnorePatterns: ['/src/databases/migrations/'],
|
||||
testTimeout: 10_000,
|
||||
};
|
||||
|
|
|
@ -96,9 +96,7 @@
|
|||
"@types/yamljs": "^0.2.31",
|
||||
"chokidar": "^3.5.2",
|
||||
"concurrently": "^8.2.0",
|
||||
"ts-essentials": "^7.0.3",
|
||||
"tsc-alias": "^1.8.7",
|
||||
"tsconfig-paths": "^4.2.0"
|
||||
"ts-essentials": "^7.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@n8n/client-oauth2": "workspace:*",
|
||||
|
|
|
@ -1,19 +1,9 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": ["./tsconfig.json", "../../tsconfig.build.json"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"types": ["node"],
|
||||
"noEmit": false,
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["test/**"],
|
||||
"tsc-alias": {
|
||||
"replacers": {
|
||||
"base-url": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
||||
}
|
||||
"exclude": ["test/**"]
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": ["../../tsconfig.json", "../../tsconfig.backend.json"],
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"types": ["node", "jest"],
|
||||
"noEmit": true,
|
||||
"preserveSymlinks": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
|
@ -12,7 +10,6 @@
|
|||
"@/*": ["./*"],
|
||||
"@db/*": ["./databases/*"]
|
||||
},
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
||||
// TODO: remove all options below this line
|
||||
"strict": false,
|
||||
"noUnusedLocals": false,
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": ["./tsconfig.json", "../../tsconfig.build.json"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"types": ["node"],
|
||||
"noEmit": false,
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["test/**"]
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": ["../../tsconfig.json", "../../tsconfig.backend.json"],
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"types": ["node", "jest"],
|
||||
"composite": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
},
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
||||
// TODO: remove all options below this line
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"importHelpers": true,
|
||||
"skipLibCheck": true,
|
||||
"allowJs": true,
|
||||
"incremental": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"outDir": "dist",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"skipLibCheck": true,
|
||||
"allowJs": true,
|
||||
"importHelpers": true,
|
||||
"incremental": false,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": ["../../tsconfig.json", "../../tsconfig.backend.json"],
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"types": ["node"],
|
||||
"preserveSymlinks": true,
|
||||
// TODO: remove all options below this line
|
||||
"noUnusedLocals": false,
|
||||
|
|
|
@ -2,8 +2,4 @@
|
|||
module.exports = {
|
||||
...require('../../jest.config'),
|
||||
collectCoverageFrom: ['credentials/**/*.ts', 'nodes/**/*.ts', 'utils/**/*.ts'],
|
||||
moduleNameMapper: {
|
||||
'^@test/(.*)$': '<rootDir>/test/$1',
|
||||
'^@utils/(.*)$': '<rootDir>/utils/$1',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": ["./tsconfig.json", "../../tsconfig.build.json"],
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"types": ["node"],
|
||||
"noEmit": false,
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": [
|
||||
"credentials/**/*.ts",
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": ["../../tsconfig.json", "../../tsconfig.backend.json"],
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "es2020", "es2022.error"],
|
||||
"types": ["node", "jest"],
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
"@test/*": ["./test/*"],
|
||||
"@utils/*": ["./utils/*"]
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": ["./tsconfig.json", "../../tsconfig.build.json"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"types": ["node"],
|
||||
"noEmit": false,
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["test/**"]
|
||||
|
|
|
@ -2,14 +2,11 @@
|
|||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"types": ["node", "jest"],
|
||||
"composite": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
},
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
||||
// TODO: remove all options below this line
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
|
|
|
@ -108,9 +108,15 @@ importers:
|
|||
ts-jest:
|
||||
specifier: ^29.1.1
|
||||
version: 29.1.1(@babel/core@7.22.9)(jest@29.6.2)(typescript@5.1.6)
|
||||
tsc-alias:
|
||||
specifier: ^1.8.7
|
||||
version: 1.8.7
|
||||
tsc-watch:
|
||||
specifier: ^6.0.4
|
||||
version: 6.0.4(typescript@5.1.6)
|
||||
tsconfig-paths:
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0
|
||||
turbo:
|
||||
specifier: 1.10.12
|
||||
version: 1.10.12
|
||||
|
@ -556,12 +562,6 @@ importers:
|
|||
ts-essentials:
|
||||
specifier: ^7.0.3
|
||||
version: 7.0.3(typescript@5.1.6)
|
||||
tsc-alias:
|
||||
specifier: ^1.8.7
|
||||
version: 1.8.7
|
||||
tsconfig-paths:
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0
|
||||
|
||||
packages/core:
|
||||
dependencies:
|
||||
|
@ -19805,7 +19805,7 @@ packages:
|
|||
engines: {node: '>=6'}
|
||||
dependencies:
|
||||
json5: 2.2.3
|
||||
minimist: 1.2.7
|
||||
minimist: 1.2.8
|
||||
strip-bom: 3.0.0
|
||||
dev: true
|
||||
|
||||
|
|
7
tsconfig.backend.json
Normal file
7
tsconfig.backend.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"types": ["node", "jest"],
|
||||
"noEmit": true,
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo"
|
||||
}
|
||||
}
|
15
tsconfig.build.json
Normal file
15
tsconfig.build.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"types": ["node"],
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
},
|
||||
"tsc-alias": {
|
||||
"replacers": {
|
||||
"base-url": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"incremental": true,
|
||||
"declaration": true,
|
||||
"declaration": false,
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue