From 50d80ee620e1c8aa138a5bdf503801cf0f80352f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 3 Jul 2025 13:32:57 +0200 Subject: [PATCH] refactor(core): Set up `@n8n/errors` package (#16918) --- codecov.yml | 1 + packages/@n8n/errors/eslint.config.mjs | 8 ++++++++ packages/@n8n/errors/package.json | 26 ++++++++++++++++++++++++ packages/@n8n/errors/src/index.ts | 1 + packages/@n8n/errors/tsconfig.build.json | 11 ++++++++++ packages/@n8n/errors/tsconfig.json | 12 +++++++++++ packages/cli/package.json | 1 + packages/cli/tsconfig.json | 1 + pnpm-lock.yaml | 17 ++++++++++++---- 9 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 packages/@n8n/errors/eslint.config.mjs create mode 100644 packages/@n8n/errors/package.json create mode 100644 packages/@n8n/errors/src/index.ts create mode 100644 packages/@n8n/errors/tsconfig.build.json create mode 100644 packages/@n8n/errors/tsconfig.json diff --git a/codecov.yml b/codecov.yml index 6b4f6e3f13..3d0b6896de 100644 --- a/codecov.yml +++ b/codecov.yml @@ -36,6 +36,7 @@ component_management: - packages/@n8n/constants/** - packages/@n8n/backend-common/** - packages/@n8n/backend-test-utils/** + - packages/@n8n/errors/** - packages/@n8n/db/** - packages/@n8n/di/** - packages/@n8n/imap/** diff --git a/packages/@n8n/errors/eslint.config.mjs b/packages/@n8n/errors/eslint.config.mjs new file mode 100644 index 0000000000..541ae772bb --- /dev/null +++ b/packages/@n8n/errors/eslint.config.mjs @@ -0,0 +1,8 @@ +import { defineConfig } from 'eslint/config'; +import { baseConfig } from '@n8n/eslint-config/base'; + +export default defineConfig(baseConfig, { + rules: { + 'unicorn/filename-case': ['error', { case: 'kebabCase' }], + }, +}); diff --git a/packages/@n8n/errors/package.json b/packages/@n8n/errors/package.json new file mode 100644 index 0000000000..528a656731 --- /dev/null +++ b/packages/@n8n/errors/package.json @@ -0,0 +1,26 @@ +{ + "name": "@n8n/errors", + "version": "0.1.0", + "scripts": { + "clean": "rimraf dist .turbo", + "dev": "pnpm watch", + "typecheck": "tsc --noEmit", + "build": "tsc -p tsconfig.build.json", + "format": "biome format --write .", + "format:check": "biome ci .", + "lint": "eslint . --quiet", + "lintfix": "eslint . --fix", + "watch": "tsc -p tsconfig.build.json --watch", + "test": "jest", + "test:dev": "jest --watch" + }, + "main": "dist/index.js", + "module": "src/index.ts", + "types": "dist/index.d.ts", + "files": [ + "dist/**/*" + ], + "devDependencies": { + "@n8n/typescript-config": "workspace:*" + } +} \ No newline at end of file diff --git a/packages/@n8n/errors/src/index.ts b/packages/@n8n/errors/src/index.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/@n8n/errors/src/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@n8n/errors/tsconfig.build.json b/packages/@n8n/errors/tsconfig.build.json new file mode 100644 index 0000000000..ee0e3e20fd --- /dev/null +++ b/packages/@n8n/errors/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": ["./tsconfig.json", "@n8n/typescript-config/tsconfig.build.json"], + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/build.tsbuildinfo" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/__tests__/**"] +} diff --git a/packages/@n8n/errors/tsconfig.json b/packages/@n8n/errors/tsconfig.json new file mode 100644 index 0000000000..eca44d32aa --- /dev/null +++ b/packages/@n8n/errors/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "@n8n/typescript-config/tsconfig.common.json", + "compilerOptions": { + "rootDir": ".", + "types": ["node", "jest"], + "baseUrl": "src", + "tsBuildInfoFile": "dist/typecheck.tsbuildinfo", + "experimentalDecorators": true, + "emitDecoratorMetadata": true + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/cli/package.json b/packages/cli/package.json index 3435e9c50c..abd4ef01bf 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -94,6 +94,7 @@ "@n8n/db": "workspace:^", "@n8n/decorators": "workspace:*", "@n8n/di": "workspace:*", + "@n8n/errors": "workspace:*", "@n8n/backend-test-utils": "workspace:^", "@n8n/localtunnel": "3.0.0", "@n8n/n8n-nodes-langchain": "workspace:*", diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index c358ae0f8f..e880f47585 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -29,6 +29,7 @@ { "path": "../@n8n/constants/tsconfig.build.json" }, { "path": "../@n8n/decorators/tsconfig.build.json" }, { "path": "../@n8n/db/tsconfig.build.json" }, + { "path": "../@n8n/errors/tsconfig.build.json" }, { "path": "../@n8n/backend-common/tsconfig.build.json" }, { "path": "../@n8n/backend-test-utils/tsconfig.build.json" }, { "path": "../@n8n/di/tsconfig.build.json" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8ad631ddd8..f06909af34 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -685,6 +685,12 @@ importers: specifier: workspace:* version: link:../typescript-config + packages/@n8n/errors: + devDependencies: + '@n8n/typescript-config': + specifier: workspace:* + version: link:../typescript-config + packages/@n8n/eslint-config: dependencies: eslint: @@ -1259,6 +1265,9 @@ importers: '@n8n/di': specifier: workspace:* version: link:../@n8n/di + '@n8n/errors': + specifier: workspace:* + version: link:../@n8n/errors '@n8n/localtunnel': specifier: 3.0.0 version: 3.0.0 @@ -15152,8 +15161,8 @@ packages: vue-component-type-helpers@2.2.10: resolution: {integrity: sha512-iDUO7uQK+Sab2tYuiP9D1oLujCWlhHELHMgV/cB13cuGbG4qwkLHvtfWb6FzvxrIOPDnU0oHsz2MlQjhYDeaHA==} - vue-component-type-helpers@3.0.0: - resolution: {integrity: sha512-J1HtqhZIqmYoNg4SLcYVFdCdsVUkMo4Z6/Wx4sQMfY8TFIIqDmd3mS2whfBIKzAA7dHMexarwYbvtB/fOUuEsw==} + vue-component-type-helpers@3.0.1: + resolution: {integrity: sha512-j23mCB5iEbGsyIhnVdXdWUOg+UdwmVxpKnYYf2j+4ppCt5VSFXKjwu9YFt0QYxUaf5G99PuHsVfRScjHCRSsGQ==} vue-demi@0.14.10: resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==} @@ -20572,7 +20581,7 @@ snapshots: ts-dedent: 2.2.0 type-fest: 2.19.0 vue: 3.5.13(typescript@5.8.3) - vue-component-type-helpers: 3.0.0 + vue-component-type-helpers: 3.0.1 '@stylistic/eslint-plugin@5.0.0(eslint@9.29.0(jiti@1.21.7))': dependencies: @@ -31002,7 +31011,7 @@ snapshots: vue-component-type-helpers@2.2.10: {} - vue-component-type-helpers@3.0.0: {} + vue-component-type-helpers@3.0.1: {} vue-demi@0.14.10(vue@3.5.13(typescript@5.8.3)): dependencies: