From 7e9368d325c770e5e120b7bda9c336f436008a9e Mon Sep 17 00:00:00 2001
From: Google GitHub Actions Bot
<72759630+google-github-actions-bot@users.noreply.github.com>
Date: Wed, 1 Jun 2022 17:30:25 -0500
Subject: [PATCH] chore: build dist release-please-action (#502)
---
dist/commit.hbs | 58 ++-
dist/commit1.hbs | 50 +--
dist/header.hbs | 18 +-
dist/header1.hbs | 18 +-
dist/index.js | 1057 ++++++++++++++++++++++++++++++++++++--------
dist/template.hbs | 22 +-
dist/template1.hbs | 20 +-
7 files changed, 974 insertions(+), 269 deletions(-)
diff --git a/dist/commit.hbs b/dist/commit.hbs
index fe003a0..28d9293 100644
--- a/dist/commit.hbs
+++ b/dist/commit.hbs
@@ -1,2 +1,56 @@
-* {{#if subject}} {{~subject}} {{~else}} {{~header}} {{~/if}}{{#if body}}
-{{body}}{{~/if}}
+* {{header}}
+
+{{~!-- commit link --}} {{#if @root.linkReferences~}}
+ ([{{hash}}](
+ {{~#if @root.repository}}
+ {{~#if @root.host}}
+ {{~@root.host}}/
+ {{~/if}}
+ {{~#if @root.owner}}
+ {{~@root.owner}}/
+ {{~/if}}
+ {{~@root.repository}}
+ {{~else}}
+ {{~@root.repoUrl}}
+ {{~/if}}/
+ {{~@root.commit}}/{{hash}}))
+{{~else}}
+ {{~hash}}
+{{~/if}}
+
+{{~!-- commit references --}}
+{{~#if references~}}
+ , closes
+ {{~#each references}} {{#if @root.linkReferences~}}
+ [
+ {{~#if this.owner}}
+ {{~this.owner}}/
+ {{~/if}}
+ {{~this.repository}}#{{this.issue}}](
+ {{~#if @root.repository}}
+ {{~#if @root.host}}
+ {{~@root.host}}/
+ {{~/if}}
+ {{~#if this.repository}}
+ {{~#if this.owner}}
+ {{~this.owner}}/
+ {{~/if}}
+ {{~this.repository}}
+ {{~else}}
+ {{~#if @root.owner}}
+ {{~@root.owner}}/
+ {{~/if}}
+ {{~@root.repository}}
+ {{~/if}}
+ {{~else}}
+ {{~@root.repoUrl}}
+ {{~/if}}/
+ {{~@root.issue}}/{{this.issue}})
+ {{~else}}
+ {{~#if this.owner}}
+ {{~this.owner}}/
+ {{~/if}}
+ {{~this.repository}}#{{this.issue}}
+ {{~/if}}{{/each}}
+{{~/if}}
+
diff --git a/dist/commit1.hbs b/dist/commit1.hbs
index 28d9293..641c2f3 100644
--- a/dist/commit1.hbs
+++ b/dist/commit1.hbs
@@ -1,23 +1,16 @@
-* {{header}}
-
-{{~!-- commit link --}} {{#if @root.linkReferences~}}
- ([{{hash}}](
- {{~#if @root.repository}}
- {{~#if @root.host}}
- {{~@root.host}}/
- {{~/if}}
- {{~#if @root.owner}}
- {{~@root.owner}}/
- {{~/if}}
- {{~@root.repository}}
- {{~else}}
- {{~@root.repoUrl}}
- {{~/if}}/
- {{~@root.commit}}/{{hash}}))
+*{{#if scope}} **{{scope}}:**
+{{~/if}} {{#if subject}}
+ {{~subject}}
{{~else}}
- {{~hash}}
+ {{~header}}
{{~/if}}
+{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
+ ([{{shortHash}}]({{commitUrlFormat}}))
+{{~else}}
+ {{~shortHash}}
+{{~/if}}{{~/if}}
+
{{~!-- commit references --}}
{{~#if references~}}
, closes
@@ -26,31 +19,12 @@
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
- {{~this.repository}}#{{this.issue}}](
- {{~#if @root.repository}}
- {{~#if @root.host}}
- {{~@root.host}}/
- {{~/if}}
- {{~#if this.repository}}
- {{~#if this.owner}}
- {{~this.owner}}/
- {{~/if}}
- {{~this.repository}}
- {{~else}}
- {{~#if @root.owner}}
- {{~@root.owner}}/
- {{~/if}}
- {{~@root.repository}}
- {{~/if}}
- {{~else}}
- {{~@root.repoUrl}}
- {{~/if}}/
- {{~@root.issue}}/{{this.issue}})
+ {{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}})
{{~else}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
- {{~this.repository}}#{{this.issue}}
+ {{~this.repository}}{{this.prefix}}{{this.issue}}
{{~/if}}{{/each}}
{{~/if}}
diff --git a/dist/header.hbs b/dist/header.hbs
index c5ed4d2..49f5607 100644
--- a/dist/header.hbs
+++ b/dist/header.hbs
@@ -1,9 +1,9 @@
-### {{#if @root.linkCompare~}}
- [{{version}}]({{compareUrlFormat}})
-{{~else}}
- {{~version}}
-{{~/if}}
-{{~#if title}} "{{title}}"
-{{~/if}}
-{{~#if date}} / {{date}}
-{{/if}}
+## {{#if isPatch~}}
+ {{~/if~}} {{version}}
+ {{~#if title}} "{{title}}"
+ {{~/if~}}
+ {{~#if date}} ({{date}})
+ {{~/if~}}
+ {{~#if isPatch~}}
+ {{~/if}}
+
diff --git a/dist/header1.hbs b/dist/header1.hbs
index 49f5607..d7efc8f 100644
--- a/dist/header1.hbs
+++ b/dist/header1.hbs
@@ -1,9 +1,9 @@
-## {{#if isPatch~}}
- {{~/if~}} {{version}}
- {{~#if title}} "{{title}}"
- {{~/if~}}
- {{~#if date}} ({{date}})
- {{~/if~}}
- {{~#if isPatch~}}
- {{~/if}}
-
+## {{#if @root.linkCompare~}}
+ [{{version}}]({{compareUrlFormat}})
+{{~else}}
+ {{~version}}
+{{~/if}}
+{{~#if title}} "{{title}}"
+{{~/if}}
+{{~#if date}} ({{date}})
+{{/if}}
diff --git a/dist/index.js b/dist/index.js
index 198bb80..b5e18bf 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -12382,7 +12382,7 @@ function _objectWithoutProperties(source, excluded) {
return target;
}
-const VERSION = "3.5.1";
+const VERSION = "3.6.0";
const _excluded = ["authStrategy"];
class Octokit {
@@ -18885,6 +18885,239 @@ module.exports = function (str, pos) {
};
+/***/ }),
+
+/***/ 49988:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.getDiffString = exports.getChanges = exports.parseChanges = exports.getAllDiffs = exports.getGitFileData = exports.findRepoRoot = exports.resolvePath = void 0;
+const child_process_1 = __nccwpck_require__(63129);
+const types_1 = __nccwpck_require__(13984);
+const logger_1 = __nccwpck_require__(58192);
+const fs_1 = __nccwpck_require__(35747);
+const path = __nccwpck_require__(85622);
+class InstallationError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = 'InstallationError';
+ }
+}
+/**
+ * Get the absolute path of a relative path
+ * @param {string} dir the wildcard directory containing git change, not necessarily the root git directory
+ * @returns {string} the absolute path relative to the path that the user executed the bash command in
+ */
+function resolvePath(dir) {
+ const absoluteDir = path.resolve(process.cwd(), dir);
+ return absoluteDir;
+}
+exports.resolvePath = resolvePath;
+/**
+ * Get the git root directory.
+ * Errors if the directory provided is not a git directory.
+ * @param {string} dir an absolute directory
+ * @returns {string} the absolute path of the git directory root
+ */
+function findRepoRoot(dir) {
+ try {
+ return (0, child_process_1.execSync)('git rev-parse --show-toplevel', { cwd: dir })
+ .toString()
+ .trimRight(); // remove the trailing \n
+ }
+ catch (err) {
+ logger_1.logger.error(`The directory provided is not a git directory: ${dir}`);
+ throw err;
+ }
+}
+exports.findRepoRoot = findRepoRoot;
+/**
+ * Returns the git diff old/new mode, status, and path. Given a git diff.
+ * Errors if there is a parsing error
+ * @param {string} gitDiffPattern A single file diff. Renames and copies are broken up into separate diffs. See https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-git-diff-filesltpatterngt82308203 for more details
+ * @returns indexable git diff fields: old/new mode, status, and path
+ */
+function parseGitDiff(gitDiffPattern) {
+ try {
+ const fields = gitDiffPattern.split(' ');
+ const newMode = fields[1];
+ const oldMode = fields[0].substring(1);
+ const statusAndPath = fields[4].split('\t');
+ const status = statusAndPath[0];
+ const relativePath = statusAndPath[1];
+ return { oldMode, newMode, status, relativePath };
+ }
+ catch (err) {
+ logger_1.logger.warn(`\`git diff --raw\` may have changed formats: \n ${gitDiffPattern}`);
+ throw err;
+ }
+}
+/**
+ * Get the GitHub mode, file content, and relative path asynchronously
+ * Rejects if there is a git diff error, or if the file contents could not be loaded.
+ * @param {string} gitRootDir the root of the local GitHub repository
+ * @param {string} gitDiffPattern A single file diff. Renames and copies are broken up into separate diffs. See https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-git-diff-filesltpatterngt82308203 for more details
+ * @returns {Promise} the current mode, the relative path of the file in the Git Repository, and the file status.
+ */
+function getGitFileData(gitRootDir, gitDiffPattern) {
+ return new Promise((resolve, reject) => {
+ try {
+ const { oldMode, newMode, status, relativePath } = parseGitDiff(gitDiffPattern);
+ // if file is deleted, do not attempt to read it
+ if (status === 'D') {
+ resolve({ path: relativePath, fileData: new types_1.FileData(null, oldMode) });
+ }
+ else {
+ // else read the file
+ (0, fs_1.readFile)(gitRootDir + '/' + relativePath, {
+ encoding: 'utf-8',
+ }, (err, content) => {
+ if (err) {
+ logger_1.logger.error(`Error loading file ${relativePath} in git directory ${gitRootDir}`);
+ reject(err);
+ }
+ resolve({
+ path: relativePath,
+ fileData: new types_1.FileData(content, newMode),
+ });
+ });
+ }
+ }
+ catch (err) {
+ reject(err);
+ }
+ });
+}
+exports.getGitFileData = getGitFileData;
+/**
+ * Get all the diffs using `git diff` of a git directory.
+ * Errors if the git directory provided is not a git directory.
+ * @param {string} gitRootDir a git directory
+ * @returns {string[]} a list of git diffs
+ */
+function getAllDiffs(gitRootDir) {
+ (0, child_process_1.execSync)('git add -A', { cwd: gitRootDir });
+ const diffs = (0, child_process_1.execSync)('git diff --raw --staged --no-renames', {
+ cwd: gitRootDir,
+ })
+ .toString() // strictly return buffer for mocking purposes. sinon ts doesn't infer {encoding: 'utf-8'}
+ .trimRight() // remove the trailing new line
+ .split('\n')
+ .filter(line => !!line.trim());
+ (0, child_process_1.execSync)('git reset .', { cwd: gitRootDir });
+ return diffs;
+}
+exports.getAllDiffs = getAllDiffs;
+/**
+ * Get the git changes of the current project asynchronously.
+ * Rejects if any of the files fails to load (if not deleted),
+ * or if there is a git diff parse error
+ * @param {string[]} diffs the git diff raw output (which only shows relative paths)
+ * @param {string} gitDir the root of the local GitHub repository
+ * @returns {Promise} the changeset
+ */
+async function parseChanges(diffs, gitDir) {
+ try {
+ // get updated file contents
+ const changes = new Map();
+ const changePromises = [];
+ for (let i = 0; i < diffs.length; i++) {
+ // TODO - handle memory constraint
+ changePromises.push(getGitFileData(gitDir, diffs[i]));
+ }
+ const gitFileDatas = await Promise.all(changePromises);
+ for (let i = 0; i < gitFileDatas.length; i++) {
+ changes.set(gitFileDatas[i].path, gitFileDatas[i].fileData);
+ }
+ return changes;
+ }
+ catch (err) {
+ logger_1.logger.error('Error parsing git changes');
+ throw err;
+ }
+}
+exports.parseChanges = parseChanges;
+/**
+ * Throws an error if git is not installed
+ * @returns {void} void if git is installed
+ */
+function validateGitInstalled() {
+ try {
+ (0, child_process_1.execSync)('git --version');
+ }
+ catch (err) {
+ logger_1.logger.error('git not installed');
+ throw new InstallationError('git command is not recognized. Make sure git is installed.');
+ }
+}
+/**
+ * Load the change set asynchronously.
+ * @param dir the directory containing git changes
+ * @returns {Promise} the change set
+ */
+function getChanges(dir) {
+ try {
+ validateGitInstalled();
+ const absoluteDir = resolvePath(dir);
+ const gitRootDir = findRepoRoot(absoluteDir);
+ const diffs = getAllDiffs(gitRootDir);
+ return parseChanges(diffs, gitRootDir);
+ }
+ catch (err) {
+ if (!(err instanceof InstallationError)) {
+ logger_1.logger.error('Error loadng git changes.');
+ }
+ throw err;
+ }
+}
+exports.getChanges = getChanges;
+/**
+ * Get the git changes of the current project asynchronously.
+ * Rejects if any of the files fails to load (if not deleted),
+ * or if there is a git diff parse error
+ * @param {string[]} diffs the git diff raw output (which only shows relative paths)
+ * @param {string} gitDir the root of the local GitHub repository
+ * @returns {string} the diff
+ */
+function getDiffString(dir) {
+ try {
+ validateGitInstalled();
+ const absoluteDir = resolvePath(dir);
+ const gitRootDir = findRepoRoot(absoluteDir);
+ (0, child_process_1.execSync)('git add -A', { cwd: gitRootDir });
+ const diff = (0, child_process_1.execSync)('git diff --staged --no-renames', {
+ cwd: gitRootDir,
+ })
+ .toString() // strictly return buffer for mocking purposes. sinon ts doesn't infer {encoding: 'utf-8'}
+ .trimRight(); // remove the trailing new line
+ (0, child_process_1.execSync)('git reset .', { cwd: gitRootDir });
+ return diff;
+ }
+ catch (err) {
+ if (!(err instanceof InstallationError)) {
+ logger_1.logger.error('Error loadng git changes.');
+ }
+ throw err;
+ }
+}
+exports.getDiffString = getDiffString;
+//# sourceMappingURL=handle-git-dir-change.js.map
+
/***/ }),
/***/ 9558:
@@ -19195,6 +19428,7 @@ exports.createCommit = createCommit;
* @returns {Promise}
*/
async function updateRef(octokit, origin, newSha, force) {
+ logger_1.logger.info(`Updating reference heads/${origin.branch} to ${newSha}`);
await octokit.git.updateRef({
owner: origin.owner,
repo: origin.repo,
@@ -19282,7 +19516,7 @@ async function fork(octokit, upstream) {
}
catch (err) {
logger_1.logger.error('Error when forking');
- throw Error(err.toString());
+ throw err;
}
}
exports.fork = fork;
@@ -19540,10 +19774,10 @@ async function createPullRequestReview(octokit, remote, pullNumber, pageSize, di
const pullRequestHunks = await exports.getPullRequestHunks(octokit, remote, pullNumber, pageSize);
// get the hunks from the suggested change
const allSuggestedHunks = typeof diffContents === 'string'
- ? diff_utils_1.parseAllHunks(diffContents)
- : hunk_utils_1.getRawSuggestionHunks(diffContents);
+ ? (0, diff_utils_1.parseAllHunks)(diffContents)
+ : (0, hunk_utils_1.getRawSuggestionHunks)(diffContents);
// split hunks by commentable and uncommentable
- const { validHunks, invalidHunks } = hunk_utils_1.partitionSuggestedHunksByScope(pullRequestHunks, allSuggestedHunks);
+ const { validHunks, invalidHunks } = (0, hunk_utils_1.partitionSuggestedHunksByScope)(pullRequestHunks, allSuggestedHunks);
// create pull request review
const reviewNumber = await exports.makeInlineSuggestions(octokit, validHunks, invalidHunks, remote, pullNumber);
return reviewNumber;
@@ -19621,7 +19855,7 @@ async function getPullRequestHunks(octokit, remote, pullNumber, pageSize) {
logger_1.logger.warn(`File ${file.filename} may have a patch that is too large to display patch object.`);
}
else {
- const hunks = diff_utils_1.parsePatch(file.patch);
+ const hunks = (0, diff_utils_1.parsePatch)(file.patch);
pullRequestHunks.set(file.filename, hunks);
}
});
@@ -19654,7 +19888,7 @@ exports.getPullRequestHunks = getPullRequestHunks;
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.parseTextFiles = exports.createPullRequest = exports.reviewPullRequest = void 0;
+exports.parseTextFiles = exports.createPullRequest = exports.reviewPullRequest = exports.getDiffString = exports.getChanges = void 0;
const types_1 = __nccwpck_require__(13984);
const logger_1 = __nccwpck_require__(58192);
const default_options_handler_1 = __nccwpck_require__(9558);
@@ -19665,6 +19899,9 @@ const fork_1 = __nccwpck_require__(67386);
const commit_and_push_1 = __nccwpck_require__(4424);
const open_pull_request_1 = __nccwpck_require__(24461);
const labels_1 = __nccwpck_require__(8831);
+var handle_git_dir_change_1 = __nccwpck_require__(49988);
+Object.defineProperty(exports, "getChanges", ({ enumerable: true, get: function () { return handle_git_dir_change_1.getChanges; } }));
+Object.defineProperty(exports, "getDiffString", ({ enumerable: true, get: function () { return handle_git_dir_change_1.getDiffString; } }));
/**
* Given a set of suggestions, make all the multiline inline review comments on a given pull request given
* that they are in scope of the pull request. Outof scope suggestions are not made.
@@ -19682,7 +19919,7 @@ const labels_1 = __nccwpck_require__(8831);
* @returns the created review's id number, or null if there are no changes to be made.
*/
async function reviewPullRequest(octokit, diffContents, options) {
- logger_1.setupLogger(options.logger);
+ (0, logger_1.setupLogger)(options.logger);
// if null undefined, or the empty map then no changes have been provided.
// Do not execute GitHub workflow
if (diffContents === null ||
@@ -19691,12 +19928,12 @@ async function reviewPullRequest(octokit, diffContents, options) {
logger_1.logger.info('Empty changes provided. No suggestions to be made. Cancelling workflow.');
return null;
}
- const gitHubConfigs = default_options_handler_1.addReviewCommentsDefaults(options);
+ const gitHubConfigs = (0, default_options_handler_1.addReviewCommentsDefaults)(options);
const remote = {
owner: gitHubConfigs.owner,
repo: gitHubConfigs.repo,
};
- const reviewNumber = await review_pull_request_1.createPullRequestReview(octokit, remote, gitHubConfigs.pullNumber, gitHubConfigs.pageSize, diffContents);
+ const reviewNumber = await (0, review_pull_request_1.createPullRequestReview)(octokit, remote, gitHubConfigs.pullNumber, gitHubConfigs.pageSize, diffContents);
return reviewNumber;
}
exports.reviewPullRequest = reviewPullRequest;
@@ -19723,27 +19960,45 @@ exports.reviewPullRequest = reviewPullRequest;
* @returns {Promise} the pull request number. Returns 0 if unsuccessful.
*/
async function createPullRequest(octokit, changes, options) {
- logger_1.setupLogger(options.logger);
+ (0, logger_1.setupLogger)(options.logger);
// if null undefined, or the empty map then no changes have been provided.
// Do not execute GitHub workflow
if (changes === null || changes === undefined || changes.size === 0) {
logger_1.logger.info('Empty change set provided. No changes need to be made. Cancelling workflow.');
return 0;
}
- const gitHubConfigs = default_options_handler_1.addPullRequestDefaults(options);
+ const gitHubConfigs = (0, default_options_handler_1.addPullRequestDefaults)(options);
logger_1.logger.info('Starting GitHub PR workflow...');
const upstream = {
owner: gitHubConfigs.upstreamOwner,
repo: gitHubConfigs.upstreamRepo,
};
- const origin = options.fork === false ? upstream : await fork_1.fork(octokit, upstream);
+ const origin = options.fork === false ? upstream : await (0, fork_1.fork)(octokit, upstream);
+ if (options.fork) {
+ // try to sync the fork
+ await retry(async () => await octokit.repos.mergeUpstream({
+ owner: origin.owner,
+ repo: origin.repo,
+ branch: gitHubConfigs.primary,
+ }), {
+ retries: options.retry,
+ factor: 2.8411,
+ minTimeout: 3000,
+ randomize: false,
+ onRetry: (e, attempt) => {
+ e.message = `Error creating syncing upstream: ${e.message}`;
+ logger_1.logger.error(e);
+ logger_1.logger.info(`Retry attempt #${attempt}...`);
+ },
+ });
+ }
const originBranch = {
...origin,
branch: gitHubConfigs.branch,
};
// The `retry` flag defaults to `5` to maintain compatibility
options.retry = options.retry === undefined ? 5 : options.retry;
- const refHeadSha = await retry(async () => await branch_1.branch(octokit, origin, upstream, originBranch.branch, gitHubConfigs.primary), {
+ const refHeadSha = await retry(async () => await (0, branch_1.branch)(octokit, origin, upstream, originBranch.branch, gitHubConfigs.primary), {
retries: options.retry,
factor: 2.8411,
minTimeout: 3000,
@@ -19754,15 +20009,15 @@ async function createPullRequest(octokit, changes, options) {
logger_1.logger.info(`Retry attempt #${attempt}...`);
},
});
- await commit_and_push_1.commitAndPush(octokit, refHeadSha, changes, originBranch, gitHubConfigs.message, gitHubConfigs.force);
+ await (0, commit_and_push_1.commitAndPush)(octokit, refHeadSha, changes, originBranch, gitHubConfigs.message, gitHubConfigs.force);
const description = {
body: gitHubConfigs.description,
title: gitHubConfigs.title,
};
- const prNumber = await open_pull_request_1.openPullRequest(octokit, upstream, originBranch, description, gitHubConfigs.maintainersCanModify, gitHubConfigs.primary, options.draft);
+ const prNumber = await (0, open_pull_request_1.openPullRequest)(octokit, upstream, originBranch, description, gitHubConfigs.maintainersCanModify, gitHubConfigs.primary, options.draft);
logger_1.logger.info(`Successfully opened pull request: ${prNumber}.`);
// addLabels will no-op if options.labels is undefined or empty.
- await labels_1.addLabels(octokit, upstream, originBranch, prNumber, options.labels);
+ await (0, labels_1.addLabels)(octokit, upstream, originBranch, prNumber, options.labels);
return prNumber;
}
exports.createPullRequest = createPullRequest;
@@ -19999,7 +20254,7 @@ exports.parseAllHunks = parseAllHunks;
* @returns Hunk[]
*/
function getSuggestedHunks(oldContent, newContent) {
- const diff = diff_1.createPatch('unused', oldContent, newContent);
+ const diff = (0, diff_1.createPatch)('unused', oldContent, newContent);
return parseAllHunks(diff).get('unused') || [];
}
exports.getSuggestedHunks = getSuggestedHunks;
@@ -20081,7 +20336,7 @@ function getRawSuggestionHunks(diffContents) {
if (fileDiffContent.oldContent === fileDiffContent.newContent) {
return;
}
- const hunks = diff_utils_1.getSuggestedHunks(fileDiffContent.oldContent, fileDiffContent.newContent);
+ const hunks = (0, diff_utils_1.getSuggestedHunks)(fileDiffContent.oldContent, fileDiffContent.newContent);
fileHunks.set(fileName, hunks);
});
logger_1.logger.info('Parsed ranges of old and new patch');
@@ -21754,9 +22009,9 @@ module.exports = function (config) {
})
return Q.all([
- readFile(__nccwpck_require__.ab + "template2.hbs", 'utf-8'),
- readFile(__nccwpck_require__.ab + "header2.hbs", 'utf-8'),
- readFile(__nccwpck_require__.ab + "commit2.hbs", 'utf-8'),
+ readFile(__nccwpck_require__.ab + "template1.hbs", 'utf-8'),
+ readFile(__nccwpck_require__.ab + "header1.hbs", 'utf-8'),
+ readFile(__nccwpck_require__.ab + "commit1.hbs", 'utf-8'),
readFile(__nccwpck_require__.ab + "footer1.hbs", 'utf-8')
])
.spread((template, header, commit, footer) => {
@@ -21976,9 +22231,9 @@ function conventionalChangelogWriterInit (context, options) {
includeDetails: false,
ignoreReverted: true,
doFlush: true,
- mainTemplate: readFileSync(__nccwpck_require__.ab + "template1.hbs", 'utf-8'),
- headerPartial: readFileSync(__nccwpck_require__.ab + "header1.hbs", 'utf-8'),
- commitPartial: readFileSync(__nccwpck_require__.ab + "commit1.hbs", 'utf-8'),
+ mainTemplate: readFileSync(__nccwpck_require__.ab + "template.hbs", 'utf-8'),
+ headerPartial: readFileSync(__nccwpck_require__.ab + "header.hbs", 'utf-8'),
+ commitPartial: readFileSync(__nccwpck_require__.ab + "commit.hbs", 'utf-8'),
footerPartial: readFileSync(__nccwpck_require__.ab + "footer.hbs", 'utf-8')
}, options)
@@ -74448,8 +74703,7 @@ function onceStrict (fn) {
/***/ ((module) => {
"use strict";
-function _createForOfIteratorHelper(o,allowArrayLike){var it;if(typeof Symbol==="undefined"||o[Symbol.iterator]==null){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e2){throw _e2},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=o[Symbol.iterator]()},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e3){didErr=true;err=_e3},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e2){throw _e2},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e3){didErr=true;err=_e3},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i {
let parent = ancestors.pop();
@@ -79638,10 +79892,12 @@ exports.getPluginTypes = exports.unregisterPlugin = exports.registerPlugin = exp
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 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),
'node-workspace': options => new node_workspace_1.NodeWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
+ 'maven-workspace': options => new maven_workspace_1.MavenWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
};
function buildPlugin(options) {
if (typeof options.type === 'object') {
@@ -79748,13 +80004,17 @@ exports.getVersioningStrategyTypes = getVersioningStrategyTypes;
// limitations under the License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getReleaserTypes = exports.unregisterReleaseType = exports.registerReleaseType = exports.buildStrategy = void 0;
@@ -79826,12 +80086,12 @@ const releasers = {
async function buildStrategy(options) {
var _a;
const targetBranch = (_a = options.targetBranch) !== null && _a !== void 0 ? _a : options.github.repository.defaultBranch;
- const versioningStrategy = versioning_strategy_factory_1.buildVersioningStrategy({
+ const versioningStrategy = (0, versioning_strategy_factory_1.buildVersioningStrategy)({
type: options.versioning,
bumpMinorPreMajor: options.bumpMinorPreMajor,
bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
});
- const changelogNotes = changelog_notes_factory_1.buildChangelogNotes({
+ const changelogNotes = (0, changelog_notes_factory_1.buildChangelogNotes)({
type: options.changelogType || 'default',
github: options.github,
changelogSections: options.changelogSections,
@@ -80000,7 +80260,7 @@ class GitHub {
this.createPullRequest = wrapAsync(async (pullRequest, targetBranch, message, updates, options) => {
// Update the files for the release if not already supplied
const changes = await this.buildChangeSet(updates, targetBranch);
- const prNumber = await code_suggester_1.createPullRequest(this.octokit, changes, {
+ const prNumber = await (0, code_suggester_1.createPullRequest)(this.octokit, changes, {
upstreamOwner: this.repository.owner,
upstreamRepo: this.repository.repo,
title: pullRequest.title,
@@ -80050,13 +80310,13 @@ class GitHub {
const changes = await this.buildChangeSet(releasePullRequest.updates, targetBranch);
let message = releasePullRequest.title.toString();
if (options === null || options === void 0 ? void 0 : options.signoffUser) {
- message = signoff_commit_message_1.signoffCommitMessage(message, options.signoffUser);
+ message = (0, signoff_commit_message_1.signoffCommitMessage)(message, options.signoffUser);
}
const title = releasePullRequest.title.toString();
const body = releasePullRequest.body
.toString()
.slice(0, MAX_ISSUE_BODY_SIZE);
- const prNumber = await code_suggester_1.createPullRequest(this.octokit, changes, {
+ const prNumber = await (0, code_suggester_1.createPullRequest)(this.octokit, changes, {
upstreamOwner: this.repository.owner,
upstreamRepo: this.repository.repo,
title,
@@ -80414,7 +80674,7 @@ class GitHub {
repo: this.repository.repo,
num: 25,
targetBranch,
- maxFilesChanged: 100,
+ maxFilesChanged: 100, // max is 100
});
// if the branch does exist, return null
if (!response.repository.ref) {
@@ -80740,9 +81000,10 @@ class GitHub {
async createReleasePullRequest(releasePullRequest, targetBranch, options) {
let message = releasePullRequest.title.toString();
if (options === null || options === void 0 ? void 0 : options.signoffUser) {
- message = signoff_commit_message_1.signoffCommitMessage(message, options.signoffUser);
+ message = (0, signoff_commit_message_1.signoffCommitMessage)(message, options.signoffUser);
}
- const pullRequestLabels = (options === null || options === void 0 ? void 0 : options.skipLabeling) ? []
+ const pullRequestLabels = (options === null || options === void 0 ? void 0 : options.skipLabeling)
+ ? []
: releasePullRequest.labels;
return await this.createPullRequest({
headBranchName: releasePullRequest.headRefName,
@@ -80948,7 +81209,8 @@ class Manifest {
this.releasedVersions = releasedVersions;
this.manifestPath =
(manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.manifestPath) || exports.DEFAULT_RELEASE_PLEASE_MANIFEST;
- this.separatePullRequests = (_a = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.separatePullRequests) !== null && _a !== void 0 ? _a : Object.keys(repositoryConfig).length === 1;
+ this.separatePullRequests =
+ (_a = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.separatePullRequests) !== null && _a !== void 0 ? _a : Object.keys(repositoryConfig).length === 1;
this.plugins = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.plugins) || [];
this.fork = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.fork) || false;
this.signoffUser = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.signoff;
@@ -80963,7 +81225,8 @@ class Manifest {
this.lastReleaseSha = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.lastReleaseSha;
this.draft = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draft;
this.draftPullRequest = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draftPullRequest;
- this.groupPullRequestTitlePattern = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.groupPullRequestTitlePattern;
+ this.groupPullRequestTitlePattern =
+ manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.groupPullRequestTitlePattern;
this.releaseSearchDepth =
(manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.releaseSearchDepth) || DEFAULT_RELEASE_SEARCH_DEPTH;
this.commitSearchDepth =
@@ -81018,7 +81281,7 @@ class Manifest {
static async fromConfig(github, targetBranch, config, manifestOptions, path = exports.ROOT_PROJECT_PATH) {
const repositoryConfig = {};
repositoryConfig[path] = config;
- const strategy = await factory_1.buildStrategy({
+ const strategy = await (0, factory_1.buildStrategy)({
github,
...config,
});
@@ -81186,7 +81449,7 @@ class Manifest {
}
}
// Build plugins
- const plugins = this.plugins.map(pluginType => factory_1.buildPlugin({
+ const plugins = this.plugins.map(pluginType => (0, factory_1.buildPlugin)({
type: pluginType,
github: this.github,
targetBranch: this.targetBranch,
@@ -81546,7 +81809,7 @@ class Manifest {
for (const path in this.repositoryConfig) {
const config = this.repositoryConfig[path];
logger_1.logger.debug(`${path}: ${config.releaseType}`);
- const strategy = await factory_1.buildStrategy({
+ const strategy = await (0, factory_1.buildStrategy)({
...config,
github: this.github,
path,
@@ -81960,7 +82223,7 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
async buildAllPackages(candidates) {
var _a, _b, _c, _d;
const cargoManifestContent = await this.github.getFileContentsOnBranch('Cargo.toml', this.targetBranch);
- const cargoManifest = common_1.parseCargoManifest(cargoManifestContent.parsedContent);
+ const cargoManifest = (0, common_1.parseCargoManifest)(cargoManifestContent.parsedContent);
if (!((_a = cargoManifest.workspace) === null || _a === void 0 ? void 0 : _a.members)) {
logger_1.logger.warn("cargo-workspace plugin used, but top-level Cargo.toml isn't a cargo workspace");
return { allPackages: [], candidatesByPackage: {} };
@@ -81970,13 +82233,13 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
const members = cargoManifest.workspace.members;
members.push(manifest_1.ROOT_PROJECT_PATH);
for (const path of members) {
- const manifestPath = addPath(path, 'Cargo.toml');
+ const manifestPath = (0, workspace_1.addPath)(path, 'Cargo.toml');
logger_1.logger.info(`looking for candidate with path: ${path}`);
const candidate = candidates.find(c => c.path === path);
// get original content of the crate
const manifestContent = ((_b = candidate === null || candidate === void 0 ? void 0 : candidate.pullRequest.updates.find(update => update.path === manifestPath)) === null || _b === void 0 ? void 0 : _b.cachedFileContents) ||
(await this.github.getFileContentsOnBranch(manifestPath, this.targetBranch));
- const manifest = common_1.parseCargoManifest(manifestContent.parsedContent);
+ const manifest = (0, common_1.parseCargoManifest)(manifestContent.parsedContent);
const packageName = (_c = manifest.package) === null || _c === void 0 ? void 0 : _c.name;
if (!packageName) {
logger_1.logger.warn(`package manifest at ${manifestPath} is missing [package.name]`);
@@ -82017,18 +82280,18 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
versionsMap: updatedVersions,
});
const updatedContent = updater.updateContent(pkg.manifestContent);
- const originalManifest = common_1.parseCargoManifest(pkg.manifestContent);
- const updatedManifest = common_1.parseCargoManifest(updatedContent);
+ const originalManifest = (0, common_1.parseCargoManifest)(pkg.manifestContent);
+ const updatedManifest = (0, common_1.parseCargoManifest)(updatedContent);
const dependencyNotes = getChangelogDepsNotes(originalManifest, updatedManifest);
existingCandidate.pullRequest.updates =
existingCandidate.pullRequest.updates.map(update => {
- if (update.path === addPath(existingCandidate.path, 'Cargo.toml')) {
+ if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'Cargo.toml')) {
update.updater = new raw_content_1.RawContent(updatedContent);
}
else if (update.updater instanceof changelog_1.Changelog && dependencyNotes) {
- update.updater.changelogEntry = appendDependenciesSectionToChangelog(update.updater.changelogEntry, dependencyNotes);
+ update.updater.changelogEntry = (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes);
}
- else if (update.path === addPath(existingCandidate.path, 'Cargo.lock')) {
+ else if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'Cargo.lock')) {
update.updater = new cargo_lock_1.CargoLock(updatedVersions);
}
return update;
@@ -82037,13 +82300,13 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
if (dependencyNotes) {
if (existingCandidate.pullRequest.body.releaseData.length > 0) {
existingCandidate.pullRequest.body.releaseData[0].notes =
- appendDependenciesSectionToChangelog(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes);
+ (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes);
}
else {
existingCandidate.pullRequest.body.releaseData.push({
component: pkg.name,
version: existingCandidate.pullRequest.version,
- notes: appendDependenciesSectionToChangelog('', dependencyNotes),
+ notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes),
});
}
}
@@ -82059,8 +82322,8 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
versionsMap: updatedVersions,
});
const updatedContent = updater.updateContent(pkg.manifestContent);
- const originalManifest = common_1.parseCargoManifest(pkg.manifestContent);
- const updatedManifest = common_1.parseCargoManifest(updatedContent);
+ const originalManifest = (0, common_1.parseCargoManifest)(pkg.manifestContent);
+ const updatedManifest = (0, common_1.parseCargoManifest)(updatedContent);
const dependencyNotes = getChangelogDepsNotes(originalManifest, updatedManifest);
const pullRequest = {
title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch),
@@ -82068,17 +82331,17 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
{
component: pkg.name,
version,
- notes: appendDependenciesSectionToChangelog('', dependencyNotes),
+ notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes),
},
]),
updates: [
{
- path: addPath(pkg.path, 'Cargo.toml'),
+ path: (0, workspace_1.addPath)(pkg.path, 'Cargo.toml'),
createIfMissing: false,
updater: new raw_content_1.RawContent(updatedContent),
},
{
- path: addPath(pkg.path, 'CHANGELOG.md'),
+ path: (0, workspace_1.addPath)(pkg.path, 'CHANGELOG.md'),
createIfMissing: false,
updater: new changelog_1.Changelog({
version,
@@ -82197,44 +82460,6 @@ function getChangelogDepsNotes(originalManifest, updatedManifest) {
}
return '';
}
-const DEPENDENCY_HEADER = new RegExp('### Dependencies');
-function appendDependenciesSectionToChangelog(changelog, notes) {
- if (!changelog) {
- return `### Dependencies\n\n${notes}`;
- }
- const newLines = [];
- let seenDependenciesSection = false;
- let seenDependencySectionSpacer = false;
- let injected = false;
- for (const line of changelog.split('\n')) {
- if (seenDependenciesSection) {
- const trimmedLine = line.trim();
- if (seenDependencySectionSpacer &&
- !injected &&
- !trimmedLine.startsWith('*')) {
- newLines.push(changelog);
- injected = true;
- }
- if (trimmedLine === '') {
- seenDependencySectionSpacer = true;
- }
- }
- if (line.match(DEPENDENCY_HEADER)) {
- seenDependenciesSection = true;
- }
- newLines.push(line);
- }
- if (injected) {
- return newLines.join('\n');
- }
- if (seenDependenciesSection) {
- return `${changelog}\n${notes}`;
- }
- return `${changelog}\n\n\n### Dependencies\n\n${notes}`;
-}
-function addPath(path, file) {
- return path === manifest_1.ROOT_PROJECT_PATH ? file : `${path}/${file}`;
-}
//# sourceMappingURL=cargo-workspace.js.map
/***/ }),
@@ -82317,7 +82542,7 @@ class LinkedVersions extends plugin_1.ManifestPlugin {
if (path in groupStrategies) {
const component = await strategiesByPath[path].getComponent();
logger_1.logger.info(`Replacing strategy for path ${path} with forced version: ${primaryVersion}`);
- newStrategies[path] = await factory_1.buildStrategy({
+ newStrategies[path] = await (0, factory_1.buildStrategy)({
...this.repositoryConfig[path],
github: this.github,
path,
@@ -82371,6 +82596,266 @@ exports.LinkedVersions = LinkedVersions;
/***/ }),
+/***/ 66113:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright 2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.MavenWorkspace = void 0;
+const workspace_1 = __nccwpck_require__(44226);
+const version_1 = __nccwpck_require__(17348);
+const versioning_strategy_1 = __nccwpck_require__(41941);
+const dom = __nccwpck_require__(49213);
+const xpath = __nccwpck_require__(65319);
+const logger_1 = __nccwpck_require__(68809);
+const path_1 = __nccwpck_require__(85622);
+const pom_xml_1 = __nccwpck_require__(60255);
+const changelog_1 = __nccwpck_require__(3325);
+const pull_request_title_1 = __nccwpck_require__(1158);
+const pull_request_body_1 = __nccwpck_require__(70774);
+const branch_name_1 = __nccwpck_require__(16344);
+const JAVA_RELEASE_TYPES = new Set(['java', 'java-bom', 'java-yoshi', 'maven']);
+const XPATH_PROJECT_GROUP = '/*[local-name()="project"]/*[local-name()="groupId"]';
+const XPATH_PROJECT_ARTIFACT = '/*[local-name()="project"]/*[local-name()="artifactId"]';
+const XPATH_PROJECT_VERSION = '/*[local-name()="project"]/*[local-name()="version"]';
+const XPATH_PROJECT_DEPENDENCIES = '/*[local-name()="project"]/*[local-name()="dependencies"]/*[local-name()="dependency"]';
+class MavenWorkspace extends workspace_1.WorkspacePlugin {
+ async fetchPom(path) {
+ const content = await this.github.getFileContentsOnBranch(path, this.targetBranch);
+ const document = new dom.DOMParser().parseFromString(content.parsedContent);
+ const groupNodes = xpath.select(XPATH_PROJECT_GROUP, document);
+ if (groupNodes.length === 0) {
+ logger_1.logger.warn(`Missing project.groupId in ${path}`);
+ return;
+ }
+ const artifactNodes = xpath.select(XPATH_PROJECT_ARTIFACT, document);
+ if (artifactNodes.length === 0) {
+ logger_1.logger.warn(`Missing project.artifactId in ${path}`);
+ return;
+ }
+ const versionNodes = xpath.select(XPATH_PROJECT_VERSION, document);
+ if (versionNodes.length === 0) {
+ logger_1.logger.warn(`Missing project.version in ${path}`);
+ return;
+ }
+ const dependencies = [];
+ const testDependencies = [];
+ for (const dependencyNode of xpath.select(XPATH_PROJECT_DEPENDENCIES, document)) {
+ const parsedNode = (0, pom_xml_1.parseDependencyNode)(dependencyNode);
+ if (!parsedNode.version) {
+ continue;
+ }
+ if (parsedNode.scope === 'test') {
+ testDependencies.push({
+ groupId: parsedNode.groupId,
+ artifactId: parsedNode.artifactId,
+ version: parsedNode.version,
+ });
+ }
+ else {
+ dependencies.push({
+ groupId: parsedNode.groupId,
+ artifactId: parsedNode.artifactId,
+ version: parsedNode.version,
+ });
+ }
+ }
+ const groupId = groupNodes[0].firstChild.textContent;
+ const artifactId = artifactNodes[0].firstChild.textContent;
+ return {
+ path,
+ groupId,
+ artifactId,
+ name: `${groupId}:${artifactId}`,
+ version: versionNodes[0].firstChild.textContent,
+ dependencies,
+ testDependencies,
+ pomContent: content.parsedContent,
+ };
+ }
+ async buildAllPackages(candidates) {
+ const allPackages = [];
+ const candidatesByPackage = {};
+ // find all pom.xml files and build a dependency graph
+ const pomFiles = await this.github.findFilesByFilenameAndRef('pom.xml', this.targetBranch);
+ for (const pomFile of pomFiles) {
+ const path = (0, path_1.dirname)(pomFile);
+ const config = this.repositoryConfig[path];
+ if (!config) {
+ logger_1.logger.info(`path '${path}' not configured, ignoring '${pomFile}'`);
+ continue;
+ }
+ const mavenArtifact = await this.fetchPom(pomFile);
+ if (!mavenArtifact) {
+ continue;
+ }
+ allPackages.push(mavenArtifact);
+ const candidate = candidates.find(candidate => candidate.path === path);
+ if (candidate) {
+ candidatesByPackage[this.packageNameFromPackage(mavenArtifact)] =
+ candidate;
+ }
+ else {
+ logger_1.logger.warn(`found ${pomFile} in path ${path}, but did not find an associated candidate PR`);
+ }
+ }
+ return {
+ allPackages,
+ candidatesByPackage,
+ };
+ }
+ async buildGraph(allPackages) {
+ const artifactsByName = allPackages.reduce((collection, mavenArtifact) => {
+ collection[mavenArtifact.name] = mavenArtifact;
+ return collection;
+ }, {});
+ const graph = new Map();
+ for (const mavenArtifact of allPackages) {
+ const allDeps = [
+ ...mavenArtifact.dependencies,
+ ...mavenArtifact.testDependencies,
+ ];
+ const workspaceDeps = allDeps.filter(dep => artifactsByName[packageNameFromGav(dep)]);
+ graph.set(mavenArtifact.name, {
+ deps: workspaceDeps.map(dep => packageNameFromGav(dep)),
+ value: mavenArtifact,
+ });
+ }
+ return graph;
+ }
+ bumpVersion(artifact) {
+ const version = version_1.Version.parse(artifact.version);
+ return new versioning_strategy_1.PatchVersionUpdate().bump(version);
+ }
+ updateCandidate(existingCandidate, artifact, updatedVersions) {
+ const version = updatedVersions.get(artifact.name);
+ if (!version) {
+ throw new Error(`Didn't find updated version for ${artifact.name}`);
+ }
+ const updater = new pom_xml_1.PomXml(version, updatedVersions);
+ const dependencyNotes = getChangelogDepsNotes(artifact, updater, updatedVersions);
+ existingCandidate.pullRequest.updates =
+ existingCandidate.pullRequest.updates.map(update => {
+ if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'pom.xml')) {
+ update.updater = updater;
+ }
+ else if (update.updater instanceof changelog_1.Changelog) {
+ if (dependencyNotes) {
+ update.updater.changelogEntry =
+ (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes);
+ }
+ }
+ return update;
+ });
+ // append dependency notes
+ if (dependencyNotes) {
+ if (existingCandidate.pullRequest.body.releaseData.length > 0) {
+ existingCandidate.pullRequest.body.releaseData[0].notes =
+ (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes);
+ }
+ else {
+ existingCandidate.pullRequest.body.releaseData.push({
+ component: artifact.name,
+ version: existingCandidate.pullRequest.version,
+ notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes),
+ });
+ }
+ }
+ return existingCandidate;
+ }
+ newCandidate(artifact, updatedVersions) {
+ const version = updatedVersions.get(artifact.name);
+ if (!version) {
+ throw new Error(`Didn't find updated version for ${artifact.name}`);
+ }
+ const updater = new pom_xml_1.PomXml(version, updatedVersions);
+ const dependencyNotes = getChangelogDepsNotes(artifact, updater, updatedVersions);
+ const pullRequest = {
+ title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch),
+ body: new pull_request_body_1.PullRequestBody([
+ {
+ component: artifact.name,
+ version,
+ notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes),
+ },
+ ]),
+ updates: [
+ {
+ path: (0, workspace_1.addPath)(artifact.path, 'pom.xml'),
+ createIfMissing: false,
+ updater,
+ },
+ {
+ path: (0, workspace_1.addPath)(artifact.path, 'CHANGELOG.md'),
+ createIfMissing: false,
+ updater: new changelog_1.Changelog({
+ version,
+ changelogEntry: dependencyNotes,
+ }),
+ },
+ ],
+ labels: [],
+ headRefName: branch_name_1.BranchName.ofTargetBranch(this.targetBranch).toString(),
+ version,
+ draft: false,
+ };
+ return {
+ path: artifact.path,
+ pullRequest,
+ config: {
+ releaseType: 'maven',
+ },
+ };
+ }
+ inScope(candidate) {
+ return JAVA_RELEASE_TYPES.has(candidate.config.releaseType);
+ }
+ packageNameFromPackage(artifact) {
+ return artifact.name;
+ }
+ pathFromPackage(artifact) {
+ return artifact.path;
+ }
+ postProcessCandidates(candidates, _updatedVersions) {
+ // NOP for maven workspaces
+ return candidates;
+ }
+}
+exports.MavenWorkspace = MavenWorkspace;
+function packageNameFromGav(gav) {
+ return `${gav.groupId}:${gav.artifactId}`;
+}
+function getChangelogDepsNotes(artifact, updater, updatedVersions) {
+ const document = new dom.DOMParser().parseFromString(artifact.pomContent);
+ const dependencyUpdates = updater.dependencyUpdates(document, updatedVersions);
+ const depUpdateNotes = [];
+ for (const dependencyUpdate of dependencyUpdates) {
+ depUpdateNotes.push(`\n * ${dependencyUpdate.name} bumped to ${dependencyUpdate.version}`);
+ logger_1.logger.info(`bumped ${dependencyUpdate.name} to ${dependencyUpdate.version}`);
+ }
+ if (depUpdateNotes.length > 0) {
+ return `* The following workspace dependencies were updated${depUpdateNotes.join()}`;
+ }
+ return '';
+}
+//# sourceMappingURL=maven-workspace.js.map
+
+/***/ }),
+
/***/ 90514:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -82439,7 +82924,7 @@ class Merge extends plugin_1.ManifestPlugin {
rootRelease = candidate;
}
}
- const updates = composite_1.mergeUpdates(rawUpdates);
+ const updates = (0, composite_1.mergeUpdates)(rawUpdates);
const pullRequest = {
title: pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.component, this.targetBranch, rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.version, this.pullRequestTitlePattern),
body: new pull_request_body_1.PullRequestBody(releaseData, { useComponents: true }),
@@ -82536,7 +83021,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
const candidate = candidatesByPath.get(path);
if (candidate) {
logger_1.logger.debug(`Found candidate pull request for path: ${candidate.path}`);
- const packagePath = addPath(candidate.path, 'package.json');
+ const packagePath = (0, workspace_1.addPath)(candidate.path, 'package.json');
const packageUpdate = candidate.pullRequest.updates.find(update => update.path === packagePath);
if (packageUpdate === null || packageUpdate === void 0 ? void 0 : packageUpdate.cachedFileContents) {
const pkg = new Package(packageUpdate.cachedFileContents.parsedContent, candidate.path);
@@ -82551,7 +83036,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
}
}
else {
- const packagePath = addPath(path, 'package.json');
+ const packagePath = (0, workspace_1.addPath)(path, 'package.json');
logger_1.logger.debug(`No candidate pull request for path: ${path} - inspect package from ${packagePath}`);
const contents = await this.github.getFileContentsOnBranch(packagePath, this.targetBranch);
packagesByPath.set(path, new Package(contents.parsedContent, path));
@@ -82592,13 +83077,13 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage);
existingCandidate.pullRequest.updates =
existingCandidate.pullRequest.updates.map(update => {
- if (update.path === addPath(existingCandidate.path, 'package.json')) {
- update.updater = new raw_content_1.RawContent(json_stringify_1.jsonStringify(updatedPackage.toJSON(), updatedPackage.rawContent));
+ if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'package.json')) {
+ update.updater = new raw_content_1.RawContent((0, json_stringify_1.jsonStringify)(updatedPackage.toJSON(), updatedPackage.rawContent));
}
else if (update.updater instanceof changelog_1.Changelog) {
if (dependencyNotes) {
update.updater.changelogEntry =
- appendDependenciesSectionToChangelog(update.updater.changelogEntry, dependencyNotes);
+ (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes);
}
}
return update;
@@ -82607,13 +83092,13 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
if (dependencyNotes) {
if (existingCandidate.pullRequest.body.releaseData.length > 0) {
existingCandidate.pullRequest.body.releaseData[0].notes =
- appendDependenciesSectionToChangelog(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes);
+ (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes);
}
else {
existingCandidate.pullRequest.body.releaseData.push({
component: updatedPackage.name,
version: existingCandidate.pullRequest.version,
- notes: appendDependenciesSectionToChangelog('', dependencyNotes),
+ notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes),
});
}
}
@@ -82648,21 +83133,21 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
{
component: updatedPackage.name,
version,
- notes: appendDependenciesSectionToChangelog('', dependencyNotes),
+ notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes),
},
]),
updates: [
{
- path: addPath(updatedPackage.location, 'package.json'),
+ path: (0, workspace_1.addPath)(updatedPackage.location, 'package.json'),
createIfMissing: false,
- updater: new raw_content_1.RawContent(json_stringify_1.jsonStringify(packageJson, updatedPackage.rawContent)),
+ updater: new raw_content_1.RawContent((0, json_stringify_1.jsonStringify)(packageJson, updatedPackage.rawContent)),
},
{
- path: addPath(updatedPackage.location, 'CHANGELOG.md'),
+ path: (0, workspace_1.addPath)(updatedPackage.location, 'CHANGELOG.md'),
createIfMissing: false,
updater: new changelog_1.Changelog({
version,
- changelogEntry: appendDependenciesSectionToChangelog('', dependencyNotes),
+ changelogEntry: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes),
}),
},
],
@@ -82750,44 +83235,6 @@ function getChangelogDepsNotes(original, updated) {
}
return '';
}
-const DEPENDENCY_HEADER = new RegExp('### Dependencies');
-function appendDependenciesSectionToChangelog(changelog, notes) {
- if (!changelog) {
- return `### Dependencies\n\n${notes}`;
- }
- const newLines = [];
- let seenDependenciesSection = false;
- let seenDependencySectionSpacer = false;
- let injected = false;
- for (const line of changelog.split('\n')) {
- if (seenDependenciesSection) {
- const trimmedLine = line.trim();
- if (seenDependencySectionSpacer &&
- !injected &&
- !trimmedLine.startsWith('*')) {
- newLines.push(changelog);
- injected = true;
- }
- if (trimmedLine === '') {
- seenDependencySectionSpacer = true;
- }
- }
- if (line.match(DEPENDENCY_HEADER)) {
- seenDependenciesSection = true;
- }
- newLines.push(line);
- }
- if (injected) {
- return newLines.join('\n');
- }
- if (seenDependenciesSection) {
- return `${changelog}\n${notes}`;
- }
- return `${changelog}\n\n\n### Dependencies\n\n${notes}`;
-}
-function addPath(path, file) {
- return path === manifest_1.ROOT_PROJECT_PATH ? file : `${path}/${file}`;
-}
//# sourceMappingURL=node-workspace.js.map
/***/ }),
@@ -82811,7 +83258,7 @@ function addPath(path, file) {
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.WorkspacePlugin = void 0;
+exports.addPath = exports.appendDependenciesSectionToChangelog = exports.WorkspacePlugin = void 0;
const plugin_1 = __nccwpck_require__(31651);
const manifest_1 = __nccwpck_require__(31999);
const logger_1 = __nccwpck_require__(68809);
@@ -82987,6 +83434,47 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
}
}
exports.WorkspacePlugin = WorkspacePlugin;
+const DEPENDENCY_HEADER = new RegExp('### Dependencies');
+function appendDependenciesSectionToChangelog(changelog, notes) {
+ if (!changelog) {
+ return `### Dependencies\n\n${notes}`;
+ }
+ logger_1.logger.info('appending dependency notes to changelog');
+ const newLines = [];
+ let seenDependenciesSection = false;
+ let seenDependencySectionSpacer = false;
+ let injected = false;
+ for (const line of changelog.split('\n')) {
+ if (seenDependenciesSection) {
+ const trimmedLine = line.trim();
+ if (seenDependencySectionSpacer &&
+ !injected &&
+ !trimmedLine.startsWith('*')) {
+ newLines.push(changelog);
+ injected = true;
+ }
+ if (trimmedLine === '') {
+ seenDependencySectionSpacer = true;
+ }
+ }
+ if (line.match(DEPENDENCY_HEADER)) {
+ seenDependenciesSection = true;
+ }
+ newLines.push(line);
+ }
+ if (injected) {
+ return newLines.join('\n');
+ }
+ if (seenDependenciesSection) {
+ return `${changelog}\n${notes}`;
+ }
+ return `${changelog}\n\n\n### Dependencies\n\n${notes}`;
+}
+exports.appendDependenciesSectionToChangelog = appendDependenciesSectionToChangelog;
+function addPath(path, file) {
+ return path === manifest_1.ROOT_PROJECT_PATH ? file : `${path}/${file}`;
+}
+exports.addPath = addPath;
//# sourceMappingURL=workspace.js.map
/***/ }),
@@ -83026,6 +83514,7 @@ const generic_1 = __nccwpck_require__(96323);
const generic_json_1 = __nccwpck_require__(15011);
const generic_xml_1 = __nccwpck_require__(15591);
const pom_xml_1 = __nccwpck_require__(60255);
+const generic_yaml_1 = __nccwpck_require__(61024);
const DEFAULT_CHANGELOG_PATH = 'CHANGELOG.md';
/**
* A strategy is responsible for determining which files are
@@ -83130,7 +83619,7 @@ class BaseStrategy {
* open a pull request.
*/
async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
- const conventionalCommits = await this.postProcessCommits(commit_1.parseConventionalCommits(commits));
+ const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits));
logger_1.logger.info(`Considering: ${conventionalCommits.length} commits`);
if (conventionalCommits.length === 0) {
logger_1.logger.info(`No commits for path: ${this.path}, skipping`);
@@ -83158,7 +83647,7 @@ class BaseStrategy {
versionsMap,
latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version,
});
- const updatesWithExtras = composite_1.mergeUpdates(updates.concat(...this.extraFileUpdates(newVersion, versionsMap)));
+ const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...this.extraFileUpdates(newVersion, versionsMap)));
const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease);
return {
title: pullRequestTitle,
@@ -83180,6 +83669,12 @@ class BaseStrategy {
createIfMissing: false,
updater: new generic_json_1.GenericJson(extraFile.jsonpath, version),
};
+ case 'yaml':
+ return {
+ path: this.addPath(extraFile.path),
+ createIfMissing: false,
+ updater: new generic_yaml_1.GenericYaml(extraFile.jsonpath, version),
+ };
case 'xml':
return {
path: this.addPath(extraFile.path),
@@ -83456,7 +83951,8 @@ class DotnetYoshi extends base_1.BaseStrategy {
var _a, _b, _c, _d;
options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
options.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : DEFAULT_CHANGELOG_PATH;
- options.pullRequestTitlePattern = (_c = options.pullRequestTitlePattern) !== null && _c !== void 0 ? _c : DEFAULT_PULL_REQUEST_TITLE_PATTERN;
+ options.pullRequestTitlePattern =
+ (_c = options.pullRequestTitlePattern) !== null && _c !== void 0 ? _c : DEFAULT_PULL_REQUEST_TITLE_PATTERN;
options.includeVInTag = (_d = options.includeVInTag) !== null && _d !== void 0 ? _d : false;
super(options);
}
@@ -83701,7 +84197,7 @@ class GoYoshi extends base_1.BaseStrategy {
logger_1.logger.info('Looking for go.mod files');
const paths = (await this.github.findFilesByFilenameAndRef('go.mod', this.targetBranch))
.filter(path => !path.includes('internal') && path !== 'go.mod')
- .map(path => path_1.dirname(path));
+ .map(path => (0, path_1.dirname)(path));
logger_1.logger.info(`Found ${paths.length} submodules`);
logger_1.logger.debug(JSON.stringify(paths));
return new Set(paths);
@@ -84149,7 +84645,7 @@ class Java extends base_1.BaseStrategy {
changelogEntry: notes,
isSnapshot: true,
});
- const updatesWithExtras = composite_1.mergeUpdates(updates.concat(...this.extraFileUpdates(newVersion, versionsMap)));
+ const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...this.extraFileUpdates(newVersion, versionsMap)));
return {
title: pullRequestTitle,
body: pullRequestBody,
@@ -84595,7 +85091,7 @@ class PHPYoshi extends base_1.BaseStrategy {
}
async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
var _a, _b, _c;
- const conventionalCommits = await this.postProcessCommits(commit_1.parseConventionalCommits(commits));
+ const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits));
if (conventionalCommits.length === 0) {
logger_1.logger.info(`No commits for path: ${this.path}, skipping`);
return undefined;
@@ -84985,7 +85481,7 @@ class Python extends base_1.BaseStrategy {
async getPyProject(path) {
try {
const content = await this.github.getFileContentsOnBranch(path, this.targetBranch);
- return pyproject_toml_1.parsePyProject(content.parsedContent);
+ return (0, pyproject_toml_1.parsePyProject)(content.parsedContent);
}
catch (e) {
return null;
@@ -85047,9 +85543,9 @@ class RubyYoshi extends base_1.BaseStrategy {
super({
...options,
changelogSections: CHANGELOG_SECTIONS,
- commitPartial: fs_1.readFileSync(__nccwpck_require__.ab + "commit.hbs", 'utf8'),
- headerPartial: fs_1.readFileSync(__nccwpck_require__.ab + "header.hbs", 'utf8'),
- mainTemplate: fs_1.readFileSync(__nccwpck_require__.ab + "template.hbs", 'utf8'),
+ commitPartial: (0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../../templates/commit.hbs'), 'utf8'),
+ headerPartial: (0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../../templates/header.hbs'), 'utf8'),
+ mainTemplate: (0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../../templates/template.hbs'), 'utf8'),
tagSeparator: '/',
});
this.versionFile = (_a = options.versionFile) !== null && _a !== void 0 ? _a : '';
@@ -85079,7 +85575,7 @@ class RubyYoshi extends base_1.BaseStrategy {
}
async postProcessCommits(commits) {
commits.forEach(commit => {
- commit.message = indent_commit_1.indentCommit(commit);
+ commit.message = (0, indent_commit_1.indentCommit)(commit);
});
return commits;
}
@@ -85161,7 +85657,7 @@ class Ruby extends base_1.BaseStrategy {
}
async postProcessCommits(commits) {
commits.forEach(commit => {
- commit.message = indent_commit_1.indentCommit(commit);
+ commit.message = (0, indent_commit_1.indentCommit)(commit);
});
return commits;
}
@@ -85233,7 +85729,7 @@ class Rust extends base_1.BaseStrategy {
logger_1.logger.warn(`member ${member} declared but did not find Cargo.toml`);
continue;
}
- const manifest = common_1.parseCargoManifest(manifestContent.parsedContent);
+ const manifest = (0, common_1.parseCargoManifest)(manifestContent.parsedContent);
manifestsByPath.set(manifestPath, manifestContent);
if (!((_c = manifest.package) === null || _c === void 0 ? void 0 : _c.name)) {
logger_1.logger.warn(`member ${member} has no package name`);
@@ -85319,7 +85815,7 @@ class Rust extends base_1.BaseStrategy {
}
async getManifest(path) {
const content = await this.getContent(path);
- return content ? common_1.parseCargoManifest(content.parsedContent) : null;
+ return content ? (0, common_1.parseCargoManifest)(content.parsedContent) : null;
}
}
exports.Rust = Rust;
@@ -85770,7 +86266,7 @@ class Apis {
return content;
}
api.version = this.version.toString();
- return json_stringify_1.jsonStringify(data, content);
+ return (0, json_stringify_1.jsonStringify)(data, content);
}
}
exports.Apis = Apis;
@@ -85864,7 +86360,7 @@ class GenericJson {
logger_1.logger.warn(`No entries modified in ${this.jsonpath}`);
return content;
}
- return json_stringify_1.jsonStringify(data, content);
+ return (0, json_stringify_1.jsonStringify)(data, content);
}
}
exports.GenericJson = GenericJson;
@@ -85917,6 +86413,90 @@ exports.GenericXml = GenericXml;
/***/ }),
+/***/ 61024:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright 2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.GenericYaml = void 0;
+const jp = __nccwpck_require__(74378);
+const yaml = __nccwpck_require__(21917);
+const logger_1 = __nccwpck_require__(68809);
+const DOCUMENT_SEPARATOR = '---\n';
+/**
+ * Updates YAML document according to given JSONPath.
+ *
+ * Note that used parser does reformat the document and removes all comments,
+ * and converts everything to pure YAML (even JSON source).
+ * If you want to retain formatting, use generic updater with comment hints.
+ *
+ * When applied on multi-document file, it updates all documents.
+ */
+class GenericYaml {
+ constructor(jsonpath, version) {
+ this.jsonpath = jsonpath;
+ this.version = version;
+ }
+ /**
+ * Given initial file contents, return updated contents.
+ * @param {string} content The initial content
+ * @returns {string} The updated content
+ */
+ updateContent(content) {
+ // Parse possibly multi-document file
+ let docs;
+ try {
+ docs = yaml.loadAll(content, null, { json: true });
+ }
+ catch (e) {
+ logger_1.logger.warn('Invalid yaml, cannot be parsed', e);
+ return content;
+ }
+ // Update each document
+ let modified = false;
+ docs.forEach(data => {
+ const nodes = jp.apply(data, this.jsonpath, _val => {
+ return this.version.toString();
+ });
+ if (nodes && nodes.length) {
+ modified = true;
+ }
+ });
+ // If nothing was modified, return original content
+ if (!modified) {
+ logger_1.logger.warn(`No entries modified in ${this.jsonpath}`);
+ return content;
+ }
+ // Stringify documents
+ if (docs.length === 1) {
+ // Single doc
+ return yaml.dump(docs[0]);
+ }
+ else {
+ // Multi-document, each document starts with separator
+ return docs.map(data => DOCUMENT_SEPARATOR + yaml.dump(data)).join('');
+ }
+ }
+}
+exports.GenericYaml = GenericYaml;
+//# sourceMappingURL=generic-yaml.js.map
+
+/***/ }),
+
/***/ 96323:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -86292,11 +86872,13 @@ exports.JavaUpdate = JavaUpdate;
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.PomXml = void 0;
+exports.parseDependencyNode = exports.PomXml = void 0;
const base_xml_1 = __nccwpck_require__(29481);
const xpath = __nccwpck_require__(65319);
const XPATH_PROJECT_VERSION = '/*[local-name()="project"]/*[local-name()="version"]';
const XPATH_PROJECT_PARENT_VERSION = '/*[local-name()="project"]/*[local-name()="parent"]/*[local-name()="version"]';
+const XPATH_PROJECT_DEPENDENCIES = '/*[local-name()="project"]/*[local-name()="dependencies"]/*[local-name()="dependency"]';
+const XPATH_PROJECT_DEPENDENCY_MANAGEMENT_DEPENDENCIES = '/*[local-name()="project"]/*[local-name()="dependencyManagement"]/*[local-name()="dependencies"]/*[local-name()="dependency"]';
/**
* Updates version pom.xml files.
*
@@ -86304,22 +86886,71 @@ const XPATH_PROJECT_PARENT_VERSION = '/*[local-name()="project"]/*[local-name()=
* If project.version is not present, it updates project.parent.version.
*/
class PomXml extends base_xml_1.BaseXml {
- constructor(version) {
+ constructor(version, dependencyVersions) {
super();
this.version = version;
+ this.dependencyVersions = dependencyVersions;
}
updateDocument(document) {
- const version = this.version.toString();
// NOTE this intentionally ignores namespaces - let the maven decide, what's valid and what's not
+ const updates = [];
// Update project.version
const projectVersionNodes = xpath.select(XPATH_PROJECT_VERSION, document);
if (projectVersionNodes.length) {
// If found update, detect actual change
- return PomXml.updateNodes(projectVersionNodes, version);
+ updates.push({
+ nodes: projectVersionNodes,
+ version: this.version,
+ });
}
- // Try updating project.parent.version
- const parentVersionNodes = xpath.select(XPATH_PROJECT_PARENT_VERSION, document);
- return PomXml.updateNodes(parentVersionNodes, version);
+ else {
+ // Try updating project.parent.version
+ const parentVersionNodes = xpath.select(XPATH_PROJECT_PARENT_VERSION, document);
+ updates.push({
+ nodes: parentVersionNodes,
+ version: this.version,
+ });
+ }
+ if (this.dependencyVersions) {
+ updates.push(...this.dependencyUpdates(document, this.dependencyVersions));
+ }
+ let updated = false;
+ for (const { nodes, version } of updates) {
+ updated = PomXml.updateNodes(nodes, version.toString()) || updated;
+ }
+ return updated;
+ }
+ dependencyUpdates(document, updatedVersions) {
+ const updates = [];
+ const dependencyNodes = xpath.select(XPATH_PROJECT_DEPENDENCIES, document);
+ const dependencyManagementNodes = xpath.select(XPATH_PROJECT_DEPENDENCY_MANAGEMENT_DEPENDENCIES, document);
+ // try to update dependency versions
+ for (const [name, version] of updatedVersions.entries()) {
+ // look under:
+ // - project/dependencies
+ // - project/dependencyManagement/dependencies
+ const [groupId, artifactId] = name.split(':');
+ for (const nodeGroup of [dependencyNodes, dependencyManagementNodes]) {
+ const nodes = nodeGroup.reduce((collection, node) => {
+ const dependencyNode = parseDependencyNode(node);
+ if (dependencyNode.groupId === groupId &&
+ dependencyNode.artifactId === artifactId &&
+ dependencyNode.version !== version.toString() &&
+ dependencyNode.versionNode) {
+ collection.push(dependencyNode.versionNode);
+ }
+ return collection;
+ }, []);
+ if (nodes.length) {
+ updates.push({
+ name,
+ nodes,
+ version,
+ });
+ }
+ }
+ }
+ return updates;
}
static updateNodes(nodes, value) {
const toUpdate = nodes.filter(node => node.textContent !== value);
@@ -86328,6 +86959,38 @@ class PomXml extends base_xml_1.BaseXml {
}
}
exports.PomXml = PomXml;
+function parseDependencyNode(node) {
+ var _a, _b, _c, _d;
+ let groupId = '';
+ let artifactId = '';
+ let scope;
+ let version;
+ let versionNode;
+ for (let i = 0; i < node.childNodes.length; i++) {
+ const childNode = node.childNodes.item(i);
+ if (childNode.nodeName === 'groupId') {
+ groupId = ((_a = childNode.firstChild) === null || _a === void 0 ? void 0 : _a.textContent) || '';
+ }
+ else if (childNode.nodeName === 'artifactId') {
+ artifactId = ((_b = childNode.firstChild) === null || _b === void 0 ? void 0 : _b.textContent) || '';
+ }
+ else if (childNode.nodeName === 'scope') {
+ scope = ((_c = childNode.firstChild) === null || _c === void 0 ? void 0 : _c.textContent) || '';
+ }
+ else if (childNode.nodeName === 'version') {
+ version = ((_d = childNode.firstChild) === null || _d === void 0 ? void 0 : _d.textContent) || '';
+ versionNode = childNode;
+ }
+ }
+ return {
+ groupId,
+ artifactId,
+ scope,
+ version,
+ versionNode,
+ };
+}
+exports.parseDependencyNode = parseDependencyNode;
//# sourceMappingURL=pom-xml.js.map
/***/ }),
@@ -86499,7 +87162,7 @@ class PackageJson extends default_1.DefaultUpdater {
const parsed = JSON.parse(content);
logger_1.logger.info(`updating from ${parsed.version} to ${this.version}`);
parsed.version = this.version.toString();
- return json_stringify_1.jsonStringify(parsed, content);
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
}
}
exports.PackageJson = PackageJson;
@@ -86542,7 +87205,7 @@ class PackageLockJson extends default_1.DefaultUpdater {
if (parsed.lockfileVersion === 2) {
parsed.packages[''].version = this.version.toString();
}
- return json_stringify_1.jsonStringify(parsed, content);
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
}
}
exports.PackageLockJson = PackageLockJson;
@@ -86598,7 +87261,7 @@ class SamplesPackageJson extends default_1.DefaultUpdater {
}
logger_1.logger.info(`updating ${this.packageName} dependency from ${parsed.dependencies[this.packageName]} to ^${this.version}`);
parsed.dependencies[this.packageName] = `^${this.version}`;
- return json_stringify_1.jsonStringify(parsed, content);
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
}
}
exports.SamplesPackageJson = SamplesPackageJson;
@@ -86686,7 +87349,7 @@ class EsyJson extends default_1.DefaultUpdater {
const parsed = JSON.parse(content);
logger_1.logger.info(`updating from ${parsed.version} to ${this.version}`);
parsed.version = this.version.toString();
- return json_stringify_1.jsonStringify(parsed, content);
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
}
}
exports.EsyJson = EsyJson;
@@ -86831,7 +87494,7 @@ class PHPManifest extends default_1.DefaultUpdater {
module.versions.unshift(`v${this.version}`);
}
});
- return json_stringify_1.jsonStringify(parsed, content);
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
}
}
exports.PHPManifest = PHPManifest;
@@ -86885,7 +87548,7 @@ class RootComposerUpdatePackages extends default_1.DefaultUpdater {
parsed.replace[key] = version.toString();
}
}
- return json_stringify_1.jsonStringify(parsed, content);
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
}
}
exports.RootComposerUpdatePackages = RootComposerUpdatePackages;
@@ -86939,7 +87602,7 @@ class PyProjectToml extends default_1.DefaultUpdater {
logger_1.logger.error(msg);
throw new Error(msg);
}
- return toml_edit_1.replaceTomlValue(content, (parsed.project ? ['project'] : ['tool', 'poetry']).concat('version'), this.version.toString());
+ return (0, toml_edit_1.replaceTomlValue)(content, (parsed.project ? ['project'] : ['tool', 'poetry']).concat('version'), this.version.toString());
}
}
exports.PyProjectToml = PyProjectToml;
@@ -87139,7 +87802,7 @@ class ReleasePleaseManifest extends default_1.DefaultUpdater {
parsed[path] = version.toString();
}
if (content) {
- return json_stringify_1.jsonStringify(parsed, content);
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
}
else {
return JSON.stringify(parsed, null, 2);
@@ -87227,7 +87890,7 @@ class CargoLock {
*/
updateContent(content) {
let payload = content;
- const parsed = common_1.parseCargoLockfile(payload);
+ const parsed = (0, common_1.parseCargoLockfile)(payload);
if (!parsed.package) {
logger_1.logger.error('is not a Cargo lockfile');
throw new Error('is not a Cargo lockfile');
@@ -87251,7 +87914,7 @@ class CargoLock {
// `path` argument.
const packageIndex = i.toString();
logger_1.logger.info(`updating ${pkg.name} in`);
- payload = toml_edit_1.replaceTomlValue(payload, ['package', packageIndex, 'version'], nextVersion.toString());
+ payload = (0, toml_edit_1.replaceTomlValue)(payload, ['package', packageIndex, 'version'], nextVersion.toString());
}
return payload;
}
@@ -87299,13 +87962,13 @@ class CargoToml extends default_1.DefaultUpdater {
if (!this.versionsMap) {
throw new Error('updateContent called with no versions');
}
- const parsed = common_1.parseCargoManifest(payload);
+ const parsed = (0, common_1.parseCargoManifest)(payload);
if (!parsed.package) {
const msg = 'is not a package manifest (might be a cargo workspace)';
logger_1.logger.error(msg);
throw new Error(msg);
}
- payload = toml_edit_1.replaceTomlValue(payload, ['package', 'version'], this.version.toString());
+ payload = (0, toml_edit_1.replaceTomlValue)(payload, ['package', 'version'], this.version.toString());
for (const [pkgName, pkgVersion] of this.versionsMap) {
for (const depKind of common_1.DEP_KINDS) {
const deps = parsed[depKind];
@@ -87325,7 +87988,7 @@ class CargoToml extends default_1.DefaultUpdater {
continue; // to next depKind
}
logger_1.logger.info(`updating ${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`);
- payload = toml_edit_1.replaceTomlValue(payload, [depKind, pkgName, 'version'], pkgVersion.toString());
+ payload = (0, toml_edit_1.replaceTomlValue)(payload, [depKind, pkgName, 'version'], pkgVersion.toString());
}
// Update platform-specific dependencies
if (parsed.target) {
@@ -87344,7 +88007,7 @@ class CargoToml extends default_1.DefaultUpdater {
continue; // to next depKind
}
logger_1.logger.info(`updating target.${targetName}.${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`);
- payload = toml_edit_1.replaceTomlValue(payload, ['target', targetName, depKind, pkgName, 'version'], pkgVersion.toString());
+ payload = (0, toml_edit_1.replaceTomlValue)(payload, ['target', targetName, depKind, pkgName, 'version'], pkgVersion.toString());
}
}
}
@@ -88253,7 +88916,7 @@ const SUMMARY_PATTERN = /^(?.*[^:]):? (?\d+\.\d+\.\d+.*)$/;
const COMPONENTLESS_SUMMARY_PATTERN = /^(?\d+\.\d+\.\d+.*)$/;
function extractMultipleReleases(notes) {
const data = [];
- const root = node_html_parser_1.parse(notes);
+ const root = (0, node_html_parser_1.parse)(notes);
for (const detail of root.getElementsByTagName('details')) {
const summaryNode = detail.getElementsByTagName('summary')[0];
const summary = summaryNode === null || summaryNode === void 0 ? void 0 : summaryNode.textContent;
@@ -88341,10 +89004,12 @@ function generateMatchPattern(pullRequestTitlePattern) {
pullRequestTitlePattern.search(/\$\{version\}/) === -1)
logger_1.logger.warn("pullRequestTitlePattern miss the part of '${version}'");
return new RegExp(`^${(pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN)
- .replace('${scope}', '(\\((?[\\w-.]+)\\))?')
+ .replace('[', '\\[') // TODO: handle all regex escaping
+ .replace(']', '\\]')
+ .replace('${scope}', '(\\((?[\\w-./]+)\\))?')
.replace('${component}', ' ?(?[\\w-.]*)?')
.replace('${version}', 'v?(?[0-9].*)')
- .replace('${branch}', '(?[\\w-.]+)?')}$`);
+ .replace('${branch}', '(?[\\w-./]+)?')}$`);
}
exports.generateMatchPattern = generateMatchPattern;
class PullRequestTitle {
@@ -88366,7 +89031,7 @@ class PullRequestTitle {
: undefined,
component: match.groups['component'],
targetBranch: match.groups['branch'],
- pullRequestTitlePattern: pullRequestTitlePattern,
+ pullRequestTitlePattern,
});
}
return undefined;
@@ -88488,7 +89153,7 @@ exports.signoffCommitMessage = signoffCommitMessage;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TagName = void 0;
const version_1 = __nccwpck_require__(17348);
-const TAG_PATTERN = /^((?.*)(?[^a-zA-Z]))?(?v)?(?\d+\.\d+\.\d+.*)$/;
+const TAG_PATTERN = /^((?.*)(?[^a-zA-Z0-9]))?(?v)?(?\d+\.\d+\.\d+.*)$/;
const DEFAULT_SEPARATOR = '-';
class TagName {
constructor(version, component, separator = DEFAULT_SEPARATOR, includeV = true) {
@@ -113583,7 +114248,7 @@ module.exports = {};
/***/ ((module) => {
"use strict";
-module.exports = {"i8":"13.16.5"};
+module.exports = {"i8":"13.18.0"};
/***/ }),
@@ -113611,6 +114276,14 @@ module.exports = require("buffer");;
/***/ }),
+/***/ 63129:
+/***/ ((module) => {
+
+"use strict";
+module.exports = require("child_process");;
+
+/***/ }),
+
/***/ 27619:
/***/ ((module) => {
diff --git a/dist/template.hbs b/dist/template.hbs
index 0e567ae..2c1349a 100644
--- a/dist/template.hbs
+++ b/dist/template.hbs
@@ -1,19 +1,11 @@
{{> header}}
-{{#if noteGroups}}
-{{#each noteGroups}}
-#### ⚠ {{title}}
-
-{{#each notes}}
-* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
-{{/each}}
-{{/each}}
-{{/if}}
{{#each commitGroups}}
-
-{{#if title}}
-#### {{title}}
-
-{{/if}}
{{#each commits}}
-{{> commit root=@root}}{{/each}}{{/each}}
\ No newline at end of file
+{{> commit root=@root}}
+{{/each}}
+{{/each}}
+
+{{> footer}}
+
+
diff --git a/dist/template1.hbs b/dist/template1.hbs
index 2c1349a..3b194f0 100644
--- a/dist/template1.hbs
+++ b/dist/template1.hbs
@@ -1,11 +1,23 @@
{{> header}}
+{{#if noteGroups}}
+{{#each noteGroups}}
+
+### ⚠ {{title}}
+
+{{#each notes}}
+* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
+{{/each}}
+{{/each}}
+{{/if}}
{{#each commitGroups}}
+
+{{#if title}}
+### {{title}}
+
+{{/if}}
{{#each commits}}
{{> commit root=@root}}
{{/each}}
+
{{/each}}
-
-{{> footer}}
-
-