release-please 15.3.0 → 15.4.0

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [15.4.0](https://github.com/googleapis/release-please/compare/v15.3.1...v15.4.0) (2023-01-26)
8
+
9
+
10
+ ### Features
11
+
12
+ * **changelog.json:** Include referenced issues/prs ([#1830](https://github.com/googleapis/release-please/issues/1830)) ([bacbbb5](https://github.com/googleapis/release-please/commit/bacbbb52ad802d42af1ffb40e8c616cc6c6601a6))
13
+
14
+ ## [15.3.1](https://github.com/googleapis/release-please/compare/v15.3.0...v15.3.1) (2023-01-26)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Filter changelog.json commits based on changelog sections ([#1827](https://github.com/googleapis/release-please/issues/1827)) ([844aacd](https://github.com/googleapis/release-please/commit/844aacd76434ae288ee3ac9b2061dd9406e99bd8))
20
+
7
21
  ## [15.3.0](https://github.com/googleapis/release-please/compare/v15.2.0...v15.3.0) (2023-01-25)
8
22
 
9
23
 
@@ -23,7 +23,7 @@ const composite_1 = require("../updaters/composite");
23
23
  const errors_1 = require("../errors");
24
24
  const java_1 = require("./java");
25
25
  const java_update_1 = require("../updaters/java/java-update");
26
- const BREAKING_CHANGE_NOTE = 'BREAKING CHANGE';
26
+ const filter_commits_1 = require("../util/filter-commits");
27
27
  class JavaYoshiMonoRepo extends java_1.Java {
28
28
  /**
29
29
  * Override this method to post process commits
@@ -152,12 +152,7 @@ class JavaYoshiMonoRepo extends java_1.Java {
152
152
  const cs = new commit_split_1.CommitSplit({
153
153
  includeEmpty: false,
154
154
  });
155
- const splitCommits = cs.split(options.commits.filter(commit => {
156
- const isBreaking = commit.notes.find(note => {
157
- return note.title === BREAKING_CHANGE_NOTE;
158
- });
159
- return commit.type !== 'chore' || isBreaking;
160
- }));
155
+ const splitCommits = cs.split((0, filter_commits_1.filterCommits)(options.commits, this.changelogSections));
161
156
  for (const path of Object.keys(splitCommits)) {
162
157
  const repoMetadata = await this.getRepoMetadata(path);
163
158
  const artifactName = repoMetadata
@@ -21,7 +21,7 @@ const samples_package_json_1 = require("../updaters/node/samples-package-json");
21
21
  const changelog_1 = require("../updaters/changelog");
22
22
  const package_json_1 = require("../updaters/node/package-json");
23
23
  const errors_1 = require("../errors");
24
- const BREAKING_CHANGE_NOTE = 'BREAKING CHANGE';
24
+ const filter_commits_1 = require("../util/filter-commits");
25
25
  class Node extends base_1.BaseStrategy {
26
26
  async buildUpdates(options) {
27
27
  var _a;
@@ -64,12 +64,7 @@ class Node extends base_1.BaseStrategy {
64
64
  });
65
65
  // If a machine readable changelog.json exists update it:
66
66
  if (options.commits && packageName) {
67
- const commits = options.commits.filter(commit => {
68
- const isBreaking = commit.notes.find(note => {
69
- return note.title === BREAKING_CHANGE_NOTE;
70
- });
71
- return commit.type !== 'chore' || isBreaking;
72
- });
67
+ const commits = (0, filter_commits_1.filterCommits)(options.commits, this.changelogSections);
73
68
  updates.push({
74
69
  path: 'changelog.json',
75
70
  createIfMissing: false,
@@ -50,6 +50,7 @@ class ChangelogJson extends default_1.DefaultUpdater {
50
50
  type: commit.type,
51
51
  sha: commit.sha,
52
52
  message: message,
53
+ issues: commit.references.map(ref => ref.issue),
53
54
  };
54
55
  if (commit.scope)
55
56
  change.scope = commit.scope;
@@ -0,0 +1,12 @@
1
+ import { ChangelogSection } from '../changelog-notes';
2
+ import { ConventionalCommit } from '../commit';
3
+ /**
4
+ * Given a set of conventional commits and the configured
5
+ * changelog sections provided by the user, return the set
6
+ * of commits that should be displayed:
7
+ *
8
+ * @param commits
9
+ * @param changelogSections
10
+ * @returns ConventionalCommit[]
11
+ */
12
+ export declare function filterCommits(commits: ConventionalCommit[], changelogSections?: ChangelogSection[]): ConventionalCommit[];
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ // Copyright 2023 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.filterCommits = void 0;
17
+ const BREAKING_CHANGE_NOTE = 'BREAKING CHANGE';
18
+ const DEFAULT_CHANGELOG_SECTIONS = [
19
+ { type: 'feat', section: 'Features' },
20
+ { type: 'fix', section: 'Bug Fixes' },
21
+ { type: 'perf', section: 'Performance Improvements' },
22
+ { type: 'revert', section: 'Reverts' },
23
+ { type: 'chore', section: 'Miscellaneous Chores', hidden: true },
24
+ { type: 'docs', section: 'Documentation', hidden: true },
25
+ { type: 'style', section: 'Styles', hidden: true },
26
+ { type: 'refactor', section: 'Code Refactoring', hidden: true },
27
+ { type: 'test', section: 'Tests', hidden: true },
28
+ { type: 'build', section: 'Build System', hidden: true },
29
+ { type: 'ci', section: 'Continuous Integration', hidden: true },
30
+ ];
31
+ /**
32
+ * Given a set of conventional commits and the configured
33
+ * changelog sections provided by the user, return the set
34
+ * of commits that should be displayed:
35
+ *
36
+ * @param commits
37
+ * @param changelogSections
38
+ * @returns ConventionalCommit[]
39
+ */
40
+ function filterCommits(commits, changelogSections) {
41
+ changelogSections = changelogSections !== null && changelogSections !== void 0 ? changelogSections : DEFAULT_CHANGELOG_SECTIONS;
42
+ const hiddenSections = [];
43
+ const visibleSections = [];
44
+ for (const section of changelogSections) {
45
+ if (!section.hidden)
46
+ visibleSections.push(section.type);
47
+ else
48
+ hiddenSections.push(section.type);
49
+ }
50
+ return commits.filter(commit => {
51
+ const isBreaking = commit.notes.find(note => {
52
+ return note.title === BREAKING_CHANGE_NOTE;
53
+ });
54
+ return (visibleSections.includes(commit.type) ||
55
+ (isBreaking && hiddenSections.includes(commit.type)));
56
+ });
57
+ }
58
+ exports.filterCommits = filterCommits;
59
+ //# sourceMappingURL=filter-commits.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "15.3.0",
3
+ "version": "15.4.0",
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",