Skip to content

Commit

Permalink
ci: Consistent tsconfig setup for backend packages and fix pnpm typec…
Browse files Browse the repository at this point in the history
…heck for composite packages (no-changelog) (#9604)

Co-authored-by: Iván Ovejero <[email protected]>
  • Loading branch information
netroy and ivov authored Jun 5, 2024
1 parent 84f091d commit 044607e
Show file tree
Hide file tree
Showing 29 changed files with 39 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci-pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
- name: Build
run: pnpm build

- name: Run typecheck
run: pnpm typecheck

- name: Cache build artifacts
uses: actions/cache/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "turbo run build",
"build:backend": "pnpm --filter=!@n8n/chat --filter=!@n8n/codemirror-lang --filter=!n8n-design-system --filter=!n8n-editor-ui build",
"build:frontend": "pnpm --filter=@n8n/chat --filter=@n8n/codemirror-lang --filter=n8n-design-system --filter=n8n-editor-ui build",
"typecheck": "turbo run typecheck",
"typecheck": "pnpm --filter=!@n8n/chat --filter=!@n8n/storybook --filter=!n8n-core --filter=!n8n-editor-ui --filter=!n8n-workflow --filter=!n8n typecheck",
"dev": "turbo run dev --parallel --filter=!n8n-design-system --filter=!@n8n/chat",
"dev:ai": "turbo run dev --parallel --filter=@n8n/nodes-langchain --filter=n8n --filter=n8n-core",
"clean": "turbo run clean --parallel",
Expand All @@ -26,7 +26,7 @@
"start:tunnel": "./packages/cli/bin/n8n start --tunnel",
"start:windows": "cd packages/cli/bin && n8n",
"test": "turbo run test",
"test:backend": "pnpm --filter=!@n8n/chat --filter=!@n8n/codemirror-lang --filter=!n8n-design-system --filter=!n8n-editor-ui --filter=!n8n-nodes-base test --filter=!@n8n/n8n-nodes-langchain test",
"test:backend": "pnpm --filter=!@n8n/chat --filter=!@n8n/codemirror-lang --filter=!n8n-design-system --filter=!n8n-editor-ui --filter=!n8n-nodes-base --filter=!@n8n/n8n-nodes-langchain test",
"test:nodes": "pnpm --filter=n8n-nodes-base --filter=@n8n/n8n-nodes-langchain test",
"test:frontend": "pnpm --filter=@n8n/chat --filter=@n8n/codemirror-lang --filter=n8n-design-system --filter=n8n-editor-ui test",
"watch": "turbo run watch --parallel",
Expand Down
2 changes: 1 addition & 1 deletion packages/@n8n/client-oauth2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"clean": "rimraf dist .turbo",
"dev": "pnpm watch",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write . --ignore-path ../../../.prettierignore",
"lint": "eslint . --quiet",
Expand Down
1 change: 1 addition & 0 deletions packages/@n8n/client-oauth2/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": ["./tsconfig.json", "../../../tsconfig.build.json"],
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/build.tsbuildinfo"
Expand Down
2 changes: 0 additions & 2 deletions packages/@n8n/client-oauth2/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"compilerOptions": {
"rootDir": ".",
"types": ["node", "jest"],
"composite": true,
"noEmit": true,
"baseUrl": "src",
"paths": {
"@/*": ["./*"]
Expand Down
3 changes: 1 addition & 2 deletions packages/@n8n/codemirror-lang/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"extends": "../../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
"strict": true
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo"
},
"include": ["src/**/*.ts", "test/**/*.ts"]
}
2 changes: 1 addition & 1 deletion packages/@n8n/imap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"clean": "rimraf dist .turbo",
"dev": "pnpm watch",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write . --ignore-path ../../../.prettierignore",
"lint": "eslint . --quiet",
Expand Down
1 change: 1 addition & 0 deletions packages/@n8n/imap/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": ["./tsconfig.json", "../../../tsconfig.build.json"],
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/build.tsbuildinfo"
Expand Down
2 changes: 0 additions & 2 deletions packages/@n8n/imap/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"compilerOptions": {
"rootDir": ".",
"types": ["node", "jest"],
"composite": true,
"noEmit": true,
"baseUrl": "src",
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@n8n/nodes-langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"clean": "rimraf dist .turbo",
"dev": "pnpm run watch",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json && pnpm n8n-copy-icons && pnpm build:metadata",
"build:metadata": "pnpm n8n-generate-known && pnpm n8n-generate-ui-types",
"format": "prettier nodes credentials --write",
Expand Down
5 changes: 1 addition & 4 deletions packages/@n8n/nodes-langchain/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"extends": ["./tsconfig.json"],
"extends": ["./tsconfig.json", "../../../tsconfig.build.json"],
"compilerOptions": {
"types": ["node"],
"noEmit": false,
"declaration": true,
"outDir": "dist",
"tsBuildInfoFile": "dist/build.tsbuildinfo"
},
Expand Down
30 changes: 10 additions & 20 deletions packages/@n8n/nodes-langchain/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
{
"extends": ["../../../tsconfig.json", "../../../tsconfig.backend.json"],
"compilerOptions": {
"strict": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es2019",
"lib": ["es2019", "es2020", "es2022.error"],
"removeComments": true,
"useUnknownInCatchVariables": false,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"preserveConstEnums": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"incremental": true,
"declaration": true,
"sourceMap": true,
"skipLibCheck": true,
"outDir": "./dist/"
"lib": ["es2020", "es2022.error"],
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
// TODO: remove all options below this line
"useUnknownInCatchVariables": false
},
"include": ["credentials/**/*", "nodes/**/*", "utils/**/*.ts", "nodes/**/*.json", "types/*.ts"]
"include": ["credentials/**/*", "nodes/**/*", "utils/**/*.ts", "nodes/**/*.json", "types/*.ts"],
"references": [
{ "path": "../../workflow/tsconfig.build.json" },
{ "path": "../../core/tsconfig.build.json" }
]
}
2 changes: 1 addition & 1 deletion packages/@n8n/permissions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"clean": "rimraf dist .turbo",
"dev": "pnpm watch",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write . --ignore-path ../../../.prettierignore",
"lint": "eslint . --quiet",
Expand Down
1 change: 1 addition & 0 deletions packages/@n8n/permissions/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": ["./tsconfig.json", "../../../tsconfig.build.json"],
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/build.tsbuildinfo"
Expand Down
2 changes: 0 additions & 2 deletions packages/@n8n/permissions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"compilerOptions": {
"rootDir": ".",
"types": ["node", "jest"],
"composite": true,
"noEmit": true,
"baseUrl": "src",
"paths": {
"@/*": ["./*"]
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"scripts": {
"clean": "rimraf dist .turbo",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node scripts/build.mjs",
"buildAndDev": "pnpm run build && pnpm run dev",
"dev": "concurrently -k -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold\" \"npm run watch\" \"nodemon\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"scripts": {
"clean": "rimraf dist .turbo",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json",
"dev": "pnpm watch",
"format": "prettier --write . --ignore-path ../../.prettierignore",
Expand Down
1 change: 1 addition & 0 deletions packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": ["./tsconfig.json", "../../tsconfig.build.json"],
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/build.tsbuildinfo"
Expand Down
1 change: 0 additions & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": ["../../tsconfig.json", "../../tsconfig.backend.json"],
"compilerOptions": {
"rootDir": ".",
"composite": true,
"baseUrl": "src",
"paths": {
"@/*": ["./*"]
Expand Down
4 changes: 2 additions & 2 deletions packages/design-system/src/mixins/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { t } from '../locale';

export default {
methods: {
t(path: string, ...args: string[]) {
return t.call(this, path, ...args);
t(path: string, options: object) {
return t.call(this, path, options);
},
},
};
1 change: 0 additions & 1 deletion packages/design-system/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
// TODO: remove all options below this line
"strict": false,
"noImplicitAny": false,
"noImplicitReturns": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { apiUrl } from '../Peekalink.node';
import type { WorkflowTestData } from '@test/nodes/types';
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
import * as Helpers from '@test/nodes/Helpers';
import { NodeConnectionType } from 'n8n-workflow';

describe('Peekalink Node', () => {
const exampleComPreview = {
Expand Down Expand Up @@ -57,7 +58,7 @@ describe('Peekalink Node', () => {
[
{
node: 'Peekalink',
type: 'main',
type: NodeConnectionType.Main,
index: 0,
},
],
Expand Down Expand Up @@ -129,7 +130,7 @@ describe('Peekalink Node', () => {
[
{
node: 'Peekalink',
type: 'main',
type: NodeConnectionType.Main,
index: 0,
},
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-loop-func */
import type { IDataObject } from 'n8n-workflow';
import { NodeConnectionType, type IDataObject } from 'n8n-workflow';
import type { WorkflowTestData } from '@test/nodes/types';
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
import * as Helpers from '@test/nodes/Helpers';
Expand Down Expand Up @@ -49,12 +49,12 @@ describe('Execute Stop and Error Node', () => {
[
{
node: 'Stop and Error1',
type: 'main',
type: NodeConnectionType.Main,
index: 0,
},
{
node: 'Stop and Error',
type: 'main',
type: NodeConnectionType.Main,
index: 0,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"clean": "rimraf dist .turbo",
"dev": "pnpm watch",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && pnpm n8n-copy-icons && pnpm n8n-generate-translations && pnpm build:metadata",
"build:metadata": "pnpm n8n-generate-known && pnpm n8n-generate-ui-types",
"format": "prettier --write . --ignore-path ../../.prettierignore",
Expand Down
2 changes: 1 addition & 1 deletion packages/workflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"scripts": {
"clean": "rimraf dist .turbo",
"dev": "pnpm watch",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write . --ignore-path ../../.prettierignore",
"lint": "eslint . --quiet",
Expand Down
1 change: 1 addition & 0 deletions packages/workflow/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": ["./tsconfig.json", "../../tsconfig.build.json"],
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/build.tsbuildinfo"
Expand Down
1 change: 0 additions & 1 deletion packages/workflow/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"composite": true,
"baseUrl": "src",
"paths": {
"@/*": ["./*"]
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.backend.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"types": ["node", "jest"],
"noEmit": true
"types": ["node", "jest"]
}
}
1 change: 0 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"types": ["node"],
"noEmit": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"declaration": true
Expand Down

0 comments on commit 044607e

Please sign in to comment.