refactor: Accumulate loadOptions from all node versions to validate (no-changelog) (#6014)

 Accumulate loadOptions from node versions to validate
This commit is contained in:
Iván Ovejero
2023-04-20 16:21:07 +02:00
committed by GitHub
parent 723f81bab0
commit 9b651cf4f8
2 changed files with 13 additions and 9 deletions

View File

@@ -44,8 +44,6 @@ export abstract class DirectoryLoader {
types: Types = { nodes: [], credentials: [] };
withLoadOptionsMethods = false; // only for validation during build
constructor(
readonly directory: string,
protected readonly excludeNodes: string[] = [],
@@ -102,10 +100,13 @@ export abstract class DirectoryLoader {
this.fixIconPath(versionNode.description, filePath);
}
for (const version of Object.values(tempNode.nodeVersions)) {
this.addLoadOptionsMethods(version);
}
const currentVersionNode = tempNode.nodeVersions[tempNode.currentVersion];
this.addCodex({ node: currentVersionNode, filePath, isCustom });
nodeVersion = tempNode.currentVersion;
if (this.withLoadOptionsMethods) this.addLoadOptionsMethods(currentVersionNode);
if (currentVersionNode.hasOwnProperty('executeSingle')) {
Logger.warn(
@@ -114,7 +115,7 @@ export abstract class DirectoryLoader {
);
}
} else {
if (this.withLoadOptionsMethods) this.addLoadOptionsMethods(tempNode);
this.addLoadOptionsMethods(tempNode);
// Short renaming to avoid type issues
nodeVersion = Array.isArray(tempNode.description.version)
@@ -306,9 +307,7 @@ export class PackageDirectoryLoader extends DirectoryLoader {
this.packageName = this.packageJson.name;
}
override async loadAll(options = { withLoadOptionsMethods: false }) {
this.withLoadOptionsMethods = options.withLoadOptionsMethods;
override async loadAll() {
await this.readPackageJson();
const { n8n } = this.packageJson;