@bonvoy/core
v0.3.0
Published
🚢 Core hook system for bonvoy release automation
Maintainers
Readme
@bonvoy/core 🚢
Core hook system for bonvoy release automation
The heart of bonvoy - provides the plugin architecture, configuration system, and workspace detection for npm monorepos.
Features
- 🔌 Plugin Architecture - Extensible hook system using tapable
- 📦 Monorepo Support - npm workspaces detection and management
- ⚙️ Configuration - Flexible config loading with cosmiconfig
- 🛡️ Type Safety - Runtime validation with Zod
- 📋 Schema Generation - JSON Schema for IDE autocompletion
Installation
npm install @bonvoy/coreUsage
Basic Plugin
import { Bonvoy, BonvoyPlugin } from '@bonvoy/core';
class MyPlugin implements BonvoyPlugin {
name = 'my-plugin';
apply(bonvoy: Bonvoy) {
bonvoy.hooks.beforeShipIt.tap(this.name, (context) => {
console.log('Starting release...');
});
}
}
const bonvoy = new Bonvoy();
bonvoy.use(new MyPlugin());Configuration
import { loadConfig } from '@bonvoy/core';
const config = await loadConfig();
console.log(config.versioning); // 'independent' | 'fixed'Workspace Detection
import { detectWorkspaces } from '@bonvoy/core';
const packages = await detectWorkspaces('/path/to/monorepo');
console.log(packages.map(p => p.name));Hook System
Available hooks for plugins:
beforeShipIt- Before starting release processvalidateRepo- Validate repository stategetVersion- Determine version bump for packagesversion- Apply version changesafterVersion- After version changes appliedbeforeChangelog- Before generating changeloggenerateChangelog- Generate changelog contentafterChangelog- After changelog generatedbeforePublish- Before publishing packagespublish- Publish packagesafterPublish- After packages publishedbeforeRelease- Before creating releasesmakeRelease- Create releasesafterRelease- After releases created
Configuration Schema
interface BonvoyConfig {
versioning?: 'independent' | 'fixed';
rootVersionStrategy?: 'max' | 'patch' | 'none';
commitMessage?: string;
tagFormat?: string;
changelog?: {
global?: boolean;
sections?: Record<string, string>;
};
workflow?: 'direct' | 'pr';
baseBranch?: string;
plugins?: (string | [string, object])[];
}License
MIT
