refactor(core): Start modularizing the community packages feature (#17757)

This commit is contained in:
Iván Ovejero
2025-07-31 13:55:38 +02:00
committed by GitHub
parent 1ed8239625
commit 1d31e6a0c4
35 changed files with 171 additions and 172 deletions

View File

@@ -20,6 +20,7 @@ export const LOG_SCOPES = [
'workflow-activation',
'ssh-client',
'cron',
'community-nodes',
] as const;
export type LogScope = (typeof LOG_SCOPES)[number];

View File

@@ -1,4 +1,4 @@
import { Config, Env, Nested } from '../decorators';
import { Config, Env } from '../decorators';
function isStringArray(input: unknown): input is string[] {
return Array.isArray(input) && input.every((item) => typeof item === 'string');
@@ -20,33 +20,6 @@ class JsonStringArray extends Array<string> {
}
}
@Config
class CommunityPackagesConfig {
/** Whether to enable community packages */
@Env('N8N_COMMUNITY_PACKAGES_ENABLED')
enabled: boolean = true;
/** NPM registry URL to pull community packages from */
@Env('N8N_COMMUNITY_PACKAGES_REGISTRY')
registry: string = 'https://registry.npmjs.org';
/** Whether to reinstall any missing community packages */
@Env('N8N_REINSTALL_MISSING_PACKAGES')
reinstallMissing: boolean = false;
/** Whether to block installation of not verified packages */
@Env('N8N_UNVERIFIED_PACKAGES_ENABLED')
unverifiedEnabled: boolean = true;
/** Whether to enable and show search suggestion of packages verified by n8n */
@Env('N8N_VERIFIED_PACKAGES_ENABLED')
verifiedEnabled: boolean = true;
/** Whether to load community packages */
@Env('N8N_COMMUNITY_PACKAGES_PREVENT_LOADING')
preventLoading: boolean = false;
}
@Config
export class NodesConfig {
/** Node types to load. Includes all if unspecified. @example '["n8n-nodes-base.hackerNews"]' */
@@ -64,7 +37,4 @@ export class NodesConfig {
/** Whether to enable Python execution on the Code node. */
@Env('N8N_PYTHON_ENABLED')
pythonEnabled: boolean = true;
@Nested
communityPackages: CommunityPackagesConfig;
}

View File

@@ -138,14 +138,6 @@ describe('GlobalConfig', () => {
files: [],
},
nodes: {
communityPackages: {
enabled: true,
registry: 'https://registry.npmjs.org',
reinstallMissing: false,
unverifiedEnabled: true,
verifiedEnabled: true,
preventLoading: false,
},
errorTriggerType: 'n8n-nodes-base.errorTrigger',
include: [],
exclude: [],