n8n/packages/core/bin/generate-node-defs
Mutasem Aldmour 76f52b0988
feat(ai-builder): Add code-base workflow builder and related changes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 07:32:04 +01:00

37 lines
1.1 KiB
JavaScript
Executable File

#!/usr/bin/env node
const path = require('path');
const fs = require('fs');
const { orchestrateGeneration } = require('@n8n/workflow-sdk/dist/generate-types/generate-types');
const cwd = process.cwd();
const nodesJsonPath = path.join(cwd, 'dist', 'types', 'nodes.json');
const outputDir = path.join(cwd, 'dist', 'node-definitions');
if (!fs.existsSync(nodesJsonPath)) {
console.error(`nodes.json not found at ${nodesJsonPath}`);
process.exit(1);
}
(async () => {
const content = await fs.promises.readFile(nodesJsonPath, 'utf-8');
const nodes = JSON.parse(content);
const packageJsonPath = path.join(cwd, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
const packageName = packageJson.name;
for (const node of nodes) {
if (!node.name.includes('.')) {
node.name = `${packageName}.${node.name}`;
}
}
const result = await orchestrateGeneration({ nodes, outputDir });
console.log(`Generated node definitions for ${result.nodeCount} nodes in ${outputDir}`);
})().catch((error) => {
console.error('Node definition generation failed:', error);
process.exit(1);
});