release-please 12.3.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 (140) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +5 -0
  3. package/build/src/bin/release-please.d.ts +2 -0
  4. package/build/src/bin/release-please.js +7 -0
  5. package/build/src/bootstrapper.d.ts +12 -0
  6. package/build/src/bootstrapper.js +60 -0
  7. package/build/src/changelog-notes/default.d.ts +15 -0
  8. package/build/src/changelog-notes/default.js +71 -0
  9. package/build/src/changelog-notes/github.d.ts +8 -0
  10. package/build/src/changelog-notes/github.js +26 -0
  11. package/build/src/changelog-notes.d.ts +19 -0
  12. package/build/src/changelog-notes.js +16 -0
  13. package/build/src/commit.d.ts +26 -0
  14. package/build/src/commit.js +316 -0
  15. package/build/src/constants.d.ts +1 -0
  16. package/build/src/constants.js +2 -1
  17. package/build/src/factory.js +2 -1
  18. package/build/src/github.d.ts +1 -0
  19. package/build/src/github.js +3 -2
  20. package/build/src/index.d.ts +1 -0
  21. package/build/src/plugin.d.ts +20 -0
  22. package/build/src/plugin.js +31 -0
  23. package/build/src/plugins/merge.d.ts +11 -0
  24. package/build/src/plugins/merge.js +83 -0
  25. package/build/src/plugins/workspace.d.ts +102 -0
  26. package/build/src/plugins/workspace.js +170 -0
  27. package/build/src/pull-request.d.ts +10 -0
  28. package/build/src/pull-request.js +16 -0
  29. package/build/src/release-notes.d.ts +29 -0
  30. package/build/src/release-notes.js +71 -0
  31. package/build/src/release-pull-request.d.ts +13 -0
  32. package/build/src/release-pull-request.js +16 -0
  33. package/build/src/release.d.ts +6 -0
  34. package/build/src/release.js +16 -0
  35. package/build/src/releasers/dart.d.ts +9 -0
  36. package/build/src/releasers/dart.js +65 -0
  37. package/build/src/releasers/index.d.ts +1 -1
  38. package/build/src/releasers/index.js +4 -0
  39. package/build/src/releasers/java-backport.d.ts +9 -0
  40. package/build/src/releasers/java-backport.js +43 -0
  41. package/build/src/repository.d.ts +5 -0
  42. package/build/src/repository.js +16 -0
  43. package/build/src/strategies/dart.d.ts +8 -0
  44. package/build/src/strategies/dart.js +63 -0
  45. package/build/src/strategies/elixir.d.ts +5 -0
  46. package/build/src/strategies/elixir.js +45 -0
  47. package/build/src/strategies/go-yoshi.d.ts +13 -0
  48. package/build/src/strategies/go-yoshi.js +114 -0
  49. package/build/src/strategies/go.d.ts +5 -0
  50. package/build/src/strategies/go.js +36 -0
  51. package/build/src/strategies/helm.d.ts +8 -0
  52. package/build/src/strategies/helm.js +63 -0
  53. package/build/src/strategies/java-yoshi.d.ts +25 -0
  54. package/build/src/strategies/java-yoshi.js +259 -0
  55. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  56. package/build/src/strategies/krm-blueprint.js +64 -0
  57. package/build/src/strategies/node.d.ts +9 -0
  58. package/build/src/strategies/node.js +82 -0
  59. package/build/src/strategies/ocaml.d.ts +5 -0
  60. package/build/src/strategies/ocaml.js +75 -0
  61. package/build/src/strategies/php-yoshi.d.ts +10 -0
  62. package/build/src/strategies/php-yoshi.js +214 -0
  63. package/build/src/strategies/php.d.ts +6 -0
  64. package/build/src/strategies/php.js +67 -0
  65. package/build/src/strategies/python.d.ts +8 -0
  66. package/build/src/strategies/python.js +117 -0
  67. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  68. package/build/src/strategies/ruby-yoshi.js +116 -0
  69. package/build/src/strategies/ruby.d.ts +13 -0
  70. package/build/src/strategies/ruby.js +61 -0
  71. package/build/src/strategies/rust.d.ts +20 -0
  72. package/build/src/strategies/rust.js +120 -0
  73. package/build/src/strategies/simple.d.ts +5 -0
  74. package/build/src/strategies/simple.js +45 -0
  75. package/build/src/strategies/terraform-module.d.ts +7 -0
  76. package/build/src/strategies/terraform-module.js +72 -0
  77. package/build/src/strategy.d.ts +103 -0
  78. package/build/src/strategy.js +249 -0
  79. package/build/src/update.d.ts +23 -0
  80. package/build/src/update.js +16 -0
  81. package/build/src/updaters/composite.d.ts +19 -0
  82. package/build/src/updaters/composite.js +42 -0
  83. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  84. package/build/src/updaters/dart/pubspec-yaml.js +45 -0
  85. package/build/src/updaters/default.d.ts +21 -0
  86. package/build/src/updaters/default.js +36 -0
  87. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  88. package/build/src/updaters/dotnet/csproj.js +33 -0
  89. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  90. package/build/src/updaters/elixir/elixir-mix-exs.js +37 -0
  91. package/build/src/updaters/go/version-go.d.ts +4 -0
  92. package/build/src/updaters/go/version-go.js +24 -0
  93. package/build/src/updaters/java/java-update.d.ts +14 -0
  94. package/build/src/updaters/java/java-update.js +76 -0
  95. package/build/src/updaters/node/package-json.d.ts +12 -0
  96. package/build/src/updaters/node/package-json.js +37 -0
  97. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  98. package/build/src/updaters/node/package-lock-json.js +36 -0
  99. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  100. package/build/src/updaters/node/samples-package-json.js +49 -0
  101. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  102. package/build/src/updaters/php/php-client-version.js +32 -0
  103. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  104. package/build/src/updaters/php/php-manifest.js +55 -0
  105. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  106. package/build/src/updaters/php/root-composer-update-packages.js +47 -0
  107. package/build/src/updaters/pubspec-yaml.d.ts +13 -0
  108. package/build/src/updaters/pubspec-yaml.js +44 -0
  109. package/build/src/updaters/raw-content.d.ts +19 -0
  110. package/build/src/updaters/raw-content.js +39 -0
  111. package/build/src/updaters/release-please-config.d.ts +8 -0
  112. package/build/src/updaters/release-please-config.js +41 -0
  113. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  114. package/build/src/updaters/ruby/version-rb.js +32 -0
  115. package/build/src/updaters/rust/cargo-toml.js +5 -1
  116. package/build/src/util/commit-split.d.ts +11 -0
  117. package/build/src/util/commit-split.js +94 -0
  118. package/build/src/util/pull-request-body.d.ts +20 -0
  119. package/build/src/util/pull-request-body.js +129 -0
  120. package/build/src/util/tag-name.d.ts +9 -0
  121. package/build/src/util/tag-name.js +41 -0
  122. package/build/src/util/toml-edit.d.ts +8 -0
  123. package/build/src/util/toml-edit.js +125 -0
  124. package/build/src/version.d.ts +11 -0
  125. package/build/src/version.js +45 -0
  126. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  127. package/build/src/versioning-strategies/always-bump-patch.js +25 -0
  128. package/build/src/versioning-strategies/default.d.ts +15 -0
  129. package/build/src/versioning-strategies/default.js +67 -0
  130. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  131. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  132. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  133. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  134. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  135. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  136. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  137. package/build/src/versioning-strategies/service-pack.js +40 -0
  138. package/build/src/versioning-strategy.d.ts +28 -0
  139. package/build/src/versioning-strategy.js +55 -0
  140. package/package.json +3 -3
