release-please 12.3.0 → 13.0.0-candidate.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.
Files changed (244) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +5 -0
  3. package/build/src/bin/release-please.d.ts +51 -11
  4. package/build/src/bin/release-please.js +409 -150
  5. package/build/src/bootstrapper.d.ts +12 -0
  6. package/build/src/bootstrapper.js +60 -0
  7. package/build/src/commit.d.ts +26 -0
  8. package/build/src/{util/to-conventional-changelog-format.js → commit.js} +97 -2
  9. package/build/src/errors/index.d.ts +0 -5
  10. package/build/src/errors/index.js +1 -10
  11. package/build/src/factory.d.ts +25 -37
  12. package/build/src/factory.js +159 -150
  13. package/build/src/github.d.ts +151 -883
  14. package/build/src/github.js +584 -1013
  15. package/build/src/manifest.d.ts +177 -48
  16. package/build/src/manifest.js +583 -487
  17. package/build/src/plugin.d.ts +20 -0
  18. package/build/src/{plugins/plugin.js → plugin.js} +10 -9
  19. package/build/src/plugins/cargo-workspace.d.ts +48 -18
  20. package/build/src/plugins/cargo-workspace.js +247 -328
  21. package/build/src/plugins/merge.d.ts +11 -0
  22. package/build/src/plugins/merge.js +83 -0
  23. package/build/src/plugins/node-workspace.d.ts +35 -17
  24. package/build/src/plugins/node-workspace.js +234 -271
  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/{updaters/java/readme.js → pull-request.js} +2 -7
  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/{updaters/java/pom-xml.js → release-pull-request.js} +2 -7
  33. package/build/src/release.d.ts +6 -0
  34. package/build/src/release.js +16 -0
  35. package/build/src/repository.d.ts +5 -0
  36. package/build/src/repository.js +16 -0
  37. package/build/src/strategies/dart.d.ts +8 -0
  38. package/build/src/strategies/dart.js +63 -0
  39. package/build/src/strategies/elixir.d.ts +5 -0
  40. package/build/src/{releasers → strategies}/elixir.js +18 -14
  41. package/build/src/strategies/go-yoshi.d.ts +13 -0
  42. package/build/src/strategies/go-yoshi.js +106 -0
  43. package/build/src/strategies/go.d.ts +5 -0
  44. package/build/src/{releasers → strategies}/go.js +11 -12
  45. package/build/src/strategies/helm.d.ts +8 -0
  46. package/build/src/strategies/helm.js +63 -0
  47. package/build/src/strategies/java-yoshi.d.ts +24 -0
  48. package/build/src/strategies/java-yoshi.js +203 -0
  49. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  50. package/build/src/{releasers → strategies}/krm-blueprint.js +26 -22
  51. package/build/src/strategies/node.d.ts +9 -0
  52. package/build/src/strategies/node.js +82 -0
  53. package/build/src/strategies/ocaml.d.ts +5 -0
  54. package/build/src/{releasers → strategies}/ocaml.js +34 -28
  55. package/build/src/strategies/php-yoshi.d.ts +9 -0
  56. package/build/src/strategies/php-yoshi.js +214 -0
  57. package/build/src/strategies/php.d.ts +6 -0
  58. package/build/src/{releasers → strategies}/php.js +24 -23
  59. package/build/src/strategies/python.d.ts +8 -0
  60. package/build/src/strategies/python.js +117 -0
  61. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  62. package/build/src/strategies/ruby-yoshi.js +116 -0
  63. package/build/src/strategies/ruby.d.ts +13 -0
  64. package/build/src/{releasers → strategies}/ruby.js +26 -27
  65. package/build/src/strategies/rust.d.ts +20 -0
  66. package/build/src/strategies/rust.js +120 -0
  67. package/build/src/strategies/simple.d.ts +5 -0
  68. package/build/src/{releasers → strategies}/simple.js +18 -14
  69. package/build/src/strategies/terraform-module.d.ts +7 -0
  70. package/build/src/{releasers → strategies}/terraform-module.js +29 -23
  71. package/build/src/strategy.d.ts +99 -0
  72. package/build/src/strategy.js +237 -0
  73. package/build/src/update.d.ts +23 -0
  74. package/build/src/{updaters/update.js → update.js} +1 -1
  75. package/build/src/updaters/changelog.d.ts +7 -10
  76. package/build/src/updaters/changelog.js +3 -9
  77. package/build/src/updaters/changelog.js.map +1 -1
  78. package/build/src/updaters/composite.d.ts +19 -0
  79. package/build/src/updaters/composite.js +42 -0
  80. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  81. package/build/src/updaters/dart/pubspec-yaml.js +45 -0
  82. package/build/src/updaters/default.d.ts +21 -0
  83. package/build/src/updaters/{version-txt.js → default.js} +16 -10
  84. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  85. package/build/src/updaters/{java/google-utils.js → dotnet/csproj.js} +16 -13
  86. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  87. package/build/src/updaters/{elixir-mix-exs.js → elixir/elixir-mix-exs.js} +12 -10
  88. package/build/src/updaters/helm/chart-yaml.d.ts +10 -11
  89. package/build/src/updaters/helm/chart-yaml.js +12 -10
  90. package/build/src/updaters/java/java-update.d.ts +14 -0
  91. package/build/src/updaters/java/{java_update.js → java-update.js} +22 -22
  92. package/build/src/updaters/java/versions-manifest.d.ts +12 -2
  93. package/build/src/updaters/java/versions-manifest.js +20 -4
  94. package/build/src/updaters/krm/krm-blueprint-version.d.ts +10 -11
  95. package/build/src/updaters/krm/krm-blueprint-version.js +13 -12
  96. package/build/src/updaters/node/package-json.d.ts +12 -0
  97. package/build/src/updaters/{package-json.js → node/package-json.js} +14 -16
  98. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  99. package/build/src/updaters/node/package-lock-json.js +36 -0
  100. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  101. package/build/src/updaters/{samples-package-json.js → node/samples-package-json.js} +19 -8
  102. package/build/src/updaters/ocaml/dune-project.d.ts +10 -11
  103. package/build/src/updaters/ocaml/dune-project.js +11 -9
  104. package/build/src/updaters/ocaml/esy-json.d.ts +10 -11
  105. package/build/src/updaters/ocaml/esy-json.js +12 -10
  106. package/build/src/updaters/ocaml/opam.d.ts +10 -11
  107. package/build/src/updaters/ocaml/opam.js +11 -9
  108. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  109. package/build/src/updaters/{php-client-version.js → php/php-client-version.js} +10 -9
  110. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  111. package/build/src/updaters/{php-manifest.js → php/php-manifest.js} +17 -15
  112. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  113. package/build/src/updaters/{root-composer-update-packages.js → php/root-composer-update-packages.js} +17 -16
  114. package/build/src/updaters/python/pyproject-toml.d.ts +10 -11
  115. package/build/src/updaters/python/pyproject-toml.js +13 -11
  116. package/build/src/updaters/python/python-file-with-version.d.ts +7 -11
  117. package/build/src/updaters/python/python-file-with-version.js +7 -8
  118. package/build/src/updaters/python/setup-cfg.d.ts +10 -11
  119. package/build/src/updaters/python/setup-cfg.js +10 -8
  120. package/build/src/updaters/python/setup-py.d.ts +10 -11
  121. package/build/src/updaters/python/setup-py.js +10 -8
  122. package/build/src/updaters/raw-content.d.ts +19 -0
  123. package/build/src/{plugins/index.js → updaters/raw-content.js} +23 -12
  124. package/build/src/updaters/release-please-config.d.ts +8 -0
  125. package/build/src/updaters/release-please-config.js +41 -0
  126. package/build/src/updaters/release-please-manifest.d.ts +2 -11
  127. package/build/src/updaters/release-please-manifest.js +11 -14
  128. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  129. package/build/src/updaters/{version-rb.js → ruby/version-rb.js} +10 -8
  130. package/build/src/updaters/rust/cargo-lock.d.ts +7 -11
  131. package/build/src/updaters/rust/cargo-lock.js +14 -16
  132. package/build/src/updaters/rust/cargo-toml.d.ts +7 -11
  133. package/build/src/updaters/rust/cargo-toml.js +19 -21
  134. package/build/src/updaters/terraform/module-version.d.ts +10 -11
  135. package/build/src/updaters/terraform/module-version.js +11 -9
  136. package/build/src/updaters/terraform/readme.d.ts +10 -11
  137. package/build/src/updaters/terraform/readme.js +11 -10
  138. package/build/src/updaters/terraform/readme.js.map +1 -1
  139. package/build/src/util/branch-name.d.ts +5 -4
  140. package/build/src/util/branch-name.js +13 -10
  141. package/build/src/{commit-split.d.ts → util/commit-split.d.ts} +2 -4
  142. package/build/src/{commit-split.js → util/commit-split.js} +4 -2
  143. package/build/src/util/indent-commit.d.ts +1 -1
  144. package/build/src/util/logger.d.ts +5 -2
  145. package/build/src/util/logger.js +9 -4
  146. package/build/src/util/pull-request-body.d.ts +20 -0
  147. package/build/src/util/pull-request-body.js +129 -0
  148. package/build/src/util/pull-request-title.d.ts +8 -6
  149. package/build/src/util/pull-request-title.js +20 -6
  150. package/build/src/util/tag-name.d.ts +9 -0
  151. package/build/src/util/tag-name.js +41 -0
  152. package/build/src/{updaters → util}/toml-edit.d.ts +0 -0
  153. package/build/src/{updaters → util}/toml-edit.js +0 -0
  154. package/build/src/version.d.ts +11 -0
  155. package/build/src/version.js +45 -0
  156. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  157. package/build/src/{updaters/package-lock-json.js → versioning-strategies/always-bump-patch.js} +8 -11
  158. package/build/src/versioning-strategies/default.d.ts +15 -0
  159. package/build/src/versioning-strategies/default.js +67 -0
  160. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  161. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  162. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  163. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  164. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  165. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  166. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  167. package/build/src/versioning-strategies/service-pack.js +40 -0
  168. package/build/src/versioning-strategy.d.ts +28 -0
  169. package/build/src/versioning-strategy.js +55 -0
  170. package/package.json +9 -8
  171. package/build/src/constants.d.ts +0 -6
  172. package/build/src/constants.js +0 -23
  173. package/build/src/conventional-commits.d.ts +0 -53
  174. package/build/src/conventional-commits.js +0 -167
  175. package/build/src/github-release.d.ts +0 -34
  176. package/build/src/github-release.js +0 -92
  177. package/build/src/graphql-to-commits.d.ts +0 -60
  178. package/build/src/graphql-to-commits.js +0 -112
  179. package/build/src/index.d.ts +0 -94
  180. package/build/src/index.js +0 -32
  181. package/build/src/plugins/index.d.ts +0 -5
  182. package/build/src/plugins/plugin.d.ts +0 -21
  183. package/build/src/release-pr.d.ts +0 -101
  184. package/build/src/release-pr.js +0 -461
  185. package/build/src/releasers/elixir.d.ts +0 -5
  186. package/build/src/releasers/go-yoshi.d.ts +0 -10
  187. package/build/src/releasers/go-yoshi.js +0 -162
  188. package/build/src/releasers/go.d.ts +0 -6
  189. package/build/src/releasers/helm.d.ts +0 -9
  190. package/build/src/releasers/helm.js +0 -66
  191. package/build/src/releasers/index.d.ts +0 -7
  192. package/build/src/releasers/index.js +0 -72
  193. package/build/src/releasers/java/bump_type.d.ts +0 -4
  194. package/build/src/releasers/java/bump_type.js +0 -38
  195. package/build/src/releasers/java/stability.d.ts +0 -5
  196. package/build/src/releasers/java/stability.js +0 -37
  197. package/build/src/releasers/java/version.d.ts +0 -13
  198. package/build/src/releasers/java/version.js +0 -112
  199. package/build/src/releasers/java-bom.d.ts +0 -16
  200. package/build/src/releasers/java-bom.js +0 -83
  201. package/build/src/releasers/java-lts.d.ts +0 -9
  202. package/build/src/releasers/java-lts.js +0 -47
  203. package/build/src/releasers/java-yoshi.d.ts +0 -28
  204. package/build/src/releasers/java-yoshi.js +0 -304
  205. package/build/src/releasers/krm-blueprint.d.ts +0 -6
  206. package/build/src/releasers/node.d.ts +0 -10
  207. package/build/src/releasers/node.js +0 -84
  208. package/build/src/releasers/ocaml.d.ts +0 -5
  209. package/build/src/releasers/php-yoshi.d.ts +0 -5
  210. package/build/src/releasers/php-yoshi.js +0 -191
  211. package/build/src/releasers/php.d.ts +0 -7
  212. package/build/src/releasers/python.d.ts +0 -11
  213. package/build/src/releasers/python.js +0 -127
  214. package/build/src/releasers/ruby-yoshi.d.ts +0 -5
  215. package/build/src/releasers/ruby-yoshi.js +0 -142
  216. package/build/src/releasers/ruby.d.ts +0 -11
  217. package/build/src/releasers/rust.d.ts +0 -30
  218. package/build/src/releasers/rust.js +0 -163
  219. package/build/src/releasers/simple.d.ts +0 -5
  220. package/build/src/releasers/terraform-module.d.ts +0 -6
  221. package/build/src/updaters/elixir-mix-exs.d.ts +0 -13
  222. package/build/src/updaters/java/google-utils.d.ts +0 -13
  223. package/build/src/updaters/java/java_update.d.ts +0 -13
  224. package/build/src/updaters/java/pom-xml.d.ts +0 -3
  225. package/build/src/updaters/java/readme.d.ts +0 -3
  226. package/build/src/updaters/java/readme.js.map +0 -1
  227. package/build/src/updaters/package-json.d.ts +0 -16
  228. package/build/src/updaters/package-lock-json.d.ts +0 -7
  229. package/build/src/updaters/php-client-version.d.ts +0 -13
  230. package/build/src/updaters/php-manifest.d.ts +0 -13
  231. package/build/src/updaters/root-composer-update-package.d.ts +0 -13
  232. package/build/src/updaters/root-composer-update-package.js +0 -45
  233. package/build/src/updaters/root-composer-update-packages.d.ts +0 -13
  234. package/build/src/updaters/samples-package-json.d.ts +0 -13
  235. package/build/src/updaters/update.d.ts +0 -20
  236. package/build/src/updaters/version-rb.d.ts +0 -13
  237. package/build/src/updaters/version-txt.d.ts +0 -12
  238. package/build/src/updaters/version.d.ts +0 -13
  239. package/build/src/updaters/version.js +0 -31
  240. package/build/src/util/checkpoint.d.ts +0 -6
  241. package/build/src/util/checkpoint.js +0 -33
  242. package/build/src/util/release-notes.d.ts +0 -7
  243. package/build/src/util/release-notes.js +0 -34
  244. package/build/src/util/to-conventional-changelog-format.d.ts +0 -2
