diff --git a/dist/index.js b/dist/index.js index 39d993c..f613123 100644 --- a/dist/index.js +++ b/dist/index.js @@ -79912,7 +79912,10 @@ function buildPlugin(options) { if (typeof options.type === 'object') { const builder = pluginFactories[options.type.type]; if (builder) { - return builder(options); + return builder({ + ...options.type, + ...options, + }); } throw new errors_1.ConfigurationError(`Unknown plugin type: ${options.type.type}`, 'core', `${options.github.repository.owner}/${options.github.repository.repo}`); } @@ -80841,16 +80844,16 @@ class GitHub { return { pageInfo: response.repository.pullRequests.pageInfo, data: pullRequests.map(pullRequest => { - var _a; + var _a, _b, _c; return { sha: (_a = pullRequest.mergeCommit) === null || _a === void 0 ? void 0 : _a.oid, number: pullRequest.number, baseBranchName: pullRequest.baseRefName, headBranchName: pullRequest.headRefName, - labels: (pullRequest.labels.nodes || []).map(l => l.name), + labels: (((_b = pullRequest.labels) === null || _b === void 0 ? void 0 : _b.nodes) || []).map(l => l.name), title: pullRequest.title, body: pullRequest.body + '', - files: pullRequest.files.nodes.map(node => node.path), + files: (((_c = pullRequest.files) === null || _c === void 0 ? void 0 : _c.nodes) || []).map(node => node.path), }; }), }; @@ -81523,6 +81526,7 @@ class Manifest { plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, this.groupPullRequestTitlePattern)); } for (const plugin of plugins) { + logger_1.logger.debug(`running plugin: ${plugin.constructor.name}`); newReleasePullRequests = await plugin.run(newReleasePullRequests); } return newReleasePullRequests.map(pullRequestWithConfig => pullRequestWithConfig.pullRequest); @@ -81865,6 +81869,7 @@ exports.Manifest = Manifest; * @returns {ReleaserConfig} */ function extractReleaserConfig(config) { + var _a, _b; return { releaseType: config['release-type'], bumpMinorPreMajor: config['bump-minor-pre-major'], @@ -81887,6 +81892,9 @@ function extractReleaserConfig(config) { pullRequestTitlePattern: config['pull-request-title-pattern'], tagSeparator: config['tag-separator'], separatePullRequests: config['separate-pull-requests'], + labels: (_a = config['label']) === null || _a === void 0 ? void 0 : _a.split(','), + releaseLabels: (_b = config['release-label']) === null || _b === void 0 ? void 0 : _b.split(','), + skipSnapshot: config['skip-snapshot'], }; } /** @@ -81921,9 +81929,9 @@ async function parseConfig(github, configFile, branch, onlyPath, releaseAs) { separatePullRequests: config['separate-pull-requests'], groupPullRequestTitlePattern: config['group-pull-request-title-pattern'], plugins: config['plugins'], - labels: configLabel === undefined ? undefined : [configLabel], - releaseLabels: configReleaseLabel === undefined ? undefined : [configReleaseLabel], - snapshotLabels: configSnapshotLabel === undefined ? undefined : [configSnapshotLabel], + labels: configLabel === null || configLabel === void 0 ? void 0 : configLabel.split(','), + releaseLabels: configReleaseLabel === null || configReleaseLabel === void 0 ? void 0 : configReleaseLabel.split(','), + snapshotLabels: configSnapshotLabel === null || configSnapshotLabel === void 0 ? void 0 : configSnapshotLabel.split(','), releaseSearchDepth: config['release-search-depth'], commitSearchDepth: config['commit-search-depth'], sequentialCalls: config['sequential-calls'], @@ -82091,7 +82099,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config, return candidateTagVersion.sort((a, b) => b.compare(a))[0]; } function mergeReleaserConfig(defaultConfig, pathConfig) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; return { releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node', bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor, @@ -82113,6 +82121,7 @@ function mergeReleaserConfig(defaultConfig, pathConfig) { tagSeparator: (_u = pathConfig.tagSeparator) !== null && _u !== void 0 ? _u : defaultConfig.tagSeparator, pullRequestTitlePattern: (_v = pathConfig.pullRequestTitlePattern) !== null && _v !== void 0 ? _v : defaultConfig.pullRequestTitlePattern, separatePullRequests: (_w = pathConfig.separatePullRequests) !== null && _w !== void 0 ? _w : defaultConfig.separatePullRequests, + skipSnapshot: (_x = pathConfig.skipSnapshot) !== null && _x !== void 0 ? _x : defaultConfig.skipSnapshot, }; } /** @@ -82390,10 +82399,16 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { }; } postProcessCandidates(candidates, updatedVersions) { - const rootCandidate = candidates.find(c => c.path === manifest_1.ROOT_PROJECT_PATH); + let rootCandidate = candidates.find(c => c.path === manifest_1.ROOT_PROJECT_PATH); if (!rootCandidate) { - throw Error('Unable to find root candidate pull request'); + logger_1.logger.warn('Unable to find root candidate pull request'); + rootCandidate = candidates.find(c => c.config.releaseType === 'rust'); } + if (!rootCandidate) { + logger_1.logger.warn('Unable to find a rust candidate pull request'); + return candidates; + } + // Update the root Cargo.lock if it exists rootCandidate.pullRequest.updates.push({ path: 'Cargo.lock', createIfMissing: false, @@ -82522,10 +82537,12 @@ const merge_1 = __nccwpck_require__(90514); * Release notes are broken up using ``/`
` blocks. */ class LinkedVersions extends plugin_1.ManifestPlugin { - constructor(github, targetBranch, repositoryConfig, groupName, components) { + constructor(github, targetBranch, repositoryConfig, groupName, components, options = {}) { + var _a; super(github, targetBranch, repositoryConfig); this.groupName = groupName; this.components = new Set(components); + this.merge = (_a = options.merge) !== null && _a !== void 0 ? _a : true; } /** * Pre-configure strategies. @@ -82596,6 +82613,9 @@ class LinkedVersions extends plugin_1.ManifestPlugin { * @returns {CandidateReleasePullRequest[]} Updated pull requests */ async run(candidates) { + if (!this.merge) { + return candidates; + } const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => { if (!candidate.pullRequest.version) { logger_1.logger.warn('pull request missing version', candidate); @@ -83304,10 +83324,11 @@ const release_please_manifest_1 = __nccwpck_require__(9817); */ class WorkspacePlugin extends plugin_1.ManifestPlugin { constructor(github, targetBranch, repositoryConfig, options = {}) { - var _a, _b; + var _a, _b, _c; super(github, targetBranch, repositoryConfig); this.manifestPath = (_a = options.manifestPath) !== null && _a !== void 0 ? _a : manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST; this.updateAllPackages = (_b = options.updateAllPackages) !== null && _b !== void 0 ? _b : false; + this.merge = (_c = options.merge) !== null && _c !== void 0 ? _c : true; } async run(candidates) { logger_1.logger.info('Running workspace plugin'); @@ -83372,23 +83393,20 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin { newCandidates.push(newCandidate); } } - logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`); - const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig); - newCandidates = await mergePlugin.run(newCandidates); - if (newCandidates.length === 1) { - const newUpdates = newCandidates[0].pullRequest.updates; - newUpdates.push({ - path: this.manifestPath, - createIfMissing: false, - updater: new release_please_manifest_1.ReleasePleaseManifest({ - version: newCandidates[0].pullRequest.version, - versionsMap: updatedPathVersions, - }), - }); - } - else { - logger_1.logger.warn(`Expected 1 merged candidate, got ${newCandidates.length}`); + if (this.merge) { + logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`); + const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig); + newCandidates = await mergePlugin.run(newCandidates); } + const newUpdates = newCandidates[0].pullRequest.updates; + newUpdates.push({ + path: this.manifestPath, + createIfMissing: false, + updater: new release_please_manifest_1.ReleasePleaseManifest({ + version: newCandidates[0].pullRequest.version, + versionsMap: updatedPathVersions, + }), + }); logger_1.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`); newCandidates = this.postProcessCandidates(newCandidates, updatedVersions); return [...outOfScopeCandidates, ...newCandidates]; @@ -84656,7 +84674,7 @@ const CHANGELOG_SECTIONS = [ */ class Java extends base_1.BaseStrategy { constructor(options) { - var _a; + var _a, _b; options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS; // wrap the configured versioning strategy with snapshotting const parentVersioningStrategy = options.versioningStrategy || new default_1.DefaultVersioningStrategy(); @@ -84664,6 +84682,7 @@ class Java extends base_1.BaseStrategy { super(options); this.snapshotVersioning = new java_add_snapshot_1.JavaAddSnapshot(parentVersioningStrategy); this.snapshotLabels = options.snapshotLabels || manifest_1.DEFAULT_SNAPSHOT_LABELS; + this.skipSnapshot = (_b = options.skipSnapshot) !== null && _b !== void 0 ? _b : false; } async buildReleasePullRequest(commits, latestRelease, draft, labels = []) { if (await this.needsSnapshot(commits, latestRelease)) { @@ -84716,6 +84735,9 @@ class Java extends base_1.BaseStrategy { } async needsSnapshot(commits, latestRelease) { var _a; + if (this.skipSnapshot) { + return false; + } const component = await this.getComponent(); logger_1.logger.debug('component:', component); const version = (_a = latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag) === null || _a === void 0 ? void 0 : _a.version; @@ -87600,11 +87622,18 @@ class RootComposerUpdatePackages extends default_1.DefaultUpdater { } const parsed = JSON.parse(content); if (this.versionsMap) { - // eslint-disable-next-line prefer-const - for (let [key, version] of this.versionsMap.entries()) { - version = version || '1.0.0'; - logger_1.logger.info(`updating ${key} from ${parsed.replace[key]} to ${version}`); - parsed.replace[key] = version.toString(); + for (const [key, version] of this.versionsMap.entries()) { + const toVersion = version.toString() || '1.0.0'; + let fromVersion; + if (parsed.replace) { + fromVersion = parsed.replace[key]; + parsed.replace[key] = toVersion; + } + if (parsed[key]) { + fromVersion !== null && fromVersion !== void 0 ? fromVersion : (fromVersion = parsed[key]); + parsed[key] = toVersion; + } + logger_1.logger.info(`updating ${key} from ${fromVersion} to ${toVersion}`); } } return (0, json_stringify_1.jsonStringify)(parsed, content); @@ -114309,7 +114338,7 @@ module.exports = {}; /***/ ((module) => { "use strict"; -module.exports = {"i8":"13.19.6"}; +module.exports = {"i8":"13.20.0"}; /***/ }),