UNPKG

@142vip/changelog

Version:

基于Git提交信息,生成变更记录,输出Markdown格式的日志文件

67 lines (62 loc) 2.39 kB
export { C as ChangelogAPI, G as GitCommitAPI, b as GitCommitMessageType, a as GithubAPI, M as MarkdownAPI } from './shared/changelog.DC_vhSNT.mjs'; import { VipConfig, VipGit } from '@142vip/utils'; import '@142vip/changelog'; import 'ofetch'; const CONFIG_DEFAULT_NAME = "changelog"; const CONFIG_DEFAULT_HEADER = `# Changelog All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. `; const ChangelogDefaultConfig = { scopeMap: {}, header: CONFIG_DEFAULT_HEADER, types: { feat: { title: "\u2728 Features", semver: "minor" }, perf: { title: "\u{1F525} Performance", semver: "patch" }, fix: { title: "\u{1F41B} Bug Fixes", semver: "patch" }, refactor: { title: "\u{1F485} Refactors", semver: "patch" }, docs: { title: "\u{1F4D6} Documentation", semver: "patch" }, build: { title: "\u{1F4E6} Build", semver: "patch" }, types: { title: "\u{1F30A} Types", semver: "patch" }, release: { title: "\u{1F60F} Release Packages", semver: "patch" } }, titles: { breakingChanges: "\u{1F6A8} Breaking Changes" }, contributors: true, capitalize: true, group: true, emoji: true, baseUrl: "github.com", baseUrlApi: "api.github.com", prerelease: true }; function defineChangelogConfig(config) { return config; } async function loadChangelogConfig() { return await VipConfig.loadCliConfig(CONFIG_DEFAULT_NAME, ChangelogDefaultConfig, { packageJson: true }); } async function parseCliOptions(cliOptions) { const changelogConfig = await loadChangelogConfig(); const config = VipConfig.mergeCommanderConfig(changelogConfig, cliOptions); if (config.to == null) { config.to = VipGit.getTagInHead() ?? VipGit.getCurrentBranch(); } if (config.name == null) { config.name = config.to; } if (config.from == null) { config.from = VipGit.getLastMatchingTag(config.to) || VipGit.getRecentCommitHash(); } if (config.repo == null) { config.repo = VipGit.getGitHubRepo(config.baseUrl); } if (config.prerelease == null) { config.prerelease = VipGit.isPrerelease(config.to); } config.scopeName = cliOptions.scopeName; return config; } export { CONFIG_DEFAULT_HEADER, CONFIG_DEFAULT_NAME, ChangelogDefaultConfig, defineChangelogConfig, loadChangelogConfig, parseCliOptions };