@@ -0,0 +1,106 @@
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.GoYoshi = void 0;
17
+ const strategy_1 = require("../strategy");
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const version_1 = require("../version");
20
+ // Commits containing a scope prefixed with an item in this array will be
21
+ // ignored when generating a release PR for the parent module.
22
+ const IGNORED_SUB_MODULES = new Set([
23
+ 'bigtable',
24
+ 'bigquery',
25
+ 'datastore',
26
+ 'firestore',
27
+ 'logging',
28
+ 'pubsub',
29
+ 'pubsublite',
30
+ 'spanner',
31
+ 'storage',
32
+ ]);
33
+ const REGEN_PR_REGEX = /.*auto-regenerate.*/;
34
+ const REGEN_ISSUE_REGEX = /(?<prefix>.*)\(#(?<pr>.*)\)(\n|$)/;
35
+ class GoYoshi extends strategy_1.Strategy {
36
+ constructor(options) {
37
+ var _a;
38
+ options.changelogPath = (_a = options.changelogPath) !== null && _a !== void 0 ? _a : 'CHANGES.md';
39
+ super(options);
40
+ }
41
+ async buildUpdates(options) {
42
+ const updates = [];
43
+ const version = options.newVersion;
44
+ updates.push({
45
+ path: this.addPath(this.changelogPath),
46
+ createIfMissing: true,
47
+ updater: new changelog_1.Changelog({
48
+ version,
49
+ changelogEntry: options.changelogEntry,
50
+ }),
51
+ });
52
+ return updates;
53
+ }
54
+ postProcessCommits(commits) {
55
+ let regenCommit;
56
+ return commits.filter(commit => {
57
+ var _a, _b;
58
+ // ignore commits whose scope is in the list of ignored modules
59
+ if (IGNORED_SUB_MODULES.has(commit.scope || '')) {
60
+ return false;
61
+ }
62
+ // Only have a single entry of the nightly regen listed in the changelog.
63
+ // If there are more than one of these commits, append associated PR.
64
+ if (this.repository.owner === 'googleapis' &&
65
+ this.repository.repo === 'google-api-go-client' &&
66
+ REGEN_PR_REGEX.test(commit.message)) {
67
+ if (regenCommit) {
68
+ const match = commit.message.match(REGEN_ISSUE_REGEX);
69
+ if ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.pr) {
70
+ regenCommit.references.push({
71
+ action: 'refs',
72
+ issue: match.groups.pr,
73
+ prefix: '#',
74
+ });
75
+ }
76
+ return false;
77
+ }
78
+ else {
79
+ commit.sha = '';
80
+ regenCommit = commit;
81
+ const match = commit.bareMessage.match(REGEN_ISSUE_REGEX);
82
+ if ((_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.pr) {
83
+ regenCommit.references.push({
84
+ action: 'refs',
85
+ issue: match.groups.pr,
86
+ prefix: '#',
87
+ });
88
+ regenCommit.bareMessage = match.groups.prefix.trim();
89
+ }
90
+ }
91
+ }
92
+ return true;
93
+ });
94
+ }
95
+ // "closes" is a little presumptuous, let's just indicate that the
96
+ // PR references these other commits:
97
+ async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
98
+ const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
99
+ return releaseNotes.replace(/, closes /g, ', refs ');
100
+ }
101
+ initialReleaseVersion() {
102
+ return version_1.Version.parse('0.1.0');
103
+ }
104
+ }
105
+ exports.GoYoshi = GoYoshi;
106
+ //# sourceMappingURL=go-yoshi.js.map
@@ -0,0 +1,5 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Go extends Strategy {
4
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
+ }
@@ -14,22 +14,21 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Go = void 0;
17
- const release_pr_1 = require("../release-pr");
18
17
  // Generic
