mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-05 02:59:27 +02:00
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { Command } from '@oclif/core';
|
|
|
|
import { ChildProcessError, runCommand } from '../utils/child-process';
|
|
import { detectPackageManager } from '../utils/package-manager';
|
|
|
|
export default class Release extends Command {
|
|
static override description = 'Publish your community node package to npm';
|
|
static override examples = ['<%= config.bin %> <%= command.id %>'];
|
|
static override flags = {};
|
|
|
|
async run(): Promise<void> {
|
|
await this.parse(Release);
|
|
|
|
const pm = (await detectPackageManager()) ?? 'npm';
|
|
|
|
try {
|
|
await 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 ChildProcessError) {
|
|
if (error.signal) {
|
|
process.kill(process.pid, error.signal);
|
|
} else {
|
|
process.exit(error.code ?? 0);
|
|
}
|
|
}
|
|
throw error;
|
|
}
|
|
}
|
|
}
|