changelog-splitter
Version:
✂️ conventional commit changelog markdown splitter 约定式提交更新日志 markdown 切割器
89 lines (88 loc) • 2.59 kB
TypeScript
export declare enum ConflictStrategy {
ProcessingFile = 0,
ProcessedFile = 1
}
export interface UserConfig {
/**
* 工作目录
* @default process.cwd()
*/
cwd?: string;
/**
* 当前更新日志文件
* @default "CHANGELOG.md"
*/
currentChangelogFile?: string;
/**
* 当前版本的更新日志文件,默认与 currentChangelogFile 相同
*/
currentVersionChangeFileName?: string;
/**
* package.json 文件路径,从里面读取当前版本号
* @default "package.json"
*/
packageFile?: string;
/**
* 其他版本更新日志的文件名,可以使用 `[major]` 表示大版本号
* @default "changelogs/v[major].x-CHANGELOG.md"
*/
previousVersionChangelogFileName?: string;
/**
* 其他版本更新日志文件冲突处理策略,默认选择当前配置的文件
*/
previousVersionChangelogConflictStrategy?: ConflictStrategy;
/**
* 其他版本更新日志的标题,可以使用 `[major]` 表示大版本号
* @default "# v[major].x 更新日志"
*/
previousVersionChangelogTitle?: string;
/**
* 其他版本引用标题
* @default "## 其他版本的更新日志"
*/
previousVersionLinkTitle?: string;
}
export type StrictUserConfig = Required<UserConfig>;
export interface ExtendConfig {
/**
* 根据 cwd 解析路径
* @param {string} segments
* @returns {string}
*/
resolvePath: (...segments: string[]) => string;
/**
* 当前更新日志的文件路径
*/
currentChangelogFilePath: string;
/**
* 当前版本的更新日志的文件路径
*/
currentVersionChangeFilePath: string;
/**
* 当前版本的更新日志的临时文件路径,用于临时收集各大版本的更新日志
* 收集完成后会将内容转移到 currentVersionChangeFilePath
*/
currentVersionChangeTempFilePath: string;
/**
* 当前版本号
*/
currentVersion: string;
/**
* 当前主版本号
*/
currentMajor: string;
}
export type RuntimeConfig = StrictUserConfig & ExtendConfig;
export declare const defaults: StrictUserConfig;
/**
* 定义配置
* @param {UserConfig} config
* @returns {StrictUserConfig}
*/
export declare function defineConfig(config?: UserConfig): StrictUserConfig;
/**
* 创建运行期配置
* @param {StrictUserConfig} strictUserConfig
* @returns {RuntimeConfig}
*/
export declare function createRuntimeConfig(strictUserConfig: StrictUserConfig): RuntimeConfig;