first commit

This commit is contained in:
2025-10-26 23:10:15 +08:00
commit 8f0345b7be
14961 changed files with 2356381 additions and 0 deletions

8
node_modules/@n8n/node-cli/dist/commands/build.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { Command } from '@oclif/core';
export default class Build extends Command {
static description: string;
static examples: string[];
static flags: {};
run(): Promise<void>;
}
export declare function copyStaticFiles(): Promise<void[]>;

62
node_modules/@n8n/node-cli/dist/commands/build.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyStaticFiles = copyStaticFiles;
const prompts_1 = require("@clack/prompts");
const core_1 = require("@oclif/core");
const fast_glob_1 = __importDefault(require("fast-glob"));
const promises_1 = require("node:fs/promises");
const node_path_1 = __importDefault(require("node:path"));
const picocolors_1 = __importDefault(require("picocolors"));
const rimraf_1 = require("rimraf");
const child_process_1 = require("../utils/child-process");
const prompts_2 = require("../utils/prompts");
class Build extends core_1.Command {
async run() {
await this.parse(Build);
const commandName = 'n8n-node build';
(0, prompts_1.intro)(picocolors_1.default.inverse(` ${commandName} `));
await (0, prompts_2.ensureN8nPackage)(commandName);
const buildSpinner = (0, prompts_1.spinner)();
buildSpinner.start('Building TypeScript files');
await (0, rimraf_1.rimraf)('dist');
try {
await runTscBuild();
buildSpinner.stop('TypeScript build successful');
}
catch (error) {
(0, prompts_1.cancel)('TypeScript build failed');
this.exit(1);
}
const copyStaticFilesSpinner = (0, prompts_1.spinner)();
copyStaticFilesSpinner.start('Copying static files');
await copyStaticFiles();
copyStaticFilesSpinner.stop('Copied static files');
(0, prompts_1.outro)('✓ Build successful');
}
}
Build.description = 'Compile the node in the current directory and copy assets';
Build.examples = ['<%= config.bin %> <%= command.id %>'];
Build.flags = {};
exports.default = Build;
async function runTscBuild() {
return await (0, child_process_1.runCommand)('tsc', [], {
context: 'local',
printOutput: ({ stdout, stderr }) => {
prompts_1.log.error(stdout.concat(stderr).toString());
},
});
}
async function copyStaticFiles() {
const staticFiles = fast_glob_1.default.sync(['**/*.{png,svg}', '**/__schema__/**/*.json'], {
ignore: ['dist', 'node_modules'],
});
return await Promise.all(staticFiles.map(async (filePath) => {
const destPath = node_path_1.default.join('dist', filePath);
await (0, promises_1.mkdir)(node_path_1.default.dirname(destPath), { recursive: true });
return await (0, promises_1.cp)(filePath, destPath, { recursive: true });
}));
}
//# sourceMappingURL=build.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":";;;;;AAsDA,0CAYC;AAlED,4CAAoE;AACpE,sCAAsC;AACtC,0DAA6B;AAC7B,+CAA6C;AAC7C,0DAA6B;AAC7B,4DAAoC;AACpC,mCAAgC;AAEhC,0DAAoD;AACpD,8CAAoD;AAEpD,MAAqB,KAAM,SAAQ,cAAO;IAKzC,KAAK,CAAC,GAAG;QACR,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAExB,MAAM,WAAW,GAAG,gBAAgB,CAAC;QACrC,IAAA,eAAK,EAAC,oBAAU,CAAC,OAAO,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC;QAE9C,MAAM,IAAA,0BAAgB,EAAC,WAAW,CAAC,CAAC;QAEpC,MAAM,YAAY,GAAG,IAAA,iBAAO,GAAE,CAAC;QAC/B,YAAY,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAChD,MAAM,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC;QAErB,IAAI,CAAC;YACJ,MAAM,WAAW,EAAE,CAAC;YACpB,YAAY,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAA,gBAAM,EAAC,yBAAyB,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,CAA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E,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CACF,CAAC;AACH,CAAC"}

View File

@@ -0,0 +1,14 @@
import { Command } from '@oclif/core';
export default class CloudSupport extends Command {
static description: string;
static examples: string[];
static args: {
action: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
};
run(): Promise<void>;
private enableCloudSupport;
private disableCloudSupport;
private updateEslintConfig;
private updateStrictMode;
private showCloudSupportStatus;
}

View File

