release-please 16.13.0 → 16.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -127,6 +127,17 @@ function toConventionalChangelogFormat(ast) {
127
127
  break;
128
128
  }
129
129
  });
130
+ // Add additional breaking change detection from commit body
131
+ if (body) {
132
+ const bodyString = String(body);
133
+ const breakingChangeMatch = bodyString.match(/BREAKING-CHANGE:\s*(.*)/);
134
+ if (breakingChangeMatch && breakingChangeMatch[1]) {
135
+ if (breaking.text) {
136
+ breaking.text += '\n';
137
+ }
138
+ breaking.text += breakingChangeMatch[1].trim();
139
+ }
140
+ }
130
141
  if (breaking.text !== '')
131
142
  headerCommit.notes.push(breaking);
132
143
  // Populates references array from footers:
@@ -241,6 +252,7 @@ function toConventionalChangelogFormat(ast) {
241
252
  // we should be able to move post processing into
242
253
  // to-conventional-changelog.ts.
243
254
  function postProcessCommits(commit) {
255
+ var _a;
244
256
  commit.notes.forEach(note => {
245
257
  let text = '';
246
258
  let i = 0;
@@ -262,6 +274,19 @@ function postProcessCommits(commit) {
262
274
  }
263
275
  note.text = text.trim();
264
276
  });
277
+ const breakingChangeMatch = (_a = commit.body) === null || _a === void 0 ? void 0 : _a.match(/BREAKING-CHANGE:\s*(.*)/);
278
+ if (breakingChangeMatch && breakingChangeMatch[1]) {
279
+ const existingNote = commit.notes.find(note => note.title === 'BREAKING CHANGE');
280
+ if (existingNote) {
281
+ existingNote.text += `\n${breakingChangeMatch[1].trim()}`;
282
+ }
283
+ else {
284
+ commit.notes.push({
285
+ title: 'BREAKING CHANGE',
286
+ text: breakingChangeMatch[1].trim(),
287
+ });
288
+ }
289
+ }
265
290
  return commit;
266
291
  }
267
292
  // If someone wishes to include additional contextual information for a
@@ -283,20 +308,29 @@ function hasExtendedContext(line) {
283
308
  function parseCommits(message) {
284
309
  return conventionalCommitsFilter(toConventionalChangelogFormat(parser.parser(message))).map(postProcessCommits);
285
310
  }
286
- // If someone wishes to aggregate multiple, complex commit messages into a
287
- // single commit, they can include one or more `BEGIN_NESTED_COMMIT`/`END_NESTED_COMMIT`
288
- // blocks into the body of the commit
311
+ /**
312
+ * Splits a commit message into multiple messages based on conventional commit format and nested commit blocks.
313
+ * This function is capable of:
314
+ * 1. Separating conventional commits (feat, fix, docs, etc.) within the main message.
315
+ * 2. Extracting nested commits enclosed in BEGIN_NESTED_COMMIT/END_NESTED_COMMIT blocks.
316
+ * 3. Preserving the original message structure outside of nested commit blocks.
317
+ * 4. Handling multiple nested commits and conventional commits in a single message.
318
+ *
319
+ * @param message The input commit message string
320
+ * @returns An array of individual commit messages
321
+ */
289
322
  function splitMessages(message) {
290
323
  const parts = message.split('BEGIN_NESTED_COMMIT');
291
324
  const messages = [parts.shift()];
292
325
  for (const part of parts) {
293
326
  const [newMessage, ...rest] = part.split('END_NESTED_COMMIT');
294
327
  messages.push(newMessage);
295
- // anthing outside of the BEGIN/END annotations are added to the original
296
- // commit
297
- messages[0] = messages[0] + rest.join();
328
+ messages[0] = messages[0] + rest.join('END_NESTED_COMMIT');
298
329
  }
299
- return messages;
330
+ const conventionalCommits = messages[0]
331
+ .split(/\r?\n\r?\n(?=(?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.*?\))?: )/)
332
+ .filter(Boolean);
333
+ return [...conventionalCommits, ...messages.slice(1)];
300
334
  }
301
335
  /**
302
336
  * Given a list of raw commits, parse and expand into conventional commits.
@@ -14,4 +14,4 @@ export { Logger, setLogger } from './util/logger';
14
14
  export { GitHub } from './github';
15
15
  export declare const configSchema: any;
16
16
  export declare const manifestSchema: any;
17
- export declare const VERSION = "16.13.0";
17
+ export declare const VERSION = "16.14.1";
@@ -36,6 +36,6 @@ Object.defineProperty(exports, "GitHub", { enumerable: true, get: function () {
36
36
  exports.configSchema = require('../../schemas/config.json');
37
37
  exports.manifestSchema = require('../../schemas/manifest.json');
38
38
  // x-release-please-start-version
39
- exports.VERSION = '16.13.0';
39
+ exports.VERSION = '16.14.1';
40
40
  // x-release-please-end
41
41
  //# sourceMappingURL=index.js.map
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.GenericJson = void 0;
17
- const jp = require("jsonpath");
17
+ const jsonpath_plus_1 = require("jsonpath-plus");
18
18
  const json_stringify_1 = require("../util/json-stringify");
19
19
  const logger_1 = require("../util/logger");
20
20
  const VERSION_REGEX = /(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<preRelease>[\w.]+))?(\+(?<build>[-\w.]+))?/;
@@ -30,21 +30,23 @@ class GenericJson {
30
30
  */
31
31
  updateContent(content, logger = logger_1.logger) {
32
32
  const data = JSON.parse(content);
33
- const nodes = jp.apply(data, this.jsonpath, value => {
34
- if (typeof value !== 'string') {
35
- logger.warn(`No string in ${this.jsonpath}. Skipping.`);
36
- return value;
37
- }
38
- if (!value.match(VERSION_REGEX)) {
39
- logger.warn(`No version found in ${this.jsonpath}. Skipping.`);
40
- return value;
41
- }
42
- return value.replace(VERSION_REGEX, this.version.toString());
33
+ (0, jsonpath_plus_1.JSONPath)({
34
+ resultType: 'all',
35
+ path: this.jsonpath,
36
+ json: data,
37
+ callback: (payload, _payloadType, _fullPayload) => {
38
+ if (typeof payload.value !== 'string') {
39
+ logger.warn(`No string in ${this.jsonpath}. Skipping.`);
40
+ return payload;
41
+ }
42
+ if (!payload.value.match(VERSION_REGEX)) {
43
+ logger.warn(`No version found in ${this.jsonpath}. Skipping.`);
44
+ return payload;
45
+ }
46
+ payload.parent[payload.parentProperty] = payload.parent[payload.parentProperty].replace(VERSION_REGEX, this.version.toString());
47
+ return payload;
48
+ },
43
49
  });
44
- if (!nodes) {
45
- logger.warn(`No entries modified in ${this.jsonpath}`);
46
- return content;
47
- }
48
50
  return (0, json_stringify_1.jsonStringify)(data, content);
49
51
  }
50
52
  }
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.GenericToml = void 0;
17
- const jp = require("jsonpath");
17
+ const jsonpath_plus_1 = require("jsonpath-plus");
18
18
  const toml_edit_1 = require("../util/toml-edit");
19
19
  const logger_1 = require("../util/logger");
20
20
  /**
@@ -43,7 +43,12 @@ class GenericToml {
43
43
  logger.warn('Invalid toml, cannot be parsed', e);
44
44
  return content;
45
45
  }
46
- const paths = jp.paths(data, this.jsonpath);
46
+ const pointers = (0, jsonpath_plus_1.JSONPath)({
47
+ path: this.jsonpath,
48
+ json: data,
49
+ resultType: 'pointer',
50
+ });
51
+ const paths = pointers.map(pointer => pointer.split('/').filter(Boolean));
47
52
  if (!paths || paths.length === 0) {
48
53
  logger.warn(`No entries modified in ${this.jsonpath}`);
49
54
  return content;
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.GenericYaml = void 0;
17
- const jp = require("jsonpath");
17
+ const jsonpath_plus_1 = require("jsonpath-plus");
18
18
  const yaml = require("js-yaml");
19
19
  const logger_1 = require("../util/logger");
20
20
  const DOCUMENT_SEPARATOR = '---\n';
@@ -50,12 +50,20 @@ class GenericYaml {
50
50
  // Update each document
51
51
  let modified = false;
52
52
  docs.forEach(data => {
53
- const nodes = jp.apply(data, this.jsonpath, _val => {
54
- return this.version.toString();
53
+ (0, jsonpath_plus_1.JSONPath)({
54
+ resultType: 'all',
55
+ path: this.jsonpath,
56
+ json: data,
57
+ callback: (payload, _payloadType, _fullPayload) => {
58
+ if (typeof payload.value !== 'string') {
59
+ logger.warn(`No string in ${this.jsonpath}. Skipping.`);
60
+ return payload;
61
+ }
62
+ modified = true;
63
+ payload.parent[payload.parentProperty] = this.version.toString();
64
+ return payload;
65
+ },
55
66
  });
56
- if (nodes && nodes.length) {
57
- modified = true;
58
- }
59
67
  });
60
68
  // If nothing was modified, return original content
61
69
  if (!modified) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "16.13.0",
3
+ "version": "16.14.1",
4
4
  "description": "generate release PRs based on the conventionalcommits.org spec",
5
5
  "main": "./build/src/index.js",
6
6
  "bin": "./build/src/bin/release-please.js",
@@ -86,7 +86,7 @@
86
86
  "http-proxy-agent": "^7.0.0",
87
87
  "https-proxy-agent": "^7.0.0",
88
88
  "js-yaml": "^4.0.0",
89
- "jsonpath": "^1.1.1",
89
+ "jsonpath-plus": "^9.0.0",
90
90
  "node-html-parser": "^6.0.0",
91
91
  "parse-github-repo-url": "^1.4.1",
92
92
  "semver": "^7.5.3",