mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Setup typescript project references across workflow, core, and cli (#4519)
* refactor: use consistent folder structure across workflow, core, and cli * setup typescript project references across workflow, core, and cli
This commit is contained in:
committed by
GitHub
parent
de96def372
commit
698d96a617
@@ -3,6 +3,12 @@
|
||||
*/
|
||||
module.exports = {
|
||||
extends: ['@n8n_io/eslint-config/base'],
|
||||
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: __dirname,
|
||||
},
|
||||
|
||||
rules: {
|
||||
'import/order': 'off', // TODO: remove this
|
||||
},
|
||||
|
||||
@@ -12,20 +12,21 @@
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/n8n-io/n8n.git"
|
||||
},
|
||||
"main": "dist/src/index.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "src/index.ts",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./dist/src/index.js",
|
||||
"require": "./dist/index.js",
|
||||
"import": "./src/index.ts",
|
||||
"types": "./dist/src/index.d.ts"
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "npm run watch",
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc",
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"format": "cd ../.. && node_modules/prettier/bin-prettier.js packages/workflow/**/**.ts --write",
|
||||
"lint": "eslint .",
|
||||
"lintfix": "eslint . --fix",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { IDataObject } from './Interfaces';
|
||||
import { ExecutionBaseError } from './NodeErrors';
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
import { NodeApiError, NodeOperationError } from './NodeErrors';
|
||||
import * as NodeHelpers from './NodeHelpers';
|
||||
|
||||
import type { Workflow } from '.';
|
||||
import type { Workflow } from './Workflow';
|
||||
|
||||
export class RoutingNode {
|
||||
additionalData: IWorkflowExecuteAdditionalData;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { toCronExpression } from '../src/Cron';
|
||||
import { toCronExpression } from '@/Cron';
|
||||
|
||||
describe('Cron', () => {
|
||||
describe('toCronExpression', () => {
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { Expression, Workflow } from '../src';
|
||||
import * as Helpers from './Helpers';
|
||||
import { DateTime, Duration, Interval } from 'luxon';
|
||||
import { Expression } from '@/Expression';
|
||||
import { Workflow } from '@/Workflow';
|
||||
import * as Helpers from './Helpers';
|
||||
|
||||
describe('Expression', () => {
|
||||
describe('getParameterValue()', () => {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import get from 'lodash.get';
|
||||
import {
|
||||
import type {
|
||||
CredentialInformation,
|
||||
IAdditionalCredentialOptions,
|
||||
IAllExecuteFunctions,
|
||||
IContextObject,
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentials,
|
||||
ICredentialsEncrypted,
|
||||
ICredentialsHelper,
|
||||
IDataObject,
|
||||
IExecuteData,
|
||||
IExecuteFunctions,
|
||||
@@ -32,13 +30,14 @@ import {
|
||||
IWorkflowDataProxyAdditionalKeys,
|
||||
IWorkflowDataProxyData,
|
||||
IWorkflowExecuteAdditionalData,
|
||||
NodeHelpers,
|
||||
NodeParameterValue,
|
||||
Workflow,
|
||||
WorkflowDataProxy,
|
||||
WorkflowExecuteMode,
|
||||
WorkflowHooks,
|
||||
} from '../src';
|
||||
} from '@/Interfaces';
|
||||
import { ICredentials, ICredentialsHelper } from '@/Interfaces';
|
||||
import { Workflow } from '@/Workflow';
|
||||
import { WorkflowDataProxy } from '@/WorkflowDataProxy';
|
||||
import { WorkflowHooks } from '@/WorkflowHooks';
|
||||
import * as NodeHelpers from '@/NodeHelpers';
|
||||
|
||||
export interface INodeTypesObject {
|
||||
[key: string]: INodeType;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { INodeParameters, INodeProperties, NodeHelpers } from '../src';
|
||||
import type { INodeParameters, INodeProperties } from '@/Interfaces';
|
||||
import { getNodeParameters } from '@/NodeHelpers';
|
||||
|
||||
describe('Workflow', () => {
|
||||
describe('NodeHelpers', () => {
|
||||
describe('getParameterValue', () => {
|
||||
const tests: Array<{
|
||||
description: string;
|
||||
@@ -3340,7 +3341,7 @@ describe('Workflow', () => {
|
||||
for (const testData of tests) {
|
||||
test(testData.description, () => {
|
||||
// returnDefaults: false | returnNoneDisplayed: false
|
||||
let result = NodeHelpers.getNodeParameters(
|
||||
let result = getNodeParameters(
|
||||
testData.input.nodePropertiesArray,
|
||||
testData.input.nodeValues,
|
||||
false,
|
||||
@@ -3350,7 +3351,7 @@ describe('Workflow', () => {
|
||||
expect(result).toEqual(testData.output.noneDisplayedFalse.defaultsFalse);
|
||||
|
||||
// returnDefaults: true | returnNoneDisplayed: false
|
||||
result = NodeHelpers.getNodeParameters(
|
||||
result = getNodeParameters(
|
||||
testData.input.nodePropertiesArray,
|
||||
testData.input.nodeValues,
|
||||
true,
|
||||
@@ -3360,7 +3361,7 @@ describe('Workflow', () => {
|
||||
expect(result).toEqual(testData.output.noneDisplayedFalse.defaultsTrue);
|
||||
|
||||
// returnDefaults: false | returnNoneDisplayed: true
|
||||
result = NodeHelpers.getNodeParameters(
|
||||
result = getNodeParameters(
|
||||
testData.input.nodePropertiesArray,
|
||||
testData.input.nodeValues,
|
||||
false,
|
||||
@@ -3370,7 +3371,7 @@ describe('Workflow', () => {
|
||||
expect(result).toEqual(testData.output.noneDisplayedTrue.defaultsFalse);
|
||||
|
||||
// returnDefaults: true | returnNoneDisplayed: true
|
||||
result = NodeHelpers.getNodeParameters(
|
||||
result = getNodeParameters(
|
||||
testData.input.nodePropertiesArray,
|
||||
testData.input.nodeValues,
|
||||
true,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { IDataObject, ObservableObject } from '../src';
|
||||
import type { IDataObject } from '@/Interfaces';
|
||||
import * as ObservableObject from '@/ObservableObject';
|
||||
|
||||
describe('ObservableObject', () => {
|
||||
test('should recognize that item on parent level got added (init empty)', () => {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
INode,
|
||||
INodeExecutionData,
|
||||
INodeParameters,
|
||||
DeclarativeRestApiSettings,
|
||||
IRunExecutionData,
|
||||
RoutingNode,
|
||||
Workflow,
|
||||
INodeProperties,
|
||||
IDataObject,
|
||||
IExecuteSingleFunctions,
|
||||
@@ -17,7 +15,9 @@ import {
|
||||
INodeCredentialDescription,
|
||||
IExecuteData,
|
||||
INodeTypeDescription,
|
||||
} from '../src';
|
||||
} from '@/Interfaces';
|
||||
import { RoutingNode } from '@/RoutingNode';
|
||||
import { Workflow } from '@/Workflow';
|
||||
|
||||
import * as Helpers from './Helpers';
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { v5 as uuidv5, v3 as uuidv3, v4 as uuidv4, v1 as uuidv1 } from 'uuid';
|
||||
import {
|
||||
ANONYMIZATION_CHARACTER as CHAR,
|
||||
getDomainBase,
|
||||
getDomainPath,
|
||||
} from '../src/TelemetryHelpers';
|
||||
import { ANONYMIZATION_CHARACTER as CHAR, getDomainBase, getDomainPath } from '@/TelemetryHelpers';
|
||||
|
||||
describe('getDomainBase should return protocol plus domain', () => {
|
||||
test('in valid URLs', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
IBinaryKeyData,
|
||||
IConnections,
|
||||
IDataObject,
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
INodeParameters,
|
||||
IRunExecutionData,
|
||||
NodeParameterValueType,
|
||||
Workflow,
|
||||
} from '../src';
|
||||
} from '@/Interfaces';
|
||||
import { Workflow } from '@/Workflow';
|
||||
|
||||
process.env.TEST_VARIABLE_1 = 'valueEnvVariable1';
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Workflow, WorkflowDataProxy } from '../src';
|
||||
import { IConnections, IExecuteData, INode, IRunExecutionData } from '@/Interfaces';
|
||||
import { Workflow } from '@/Workflow';
|
||||
import { WorkflowDataProxy } from '@/WorkflowDataProxy';
|
||||
import * as Helpers from './Helpers';
|
||||
import { IConnections, IExecuteData, INode, IRunExecutionData } from '../src/Interfaces';
|
||||
|
||||
describe('WorkflowDataProxy', () => {
|
||||
describe('test data proxy', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { jsonParse, deepCopy } from '../src/utils';
|
||||
import { jsonParse, deepCopy } from '@/utils';
|
||||
|
||||
describe('jsonParse', () => {
|
||||
it('parses JSON', () => {
|
||||
|
||||
12
packages/workflow/tsconfig.build.json
Normal file
12
packages/workflow/tsconfig.build.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"types": ["node"],
|
||||
"noEmit": false,
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["test/**"]
|
||||
}
|
||||
@@ -2,10 +2,16 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"types": ["node", "jest"],
|
||||
"composite": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
},
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
||||
// TODO: remove all options below this line
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
"include": ["src/**/*.ts", "test/**/*.ts"]
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": [
|
||||
"test/**/*.d.ts",
|
||||
"test/**/*"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user