@@ -0,0 +1,136 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const prompts_1 = require("@clack/prompts");
const core_1 = require("@oclif/core");
const promises_1 = __importDefault(require("node:fs/promises"));
const node_path_1 = __importDefault(require("node:path"));
const picocolors_1 = __importDefault(require("picocolors"));
const command_suggestions_1 = require("../utils/command-suggestions");
const package_1 = require("../utils/package");
const prompts_2 = require("../utils/prompts");
class CloudSupport extends core_1.Command {
async run() {
const { args } = await this.parse(CloudSupport);
await (0, prompts_2.ensureN8nPackage)('cloud-support');
const workingDir = process.cwd();
if (args.action === 'enable') {
await this.enableCloudSupport(workingDir);
}
else if (args.action === 'disable') {
await this.disableCloudSupport(workingDir);
}
else {
await this.showCloudSupportStatus(workingDir);
}
}
async enableCloudSupport(workingDir) {
(0, prompts_1.intro)(picocolors_1.default.inverse(' n8n-node cloud-support enable '));
await this.updateEslintConfig(workingDir, true);
prompts_1.log.success(`Updated ${picocolors_1.default.cyan('eslint.config.mjs')} to use default config`);
await this.updateStrictMode(workingDir, true);
prompts_1.log.success(`Enabled strict mode in ${picocolors_1.default.cyan('package.json')}`);
const lintCommand = await (0, command_suggestions_1.suggestLintCommand)();
(0, prompts_1.outro)(`Cloud support enabled. Run "${lintCommand}" to check compliance - your node must pass linting to be eligible for n8n Cloud publishing.`);
}
async disableCloudSupport(workingDir) {
(0, prompts_1.intro)(picocolors_1.default.inverse(' n8n-node cloud-support disable '));
prompts_1.log.warning(`This will make your node ineligible for n8n Cloud verification!
The following changes will be made:
• Switch to ${picocolors_1.default.magenta('configWithoutCloudSupport')} in ${picocolors_1.default.cyan('eslint.config.mjs')}
• Disable strict mode in ${picocolors_1.default.cyan('package.json')}`);
const confirmed = await (0, prompts_2.withCancelHandler)((0, prompts_1.confirm)({
message: 'Are you sure you want to disable cloud support?',
initialValue: false,
}));
if (!confirmed) {
(0, prompts_2.onCancel)('Cloud support unchanged');
return;
}
await this.updateEslintConfig(workingDir, false);
prompts_1.log.success(`Updated ${picocolors_1.default.cyan('eslint.config.mjs')} to use ${picocolors_1.default.magenta('configWithoutCloudSupport')}`);
await this.updateStrictMode(workingDir, false);
prompts_1.log.success(`Disabled strict mode in ${picocolors_1.default.cyan('package.json')}`);
(0, prompts_1.outro)("Cloud support disabled. Your node may pass linting but it won't pass verification for n8n Cloud.");
}
async updateEslintConfig(workingDir, enableCloud) {
const eslintConfigPath = node_path_1.default.resolve(workingDir, 'eslint.config.mjs');
const newConfig = enableCloud
? `import { config } from '@n8n/node-cli/eslint';
export default config;
`
: `import { configWithoutCloudSupport } from '@n8n/node-cli/eslint';
export default configWithoutCloudSupport;
`;
await promises_1.default.writeFile(eslintConfigPath, newConfig, 'utf-8');
}
async updateStrictMode(workingDir, enableStrict) {
await (0, package_1.updatePackageJson)(workingDir, (packageJson) => {
packageJson.n8n = packageJson.n8n ?? {};
packageJson.n8n.strict = enableStrict;
return packageJson;
});
}
async showCloudSupportStatus(workingDir) {
(0, prompts_1.intro)(picocolors_1.default.inverse(' n8n-node cloud-support '));
try {
const packageJson = await (0, package_1.getPackageJson)(workingDir);
const eslintConfigPath = node_path_1.default.resolve(workingDir, 'eslint.config.mjs');
const isStrictMode = packageJson?.n8n?.strict === true;
let isUsingDefaultConfig = false;
try {
const eslintConfig = await promises_1.default.readFile(eslintConfigPath, 'utf-8');
const normalizedConfig = eslintConfig.replace(/\s+/g, ' ').trim();
const expectedDefault = "import { config } from '@n8n/node-cli/eslint'; export default config;";
isUsingDefaultConfig = normalizedConfig === expectedDefault;
}
catch {
}
const isCloudSupported = isStrictMode && isUsingDefaultConfig;
if (isCloudSupported) {
prompts_1.log.success(`✅ Cloud support is ${picocolors_1.default.green('ENABLED')}
• Strict mode: ${picocolors_1.default.green('enabled')}
• ESLint config: ${picocolors_1.default.green('using default config')}
• Status: ${picocolors_1.default.green('eligible')} for n8n Cloud verification ${picocolors_1.default.dim('(if lint passes)')}`);
}
else {
prompts_1.log.warning(`⚠️ Cloud support is ${picocolors_1.default.yellow('DISABLED')}
• Strict mode: ${isStrictMode ? picocolors_1.default.green('enabled') : picocolors_1.default.red('disabled')}
• ESLint config: ${isUsingDefaultConfig ? picocolors_1.default.green('using default config') : picocolors_1.default.red('using custom config')}
• Status: ${picocolors_1.default.red('NOT eligible')} for n8n Cloud verification`);
}
const enableCommand = await (0, command_suggestions_1.suggestCloudSupportCommand)('enable');
const disableCommand = await (0, command_suggestions_1.suggestCloudSupportCommand)('disable');
const lintCommand = await (0, command_suggestions_1.suggestLintCommand)();
prompts_1.log.info(`Available commands:
${enableCommand} - Enable cloud support
${disableCommand} - Disable cloud support
${lintCommand} - Check compliance for cloud publishing`);
(0, prompts_1.outro)('Use the commands above to change cloud support settings or check compliance');
}
catch (error) {
prompts_1.log.error('Failed to read package.json or determine cloud support status');
(0, prompts_1.outro)('Make sure you are in the root directory of your node package');
}
}
}
CloudSupport.description = 'Enable or disable cloud support for this node';
CloudSupport.examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> enable',
'<%= config.bin %> <%= command.id %> disable',
];
CloudSupport.args = {
action: core_1.Args.string({
description: 'Action to perform (defaults to showing current status)',
required: false,
options: ['enable', 'disable'],
}),
};
exports.default = CloudSupport;
//# sourceMappingURL=cloud-support.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"cloud-support.js","sourceRoot":"","sources":["../../src/commands/cloud-support.ts"],"names":[],"mappings":";;;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je,wBAAW,GAAG,+CAA+C,CAAC;AAC9D,qBAAQ,GAAG;IAC1B,qCAAqC;IACrC,4CAA4C;IAC5C,6CAA6C;CAC7C,CAAC;AAEc,iBAAI,GAAG;IACtB,MAAM,EAAE,WAAI,CAAC,MAAM,CAAC;QACnB,WAAW,EAAE,wDAAwD;QACrE,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;KAC9B,CAAC;CACF,CAAC;kBAdkB,YAAY"}

View File

@@ -0,0 +1,10 @@
import { Command } from '@oclif/core';
export default class Dev extends Command {
static description: string;
static examples: string[];
static flags: {
'external-n8n': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
'custom-user-folder': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
};
run(): Promise<void>;
}