19
18
  const changelog_1 = require("../updaters/changelog");
20
- class Go extends release_pr_1.ReleasePR {
21
- constructor() {
22
- super(...arguments);
23
- this.enableSimplePrereleaseParsing = true;
24
- }
25
- async buildUpdates(changelogEntry, candidate, packageName) {
19
+ const strategy_1 = require("../strategy");
20
+ class Go extends strategy_1.Strategy {
21
+ async buildUpdates(options) {
26
22
  const updates = [];
27
- updates.push(new changelog_1.Changelog({
23
+ const version = options.newVersion;
24
+ updates.push({
28
25
  path: this.addPath(this.changelogPath),
29
- changelogEntry,
30
- version: candidate.version,
31
- packageName: packageName.name,
32
- }));
26
+ createIfMissing: true,
27
+ updater: new changelog_1.Changelog({
28
+ version,
29
+ changelogEntry: options.changelogEntry,
30
+ }),
31
+ });
33
32
  return updates;
34
33
  }
35
34
  }
@@ -0,0 +1,8 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Helm extends Strategy {
4
+ private chartYmlContents?;
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ getDefaultPackageName(): Promise<string | undefined>;
7
+ private getChartYmlContents;
8
+ }
@@ -0,0 +1,63 @@
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.Helm = void 0;
17
+ // Generic
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const yaml = require("js-yaml");
20
+ // helm
21
+ const chart_yaml_1 = require("../updaters/helm/chart-yaml");
22
+ const strategy_1 = require("../strategy");
23
+ class Helm extends strategy_1.Strategy {
24
+ async buildUpdates(options) {
25
+ const updates = [];
26
+ const version = options.newVersion;
27
+ updates.push({
28
+ path: this.addPath(this.changelogPath),
29
+ createIfMissing: true,
30
+ updater: new changelog_1.Changelog({
31
+ version,
32
+ changelogEntry: options.changelogEntry,
33
+ }),
34
+ });
35
+ updates.push({
36
+ path: this.addPath('Chart.yaml'),
37
+ createIfMissing: false,
38
+ cachedFileContents: this.chartYmlContents,
39
+ updater: new chart_yaml_1.ChartYaml({
40
+ version,
41
+ }),
42
+ });
43
+ return updates;
44
+ }
45
+ async getDefaultPackageName() {
46
+ const chartYmlContents = await this.getChartYmlContents();
47
+ const chart = yaml.load(chartYmlContents.parsedContent, { json: true });
48
+ if (typeof chart === 'object') {
49
+ return chart.name;
50
+ }
51
+ else {
52
+ return undefined;
53
+ }
54
+ }
55
+ async getChartYmlContents() {
56
+ if (!this.chartYmlContents) {
57
+ this.chartYmlContents = await this.github.getFileContents(this.addPath('Chart.yaml'));
58
+ }
59
+ return this.chartYmlContents;
60
+ }
61
+ }
62
+ exports.Helm = Helm;
63
+ //# sourceMappingURL=helm.js.map
@@ -0,0 +1,24 @@
1
+ import { Update } from '../update';
2
+ import { Version, VersionsMap } from '../version';
3
+ import { Strategy, StrategyOptions, BuildUpdatesOptions } from '../strategy';
4
+ import { GitHubFileContents } from '../github';
5
+ import { Commit } from '../commit';
6
+ import { Release } from '../release';
7
+ import { ReleasePullRequest } from '../release-pull-request';
8
+ interface JavaStrategyOptions extends StrategyOptions {
9
+ extraFiles?: string[];
10
+ }
11
+ export declare class JavaYoshi extends Strategy {
12
+ readonly extraFiles: string[];
13
+ private versionsContent?;
14
+ private snapshotVersioning;
15
+ constructor(options: JavaStrategyOptions);
16
+ buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest | undefined>;
17
+ private buildSnapshotPullRequest;
18
+ private needsSnapshot;
19
+ protected buildVersionsMap(): Promise<VersionsMap>;
20
+ protected getVersionsContent(): Promise<GitHubFileContents>;
21
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
22
+ protected initialReleaseVersion(): Version;
23
+ }
24
+ export {};
@@ -0,0 +1,203 @@
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.JavaYoshi = void 0;
17
+ const versions_manifest_1 = require("../updaters/java/versions-manifest");
18
+ const version_1 = require("../version");
19
+ const java_update_1 = require("../updaters/java/java-update");
20
+ const strategy_1 = require("../strategy");
21
+ const changelog_1 = require("../updaters/changelog");
22
+ const java_snapshot_1 = require("../versioning-strategies/java-snapshot");
23
+ const errors_1 = require("../errors");
24
+ const logger_1 = require("../util/logger");
25
+ const pull_request_title_1 = require("../util/pull-request-title");
26
+ const branch_name_1 = require("../util/branch-name");
27
+ const pull_request_body_1 = require("../util/pull-request-body");
28
+ const default_1 = require("../versioning-strategies/default");
29
+ const java_add_snapshot_1 = require("../versioning-strategies/java-add-snapshot");
30
+ const CHANGELOG_SECTIONS = [
31
+ { type: 'feat', section: 'Features' },
32
+ { type: 'fix', section: 'Bug Fixes' },
33
+ { type: 'perf', section: 'Performance Improvements' },
34
+ { type: 'deps', section: 'Dependencies' },
35
+ { type: 'revert', section: 'Reverts' },
36
+ { type: 'docs', section: 'Documentation' },
37
+ { type: 'style', section: 'Styles', hidden: true },
38
+ { type: 'chore', section: 'Miscellaneous Chores', 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 JavaYoshi extends strategy_1.Strategy {
45
+ constructor(options) {
46
+ var _a;
47
+ options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
48
+ // wrap the configured versioning strategy with snapshotting
49
+ const parentVersioningStrategy = options.versioningStrategy || new default_1.DefaultVersioningStrategy();
50
+ options.versioningStrategy = new java_snapshot_1.JavaSnapshot(parentVersioningStrategy);
51
+ super(options);
52
+ this.extraFiles = options.extraFiles || [];
53
+ this.snapshotVersioning = new java_add_snapshot_1.JavaAddSnapshot(parentVersioningStrategy);
54
+ }
55
+ async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
56
+ if (await this.needsSnapshot()) {
57
+ logger_1.logger.info('Repository needs a snapshot bump.');
58
+ return await this.buildSnapshotPullRequest(latestRelease);
59
+ }
60
+ logger_1.logger.info('No Java snapshot needed');
61
+ return await super.buildReleasePullRequest(commits, latestRelease, draft, labels);
62
+ }
63
+ async buildSnapshotPullRequest(latestRelease) {
64
+ const component = await this.getComponent();
65
+ const newVersion = latestRelease
66
+ ? await this.snapshotVersioning.bump(latestRelease.tag.version, [])
67
+ : this.initialReleaseVersion();
68
+ const versionsMap = await this.buildVersionsMap();
69
+ for (const versionKey of versionsMap.keys()) {
70
+ const version = versionsMap.get(versionKey);
71
+ if (!version) {
72
+ logger_1.logger.warn(`didn't find version for ${versionKey}`);
73
+ continue;
74
+ }
75
+ const newVersion = await this.snapshotVersioning.bump(version, []);
76
+ versionsMap.set(versionKey, newVersion);
77
+ }
78
+ const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion);
79
+ const branchName = component
80
+ ? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
81
+ : branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
82
+ const pullRequestBody = new pull_request_body_1.PullRequestBody([
83
+ {
84
+ component,
85
+ version: newVersion,
86
+ notes: '### Updating meta-information for bleeding-edge SNAPSHOT release.',
87
+ },
88
+ ]);
89
+ return {
90
+ title: pullRequestTitle,
91
+ body: pullRequestBody,
92
+ updates: [
93
+ {
94
+ path: this.addPath('versions.txt'),
95
+ createIfMissing: false,
96
+ updater: new versions_manifest_1.VersionsManifest({
97
+ version: newVersion,
98
+ versionsMap,
99
+ }),
100
+ },
101
+ ],
102
+ labels: [],
103
+ headRefName: branchName.toString(),
104
+ version: newVersion,
105
+ draft: false,
106
+ };
107
+ }
108
+ async needsSnapshot() {
109
+ return versions_manifest_1.VersionsManifest.needsSnapshot((await this.getVersionsContent()).parsedContent);
110
+ }
111
+ async buildVersionsMap() {
112
+ this.versionsContent = await this.getVersionsContent();
113
+ return versions_manifest_1.VersionsManifest.parseVersions(this.versionsContent.parsedContent);
114
+ }
115
+ async getVersionsContent() {
116
+ if (!this.versionsContent) {
117
+ try {
118
+ this.versionsContent = await this.github.getFileContentsOnBranch(this.addPath('versions.txt'), this.targetBranch);
119
+ }
120
+ catch (err) {
121
+ if (err instanceof errors_1.GitHubAPIError) {
122
+ throw new errors_1.MissingRequiredFileError(this.addPath('versions.txt'), JavaYoshi.name, `${this.repository.owner}/${this.repository.repo}`);
123
+ }
124
+ throw err;
125
+ }
126
+ }
127
+ return this.versionsContent;
128
+ }
129
+ async buildUpdates(options) {
130
+ const updates = [];
131
+ const version = options.newVersion;
132
+ const versionsMap = options.versionsMap;
133
+ updates.push({
134
+ path: this.addPath('versions.txt'),
135
+ createIfMissing: false,
136
+ cachedFileContents: this.versionsContent,
137
+ updater: new versions_manifest_1.VersionsManifest({
138
+ version,
139
+ versionsMap,
140
+ }),
141
+ });
142
+ const pomFilesSearch = this.github.findFilesByFilename('pom.xml', this.path);
143
+ const buildFilesSearch = this.github.findFilesByFilename('build.gradle', this.path);
144
+ const dependenciesSearch = this.github.findFilesByFilename('dependencies.properties', this.path);
145
+ const pomFiles = await pomFilesSearch;
146
+ pomFiles.forEach(path => {
147
+ updates.push({
148
+ path: this.addPath(path),
149
+ createIfMissing: false,
150
+ updater: new java_update_1.JavaUpdate({
151
+ version,
152
+ versionsMap,
153
+ }),
154
+ });
155
+ });
156
+ const buildFiles = await buildFilesSearch;
157
+ buildFiles.forEach(path => {
158
+ updates.push({
159
+ path: this.addPath(path),
160
+ createIfMissing: false,
161
+ updater: new java_update_1.JavaUpdate({
162
+ version,
163
+ versionsMap,
164
+ }),
165
+ });
166
+ });
167
+ const dependenciesFiles = await dependenciesSearch;
168
+ dependenciesFiles.forEach(path => {
169
+ updates.push({
170
+ path: this.addPath(path),
171
+ createIfMissing: false,
172
+ updater: new java_update_1.JavaUpdate({
173
+ version,
174
+ versionsMap,
175
+ }),
176
+ });
177
+ });
178
+ this.extraFiles.forEach(path => {
179
+ updates.push({
180
+ path,
181
+ createIfMissing: false,
182
+ updater: new java_update_1.JavaUpdate({
183
+ version,
184
+ versionsMap,
185
+ }),
186
+ });
187
+ });
188
+ updates.push({
189
+ path: this.addPath(this.changelogPath),
190
+ createIfMissing: true,
191
+ updater: new changelog_1.Changelog({
192
+ version,
193
+ changelogEntry: options.changelogEntry,
194
+ }),
195
+ });
196
+ return updates;
197
+ }
198
+ initialReleaseVersion() {
199
+ return version_1.Version.parse('0.1.0');
200
+ }
201
+ }
202
+ exports.JavaYoshi = JavaYoshi;
203
+ //# sourceMappingURL=java-yoshi.js.map
@@ -0,0 +1,7 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ import { Version } from '../version';
4
+ export declare class KRMBlueprint extends Strategy {
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ protected initialReleaseVersion(): Version;
7
+ }
@@ -14,46 +14,50 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.KRMBlueprint = void 0;
17
- const release_pr_1 = require("../release-pr");
18
17
  // Generic
19
18
  const changelog_1 = require("../updaters/changelog");
20
19
  // KRM specific.
21
20
  const krm_blueprint_version_1 = require("../updaters/krm/krm-blueprint-version");
21
+ const strategy_1 = require("../strategy");
22
+ const version_1 = require("../version");
22
23
  const KRMBlueprintAttribAnnotation = 'cnrm.cloud.google.com/blueprint';
23
24
  const hasKRMBlueprintAttrib = (content) => content.includes(KRMBlueprintAttribAnnotation);
24
- class KRMBlueprint extends release_pr_1.ReleasePR {
25
- async buildUpdates(changelogEntry, candidate, packageName) {
25
+ class KRMBlueprint extends strategy_1.Strategy {
26
+ async buildUpdates(options) {
26
27
  const updates = [];
27
- updates.push(new changelog_1.Changelog({
28
+ const version = options.newVersion;
29
+ updates.push({
28
30
  path: this.addPath(this.changelogPath),
29
- changelogEntry,
30
- version: candidate.version,
31
- packageName: packageName.name,
32
- }));
31
+ createIfMissing: true,
32
+ updater: new changelog_1.Changelog({
33
+ version,
34
+ changelogEntry: options.changelogEntry,
35
+ }),
36
+ });
33
37
  const versionsMap = new Map();
34
- if (candidate.previousTag) {
35
- // if previousTag of form pkgName-vX.x.x, we only require vX.x.x for attrib update
36
- const previousVersion = candidate.previousTag.replace(`${packageName.name}-`, '');
37
- versionsMap.set('previousVersion', previousVersion);
38
+ if (options.latestVersion) {
39
+ versionsMap.set('previousVersion', options.latestVersion);
38
40
  }
39
41
  // Update version in all yaml files with attribution annotation
40
- const yamlPaths = await this.gh.findFilesByExtension('yaml', this.path);
42
+ const yamlPaths = await this.github.findFilesByExtension('yaml', this.path);
41
43
  for (const yamlPath of yamlPaths) {
42
- const contents = await this.gh.getFileContents(this.addPath(yamlPath));
44
+ const contents = await this.github.getFileContents(this.addPath(yamlPath));
43
45
  if (hasKRMBlueprintAttrib(contents.parsedContent)) {
44
- updates.push(new krm_blueprint_version_1.KRMBlueprintVersion({
46
+ updates.push({
45
47
  path: this.addPath(yamlPath),
46
- changelogEntry,
47
- version: candidate.version,
48
- packageName: packageName.name,
49
- versions: versionsMap,
50
- }));
48
+ createIfMissing: false,
49
+ cachedFileContents: contents,
50
+ updater: new krm_blueprint_version_1.KRMBlueprintVersion({
51
+ version,
52
+ versionsMap,
53
+ }),
54
+ });
51
55
  }
52
56
  }
53
57
  return updates;
54
58
  }
55
- defaultInitialVersion() {
56
- return '0.1.0';
59
+ initialReleaseVersion() {
60
+ return version_1.Version.parse('0.1.0');
57
61
  }
58
62
  }
59
63
  exports.KRMBlueprint = KRMBlueprint;
@@ -0,0 +1,9 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Node extends Strategy {
4
+ private pkgJsonContents?;
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ getDefaultPackageName(): Promise<string | undefined>;
7
+ protected normalizeComponent(component: string | undefined): string;
8
+ private getPkgJsonContents;
9
+ }
@@ -0,0 +1,82 @@
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.Node = void 0;
17
+ const strategy_1 = require("../strategy");
18
+ const package_lock_json_1 = require("../updaters/node/package-lock-json");
19
+ const samples_package_json_1 = require("../updaters/node/samples-package-json");
20
+ const changelog_1 = require("../updaters/changelog");
21
+ const package_json_1 = require("../updaters/node/package-json");
22
+ class Node extends strategy_1.Strategy {
23
+ async buildUpdates(options) {
24
+ const updates = [];
25
+ const version = options.newVersion;
26
+ const packageName = this.component || '';
27
+ const lockFiles = ['package-lock.json', 'npm-shrinkwrap.json'];
28
+ lockFiles.forEach(lockFile => {
29
+ updates.push({
30
+ path: this.addPath(lockFile),
31
+ createIfMissing: false,
32
+ updater: new package_lock_json_1.PackageLockJson({
33
+ version,
34
+ }),
35
+ });
36
+ });
37
+ updates.push({
38
+ path: this.addPath('samples/package.json'),
39
+ createIfMissing: false,
40
+ updater: new samples_package_json_1.SamplesPackageJson({
41
+ version,
42
+ packageName,
43
+ }),
44
+ });
45
+ updates.push({
46
+ path: this.addPath(this.changelogPath),
47
+ createIfMissing: true,
48
+ updater: new changelog_1.Changelog({
49
+ version,
50
+ changelogEntry: options.changelogEntry,
51
+ }),
52
+ });
53
+ updates.push({
54
+ path: this.addPath('package.json'),
55
+ createIfMissing: false,
56
+ cachedFileContents: this.pkgJsonContents,
57
+ updater: new package_json_1.PackageJson({
58
+ version,
59
+ }),
60
+ });
61
+ return updates;
62
+ }
63
+ async getDefaultPackageName() {
64
+ const pkgJsonContents = await this.getPkgJsonContents();
65
+ const pkg = JSON.parse(pkgJsonContents.parsedContent);
66
+ return pkg.name;
67
+ }
68
+ normalizeComponent(component) {
69
+ if (!component) {
70
+ return '';
71
+ }
72
+ return component.match(/^@[\w-]+\//) ? component.split('/')[1] : component;
73
+ }
74
+ async getPkgJsonContents() {
75
+ if (!this.pkgJsonContents) {
76
+ this.pkgJsonContents = await this.github.getFileContentsOnBranch(this.addPath('package.json'), this.targetBranch);
77
+ }
78
+ return this.pkgJsonContents;
79
+ }
80
+ }
81
+ exports.Node = Node;
82
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1,5 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class OCaml extends Strategy {
4
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
+ }