#!/usr/bin/env tsx /** * Initialize a project with release-it-preset * * This script: * - Creates CHANGELOG.md with Keep a Changelog template * - Creates .release-it.json with extends configuration * - Optionally adds scripts to package.json * * Usage: * tsx init-project.ts [--yes] * * Options: * --yes Skip prompts and use defaults */ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; interface Options { yes: boolean; withWorkflows: boolean; workflowName: string; } export interface InitProjectDeps { existsSync: typeof existsSync; readFileSync: typeof readFileSync; writeFileSync: typeof writeFileSync; mkdirSync: typeof mkdirSync; readdirSync: typeof readdirSync; prompt: (question: string) => Promise; log: (message: string) => void; warn: (message: string) => void; } export declare function parseArgs(args?: string[]): Options; export declare function createChangelog(options: Options, deps: InitProjectDeps): Promise; export declare function createReleaseItConfig(options: Options, deps: InitProjectDeps): Promise; export declare function updatePackageJson(options: Options, deps: InitProjectDeps): Promise; /** * Write the GitHub Actions workflow file to .github/workflows/. * Skips silently if the file already exists (existing skip-on-conflict policy). */ export declare function writeWorkflow(options: Options, deps: InitProjectDeps): Promise; /** * Detect workspaces from pnpm-workspace.yaml or package.json#workspaces. * Returns resolved absolute package directory paths. * Returns empty array if no workspace config found. * Throws ValidationError if workspace patterns escape the project root. */ export declare function detectWorkspaces(projectRoot: string, deps: InitProjectDeps): string[]; /** * Scaffold per-package .release-it.json for each detected workspace package. * Skips packages that already have .release-it.json (skip-on-conflict policy). * Does NOT write a root .release-it.json (would conflict with per-package configs). */ export declare function scaffoldWorkspacePackages(packageDirs: string[], deps: InitProjectDeps): Promise; export declare function initProject(options: Options, deps: InitProjectDeps): Promise<{ changelog: boolean; releaseIt: boolean; packageJson: boolean; workflow: boolean; monorepoPackages: number; }>; export {};