109
node_modules/@n8n/node-cli/dist/commands/dev/index.js generated vendored Normal file
View File

@@ -0,0 +1,109 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const prompts_1 = require("@clack/prompts");
const core_1 = require("@oclif/core");
const node_os_1 = __importDefault(require("node:os"));
const node_path_1 = __importDefault(require("node:path"));
const picocolors_1 = __importDefault(require("picocolors"));
const rimraf_1 = require("rimraf");
const filesystem_1 = require("../../utils/filesystem");
const package_manager_1 = require("../../utils/package-manager");
const prompts_2 = require("../../utils/prompts");
const validation_1 = require("../../utils/validation");
const build_1 = require("../build");
const utils_1 = require("./utils");
const child_process_1 = require("../../utils/child-process");
class Dev extends core_1.Command {
async run() {
const { flags } = await this.parse(Dev);
const packageManager = (await (0, package_manager_1.detectPackageManager)()) ?? 'npm';
const { runPersistentCommand } = (0, utils_1.commands)();
(0, prompts_1.intro)(picocolors_1.default.inverse(' n8n-node dev '));
await (0, prompts_2.ensureN8nPackage)('n8n-node dev');
await (0, build_1.copyStaticFiles)();
const linkingSpinner = (0, prompts_1.spinner)();
linkingSpinner.start('Linking custom node to n8n');
await (0, child_process_1.runCommand)(packageManager, ['link']);
const n8nUserFolder = flags['custom-user-folder'];
const customNodesFolder = node_path_1.default.join(n8nUserFolder, '.n8n', 'custom');
await (0, filesystem_1.ensureFolder)(customNodesFolder);
const packageName = await (0, utils_1.readPackageName)();
const invalidNodeNameError = (0, validation_1.validateNodeName)(packageName);
if (invalidNodeNameError)
return (0, prompts_2.onCancel)(invalidNodeNameError);
await (0, rimraf_1.rimraf)(node_path_1.default.join(customNodesFolder, 'package.json'));
await (0, child_process_1.runCommand)(packageManager, ['link', packageName], {
cwd: customNodesFolder,
});
linkingSpinner.stop('Linked custom node to n8n');
if (!flags['external-n8n']) {
let setupComplete = false;
const npxN8nSpinner = (0, prompts_1.spinner)();
npxN8nSpinner.start('Starting n8n dev server');
prompts_1.log.warn(picocolors_1.default.dim('First run may take a few minutes while dependencies are installed'));
try {
await Promise.race([
new Promise((resolve) => {
runPersistentCommand('npx', ['-y', '--quiet', '--prefer-online', 'n8n@latest'], {
cwd: n8nUserFolder,
env: {
...process.env,
N8N_DEV_RELOAD: 'true',
N8N_RUNNERS_ENABLED: 'true',
DB_SQLITE_POOL_SIZE: '10',
N8N_USER_FOLDER: n8nUserFolder,
},
name: 'n8n',
color: picocolors_1.default.green,
allowOutput: (line) => {
if (line.includes('Initializing n8n process')) {
resolve();
}
return setupComplete;
},
});
}),
new Promise((_, reject) => {
setTimeout(() => {
const error = new Error('n8n startup timeout after 120 seconds');
reject(error);
}, 120_000);
}),
]);
setupComplete = true;
npxN8nSpinner.stop('Started n8n dev server');
}
catch (error) {
npxN8nSpinner.stop('Failed to start n8n dev server');
(0, prompts_2.onCancel)(error instanceof Error ? error.message : 'Unknown error occurred', 1);
return;
}
}
(0, prompts_1.outro)('✓ Setup complete');
runPersistentCommand(packageManager, ['exec', '--', 'tsc', '--watch'], {
name: 'build',
color: picocolors_1.default.cyan,
});
}
}
Dev.description = 'Run n8n with the node and rebuild on changes for live preview';
Dev.examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> --external-n8n',
'<%= config.bin %> <%= command.id %> --custom-user-folder /Users/test',
];
Dev.flags = {
'external-n8n': core_1.Flags.boolean({
default: false,
description: 'By default n8n-node dev will run n8n in a sub process. Enable this option if you would like to run n8n elsewhere. Make sure to set N8N_DEV_RELOAD to true in that case.',
}),
'custom-user-folder': core_1.Flags.directory({
default: node_path_1.default.join(node_os_1.default.homedir(), '.n8n-node-cli'),
description: 'Folder to use to store user-specific n8n data. By default it will use ~/.n8n-node-cli. The node CLI will install your node here.',
}),
};
exports.default = Dev;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dev/index.ts"],"names":[],"mappings":";;;;;AAAA,4CAA4D;AAC5D,sCAA6C;AAC7C,sDAAyB;AACzB,0DAA6B;AAC7B,4DAAoC;AACpC,mCAAgC;AAEhC,uDAAsD;AACtD,iEAAmE;AACnE,iDAAiE;AACjE,uDAA0D;AAC1D,oCAA2C;AAC3C,mCAAoD;AACpD,6DAAuD;AAEvD,MAAqB,GAAI,SAAQ,cAAO;IAoBvC,KAAK,CAAC,GAAG;QACR,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAExC,MAAM,cAAc,GAAG,CAAC,MAAM,IAAA,sCAAoB,GAAE,CAAC,IAAI,KAAK,CAAC;QAC/D,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAA,gBAAQ,GAAE,CAAC;QAE5C,IAAA,eAAK,EAAC,oBAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAE5C,MAAM,IAAA,0BAAgB,EAAC,cAAc,CAAC,CAAC;QAEvC,MAAM,IAAA,uBAAe,GAAE,CAAC;QAExB,MAAM,cAAc,GAAG,IAAA,iBAAO,GAAE,CAAC;QACjC,cAAc,CAAC,K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AS,CAAC,EAAE;YACtE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,oBAAU,CAAC,IAAI;SACtB,CAAC,CAAC;IACJ,CAAC;;AA3Ge,eAAW,GAAG,+DAA+D,CAAC;AAC9E,YAAQ,GAAG;IAC1B,qCAAqC;IACrC,oDAAoD;IACpD,sEAAsE;CACtE,CAAC;AACc,SAAK,GAAG;IACvB,cAAc,EAAE,YAAK,CAAC,OAAO,CAAC;QAC7B,OAAO,EAAE,KAAK;QACd,WAAW,EACV,yKAAyK;KAC1K,CAAC;IACF,oBAAoB,EAAE,YAAK,CAAC,SAAS,CAAC;QACrC,OAAO,EAAE,mBAAI,CAAC,IAAI,CAAC,iBAAE,CAAC,OAAO,EAAE,EAAE,eAAe,CAAC;QACjD,WAAW,EACV,kIAAkI;KACnI,CAAC;CACF,CAAC;kBAlBkB,GAAG"}

