release-please 12.6.0 → 12.6.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/src/bootstrapper.d.ts +12 -0
  3. package/build/src/bootstrapper.js +60 -0
  4. package/build/src/changelog-notes/default.d.ts +15 -0
  5. package/build/src/changelog-notes/default.js +71 -0
  6. package/build/src/changelog-notes/github.d.ts +8 -0
  7. package/build/src/changelog-notes/github.js +26 -0
  8. package/build/src/changelog-notes.d.ts +19 -0
  9. package/build/src/changelog-notes.js +16 -0
  10. package/build/src/commit.d.ts +26 -0
  11. package/build/src/commit.js +316 -0
  12. package/build/src/github.js +1 -1
  13. package/build/src/plugin.d.ts +20 -0
  14. package/build/src/plugin.js +31 -0
  15. package/build/src/plugins/merge.d.ts +11 -0
  16. package/build/src/plugins/merge.js +83 -0
  17. package/build/src/plugins/workspace.d.ts +102 -0
  18. package/build/src/plugins/workspace.js +170 -0
  19. package/build/src/pull-request.d.ts +10 -0
  20. package/build/src/pull-request.js +16 -0
  21. package/build/src/release-notes.d.ts +29 -0
  22. package/build/src/release-notes.js +71 -0
  23. package/build/src/release-pull-request.d.ts +13 -0
  24. package/build/src/release-pull-request.js +16 -0
  25. package/build/src/release.d.ts +6 -0
  26. package/build/src/release.js +16 -0
  27. package/build/src/repository.d.ts +5 -0
  28. package/build/src/repository.js +16 -0
  29. package/build/src/strategies/dart.d.ts +8 -0
  30. package/build/src/strategies/dart.js +63 -0
  31. package/build/src/strategies/elixir.d.ts +5 -0
  32. package/build/src/strategies/elixir.js +45 -0
  33. package/build/src/strategies/go-yoshi.d.ts +13 -0
  34. package/build/src/strategies/go-yoshi.js +114 -0
  35. package/build/src/strategies/go.d.ts +5 -0
  36. package/build/src/strategies/go.js +36 -0
  37. package/build/src/strategies/helm.d.ts +8 -0
  38. package/build/src/strategies/helm.js +63 -0
  39. package/build/src/strategies/java-yoshi.d.ts +25 -0
  40. package/build/src/strategies/java-yoshi.js +259 -0
  41. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  42. package/build/src/strategies/krm-blueprint.js +64 -0
  43. package/build/src/strategies/node.d.ts +9 -0
  44. package/build/src/strategies/node.js +82 -0
  45. package/build/src/strategies/ocaml.d.ts +5 -0
  46. package/build/src/strategies/ocaml.js +75 -0
  47. package/build/src/strategies/php-yoshi.d.ts +10 -0
  48. package/build/src/strategies/php-yoshi.js +214 -0
  49. package/build/src/strategies/php.d.ts +6 -0
  50. package/build/src/strategies/php.js +67 -0
  51. package/build/src/strategies/python.d.ts +8 -0
  52. package/build/src/strategies/python.js +117 -0
  53. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  54. package/build/src/strategies/ruby-yoshi.js +116 -0
  55. package/build/src/strategies/ruby.d.ts +13 -0
  56. package/build/src/strategies/ruby.js +61 -0
  57. package/build/src/strategies/rust.d.ts +20 -0
  58. package/build/src/strategies/rust.js +120 -0
  59. package/build/src/strategies/simple.d.ts +5 -0
  60. package/build/src/strategies/simple.js +45 -0
  61. package/build/src/strategies/terraform-module.d.ts +7 -0
  62. package/build/src/strategies/terraform-module.js +72 -0
  63. package/build/src/strategy.d.ts +103 -0
  64. package/build/src/strategy.js +249 -0
  65. package/build/src/update.d.ts +23 -0
  66. package/build/src/update.js +16 -0
  67. package/build/src/updaters/composite.d.ts +19 -0
  68. package/build/src/updaters/composite.js +42 -0
  69. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  70. package/build/src/updaters/dart/pubspec-yaml.js +45 -0
  71. package/build/src/updaters/default.d.ts +21 -0
  72. package/build/src/updaters/default.js +36 -0
  73. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  74. package/build/src/updaters/dotnet/csproj.js +33 -0
  75. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  76. package/build/src/updaters/elixir/elixir-mix-exs.js +37 -0
  77. package/build/src/updaters/go/version-go.d.ts +4 -0
  78. package/build/src/updaters/go/version-go.js +24 -0
  79. package/build/src/updaters/java/java-update.d.ts +14 -0
  80. package/build/src/updaters/java/java-update.js +76 -0
  81. package/build/src/updaters/node/package-json.d.ts +12 -0
  82. package/build/src/updaters/node/package-json.js +37 -0
  83. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  84. package/build/src/updaters/node/package-lock-json.js +36 -0
  85. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  86. package/build/src/updaters/node/samples-package-json.js +49 -0
  87. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  88. package/build/src/updaters/php/php-client-version.js +32 -0
  89. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  90. package/build/src/updaters/php/php-manifest.js +55 -0
  91. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  92. package/build/src/updaters/php/root-composer-update-packages.js +47 -0
  93. package/build/src/updaters/raw-content.d.ts +19 -0
  94. package/build/src/updaters/raw-content.js +39 -0
  95. package/build/src/updaters/release-please-config.d.ts +8 -0
  96. package/build/src/updaters/release-please-config.js +41 -0
  97. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  98. package/build/src/updaters/ruby/version-rb.js +32 -0
  99. package/build/src/updaters/rust/cargo-toml.js +5 -1
  100. package/build/src/util/commit-split.d.ts +11 -0
  101. package/build/src/util/commit-split.js +94 -0
  102. package/build/src/util/pull-request-body.d.ts +20 -0
  103. package/build/src/util/pull-request-body.js +129 -0
  104. package/build/src/util/tag-name.d.ts +9 -0
  105. package/build/src/util/tag-name.js +41 -0
  106. package/build/src/util/toml-edit.d.ts +8 -0
  107. package/build/src/util/toml-edit.js +125 -0
  108. package/build/src/version.d.ts +11 -0
  109. package/build/src/version.js +45 -0
  110. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  111. package/build/src/versioning-strategies/always-bump-patch.js +25 -0
  112. package/build/src/versioning-strategies/default.d.ts +15 -0
  113. package/build/src/versioning-strategies/default.js +67 -0
  114. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  115. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  116. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  117. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  118. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  119. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  120. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  121. package/build/src/versioning-strategies/service-pack.js +40 -0
  122. package/build/src/versioning-strategy.d.ts +28 -0
  123. package/build/src/versioning-strategy.js +55 -0
  124. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [12.6.1](https://www.github.com/googleapis/release-please/compare/v12.6.0...v12.6.1) (2021-12-21)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **rust:** Don't update dev-dependencies lacking a version key ([#1095](https://www.github.com/googleapis/release-please/issues/1095)) ([dc1bad9](https://www.github.com/googleapis/release-please/commit/dc1bad997ef0d028e280e75b0e6510a99d06cb44))
13
+
7
14
  ## [12.6.0](https://www.github.com/googleapis/release-please/compare/v12.5.0...v12.6.0) (2021-10-11)
8
15
 
9
16
 
@@ -0,0 +1,12 @@
1
+ import { GitHub } from './github';
2
+ import { ReleaserConfig } from './manifest';
3
+ import { PullRequest } from './pull-request';
4
+ export declare class Bootstrapper {
5
+ private github;
6
+ private targetBranch;
7
+ private manifestFile;
8
+ private configFile;
9
+ private initialVersion;
10
+ constructor(github: GitHub, targetBranch: string, manifestFile?: string, configFile?: string, initialVersionString?: string);
11
+ bootstrap(path: string, config: ReleaserConfig): Promise<PullRequest>;
12
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ // Copyright 2021 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.Bootstrapper = void 0;
17
+ const manifest_1 = require("./manifest");
18
+ const version_1 = require("./version");
19
+ const release_please_manifest_1 = require("./updaters/release-please-manifest");
20
+ const release_please_config_1 = require("./updaters/release-please-config");
21
+ class Bootstrapper {
22
+ constructor(github, targetBranch, manifestFile = manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST, configFile = manifest_1.DEFAULT_RELEASE_PLEASE_CONFIG, initialVersionString = '0.0.0') {
23
+ this.github = github;
24
+ this.targetBranch = targetBranch;
25
+ this.manifestFile = manifestFile;
26
+ this.configFile = configFile;
27
+ this.initialVersion = version_1.Version.parse(initialVersionString);
28
+ }
29
+ async bootstrap(path, config) {
30
+ const message = `chore: bootstrap releases for path: ${path}`;
31
+ const branchName = path === manifest_1.ROOT_PROJECT_PATH ? 'default' : path;
32
+ const pullRequest = {
33
+ headBranchName: `release-please/bootstrap/${branchName}`,
34
+ baseBranchName: this.targetBranch,
35
+ number: -1,
36
+ title: message,
37
+ body: `Configuring release-please for path: ${path}`,
38
+ labels: [],
39
+ files: [],
40
+ };
41
+ const version = this.initialVersion;
42
+ const versionsMap = new Map();
43
+ versionsMap.set(path, version);
44
+ const updates = [
45
+ {
46
+ path: this.manifestFile,
47
+ createIfMissing: true,
48
+ updater: new release_please_manifest_1.ReleasePleaseManifest({ version, versionsMap }),
49
+ },
50
+ {
51
+ path: this.configFile,
52
+ createIfMissing: true,
53
+ updater: new release_please_config_1.ReleasePleaseConfig(path, config),
54
+ },
55
+ ];
56
+ return await this.github.createPullRequest(pullRequest, this.targetBranch, message, updates, {});
57
+ }
58
+ }
59
+ exports.Bootstrapper = Bootstrapper;
60
+ //# sourceMappingURL=bootstrapper.js.map
@@ -0,0 +1,15 @@
1
+ import { ChangelogNotes, BuildNotesOptions } from '../changelog-notes';
2
+ import { ConventionalCommit } from '../commit';
3
+ interface DefaultChangelogNotesOptions {
4
+ commitPartial?: string;
5
+ headerPartial?: string;
6
+ mainTemplate?: string;
7
+ }
8
+ export declare class DefaultChangelogNotes implements ChangelogNotes {
9
+ private commitPartial?;
10
+ private headerPartial?;
11
+ private mainTemplate?;
12
+ constructor(options?: DefaultChangelogNotesOptions);
13
+ buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
14
+ }
15
+ export {};
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // Copyright 2021 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.DefaultChangelogNotes = void 0;
17
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
18
+ const conventionalChangelogWriter = require('conventional-changelog-writer');
19
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
20
+ const presetFactory = require('conventional-changelog-conventionalcommits');
21
+ const DEFAULT_HOST = 'https://github.com';
22
+ class DefaultChangelogNotes {
23
+ constructor(options = {}) {
24
+ this.commitPartial = options.commitPartial;
25
+ this.headerPartial = options.headerPartial;
26
+ this.mainTemplate = options.mainTemplate;
27
+ }
28
+ async buildNotes(commits, options) {
29
+ const context = {
30
+ host: options.host || DEFAULT_HOST,
31
+ owner: options.owner,
32
+ repository: options.repository,
33
+ version: options.version,
34
+ previousTag: options.previousTag,
35
+ currentTag: options.currentTag,
36
+ linkCompare: !!options.previousTag,
37
+ };
38
+ const config = {};
39
+ if (options.changelogSections) {
40
+ config.types = options.changelogSections;
41
+ }
42
+ const preset = await presetFactory(config);
43
+ preset.writerOpts.commitPartial =
44
+ this.commitPartial || preset.writerOpts.commitPartial;
45
+ preset.writerOpts.headerPartial =
46
+ this.headerPartial || preset.writerOpts.headerPartial;
47
+ preset.writerOpts.mainTemplate =
48
+ this.mainTemplate || preset.writerOpts.mainTemplate;
49
+ const changelogCommits = commits.map(commit => {
50
+ return {
51
+ body: '',
52
+ subject: commit.bareMessage,
53
+ type: commit.type,
54
+ scope: commit.scope,
55
+ notes: commit.notes,
56
+ references: commit.references,
57
+ mentions: [],
58
+ merge: null,
59
+ revert: null,
60
+ header: commit.message,
61
+ footer: null,
62
+ hash: commit.sha,
63
+ };
64
+ });
65
+ return conventionalChangelogWriter
66
+ .parseArray(changelogCommits, context, preset.writerOpts)
67
+ .trim();
68
+ }
69
+ }
70
+ exports.DefaultChangelogNotes = DefaultChangelogNotes;
71
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1,8 @@
1
+ import { ChangelogNotes, BuildNotesOptions } from '../changelog-notes';
2
+ import { ConventionalCommit } from '../commit';
3
+ import { GitHub } from '../github';
4
+ export declare class GitHubChangelogNotes implements ChangelogNotes {
5
+ private github;
6
+ constructor(github: GitHub);
7
+ buildNotes(_commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
8
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ // Copyright 2021 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.GitHubChangelogNotes = void 0;
17
+ class GitHubChangelogNotes {
18
+ constructor(github) {
19
+ this.github = github;
20
+ }
21
+ async buildNotes(_commits, options) {
22
+ return await this.github.generateReleaseNotes(options.currentTag, options.targetBranch, options.previousTag);
23
+ }
24
+ }
25
+ exports.GitHubChangelogNotes = GitHubChangelogNotes;
26
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1,19 @@
1
+ import { ConventionalCommit } from './commit';
2
+ export interface BuildNotesOptions {
3
+ host?: string;
4
+ owner: string;
5
+ repository: string;
6
+ version: string;
7
+ previousTag?: string;
8
+ currentTag: string;
9
+ targetBranch: string;
10
+ changelogSections?: ChangelogSection[];
11
+ }
12
+ export interface ChangelogNotes {
13
+ buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
14
+ }
15
+ export interface ChangelogSection {
16
+ type: string;
17
+ section: string;
18
+ hidden?: boolean;
19
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright 2021 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
+ //# sourceMappingURL=changelog-notes.js.map
@@ -0,0 +1,26 @@
1
+ import { PullRequest } from './pull-request';
2
+ import * as parser from '@conventional-commits/parser';
3
+ export interface Commit {
4
+ sha: string;
5
+ message: string;
6
+ files: string[];
7
+ pullRequest?: PullRequest;
8
+ }
9
+ export interface ConventionalCommit extends Commit {
10
+ type: string;
11
+ scope: string | null;
12
+ notes: parser.Note[];
13
+ references: parser.Reference[];
14
+ bareMessage: string;
15
+ breaking: boolean;
16
+ }
17
+ /**
18
+ * Given a list of raw commits, parse and expand into conventional commits.
19
+ *
20
+ * @param commits {Commit[]} The input commits
21
+ *
22
+ * @returns {ConventionalCommit[]} Parsed and expanded commits. There may be
23
+ * more commits returned as a single raw commit may contain multiple release
24
+ * messages.
25
+ */
26
+ export declare function parseConventionalCommits(commits: Commit[]): ConventionalCommit[];
@@ -0,0 +1,316 @@
1
+ "use strict";
2
+ // Copyright 2021 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.parseConventionalCommits = void 0;
17
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
18
+ const visit = require('unist-util-visit');
19
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
20
+ const visitWithAncestors = require('unist-util-visit-parents');
21
+ const NUMBER_REGEX = /^[0-9]+$/;
22
+ const logger_1 = require("./util/logger");
23
+ const parser = require("@conventional-commits/parser");
24
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
25
+ const conventionalCommitsFilter = require('conventional-commits-filter');
26
+ function getBlankConventionalCommit() {
27
+ return {
28
+ body: '',
29
+ subject: '',
30
+ type: '',
31
+ scope: null,
32
+ notes: [],
33
+ references: [],
34
+ mentions: [],
35
+ merge: null,
36
+ revert: null,
37
+ header: '',
38
+ footer: null,
39
+ };
40
+ }
41
+ // Converts conventional commit AST into conventional-changelog's
42
+ // output format, see: https://www.npmjs.com/package/conventional-commits-parser
43
+ function toConventionalChangelogFormat(ast) {
44
+ const commits = [];
45
+ const headerCommit = getBlankConventionalCommit();
46
+ // Separate the body and summary nodes, this simplifies the subsequent
47
+ // tree walking logic:
48
+ let body;
49
+ let summary;
50
+ visit(ast, ['body', 'summary'], (node) => {
51
+ switch (node.type) {
52
+ case 'body':
53
+ body = node;
54
+ break;
55
+ case 'summary':
56
+ summary = node;
57
+ break;
58
+ }
59
+ });
60
+ // <type>, "(", <scope>, ")", ["!"], ":", <whitespace>*, <text>
61
+ visit(summary, (node) => {
62
+ switch (node.type) {
63
+ case 'type':
64
+ headerCommit.type = node.value;
65
+ headerCommit.header += node.value;
66
+ break;
67
+ case 'scope':
68
+ headerCommit.scope = node.value;
69
+ headerCommit.header += `(${node.value})`;
70
+ break;
71
+ case 'breaking-change':
72
+ headerCommit.header += '!';
73
+ break;
74
+ case 'text':
75
+ headerCommit.subject = node.value;
76
+ headerCommit.header += `: ${node.value}`;
77
+ break;
78
+ default:
79
+ break;
80
+ }
81
+ });
82
+ // [<any body-text except pre-footer>]
83
+ if (body) {
84
+ visit(body, ['text', 'newline'], (node) => {
85
+ headerCommit.body += node.value;
86
+ });
87
+ }
88
+ // Extract BREAKING CHANGE notes, regardless of whether they fall in
89
+ // summary, body, or footer:
90
+ const breaking = {
91
+ title: 'BREAKING CHANGE',
92
+ text: '',
93
+ };
94
+ visitWithAncestors(ast, ['breaking-change'], (node, ancestors) => {
95
+ let parent = ancestors.pop();
96
+ if (!parent) {
97
+ return;
98
+ }
99
+ switch (parent.type) {
100
+ case 'summary':
101
+ breaking.text = headerCommit.subject;
102
+ break;
103
+ case 'body':
104
+ breaking.text = '';
105
+ // We treat text from the BREAKING CHANGE marker forward as
106
+ // the breaking change notes:
107
+ visit(parent, ['text', 'newline'], (node) => {
108
+ breaking.text += node.value;
109
+ });
110
+ break;
111
+ case 'token':
112
+ // If the '!' breaking change marker is used, the breaking change
113
+ // will be identified when the footer is parsed as a commit:
114
+ if (!node.value.includes('BREAKING'))
115
+ return;
116
+ parent = ancestors.pop();
117
+ visit(parent, ['text', 'newline'], (node) => {
118
+ breaking.text = node.value;
119
+ });
120
+ break;
121
+ }
122
+ });
123
+ if (breaking.text !== '')
124
+ headerCommit.notes.push(breaking);
125
+ // Populates references array from footers:
126
+ // references: [{
127
+ // action: 'Closes',
128
+ // owner: null,
129
+ // repository: null,
130
+ // issue: '1', raw: '#1',
131
+ // prefix: '#'
132
+ // }]
133
+ visit(ast, ['footer'], (node) => {
134
+ const reference = {
135
+ prefix: '#',
136
+ action: '',
137
+ issue: '',
138
+ };
139
+ let hasRefSepartor = false;
140
+ visit(node, ['type', 'separator', 'text'], (node) => {
141
+ switch (node.type) {
142
+ case 'type':
143
+ // refs, closes, etc:
144
+ // TODO(@bcoe): conventional-changelog does not currently use
145
+ // "reference.action" in its templates:
146
+ reference.action = node.value;
147
+ break;
148
+ case 'separator':
149
+ // Footer of the form "Refs #99":
150
+ if (node.value.includes('#'))
151
+ hasRefSepartor = true;
152
+ break;
153
+ case 'text':
154
+ // Footer of the form "Refs: #99"
155
+ if (node.value.charAt(0) === '#') {
156
+ hasRefSepartor = true;
157
+ reference.issue = node.value.substring(1);
158
+ // TODO(@bcoe): what about references like "Refs: #99, #102"?
159
+ }
160
+ else {
161
+ reference.issue = node.value;
162
+ }
163
+ break;
164
+ }
165
+ });
166
+ // TODO(@bcoe): how should references like "Refs: v8:8940" work.
167
+ if (hasRefSepartor && reference.issue.match(NUMBER_REGEX)) {
168
+ headerCommit.references.push(reference);
169
+ }
170
+ });
171
+ /*
172
+ * Split footers that resemble commits into additional commits, e.g.,
173
+ * chore: multiple commits
174
+ * chore(recaptchaenterprise): migrate recaptchaenterprise to the Java microgenerator
175
+ * Committer: @miraleung
176
+ * PiperOrigin-RevId: 345559154
177
+ * ...
178
+ */
179
+ visitWithAncestors(ast, ['type'], (node, ancestors) => {
180
+ let parent = ancestors.pop();
181
+ if (!parent) {
182
+ return;
183
+ }
184
+ if (parent.type === 'token') {
185
+ parent = ancestors.pop();
186
+ let footerText = '';
187
+ const semanticFooter = node.value.toLowerCase() === 'release-as';
188
+ visit(parent, ['type', 'scope', 'breaking-change', 'separator', 'text', 'newline'], (node) => {
189
+ switch (node.type) {
190
+ case 'scope':
191
+ footerText += `(${node.value})`;
192
+ break;
193
+ case 'separator':
194
+ // Footers of the form Fixes #99, should not be parsed.
195
+ if (node.value.includes('#'))
196
+ return;
197
+ footerText += `${node.value} `;
198
+ break;
199
+ default:
200
+ footerText += node.value;
201
+ break;
202
+ }
203
+ });
204
+ // Any footers that carry semantic meaning, e.g., Release-As, should
205
+ // be added to the footer field, for the benefits of post-processing:
206
+ if (semanticFooter) {
207
+ let releaseAs = '';
208
+ visit(parent, ['text'], (node) => {
209
+ releaseAs = node.value;
210
+ });
211
+ // record Release-As footer as a note
212
+ headerCommit.notes.push({
213
+ title: 'RELEASE AS',
214
+ text: releaseAs,
215
+ });
216
+ if (!headerCommit.footer)
217
+ headerCommit.footer = '';
218
+ headerCommit.footer += `\n${footerText.toLowerCase()}`.trimStart();
219
+ }
220
+ try {
221
+ for (const commit of toConventionalChangelogFormat(parser.parser(footerText))) {
222
+ commits.push(commit);
223
+ }
224
+ }
225
+ catch (err) {
226
+ // Footer does not appear to be an additional commit.
227
+ }
228
+ }
229
+ });
230
+ commits.push(headerCommit);
231
+ return commits;
232
+ }
233
+ // TODO(@bcoe): now that we walk the actual AST of conventional commits
234
+ // we should be able to move post processing into
235
+ // to-conventional-changelog.ts.
236
+ function postProcessCommits(commit) {
237
+ commit.notes.forEach(note => {
238
+ let text = '';
239
+ let i = 0;
240
+ let extendedContext = false;
241
+ for (const chunk of note.text.split(/\r?\n/)) {
242
+ if (i > 0 && hasExtendedContext(chunk) && !extendedContext) {
243
+ text = `${text.trim()}\n`;
244
+ extendedContext = true;
245
+ }
246
+ if (chunk === '')
247
+ break;
248
+ else if (extendedContext) {
249
+ text += ` ${chunk}\n`;
250
+ }
251
+ else {
252
+ text += `${chunk} `;
253
+ }
254
+ i++;
255
+ }
256
+ note.text = text.trim();
257
+ });
258
+ return commit;
259
+ }
260
+ // If someone wishes to include additional contextual information for a
261
+ // BREAKING CHANGE using markdown, they can do so by starting the line after the initial
262
+ // breaking change description with either:
263
+ //
264
+ // 1. a fourth-level header.
265
+ // 2. a bulleted list (using either '*' or '-').
266
+ //
267
+ // BREAKING CHANGE: there were breaking changes
268
+ // #### Deleted Endpoints
269
+ // - endpoint 1
270
+ // - endpoint 2
271
+ function hasExtendedContext(line) {
272
+ if (line.match(/^#### |^[*-] /))
273
+ return true;
274
+ return false;
275
+ }
276
+ function parseCommits(message) {
277
+ return conventionalCommitsFilter(toConventionalChangelogFormat(parser.parser(message))).map(postProcessCommits);
278
+ }
279
+ /**
280
+ * Given a list of raw commits, parse and expand into conventional commits.
281
+ *
282
+ * @param commits {Commit[]} The input commits
283
+ *
284
+ * @returns {ConventionalCommit[]} Parsed and expanded commits. There may be
285
+ * more commits returned as a single raw commit may contain multiple release
286
+ * messages.
287
+ */
288
+ function parseConventionalCommits(commits) {
289
+ const conventionalCommits = [];
290
+ for (const commit of commits) {
291
+ try {
292
+ for (const parsedCommit of parseCommits(commit.message)) {
293
+ const breaking = parsedCommit.notes.filter(note => note.title === 'BREAKING CHANGE')
294
+ .length > 0;
295
+ conventionalCommits.push({
296
+ sha: commit.sha,
297
+ message: parsedCommit.header,
298
+ files: commit.files,
299
+ pullRequest: commit.pullRequest,
300
+ type: parsedCommit.type,
301
+ scope: parsedCommit.scope,
302
+ bareMessage: parsedCommit.subject,
303
+ notes: parsedCommit.notes,
304
+ references: parsedCommit.references,
305
+ breaking,
306
+ });
307
+ }
308
+ }
309
+ catch (_err) {
310
+ logger_1.logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`);
311
+ }
312
+ }
313
+ return conventionalCommits;
314
+ }
315
+ exports.parseConventionalCommits = parseConventionalCommits;
316
+ //# sourceMappingURL=commit.js.map
@@ -538,7 +538,7 @@ class GitHub {
538
538
  * @throws {GitHubAPIError} on an API error
539
539
  */
540
540
  this.commentOnIssue = wrapAsync(async (comment, number) => {
541
- logger_1.logger.info(`adding comment to https://github.com/${this.owner}/${this.repo}/issue/${number}`);
541
+ logger_1.logger.info(`adding comment to https://github.com/${this.owner}/${this.repo}/issues/${number}`);
542
542
  return (await this.request('POST /repos/:owner/:repo/issues/:issue_number/comments', {
543
543
  owner: this.owner,
544
544
  repo: this.repo,
@@ -0,0 +1,20 @@
1
+ import { GitHub } from './github';
2
+ import { CandidateReleasePullRequest, RepositoryConfig } from './manifest';
3
+ /**
4
+ * A plugin runs after a repository manifest has built candidate
5
+ * pull requests and can make updates that span across multiple
6
+ * components. A plugin *might* choose to merge pull requests or add
7
+ * or update existing files.
8
+ */
9
+ export declare abstract class ManifestPlugin {
10
+ readonly github: GitHub;
11
+ readonly targetBranch: string;
12
+ readonly repositoryConfig: RepositoryConfig;
13
+ constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig);
14
+ /**
15
+ * Post-process candidate pull requests.
16
+ * @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
17
+ * @returns {CandidateReleasePullRequest[]} Updated pull requests
18
+ */
19
+ abstract run(pullRequests: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
20
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // Copyright 2021 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.ManifestPlugin = void 0;
17
+ /**
18
+ * A plugin runs after a repository manifest has built candidate
19
+ * pull requests and can make updates that span across multiple
20
+ * components. A plugin *might* choose to merge pull requests or add
21
+ * or update existing files.
22
+ */
23
+ class ManifestPlugin {
24
+ constructor(github, targetBranch, repositoryConfig) {
25
+ this.github = github;
26
+ this.targetBranch = targetBranch;
27
+ this.repositoryConfig = repositoryConfig;
28
+ }
29
+ }
30
+ exports.ManifestPlugin = ManifestPlugin;
31
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1,11 @@
1
+ import { ManifestPlugin } from '../plugin';
2
+ import { CandidateReleasePullRequest } from '../manifest';
3
+ /**
4
+ * This plugin merges multiple pull requests into a single
5
+ * release pull request.
6
+ *
7
+ * Release notes are broken up using `<summary>`/`<details>` blocks.
8
+ */
9
+ export declare class Merge extends ManifestPlugin {
10
+ run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
11
+ }