diff --git a/dist/index.js b/dist/index.js index b5e18bf..345a0a7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -79841,6 +79841,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getChangelogTypes = exports.unregisterChangelogNotes = exports.registerChangelogNotes = exports.buildChangelogNotes = void 0; const github_1 = __nccwpck_require__(88433); const default_1 = __nccwpck_require__(71480); +const errors_1 = __nccwpck_require__(93637); const changelogNotesFactories = { github: options => new github_1.GitHubChangelogNotes(options.github), default: options => new default_1.DefaultChangelogNotes(options), @@ -79850,7 +79851,7 @@ function buildChangelogNotes(options) { if (builder) { return builder(options); } - throw new Error(`Unknown changelog type: ${options.type}`); + throw new errors_1.ConfigurationError(`Unknown changelog type: ${options.type}`, 'core', `${options.github.repository.owner}/${options.github.repository.repo}`); } exports.buildChangelogNotes = buildChangelogNotes; function registerChangelogNotes(name, changelogNotesBuilder) { @@ -79893,6 +79894,7 @@ const linked_versions_1 = __nccwpck_require__(59641); const cargo_workspace_1 = __nccwpck_require__(77430); const node_workspace_1 = __nccwpck_require__(23256); const maven_workspace_1 = __nccwpck_require__(66113); +const errors_1 = __nccwpck_require__(93637); const pluginFactories = { 'linked-versions': options => new linked_versions_1.LinkedVersions(options.github, options.targetBranch, options.repositoryConfig, options.type.groupName, options.type.components), 'cargo-workspace': options => new cargo_workspace_1.CargoWorkspace(options.github, options.targetBranch, options.repositoryConfig, options), @@ -79905,14 +79907,14 @@ function buildPlugin(options) { if (builder) { return builder(options); } - throw new Error(`Unknown plugin type: ${options.type.type}`); + throw new errors_1.ConfigurationError(`Unknown plugin type: ${options.type.type}`, 'core', `${options.github.repository.owner}/${options.github.repository.repo}`); } else { const builder = pluginFactories[options.type]; if (builder) { return builder(options); } - throw new Error(`Unknown plugin type: ${options.type}`); + throw new errors_1.ConfigurationError(`Unknown plugin type: ${options.type}`, 'core', `${options.github.repository.owner}/${options.github.repository.repo}`); } } exports.buildPlugin = buildPlugin; @@ -79955,6 +79957,7 @@ exports.getVersioningStrategyTypes = exports.unregisterVersioningStrategy = expo const default_1 = __nccwpck_require__(94073); const always_bump_patch_1 = __nccwpck_require__(82926); const service_pack_1 = __nccwpck_require__(56772); +const errors_1 = __nccwpck_require__(93637); const versioningTypes = { default: options => new default_1.DefaultVersioningStrategy(options), 'always-bump-patch': options => new always_bump_patch_1.AlwaysBumpPatch(options), @@ -79965,7 +79968,7 @@ function buildVersioningStrategy(options) { if (builder) { return builder(options); } - throw new Error(`Unknown versioning strategy type: ${options.type}`); + throw new errors_1.ConfigurationError(`Unknown versioning strategy type: ${options.type}`, 'core', `${options.github.repository.owner}/${options.github.repository.repo}`); } exports.buildVersioningStrategy = buildVersioningStrategy; function registerVersioningStrategy(name, versioningStrategyBuilder) { @@ -80043,6 +80046,7 @@ const java_1 = __nccwpck_require__(46892); const maven_1 = __nccwpck_require__(60899); const versioning_strategy_factory_1 = __nccwpck_require__(11833); const changelog_notes_factory_1 = __nccwpck_require__(3095); +const errors_1 = __nccwpck_require__(93637); __exportStar(__nccwpck_require__(3095), exports); __exportStar(__nccwpck_require__(56259), exports); __exportStar(__nccwpck_require__(11833), exports); @@ -80087,6 +80091,7 @@ async function buildStrategy(options) { var _a; const targetBranch = (_a = options.targetBranch) !== null && _a !== void 0 ? _a : options.github.repository.defaultBranch; const versioningStrategy = (0, versioning_strategy_factory_1.buildVersioningStrategy)({ + github: options.github, type: options.versioning, bumpMinorPreMajor: options.bumpMinorPreMajor, bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor, @@ -80107,7 +80112,7 @@ async function buildStrategy(options) { if (builder) { return builder(strategyOptions); } - throw new Error(`Unknown release type: ${options.releaseType}`); + throw new errors_1.ConfigurationError(`Unknown release type: ${options.releaseType}`, 'core', `${options.github.repository.owner}/${options.github.repository.repo}`); } exports.buildStrategy = buildStrategy; function registerReleaseType(name, strategyBuilder) { @@ -81927,6 +81932,9 @@ async function fetchManifestConfig(github, configFile, branch) { if (e instanceof errors_1.FileNotFoundError) { throw new errors_1.ConfigurationError(`Missing required manifest config: ${configFile}`, 'base', `${github.repository.owner}/${github.repository.repo}`); } + else if (e instanceof SyntaxError) { + throw new errors_1.ConfigurationError(`Failed to parse manifest config JSON: ${configFile}\n${e.message}`, 'base', `${github.repository.owner}/${github.repository.repo}`); + } throw e; } } @@ -81962,6 +81970,9 @@ async function fetchReleasedVersions(github, manifestFile, branch) { if (e instanceof errors_1.FileNotFoundError) { throw new errors_1.ConfigurationError(`Missing required manifest versions: ${manifestFile}`, 'base', `${github.repository.owner}/${github.repository.repo}`); } + else if (e instanceof SyntaxError) { + throw new errors_1.ConfigurationError(`Failed to parse manifest versions JSON: ${manifestFile}\n${e.message}`, 'base', `${github.repository.owner}/${github.repository.repo}`); + } throw e; } } @@ -83974,6 +83985,11 @@ class DotnetYoshi extends base_1.BaseStrategy { throw e; } } + async getDefaultComponent() { + // default component is based on the path + const pathParts = this.path.split('/'); + return pathParts[pathParts.length - 1]; + } async buildUpdates(options) { const updates = []; const version = options.newVersion; @@ -83989,17 +84005,18 @@ class DotnetYoshi extends base_1.BaseStrategy { updater: new changelog_1.Changelog({ version, changelogEntry: options.changelogEntry, + versionHeaderRegex: '\n## Version [0-9[]+', }), }); } - if (!this.component) { + if (!component) { logger_1.logger.warn('Dotnet strategy expects to use components, could not update all files'); return updates; } updates.push({ path: 'apis/apis.json', createIfMissing: false, - updater: new apis_1.Apis(this.component, version), + updater: new apis_1.Apis(component, version), }); return updates; } @@ -84087,13 +84104,29 @@ const version_1 = __nccwpck_require__(17348); const version_go_1 = __nccwpck_require__(54988); const logger_1 = __nccwpck_require__(68809); const path_1 = __nccwpck_require__(85622); +const CHANGELOG_SECTIONS = [ + { type: 'feat', section: 'Features' }, + { type: 'fix', section: 'Bug Fixes' }, + { type: 'perf', section: 'Performance Improvements' }, + { type: 'revert', section: 'Reverts' }, + { type: 'docs', section: 'Documentation' }, + { type: 'style', section: 'Styles', hidden: true }, + { type: 'chore', section: 'Miscellaneous Chores', hidden: true }, + { type: 'refactor', section: 'Code Refactoring', hidden: true }, + { type: 'test', section: 'Tests', hidden: true }, + { type: 'build', section: 'Build System', hidden: true }, + { type: 'ci', section: 'Continuous Integration', hidden: true }, +]; const REGEN_PR_REGEX = /.*auto-regenerate.*/; const REGEN_ISSUE_REGEX = /(?.*)\(#(?.*)\)(\n|$)/; class GoYoshi extends base_1.BaseStrategy { constructor(options) { var _a; options.changelogPath = (_a = options.changelogPath) !== null && _a !== void 0 ? _a : 'CHANGES.md'; - super(options); + super({ + ...options, + changelogSections: CHANGELOG_SECTIONS, + }); } async buildUpdates(options) { const updates = []; @@ -85587,7 +85620,7 @@ class RubyYoshi extends base_1.BaseStrategy { // Remove bolded scope from change lines .replace(/^\* \*\*[\w-]+:\*\* /gm, '* ') // Remove PR and commit links from pull request title suffixes - .replace(/( \(\[(\w+|#\d+)\]\(https:\/\/github\.com\/[^)]*\)\))+\s*$/gm, '') + .replace(/(\(\[(\w+)\]\(https:\/\/github\.com\/[^)]*\)\))+\s*$/gm, '') // Standardize on h4 for change type subheaders .replace(/^### (Features|Bug Fixes|Documentation)$/gm, '#### $1') // Collapse 2 or more blank lines @@ -86026,15 +86059,18 @@ exports.BaseXml = BaseXml; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Changelog = void 0; const default_1 = __nccwpck_require__(69995); +const DEFAULT_VERSION_HEADER_REGEX = '\n###? v?[0-9[]'; class Changelog extends default_1.DefaultUpdater { constructor(options) { + var _a; super(options); this.changelogEntry = options.changelogEntry; + this.versionHeaderRegex = new RegExp((_a = options.versionHeaderRegex) !== null && _a !== void 0 ? _a : DEFAULT_VERSION_HEADER_REGEX, 's'); } updateContent(content) { content = content || ''; // Handle both H2 (features/BREAKING CHANGES) and H3 (fixes). - const lastEntryIndex = content.search(/\n###? v?[0-9[]/s); + const lastEntryIndex = content.search(this.versionHeaderRegex); if (lastEntryIndex === -1) { return `${this.header()}\n${this.changelogEntry}\n`; } @@ -114248,7 +114284,7 @@ module.exports = {}; /***/ ((module) => { "use strict"; -module.exports = {"i8":"13.18.0"}; +module.exports = {"i8":"13.18.6"}; /***/ }),