View File

@@ -0,0 +1,12 @@
import { type ChildProcess } from 'node:child_process';
import type { Formatter } from 'picocolors/types';
export declare function commands(): {
runPersistentCommand: (cmd: string, args: string[], opts?: {
cwd?: string;
env?: NodeJS.ProcessEnv;
name?: string;
color?: Formatter;
allowOutput?: (line: string) => boolean;
}) => ChildProcess;
};
export declare function readPackageName(): Promise<string>;

115
node_modules/@n8n/node-cli/dist/commands/dev/utils.js generated vendored Normal file
View File

@@ -0,0 +1,115 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.commands = commands;
exports.readPackageName = readPackageName;
const node_child_process_1 = require("node:child_process");
const promises_1 = __importDefault(require("node:fs/promises"));
const json_1 = require("../../utils/json");
function commands() {
const childProcesses = [];
let isShuttingDown = false;
const registerChild = (child) => {
childProcesses.push(child);
};
const killChild = (child, signal) => {
if (!child.killed) {
child.kill(signal);
}
};
const forceKillAllChildren = () => {
childProcesses.forEach((child) => killChild(child, 'SIGKILL'));
process.exit(1);
};
const gracefulShutdown = (signal) => {
if (childProcesses.length === 0) {
process.exit();
return;
}
let exitedCount = 0;
const totalChildren = childProcesses.length;
const forceExitTimer = setTimeout(forceKillAllChildren, 5000);
const onChildExit = () => {
exitedCount++;
if (exitedCount === totalChildren) {
clearTimeout(forceExitTimer);
process.exit();
}
};
childProcesses.forEach((child) => {
if (!child.killed) {
child.once('exit', onChildExit);
killChild(child, signal);
setTimeout(() => killChild(child, 'SIGKILL'), 5000);
}
else {
onChildExit();
}
});
};
const handleSignal = (signal) => {
if (isShuttingDown) {
console.log('\nForce killing processes...');
forceKillAllChildren();
return;
}
isShuttingDown = true;
if (signal === 'SIGINT') {
console.log('\nShutting down gracefully... (press Ctrl+C again to force quit)');
}
gracefulShutdown(signal);
};
process.on('SIGINT', () => handleSignal('SIGINT'));
process.on('SIGTERM', () => handleSignal('SIGTERM'));
const stripAnsiCodes = (input) => input
.replace(/\x1Bc/g, '')
.replace(/\x1B\[2J/g, '')
.replace(/\x1B\[3J/g, '')
.replace(/\x1B\[H/g, '')
.replace(/\x1B\[0?m/g, '');
const createLogger = (name, color, allowOutput) => (text) => {
if (allowOutput && !allowOutput(text))
return;
const prefix = name ? (color ? color(`[${name}]`) : `[${name}]`) : '';
console.log(prefix ? `${prefix} ${text}` : text);
};
const processOutput = (data, logger) => {
data
.toString()
.split('\n')
.map((line) => stripAnsiCodes(line).trim())
.filter(Boolean)
.forEach(logger);
};
const runPersistentCommand = (cmd, args, opts = {}) => {
const child = (0, node_child_process_1.spawn)(cmd, args, {
cwd: opts.cwd,
env: { ...process.env, ...opts.env },
stdio: ['inherit', 'pipe', 'pipe'],
shell: process.platform === 'win32',
});
registerChild(child);
const logger = createLogger(opts.name, opts.color, opts.allowOutput);
const handleOutput = (data) => processOutput(data, logger);
child.stdout?.on('data', handleOutput);
child.stderr?.on('data', handleOutput);
child.on('close', (code) => {
if (!isShuttingDown) {
console.log(`${opts.name ?? cmd} exited with code ${code}`);
process.exit(code ?? 0);
}
});
return child;
};
return {
runPersistentCommand,
};
}
async function readPackageName() {
return await promises_1.default
.readFile('package.json', 'utf-8')
.then((packageJson) => (0, json_1.jsonParse)(packageJson)?.name ?? 'unknown');
}
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/dev/utils.ts"],"names":[],"mappings":";;;;;AAOA,4BAsIC;AAED,0CAIC;AAlJD,2DAA8D;AAC9D,gEAAkC;AAGlC,2CAA6C;AAE7C,SAAgB,QAAQ;IACvB,MAAM,cAAc,GAAmB,EAAE,CAAC;IAC1C,IAAI,cAAc,GAAG,KAAK,CAAC;IAE3B,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAQ,EAAE;QACnD,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,KAAmB,EAAE,MAAsB,EAAQ,EAAE;QACvE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;IACF,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,GAAS,EAAE;QACvC,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,CAAC,MAA4B,EAAQ,EAAE;QAC/D,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO;QACR,CAAC;QAED,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC;QAE5C,MAAM,cAAc,GAAG,UAAU,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;QAE9D,MAAM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endored Normal file
View File

@@ -0,0 +1,13 @@
import { Command } from '@oclif/core';
export default class Lint extends Command {
static description: string;
static examples: string[];
static flags: {
fix: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
};
run(): Promise<void>;
private checkStrictMode;
private verifyEslintConfig;
private handleLintErrors;
private containsCloudOnlyErrors;
}

121
node_modules/@n8n/node-cli/dist/commands/lint.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const promises_1 = __importDefault(require("node:fs/promises"));
const node_path_1 = __importDefault(require("node:path"));
const picocolors_1 = __importDefault(require("picocolors"));
const child_process_1 = require("../utils/child-process");
const command_suggestions_1 = require("../utils/command-suggestions");
const package_1 = require("../utils/package");
const prompts_1 = require("../utils/prompts");
const validation_1 = require("../utils/validation");
class Lint extends core_1.Command {
async run() {
const { flags } = await this.parse(Lint);
await (0, prompts_1.ensureN8nPackage)('lint');
await this.checkStrictMode();
const args = ['.'];
if (flags.fix) {
args.push('--fix');
}
let eslintOutput = '';
try {
await (0, child_process_1.runCommand)('eslint', args, {
context: 'local',
stdio: 'pipe',
env: { ...process.env, FORCE_COLOR: '1' },
printOutput: ({ stdout, stderr }) => {
eslintOutput = Buffer.concat([...stdout, ...stderr]).toString();
process.stdout.write(Buffer.concat(stdout));
process.stderr.write(Buffer.concat(stderr));
},
});
}
catch (error) {
if (error instanceof child_process_1.ChildProcessError) {
await this.handleLintErrors(eslintOutput);
if (error.signal) {
process.kill(process.pid, error.signal);
}
else {
process.exit(error.code ?? 0);
}
}
throw error;
}
}
async checkStrictMode() {
try {
const workingDir = process.cwd();
const packageJson = await (0, package_1.getPackageJson)(workingDir);
if (!packageJson?.n8n?.strict) {
return;
}
await this.verifyEslintConfig(workingDir);
}
catch (error) {
return;
}
}
async verifyEslintConfig(workingDir) {
const eslintConfigPath = node_path_1.default.resolve(workingDir, 'eslint.config.mjs');
const templatePath = node_path_1.default.resolve(__dirname, '../template/templates/shared/default/eslint.config.mjs');
const expectedConfig = await promises_1.default.readFile(templatePath, 'utf-8');
try {
const currentConfig = await promises_1.default.readFile(eslintConfigPath, 'utf-8');
const normalizedCurrent = currentConfig.replace(/\s+/g, ' ').trim();
const normalizedExpected = expectedConfig.replace(/\s+/g, ' ').trim();
if (normalizedCurrent !== normalizedExpected) {
const enableCommand = await (0, command_suggestions_1.suggestCloudSupportCommand)('enable');
this.log(`${picocolors_1.default.red('Strict mode violation:')} ${picocolors_1.default.cyan('eslint.config.mjs')} has been modified from the default configuration.
${picocolors_1.default.dim('Expected:')}
${picocolors_1.default.gray(expectedConfig)}
To restore default config: ${enableCommand}
To disable strict mode: set ${picocolors_1.default.yellow('"strict": false')} in ${picocolors_1.default.cyan('package.json')} under the ${picocolors_1.default.yellow('"n8n"')} section.`);
process.exit(1);
}
}
catch (error) {
if ((0, validation_1.isEnoentError)(error)) {
const enableCommand = await (0, command_suggestions_1.suggestCloudSupportCommand)('enable');
this.log(`${picocolors_1.default.red('Strict mode violation:')} ${picocolors_1.default.cyan('eslint.config.mjs')} not found. Expected default configuration.
To create default config: ${enableCommand}`);
process.exit(1);
}
throw error;
}
}
async handleLintErrors(eslintOutput) {
if (this.containsCloudOnlyErrors(eslintOutput)) {
const disableCommand = await (0, command_suggestions_1.suggestCloudSupportCommand)('disable');
this.log(`${picocolors_1.default.yellow('⚠️ n8n Cloud compatibility issues detected')}
These lint failures prevent verification to n8n Cloud.
To disable cloud compatibility checks:
${disableCommand}
${picocolors_1.default.dim(`Note: This will switch to ${picocolors_1.default.magenta('configWithoutCloudSupport')} and disable strict mode`)}`);
}
}
containsCloudOnlyErrors(errorMessage) {
const cloudOnlyRules = [
'@n8n/eslint-plugin-community-nodes/no-restricted-globals',
'@n8n/eslint-plugin-community-nodes/no-restricted-imports',
];
return cloudOnlyRules.some((rule) => errorMessage.includes(rule));
}
}
Lint.description = 'Lint the node in the current directory. Includes auto-fixing. In strict mode, verifies eslint config is unchanged from default.';
Lint.examples = ['<%= config.bin %> <%= command.id %>'];
Lint.flags = {
fix: core_1.Flags.boolean({ description: 'Automatically fix problems', default: false }),
};
exports.default = Lint;
//# sourceMappingURL=lint.js.map

1
node_modules/@n8n/node-cli/dist/commands/lint.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":";;;;;AAAA,sCAA6C;AAC7C,gEAAkC;AAClC,0DAA6B;AAC7B,4DAAoC;AAEpC,0DAAuE;AACvE,sEAA0E;AAC1E,8CAAkD;AAClD,8CAAoD;AACpD,oDAAoD;AAEpD,MAAqB,IAAK,SAAQ,cAAO;IAQxC,KAAK,CAAC,GAAG;QACR,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEzC,MAAM,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC;QAE/B,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAE7B,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAEnB,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,CAAC;QAED,IAAI,YAAY,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC;YACJ,MAAM,IAAA,0BAAU,EAAC,QAAQ,EAAE,IAAI,EAAE;gBAChC,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,MAAM;gBACb,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE;gBACzC,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE;oBACnC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC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C,wBAAwB,CAAC,IAAI,oBAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC;;4BAE5D,aAAa,EAAE,CACtC,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,YAAoB;QAClD,IAAI,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,CAAC;YAChD,MAAM,cAAc,GAAG,MAAM,IAAA,gDAA0B,EAAC,SAAS,CAAC,CAAC;YAEnE,IAAI,CAAC,GAAG,CAAC,GAAG,oBAAU,CAAC,MAAM,CAAC,6CAA6C,CAAC;;;;;IAK3E,cAAc;;EAEhB,oBAAU,CAAC,GAAG,CAAC,6BAA6B,oBAAU,CAAC,OAAO,CAAC,2BAA2B,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;QAC1H,CAAC;IACF,CAAC;IAEO,uBAAuB,CAAC,YAAoB;QACnD,MAAM,cAAc,GAAG;YACtB,0DAA0D;YAC1D,0DAA0D;SAC1D,CAAC;QAEF,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACnE,CAAC;;AA7He,gBAAW,GAC1B,iIAAiI,CAAC;AACnH,aAAQ,GAAG,CAAC,qCAAqC,CAAC,CAAC;AACnD,UAAK,GAAG;IACvB,GAAG,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;CACjF,CAAC;kBANkB,IAAI"}

View File

@@ -0,0 +1,14 @@
import { Command } from '@oclif/core';
export default class New extends Command {
static description: string;
static examples: string[];
static args: {
name: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
};
static flags: {
force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
'skip-install': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
template: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
};
run(): Promise<void>;
}

142
node_modules/@n8n/node-cli/dist/commands/new/index.js generated vendored Normal file
View File

@@ -0,0 +1,142 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const prompts_1 = require("@clack/prompts");
const core_1 = require("@oclif/core");
const change_case_1 = require("change-case");
const promises_1 = __importDefault(require("node:fs/promises"));
const node_path_1 = __importDefault(require("node:path"));
const picocolors_1 = __importDefault(require("picocolors"));
const prompts_2 = require("./prompts");
const utils_1 = require("./utils");
const templates_1 = require("../../template/templates");
const child_process_1 = require("../../utils/child-process");
const filesystem_1 = require("../../utils/filesystem");
const git_1 = require("../../utils/git");
const package_manager_1 = require("../../utils/package-manager");
const prompts_3 = require("../../utils/prompts");
const validation_1 = require("../../utils/validation");
class New extends core_1.Command {
async run() {
const { flags, args } = await this.parse(New);
const [typeFlag, templateFlag] = flags.template?.split('/') ?? [];
(0, prompts_1.intro)(picocolors_1.default.inverse((0, utils_1.createIntro)()));
const nodeName = args.name ?? (await (0, prompts_2.nodeNamePrompt)());
const invalidNodeNameError = (0, validation_1.validateNodeName)(nodeName);
if (invalidNodeNameError)
return (0, prompts_3.onCancel)(invalidNodeNameError);
const destination = node_path_1.default.resolve(process.cwd(), nodeName);
let overwrite = false;
if (await (0, filesystem_1.folderExists)(destination)) {
if (!flags.force) {
const shouldOverwrite = await (0, prompts_1.confirm)({
message: `./${nodeName} already exists, do you want to overwrite?`,
});
if ((0, prompts_1.isCancel)(shouldOverwrite) || !shouldOverwrite)
return (0, prompts_3.onCancel)();
}
overwrite = true;
}
const type = typeFlag ?? (await (0, prompts_2.nodeTypePrompt)());
if (!(0, templates_1.isTemplateType)(type)) {
return (0, prompts_3.onCancel)(`Invalid template type: ${type}`);
}
let template = templates_1.templates.programmatic.example;
if (templateFlag) {
const name = (0, change_case_1.camelCase)(templateFlag);
if (!(0, templates_1.isTemplateName)(type, name)) {
return (0, prompts_3.onCancel)(`Invalid template name: ${name} for type: ${type}`);
}
template = (0, templates_1.getTemplate)(type, name);
}
else if (type === 'declarative') {
const chosenTemplate = await (0, prompts_2.declarativeTemplatePrompt)();
template = (0, templates_1.getTemplate)('declarative', chosenTemplate);
}
const config = (await template.prompts?.()) ?? {};
const packageManager = (await (0, package_manager_1.detectPackageManager)()) ?? 'npm';
const templateData = {
destinationPath: destination,
nodePackageName: nodeName,
config,
user: (0, git_1.tryReadGitUser)(),
packageManager: {
name: packageManager,
installCommand: packageManager === 'npm' ? 'ci' : 'install',
},
};
const copyingSpinner = (0, prompts_1.spinner)();
copyingSpinner.start('Copying files');
if (overwrite) {
await promises_1.default.rm(destination, { recursive: true, force: true });
}
await (0, filesystem_1.delayAtLeast)(template.run(templateData), 1000);
copyingSpinner.stop('Files copied');
const gitSpinner = (0, prompts_1.spinner)();
gitSpinner.start('Initializing git repository');
try {
await (0, git_1.initGit)(destination);
gitSpinner.stop('Git repository initialized');
}
catch (error) {
if (error instanceof child_process_1.ChildProcessError) {
gitSpinner.stop(`Could not initialize git repository: ${error.message}`, error.code ?? undefined);
process.exit(error.code ?? 1);
}
else {
throw error;
}
}
if (!flags['skip-install']) {
const installingSpinner = (0, prompts_1.spinner)();
installingSpinner.start('Installing dependencies');
try {
await (0, filesystem_1.delayAtLeast)((0, child_process_1.runCommand)(packageManager, ['install'], {
cwd: destination,
printOutput: ({ stdout, stderr }) => {
prompts_1.log.error(stdout.concat(stderr).toString());
},
}), 1000);
}
catch (error) {
if (error instanceof child_process_1.ChildProcessError) {
installingSpinner.stop(`Could not install dependencies: ${error.message}`, error.code ?? undefined);
process.exit(error.code ?? 1);
}
else {
throw error;
}
}
installingSpinner.stop('Dependencies installed');
}
(0, prompts_1.note)(`cd ./${nodeName} && ${packageManager} run dev
📚 Documentation: https://docs.n8n.io/integrations/creating-nodes/build/${type}-style-node/
💬 Community: https://community.n8n.io`, 'Next Steps');
(0, prompts_1.outro)(`Created ./${nodeName}`);
}
}
New.description = 'Create a starter community node in a new directory';
New.examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> n8n-nodes-my-app --skip-install',
'<%= config.bin %> <%= command.id %> n8n-nodes-my-app --force',
'<%= config.bin %> <%= command.id %> n8n-nodes-my-app --template declarative/custom',
];
New.args = {
name: core_1.Args.string({ name: 'Name' }),
};
New.flags = {
force: core_1.Flags.boolean({
char: 'f',
description: 'Overwrite destination folder if it already exists',
}),
'skip-install': core_1.Flags.boolean({ description: 'Skip installing dependencies' }),
template: core_1.Flags.string({
options: ['declarative/github-issues', 'declarative/custom', 'programmatic/example'],
}),
};
exports.default = New;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/new/index.ts"],"names":[],"mappings":";;;;;AAAA,4CAAqF;AACrF,sCAAmD;AACnD,6CAAwC;AACxC,gEAAkC;AAClC,0DAA6B;AAC7B,4DAAoC;AAEpC,uCAAsF;AACtF,mCAAsC;AAEtC,wDAAkG;AAClG,6DAA0E;AAC1E,uDAAoE;AACpE,yCAA0D;AAC1D,iEAAmE;AACnE,iDAA+C;AAC/C,uDAA0D;AAE1D,MAAqB,GAAI,SAAQ,cAAO;IAsBvC,KAAK,CAAC,GAAG;QACR,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAElE,IAAA,eAAK,EAAC,oBAAU,CAAC,OAAO,CAAC,IAAA,mBAAW,GAAE,CAAC,CAAC,CAAC;QAEzC,MAAM,QAA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AAC,CAAC;gBAC/B,CAAC;qBAAM,CAAC;oBACP,MAAM,KAAK,CAAC;gBACb,CAAC;YACF,CAAC;YAED,iBAAiB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAClD,CAAC;QAED,IAAA,cAAI,EACH,QAAQ,QAAQ,OAAO,cAAc;;0EAEkC,IAAI;uCACvC,EACpC,YAAY,CACZ,CAAC;QAEF,IAAA,eAAK,EAAC,aAAa,QAAQ,IAAI,CAAC,CAAC;IAClC,CAAC;;AA5Ie,eAAW,GAAG,oDAAoD,CAAC;AACnE,YAAQ,GAAG;IAC1B,qCAAqC;IACrC,qEAAqE;IACrE,8DAA8D;IAC9D,oFAAoF;CACpF,CAAC;AACc,QAAI,GAAG;IACtB,IAAI,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;CACnC,CAAC;AACc,SAAK,GAAG;IACvB,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mDAAmD;KAChE,CAAC;IACF,cAAc,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC9E,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACtB,OAAO,EAAE,CAAC,2BAA2B,EAAE,oBAAoB,EAAE,sBAAsB,CAAU;KAC7F,CAAC;CACF,CAAC;kBApBkB,GAAG"}

View File

@@ -0,0 +1,3 @@
export declare const nodeNamePrompt: () => Promise<string>;
export declare const nodeTypePrompt: () => Promise<"declarative" | "programmatic">;
export declare const declarativeTemplatePrompt: () => Promise<"custom" | "githubIssues">;

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.declarativeTemplatePrompt = exports.nodeTypePrompt = exports.nodeNamePrompt = void 0;
const prompts_1 = require("@clack/prompts");
const templates_1 = require("../../template/templates");
const prompts_2 = require("../../utils/prompts");
const validation_1 = require("../../utils/validation");
const nodeNamePrompt = async () => await (0, prompts_2.withCancelHandler)((0, prompts_1.text)({
message: "Package name (must start with 'n8n-nodes-' or '@org/n8n-nodes-')",
placeholder: 'n8n-nodes-my-app',
validate: validation_1.validateNodeName,
defaultValue: 'n8n-nodes-my-app',
}));
exports.nodeNamePrompt = nodeNamePrompt;
const nodeTypePrompt = async () => await (0, prompts_2.withCancelHandler)((0, prompts_1.select)({
message: 'What kind of node are you building?',
options: [
{
label: 'HTTP API',
value: 'declarative',
hint: 'Low-code, faster approval for n8n Cloud',
},
{
label: 'Other',
value: 'programmatic',
hint: 'Programmatic node with full flexibility',
},
],
initialValue: 'declarative',
}));
exports.nodeTypePrompt = nodeTypePrompt;
const declarativeTemplatePrompt = async () => await (0, prompts_2.withCancelHandler)((0, prompts_1.select)({
message: 'What template do you want to use?',
options: Object.entries(templates_1.templates.declarative).map(([value, template]) => ({
value: value,
label: template.name,
hint: template.description,
})),
initialValue: 'githubIssues',
}));
exports.declarativeTemplatePrompt = declarativeTemplatePrompt;
//# sourceMappingURL=prompts.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/commands/new/prompts.ts"],"names":[],"mappings":";;;AAAA,4CAA8C;AAE9C,wDAAqD;AACrD,iDAAwD;AACxD,uDAA0D;AAEnD,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE,CACxC,MAAM,IAAA,2BAAiB,EACtB,IAAA,cAAI,EAAC;IACJ,OAAO,EAAE,kEAAkE;IAC3E,WAAW,EAAE,kBAAkB;IAC/B,QAAQ,EAAE,6BAAgB;IAC1B,YAAY,EAAE,kBAAkB;CAChC,CAAC,CACF,CAAC;AARU,QAAA,cAAc,kBAQxB;AAEI,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE,CACxC,MAAM,IAAA,2BAAiB,EACtB,IAAA,gBAAM,EAAiC;IACtC,OAAO,EAAE,qCAAqC;IAC9C,OAAO,EAAE;QACR;YACC,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,yCAAyC;SAC/C;QACD;YACC,KAAK,EAAE,OAAO;YACd,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,yCAAyC;SAC/C;KACD;IACD,YAAY,EAAE,aAAa;CAC3B,CAAC,CACF,CAAC;AAlBU,QAAA,cAAc,kBAkBxB;AAEI,MAAM,yBAAyB,GAAG,KAAK,IAAI,EAAE,CACnD,MAAM,IAAA,2BAAiB,EACtB,IAAA,gBAAM,EAAqC;IAC1C,OAAO,EAAE,mCAAmC;IAC5C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,qBAAS,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1E,KAAK,EAAE,KAA2C;QAClD,KAAK,EAAE,QAAQ,CAAC,IAAI;QACpB,IAAI,EAAE,QAAQ,CAAC,WAAW;KAC1B,CAAC,CAAC;IACH,YAAY,EAAE,cAAc;CAC5B,CAAC,CACF,CAAC;AAXU,QAAA,yBAAyB,6BAWnC"}

View File

@@ -0,0 +1 @@
export declare const createIntro: () => string;

11
node_modules/@n8n/node-cli/dist/commands/new/utils.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createIntro = void 0;
const package_manager_1 = require("../../utils/package-manager");
const createIntro = () => {
const maybePackageManager = (0, package_manager_1.detectPackageManagerFromUserAgent)();
const packageManager = maybePackageManager ?? 'npm';
return maybePackageManager ? ` ${packageManager} create @n8n/node ` : ' n8n-node new ';
};
exports.createIntro = createIntro;
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/new/utils.ts"],"names":[],"mappings":";;;AAAA,iEAAgF;AAEzE,MAAM,WAAW,GAAG,GAAG,EAAE;IAC/B,MAAM,mBAAmB,GAAG,IAAA,mDAAiC,GAAE,CAAC;IAChE,MAAM,cAAc,GAAG,mBAAmB,IAAI,KAAK,CAAC;IACpD,OAAO,mBAAmB,CAAC,CAAC,CAAC,IAAI,cAAc,oBAAoB,CAAC,CAAC,CAAC,gBAAgB,CAAC;AACxF,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB"}

View File

@@ -0,0 +1,8 @@
import { Command } from '@oclif/core';
export default class Prerelease extends Command {
static description: string;
static examples: string[];
static flags: {};
static hidden: boolean;
run(): Promise<void>;
}

20
node_modules/@n8n/node-cli/dist/commands/prerelease.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const package_manager_1 = require("../utils/package-manager");
class Prerelease extends core_1.Command {
async run() {
await this.parse(Prerelease);
const packageManager = (await (0, package_manager_1.detectPackageManager)()) ?? 'npm';
if (!process.env.RELEASE_MODE) {
this.log(`Run \`${packageManager} run release\` to publish the package`);
process.exit(1);
}
}
}
Prerelease.description = 'Only for internal use. Prevent npm publish, instead require npm run release';
Prerelease.examples = ['<%= config.bin %> <%= command.id %>'];
Prerelease.flags = {};
Prerelease.hidden = true;
exports.default = Prerelease;
//# sourceMappingURL=prerelease.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"prerelease.js","sourceRoot":"","sources":["../../src/commands/prerelease.ts"],"names":[],"mappings":";;AAAA,sCAAsC;AAEtC,8DAAgE;AAEhE,MAAqB,UAAW,SAAQ,cAAO;IAO9C,KAAK,CAAC,GAAG;QACR,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAE7B,MAAM,cAAc,GAAG,CAAC,MAAM,IAAA,sCAAoB,GAAE,CAAC,IAAI,KAAK,CAAC;QAE/D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,SAAS,cAAc,uCAAuC,CAAC,CAAC;YACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;;AAfe,sBAAW,GAC1B,6EAA6E,CAAC;AAC/D,mBAAQ,GAAG,CAAC,qCAAqC,CAAC,CAAC;AACnD,gBAAK,GAAG,EAAE,CAAC;AACX,iBAAM,GAAG,IAAI,CAAC;kBALV,UAAU"}

View File

@@ -0,0 +1,7 @@
import { Command } from '@oclif/core';
export default class Release extends Command {
static description: string;
static examples: string[];
static flags: {};
run(): Promise<void>;
}

49
node_modules/@n8n/node-cli/dist/commands/release.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const child_process_1 = require("../utils/child-process");
const package_manager_1 = require("../utils/package-manager");
class Release extends core_1.Command {
async run() {
await this.parse(Release);
const pm = (await (0, package_manager_1.detectPackageManager)()) ?? 'npm';
try {
await (0, child_process_1.runCommand)('release-it', [
'-n',
'--git.requireBranch main',
'--git.requireCleanWorkingDir',
'--git.requireUpstream',
'--git.requireCommits',
'--git.commit',
'--git.tag',
'--git.push',
'--git.changelog="npx auto-changelog --stdout --unreleased --commit-limit false -u --hide-credit"',
'--github.release',
`--hooks.before:init="${pm} run lint && ${pm} run build"`,
'--hooks.after:bump="npx auto-changelog -p"',
], {
stdio: 'inherit',
context: 'local',
env: {
RELEASE_MODE: 'true',
},
});
}
catch (error) {
if (error instanceof child_process_1.ChildProcessError) {
if (error.signal) {
process.kill(process.pid, error.signal);
}
else {
process.exit(error.code ?? 0);
}
}
throw error;
}
}
}
Release.description = 'Publish your community node package to npm';
Release.examples = ['<%= config.bin %> <%= command.id %>'];
Release.flags = {};
exports.default = Release;
//# sourceMappingURL=release.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":";;AAAA,sCAAsC;AAEtC,0DAAuE;AACvE,8DAAgE;AAEhE,MAAqB,OAAQ,SAAQ,cAAO;IAK3C,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