mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-23 10:32:17 -08:00
⚡ Simplify config imports in cli package (#1840)
* ⚡ Set path alias for config * ⚡ Update config export * ⚡ Simplify config imports * ⚡ Update also additional imports * ⚡ Update path in collation migration * ⚡ Resolve aliased paths * 👕 Fix Codacy issue * 👕 Retry to fix Codacy issue Co-authored-by: Jan <janober@users.noreply.github.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
07a3dbb372
commit
c21c8b3369
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var alias = require('module-alias');
|
||||
var path = require('path'); // tslint:disable-line:no-var-keyword
|
||||
alias(path.resolve(__dirname, "../"));
|
||||
|
||||
// Make sure that it also find the config folder when it
|
||||
// did get started from another folder that the root one.
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Command, flags } from '@oclif/command';
|
|||
const open = require('open');
|
||||
import * as Redis from 'ioredis';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
ActiveWorkflowRunner,
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
import { Command, flags } from '@oclif/command';
|
||||
import * as Redis from 'ioredis';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
ActiveWorkflowRunner,
|
||||
|
|
|
@ -45,7 +45,7 @@ import {
|
|||
LoggerProxy,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import * as Bull from 'bull';
|
||||
import * as Queue from '../src/Queue';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as core from 'n8n-core';
|
|||
|
||||
dotenv.config();
|
||||
|
||||
const config = convict({
|
||||
export const config = convict({
|
||||
|
||||
database: {
|
||||
type: {
|
||||
|
@ -633,4 +633,3 @@ config.validate({
|
|||
allowed: 'strict',
|
||||
});
|
||||
|
||||
export = config;
|
||||
|
|
|
@ -105,6 +105,7 @@
|
|||
"jwks-rsa": "~1.12.1",
|
||||
"localtunnel": "^2.0.0",
|
||||
"lodash.get": "^4.4.2",
|
||||
"module-alias": "^2.2.2",
|
||||
"mysql2": "~2.2.0",
|
||||
"n8n-core": "~0.75.0",
|
||||
"n8n-editor-ui": "~0.95.0",
|
||||
|
@ -121,6 +122,9 @@
|
|||
"typeorm": "^0.2.30",
|
||||
"winston": "^3.3.3"
|
||||
},
|
||||
"_moduleAliases": {
|
||||
"@config": "./dist/config/index.js"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
|
||||
import { TlsOptions } from 'tls';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
|
||||
import { entities } from './databases/entities';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
IExternalHooksFunctions,
|
||||
} from './';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
|
||||
|
||||
class ExternalHooksClass implements IExternalHooksClass {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import * as express from 'express';
|
||||
import { join as pathJoin } from 'path';
|
||||
import { readFile as fsReadFile } from 'fs/promises';
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
LoggerProxy,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
|
||||
import {
|
||||
getLogger,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import config = require('../config');
|
||||
import { config } from '@config';
|
||||
import * as winston from 'winston';
|
||||
|
||||
import {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as Bull from 'bull';
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import { IBullJobData } from './Interfaces';
|
||||
|
||||
export class Queue {
|
||||
|
|
|
@ -101,7 +101,7 @@ import {
|
|||
|
||||
import * as basicAuth from 'basic-auth';
|
||||
import * as compression from 'compression';
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import * as jwt from 'jsonwebtoken';
|
||||
import * as jwks from 'jwks-rsa';
|
||||
// @ts-ignore
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
} from './';
|
||||
|
||||
import * as compression from 'compression';
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import * as parseUrl from 'parseurl';
|
||||
|
||||
export function registerProductionWebhooks() {
|
||||
|
|
|
@ -43,7 +43,7 @@ import {
|
|||
WorkflowHooks,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
|
||||
import { LessThanOrEqual } from 'typeorm';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
LoggerProxy as Logger,
|
||||
Workflow,} from 'n8n-workflow';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
||||
import { validate } from 'class-validator';
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import {
|
|||
WorkflowOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
import * as PCancelable from 'p-cancelable';
|
||||
import { join as pathJoin } from 'path';
|
||||
import { fork } from 'child_process';
|
||||
|
|
|
@ -38,7 +38,7 @@ import {
|
|||
getLogger,
|
||||
} from '../src/Logger';
|
||||
|
||||
import * as config from '../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class WorkflowRunnerProcess {
|
||||
data: IWorkflowExecutionDataProcessWithExecution | undefined;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class InitialMigration1588157391238 implements MigrationInterface {
|
||||
name = 'InitialMigration1588157391238';
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
QueryRunner,
|
||||
} from 'typeorm';
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class WebhookModel1592447867632 implements MigrationInterface {
|
||||
name = 'WebhookModel1592447867632';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class CreateIndexStoppedAt1594902918301 implements MigrationInterface {
|
||||
name = 'CreateIndexStoppedAt1594902918301';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class MakeStoppedAtNullable1607431743767 implements MigrationInterface {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class AddWebhookId1611149998770 implements MigrationInterface {
|
||||
name = 'AddWebhookId1611149998770';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class ChangeDataSize1615306975123 implements MigrationInterface {
|
||||
name = 'ChangeDataSize1615306975123';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class CreateTagEntity1617268711084 implements MigrationInterface {
|
||||
name = 'CreateTagEntity1617268711084';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class ChangeCredentialDataSize1620729500000 implements MigrationInterface {
|
||||
name = 'ChangeCredentialDataSize1620729500000';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import config = require("../../../../config");
|
||||
import { config } from '@config';
|
||||
|
||||
export class UniqueWorkflowNames1620826335440 implements MigrationInterface {
|
||||
name = 'UniqueWorkflowNames1620826335440';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
import config = require('../../../../config');
|
||||
import { config } from '@config';
|
||||
|
||||
export class CertifyCorrectCollation1623936588000 implements MigrationInterface {
|
||||
name = 'CertifyCorrectCollation1623936588000';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class InitialMigration1587669153312 implements MigrationInterface {
|
||||
name = 'InitialMigration1587669153312';
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
QueryRunner,
|
||||
} from 'typeorm';
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class WebhookModel1589476000887 implements MigrationInterface {
|
||||
name = 'WebhookModel1589476000887';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class CreateIndexStoppedAt1594828256133 implements MigrationInterface {
|
||||
name = 'CreateIndexStoppedAt1594828256133';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class MakeStoppedAtNullable1607431743768 implements MigrationInterface {
|
||||
name = 'MakeStoppedAtNullable1607431743768';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class AddWebhookId1611144599516 implements MigrationInterface {
|
||||
name = 'AddWebhookId1611144599516';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class CreateTagEntity1617270242566 implements MigrationInterface {
|
||||
name = 'CreateTagEntity1617270242566';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import config = require("../../../../config");
|
||||
import { config } from '@config';
|
||||
|
||||
export class UniqueWorkflowNames1620824779533 implements MigrationInterface {
|
||||
name = 'UniqueWorkflowNames1620824779533';
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
QueryRunner,
|
||||
} from 'typeorm';
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class InitialMigration1588102412422 implements MigrationInterface {
|
||||
name = 'InitialMigration1588102412422';
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
QueryRunner,
|
||||
} from 'typeorm';
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class WebhookModel1592445003908 implements MigrationInterface {
|
||||
name = 'WebhookModel1592445003908';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class CreateIndexStoppedAt1594825041918 implements MigrationInterface {
|
||||
name = 'CreateIndexStoppedAt1594825041918';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class MakeStoppedAtNullable1607431743769 implements MigrationInterface {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class AddWebhookId1611071044839 implements MigrationInterface {
|
||||
name = 'AddWebhookId1611071044839';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import * as config from '../../../../config';
|
||||
import { config } from '@config';
|
||||
|
||||
export class CreateTagEntity1617213344594 implements MigrationInterface {
|
||||
name = 'CreateTagEntity1617213344594';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
import config = require("../../../../config");
|
||||
import { config } from '@config';
|
||||
|
||||
export class UniqueWorkflowNames1620821879465 implements MigrationInterface {
|
||||
name = 'UniqueWorkflowNames1620821879465';
|
||||
|
|
|
@ -19,7 +19,13 @@
|
|||
"target": "es2017",
|
||||
"sourceMap": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true
|
||||
"experimentalDecorators": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@config": [
|
||||
"config/index"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"**/*.d.ts",
|
||||
|
|
Loading…
Reference in a new issue