@@ -0,0 +1,214 @@
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.PHPYoshi = void 0;
17
+ const strategy_1 = require("../strategy");
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const root_composer_update_packages_1 = require("../updaters/php/root-composer-update-packages");
20
+ const php_manifest_1 = require("../updaters/php/php-manifest");
21
+ const php_client_version_1 = require("../updaters/php/php-client-version");
22
+ const version_1 = require("../version");
23
+ const commit_1 = require("../commit");
24
+ const commit_split_1 = require("../util/commit-split");
25
+ const default_1 = require("../updaters/default");
26
+ const logger_1 = require("../util/logger");
27
+ const tag_name_1 = require("../util/tag-name");
28
+ const pull_request_title_1 = require("../util/pull-request-title");
29
+ const branch_name_1 = require("../util/branch-name");
30
+ const pull_request_body_1 = require("../util/pull-request-body");
31
+ const CHANGELOG_SECTIONS = [
32
+ { type: 'feat', section: 'Features' },
33
+ { type: 'fix', section: 'Bug Fixes' },
34
+ { type: 'perf', section: 'Performance Improvements' },
35
+ { type: 'revert', section: 'Reverts' },
36
+ { type: 'docs', section: 'Documentation' },
37
+ { type: 'chore', section: 'Miscellaneous Chores' },
38
+ { type: 'style', section: 'Styles', hidden: true },
39
+ { type: 'refactor', section: 'Code Refactoring', hidden: true },
40
+ { type: 'test', section: 'Tests', hidden: true },
41
+ { type: 'build', section: 'Build System', hidden: true },
42
+ { type: 'ci', section: 'Continuous Integration', hidden: true },
43
+ ];
44
+ class PHPYoshi extends strategy_1.Strategy {
45
+ constructor(options) {
46
+ super({
47
+ ...options,
48
+ changelogSections: CHANGELOG_SECTIONS,
49
+ });
50
+ }
51
+ async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
52
+ var _a, _b, _c;
53
+ const conventionalCommits = this.postProcessCommits(commit_1.parseConventionalCommits(commits));
54
+ const newVersion = latestRelease
55
+ ? await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits)
56
+ : this.initialReleaseVersion();
57
+ const cs = new commit_split_1.CommitSplit();
58
+ const splitCommits = cs.split(conventionalCommits);
59
+ const topLevelDirectories = Object.keys(splitCommits).sort();
60
+ const versionsMap = new Map();
61
+ const directoryVersionContents = {};
62
+ const component = await this.getComponent();
63
+ const newVersionTag = new tag_name_1.TagName(newVersion, component);
64
+ let releaseNotesBody = `## ${newVersion.toString()}`;
65
+ for (const directory of topLevelDirectories) {
66
+ try {
67
+ const contents = await this.github.getFileContentsOnBranch(this.addPath(`${directory}/VERSION`), this.targetBranch);
68
+ const version = version_1.Version.parse(contents.parsedContent);
69
+ const composer = await this.github.getFileJson(this.addPath(`${directory}/composer.json`), this.targetBranch);
70
+ directoryVersionContents[directory] = {
71
+ versionContents: contents,
72
+ composer,
73
+ };
74
+ const newVersion = await this.versioningStrategy.bump(version, splitCommits[directory]);
75
+ versionsMap.set(composer.name, newVersion);
76
+ const partialReleaseNotes = await this.changelogNotes.buildNotes(splitCommits[directory], {
77
+ owner: this.repository.owner,
78
+ repository: this.repository.repo,
79
+ version: newVersion.toString(),
80
+ previousTag: (_a = latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag) === null || _a === void 0 ? void 0 : _a.toString(),
81
+ currentTag: newVersionTag.toString(),
82
+ targetBranch: this.targetBranch,
83
+ });
84
+ releaseNotesBody = updatePHPChangelogEntry(`${composer.name} ${newVersion.toString()}`, releaseNotesBody, partialReleaseNotes);
85
+ }
86
+ catch (err) {
87
+ if (err.status === 404) {
88
+ // if the updated path has no VERSION, assume this isn't a
89
+ // module that needs updating.
90
+ continue;
91
+ }
92
+ else {
93
+ throw err;
94
+ }
95
+ }
96
+ }
97
+ const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion);
98
+ const branchName = component
99
+ ? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
100
+ : branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
101
+ const updates = await this.buildUpdates({
102
+ changelogEntry: releaseNotesBody,
103
+ newVersion,
104
+ versionsMap,
105
+ latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version,
106
+ });
107
+ for (const directory in directoryVersionContents) {
108
+ const componentInfo = directoryVersionContents[directory];
109
+ const version = versionsMap.get(componentInfo.composer.name);
110
+ if (!version) {
111
+ logger_1.logger.warn(`No version found for ${componentInfo.composer.name}`);
112
+ continue;
113
+ }
114
+ updates.push({
115
+ path: this.addPath(`${directory}/VERSION`),
116
+ createIfMissing: false,
117
+ cachedFileContents: componentInfo.versionContents,
118
+ updater: new default_1.DefaultUpdater({
119
+ version,
120
+ }),
121
+ });
122
+ if ((_c = (_b = componentInfo.composer.extra) === null || _b === void 0 ? void 0 : _b.component) === null || _c === void 0 ? void 0 : _c.entry) {
123
+ updates.push({
124
+ path: this.addPath(`${directory}/${componentInfo.composer.extra.component.entry}`),
125
+ createIfMissing: false,
126
+ updater: new php_client_version_1.PHPClientVersion({
127
+ version,
128
+ }),
129
+ });
130
+ }
131
+ }
132
+ const pullRequestBody = new pull_request_body_1.PullRequestBody([
133
+ {
134
+ component,
135
+ version: newVersion,
136
+ notes: releaseNotesBody,
137
+ },
138
+ ]);
139
+ return {
140
+ title: pullRequestTitle,
141
+ body: pullRequestBody,
142
+ updates,
143
+ labels,
144
+ headRefName: branchName.toString(),
145
+ version: newVersion,
146
+ draft: draft !== null && draft !== void 0 ? draft : false,
147
+ };
148
+ }
149
+ async buildUpdates(options) {
150
+ const updates = [];
151
+ const version = options.newVersion;
152
+ const versionsMap = options.versionsMap;
153
+ updates.push({
154
+ path: this.addPath(this.changelogPath),
155
+ createIfMissing: true,
156
+ updater: new changelog_1.Changelog({
157
+ version,
158
+ changelogEntry: options.changelogEntry,
159
+ }),
160
+ });
161
+ // update the aggregate package information in the root
162
+ // composer.json and manifest.json.
163
+ updates.push({
164
+ path: this.addPath('composer.json'),
165
+ createIfMissing: false,
166
+ updater: new root_composer_update_packages_1.RootComposerUpdatePackages({
167
+ version,
168
+ versionsMap,
169
+ }),
170
+ });
171
+ updates.push({
172
+ path: this.addPath('docs/manifest.json'),
173
+ createIfMissing: false,
174
+ updater: new php_manifest_1.PHPManifest({
175
+ version,
176
+ versionsMap,
177
+ }),
178
+ });
179
+ updates.push({
180
+ path: this.addPath('src/Version.php'),
181
+ createIfMissing: false,
182
+ updater: new php_client_version_1.PHPClientVersion({
183
+ version,
184
+ versionsMap,
185
+ }),
186
+ });
187
+ updates.push({
188
+ path: this.addPath('src/ServiceBuilder.php'),
189
+ createIfMissing: false,
190
+ updater: new php_client_version_1.PHPClientVersion({
191
+ version,
192
+ versionsMap,
193
+ }),
194
+ });
195
+ return updates;
196
+ }
197
+ }
198
+ exports.PHPYoshi = PHPYoshi;
199
+ function updatePHPChangelogEntry(pkgKey, changelogEntry, entryUpdate) {
200
+ // Remove the first line of the entry, in favor of <summary>.
201
+ // This also allows us to use the same regex for extracting release
202
+ // notes (since the string "## v0.0.0" doesn't show up multiple times).
203
+ const entryUpdateSplit = entryUpdate.split(/\r?\n/);
204
+ entryUpdateSplit.shift();
205
+ entryUpdate = entryUpdateSplit.join('\n');
206
+ return `${changelogEntry}
207
+
208
+ <details><summary>${pkgKey}</summary>
209
+
210
+ ${entryUpdate}
211
+
212
+ </details>`;
213
+ }
214
+ //# sourceMappingURL=php-yoshi.js.map
@@ -0,0 +1,6 @@
1
+ import { Strategy, BuildUpdatesOptions, StrategyOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class PHP extends Strategy {
4
+ constructor(options: StrategyOptions);
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ }
@@ -0,0 +1,67 @@
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.PHP = void 0;
17
+ // Generic
18
+ const changelog_1 = require("../updaters/changelog");
19
+ // PHP Specific.
20
+ const root_composer_update_packages_1 = require("../updaters/php/root-composer-update-packages");
21
+ const strategy_1 = require("../strategy");
22
+ const CHANGELOG_SECTIONS = [
23
+ { type: 'feat', section: 'Features' },
24
+ { type: 'fix', section: 'Bug Fixes' },
25
+ { type: 'perf', section: 'Performance Improvements' },
26
+ { type: 'revert', section: 'Reverts' },
27
+ { type: 'chore', section: 'Miscellaneous Chores' },
28
+ { type: 'docs', section: 'Documentation', hidden: true },
29
+ { type: 'style', section: 'Styles', hidden: true },
30
+ { type: 'refactor', section: 'Code Refactoring', hidden: true },
31
+ { type: 'test', section: 'Tests', hidden: true },
32
+ { type: 'build', section: 'Build System', hidden: true },
33
+ { type: 'ci', section: 'Continuous Integration', hidden: true },
34
+ ];
35
+ class PHP extends strategy_1.Strategy {
36
+ constructor(options) {
37
+ var _a;
38
+ options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
39
+ super(options);
40
+ }
41
+ async buildUpdates(options) {
42
+ const updates = [];
43
+ const version = options.newVersion;
44
+ const versionsMap = new Map();
45
+ versionsMap.set('version', version);
46
+ updates.push({
47
+ path: this.addPath(this.changelogPath),
48
+ createIfMissing: true,
49
+ updater: new changelog_1.Changelog({
50
+ version,
51
+ changelogEntry: options.changelogEntry,
52
+ }),
53
+ });
54
+ // update composer.json
55
+ updates.push({
56
+ path: this.addPath('composer.json'),
57
+ createIfMissing: false,
58
+ updater: new root_composer_update_packages_1.RootComposerUpdatePackages({
59
+ version,
60
+ versionsMap,
61
+ }),
62
+ });
63
+ return updates;
64
+ }
65
+ }
66
+ exports.PHP = PHP;
67
+ //# sourceMappingURL=php.js.map
@@ -0,0 +1,8 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ import { Version } from '../version';
4
+ export declare class Python extends Strategy {
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ private getPyProject;
7
+ protected initialReleaseVersion(): Version;
8
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ // Copyright 2019 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.Python = void 0;
17
+ const strategy_1 = require("../strategy");
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const version_1 = require("../version");
20
+ const setup_cfg_1 = require("../updaters/python/setup-cfg");
21
+ const setup_py_1 = require("../updaters/python/setup-py");
22
+ const pyproject_toml_1 = require("../updaters/python/pyproject-toml");
23
+ const logger_1 = require("../util/logger");
24
+ const python_file_with_version_1 = require("../updaters/python/python-file-with-version");
25
+ class Python extends strategy_1.Strategy {
26
+ async buildUpdates(options) {
27
+ var _a;
28
+ const updates = [];
29
+ const version = options.newVersion;
30
+ updates.push({
31
+ path: this.addPath(this.changelogPath),
32
+ createIfMissing: true,
33
+ updater: new changelog_1.Changelog({
34
+ version,
35
+ changelogEntry: options.changelogEntry,
36
+ }),
37
+ });
38
+ updates.push({
39
+ path: this.addPath('setup.cfg'),
40
+ createIfMissing: false,
41
+ updater: new setup_cfg_1.SetupCfg({
42
+ version,
43
+ }),
44
+ });
45
+ updates.push({
46
+ path: this.addPath('setup.py'),
47
+ createIfMissing: false,
48
+ updater: new setup_py_1.SetupPy({
49
+ version,
50
+ }),
51
+ });
52
+ const parsedPyProject = await this.getPyProject(this.addPath('pyproject.toml'));
53
+ const pyProject = (parsedPyProject === null || parsedPyProject === void 0 ? void 0 : parsedPyProject.project) || ((_a = parsedPyProject === null || parsedPyProject === void 0 ? void 0 : parsedPyProject.tool) === null || _a === void 0 ? void 0 : _a.poetry);
54
+ let projectName = this.component;
55
+ if (pyProject) {
56
+ updates.push({
57
+ path: this.addPath('pyproject.toml'),
58
+ createIfMissing: false,
59
+ updater: new pyproject_toml_1.PyProjectToml({
60
+ version,
61
+ }),
62
+ });
63
+ projectName = pyProject.name;
64
+ }
65
+ else {
66
+ logger_1.logger.warn(parsedPyProject
67
+ ? 'invalid pyproject.toml'
68
+ : `file ${this.addPath('pyproject.toml')} did not exist`);
69
+ }
70
+ if (!projectName) {
71
+ logger_1.logger.warn('No project/component found.');
72
+ }
73
+ else {
74
+ updates.push({
75
+ path: this.addPath(`${projectName}/__init__.py`),
76
+ createIfMissing: false,
77
+ updater: new python_file_with_version_1.PythonFileWithVersion({
78
+ version,
79
+ }),
80
+ });
81
+ updates.push({
82
+ path: this.addPath(`src/${projectName}/__init__.py`),
83
+ createIfMissing: false,
84
+ updater: new python_file_with_version_1.PythonFileWithVersion({
85
+ version,
86
+ }),
87
+ });
88
+ }
89
+ // There should be only one version.py, but foreach in case that is incorrect
90
+ const versionPyFilesSearch = this.github.findFilesByFilename('version.py', this.path);
91
+ const versionPyFiles = await versionPyFilesSearch;
92
+ versionPyFiles.forEach(path => {
93
+ updates.push({
94
+ path: this.addPath(path),
95
+ createIfMissing: false,
96
+ updater: new python_file_with_version_1.PythonFileWithVersion({
97
+ version,
98
+ }),
99
+ });
100
+ });
101
+ return updates;
102
+ }
103
+ async getPyProject(path) {
104
+ try {
105
+ const content = await this.github.getFileContentsOnBranch(path, this.targetBranch);
106
+ return pyproject_toml_1.parsePyProject(content.parsedContent);
107
+ }
108
+ catch (e) {
109
+ return null;
110
+ }
111
+ }
112
+ initialReleaseVersion() {
113
+ return version_1.Version.parse('0.1.0');
114
+ }
115
+ }
116
+ exports.Python = Python;
117
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1,17 @@
1
+ import { StrategyOptions, Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { ConventionalCommit } from '../commit';
3
+ import { Update } from '../update';
4
+ import { Release } from '../release';
5
+ import { Version } from '../version';
6
+ import { TagName } from '../util/tag-name';
7
+ interface RubyYoshiStrategyOptions extends StrategyOptions {
8
+ versionFile?: string;
9
+ }
10
+ export declare class RubyYoshi extends Strategy {
11
+ readonly versionFile: string;
12
+ constructor(options: RubyYoshiStrategyOptions);
13
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
14
+ protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
15
+ protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
16
+ }
17
+ export {};
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ // Copyright 2019 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.RubyYoshi = void 0;
17
+ const indent_commit_1 = require("../util/indent-commit");
18
+ // Generic
19
+ const changelog_1 = require("../updaters/changelog");
20
+ // RubyYoshi
21
+ const version_rb_1 = require("../updaters/ruby/version-rb");
22
+ const strategy_1 = require("../strategy");
23
+ const fs_1 = require("fs");
24
+ const path_1 = require("path");
25
+ const manifest_1 = require("../manifest");
26
+ const CHANGELOG_SECTIONS = [
27
+ { type: 'feat', section: 'Features' },
28
+ { type: 'fix', section: 'Bug Fixes' },
29
+ { type: 'perf', section: 'Performance Improvements' },
30
+ { type: 'revert', section: 'Reverts' },
31
+ { type: 'docs', section: 'Documentation' },
32
+ { type: 'style', section: 'Styles', hidden: true },
33
+ { type: 'chore', section: 'Miscellaneous Chores', hidden: true },
34
+ { type: 'refactor', section: 'Code Refactoring', hidden: true },
35
+ { type: 'test', section: 'Tests', hidden: true },
36
+ { type: 'build', section: 'Build System', hidden: true },
37
+ { type: 'ci', section: 'Continuous Integration', hidden: true },
38
+ ];
39
+ class RubyYoshi extends strategy_1.Strategy {
40
+ constructor(options) {
41
+ var _a;
42
+ super({
43
+ ...options,
44
+ changelogSections: CHANGELOG_SECTIONS,
45
+ commitPartial: fs_1.readFileSync(path_1.resolve(__dirname, '../../../templates/commit.hbs'), 'utf8'),
46
+ headerPartial: fs_1.readFileSync(path_1.resolve(__dirname, '../../../templates/header.hbs'), 'utf8'),
47
+ mainTemplate: fs_1.readFileSync(path_1.resolve(__dirname, '../../../templates/template.hbs'), 'utf8'),
48
+ tagSeparator: '/',
49
+ });
50
+ this.versionFile = (_a = options.versionFile) !== null && _a !== void 0 ? _a : '';
51
+ }
52
+ async buildUpdates(options) {
53
+ const updates = [];
54
+ const version = options.newVersion;
55
+ updates.push({
56
+ path: this.addPath(this.changelogPath),
57
+ createIfMissing: true,
58
+ updater: new changelog_1.Changelog({
59
+ version,
60
+ changelogEntry: options.changelogEntry,
61
+ }),
62
+ });
63
+ const versionFile = this.versionFile
64
+ ? this.versionFile
65
+ : `lib/${(this.component || '').replace(/-/g, '/')}/version.rb`;
66
+ updates.push({
67
+ path: this.addPath(versionFile),
68
+ createIfMissing: false,
69
+ updater: new version_rb_1.VersionRB({
70
+ version,
71
+ }),
72
+ });
73
+ return updates;
74
+ }
75
+ postProcessCommits(commits) {
76
+ commits.forEach(commit => {
77
+ commit.message = indent_commit_1.indentCommit(commit);
78
+ });
79
+ return commits;
80
+ }
81
+ async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
82
+ const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
83
+ if (!latestRelease) {
84
+ return releaseNotes;
85
+ }
86
+ // summarize the commits that landed:
87
+ let summary = '### Commits since last release:\n\n';
88
+ const updatedFiles = {};
89
+ const repoUrl = `${this.repository.owner}/${this.repository.repo}`;
90
+ for (const commit of conventionalCommits) {
91
+ if (!commit.sha)
92
+ continue;
93
+ const splitMessage = commit.message.split('\n');
94
+ summary += `* [${splitMessage[0]}](https://github.com/${repoUrl}/commit/${commit.sha})\n`;
95
+ if (splitMessage.length > 2) {
96
+ summary = `${summary}<pre><code>${splitMessage
97
+ .slice(1)
98
+ .join('\n')}</code></pre>\n`;
99
+ }
100
+ commit.files.forEach(file => {
101
+ if (this.path === manifest_1.ROOT_PROJECT_PATH || file.startsWith(this.path)) {
102
+ updatedFiles[file] = true;
103
+ }
104
+ });
105
+ }
106
+ // summarize the files that changed:
107
+ summary = `${summary}\n### Files edited since last release:\n\n<pre><code>`;
108
+ Object.keys(updatedFiles).forEach(file => {
109
+ summary += `${file}\n`;
110
+ });
111
+ summary += `</code></pre>\n[Compare Changes](https://github.com/${repoUrl}/compare/${latestRelease.sha}...HEAD)\n`;
112
+ return releaseNotes + `\n---\n${summary}`;
113
+ }
114
+ }
115
+ exports.RubyYoshi = RubyYoshi;
116
+ //# sourceMappingURL=ruby-yoshi.js.map
@@ -0,0 +1,13 @@
1
+ import { StrategyOptions, Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { ConventionalCommit } from '../commit';
3
+ import { Update } from '../update';
4
+ interface RubyStrategyOptions extends StrategyOptions {
5
+ versionFile?: string;
6
+ }
7
+ export declare class Ruby extends Strategy {
8
+ readonly versionFile: string;
9
+ constructor(options: RubyStrategyOptions);
10
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
11
+ protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
12
+ }
13
+ export {};
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ // Copyright 2019 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.Ruby = void 0;
17
+ const indent_commit_1 = require("../util/indent-commit");
18
+ // Generic
19
+ const changelog_1 = require("../updaters/changelog");
20
+ // Ruby
21
+ const version_rb_1 = require("../updaters/ruby/version-rb");
22
+ const strategy_1 = require("../strategy");
23
+ class Ruby extends strategy_1.Strategy {
24
+ constructor(options) {
25
+ var _a;
26
+ super(options);
27
+ this.versionFile = (_a = options.versionFile) !== null && _a !== void 0 ? _a : '';
28
+ this.tagSeparator = '/';
29
+ }
30
+ async buildUpdates(options) {
31
+ const updates = [];
32
+ const version = options.newVersion;
33
+ updates.push({
34
+ path: this.addPath(this.changelogPath),
35
+ createIfMissing: true,
36
+ updater: new changelog_1.Changelog({
37
+ version,
38
+ changelogEntry: options.changelogEntry,
39
+ }),
40
+ });
41
+ const versionFile = this.versionFile
42
+ ? this.versionFile
43
+ : `lib/${(this.component || '').replace(/-/g, '/')}/version.rb`;
44
+ updates.push({
45
+ path: this.addPath(versionFile),
46
+ createIfMissing: false,
47
+ updater: new version_rb_1.VersionRB({
48
+ version,
49
+ }),
50
+ });
51
+ return updates;
52
+ }
53
+ postProcessCommits(commits) {
54
+ commits.forEach(commit => {
55
+ commit.message = indent_commit_1.indentCommit(commit);
56
+ });
57
+ return commits;
58
+ }
59
+ }
60
+ exports.Ruby = Ruby;
61
+ //# sourceMappingURL=ruby.js.map
@@ -0,0 +1,20 @@
1
+ import { CargoManifest } from '../updaters/rust/common';
2
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
3
+ import { Version } from '../version';
4
+ import { Update } from '../update';
5
+ export declare class Rust extends Strategy {
6
+ private packageManifest?;
7
+ private workspaceManifest?;
8
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
9
+ protected initialReleaseVersion(): Version;
10
+ getDefaultPackageName(): Promise<string | undefined>;
11
+ /**
12
+ * @returns the package's manifest, ie. `crates/foobar/Cargo.toml`
13
+ */
14
+ protected getPackageManifest(): Promise<CargoManifest | null>;
15
+ /**
16
+ * @returns the workspace's manifest, ie. `Cargo.toml` (top-level)
17
+ */
18
+ protected getWorkspaceManifest(): Promise<CargoManifest | null>;
19
+ protected getManifest(path: string): Promise<CargoManifest | null>;
20
+ }