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,102 @@
1
+ import { ManifestPlugin } from '../plugin';
2
+ import { CandidateReleasePullRequest, RepositoryConfig } from '../manifest';
3
+ import { VersionsMap, Version } from '../version';
4
+ import { GitHub } from '../github';
5
+ export declare type DependencyGraph<T> = Map<string, DependencyNode<T>>;
6
+ export interface DependencyNode<T> {
7
+ deps: string[];
8
+ value: T;
9
+ }
10
+ export interface WorkspacePluginOptions {
11
+ updateAllPackages?: boolean;
12
+ }
13
+ interface AllPackages<T> {
14
+ allPackages: T[];
15
+ candidatesByPackage: Record<string, CandidateReleasePullRequest>;
16
+ }
17
+ /**
18
+ * The plugin generalizes the logic for handling a workspace and
19
+ * will bump dependencies of managed packages if those dependencies
20
+ * are being updated.
21
+ *
22
+ * If multiple in-scope packages are being updated, it will merge them
23
+ * into a single package.
24
+ *
25
+ * This class is templatized with `T` which should be information about
26
+ * the package including the name and current version.
27
+ */
28
+ export declare abstract class WorkspacePlugin<T> extends ManifestPlugin {
29
+ private updateAllPackages;
30
+ constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, options?: WorkspacePluginOptions);
31
+ run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
32
+ /**
33
+ * Given a package, return the new bumped version after updating
34
+ * the dependency.
35
+ * @param {T} pkg The package being updated
36
+ */
37
+ protected abstract bumpVersion(pkg: T): Version;
38
+ /**
39
+ * Update an existing candidate pull request to append new
40
+ * dependency updates into the versions and changelog.
41
+ * @param {CandidateReleasePullRequest} existingCandidate The existing
42
+ * candidate pull request.
43
+ * @param {T} pkg The package being updated
44
+ * @param {VersionsMap} updatedVersions Map of package name => version to
45
+ * update.
46
+ * @returns {CandidateReleasePullRequest} The updated pull request
47
+ */
48
+ protected abstract updateCandidate(existingCandidate: CandidateReleasePullRequest, pkg: T, updatedVersions: VersionsMap): CandidateReleasePullRequest;
49
+ /**
50
+ * Create a new candidate pull request to update dependencies and force
51
+ * a version bump.
52
+ * @param {T} pkg The package being updated
53
+ * @param {VersionsMap} updatedVersions Map of package name => version to
54
+ * update.
55
+ * @returns {CandidateReleasePullRequest} A new pull request
56
+ */
57
+ protected abstract newCandidate(pkg: T, updatedVersions: VersionsMap): CandidateReleasePullRequest;
58
+ /**
59
+ * Collect all packages being managed in this workspace.
60
+ * @param {CanididateReleasePullRequest[]} candidates Existing candidate pull
61
+ * requests
62
+ * @returns {AllPackages<T>} The list of packages and candidates grouped by package name
63
+ */
64
+ protected abstract buildAllPackages(candidates: CandidateReleasePullRequest[]): Promise<AllPackages<T>>;
65
+ /**
66
+ * Builds a graph of dependencies that have been touched
67
+ * @param {T[]} allPackages All the packages in the workspace
68
+ * @returns {DependencyGraph<T>} A map of package name to other workspace packages
69
+ * it depends on.
70
+ */
71
+ protected abstract buildGraph(allPackages: T[]): Promise<DependencyGraph<T>>;
72
+ /**
73
+ * Filter to determine whether or not the candidate pull request is
74
+ * in scope of this workspace.
75
+ * @param {CandidateReleasePullRequest} candidate The candidate pull request
76
+ * @returns {boolean} Whether or not this candidate should be handled by this
77
+ * workspace.
78
+ */
79
+ protected abstract inScope(candidate: CandidateReleasePullRequest): boolean;
80
+ /**
81
+ * Given a package, return the package name of the package.
82
+ * @param {T} pkg The package definition.
83
+ * @returns {string} The package name.
84
+ */
85
+ protected abstract packageNameFromPackage(pkg: T): string;
86
+ /**
87
+ * Helper to invert the graph from package => packages that it depends on
88
+ * to package => packages that depend on it.
89
+ * @param {DependencyGraph<T>} graph
90
+ * @returns {DependencyGraph<T>}
91
+ */
92
+ private invertGraph;
93
+ /**
94
+ * Determine all the packages which need to be updated and sort them.
95
+ * @param {DependencyGraph<T>} graph The graph of package => packages it depends on
96
+ * @param {string} packageNamesToUpdate Names of the packages which are already
97
+ * being updated.
98
+ */
99
+ protected buildGraphOrder(graph: DependencyGraph<T>, packageNamesToUpdate: string[]): T[];
100
+ private visitPostOrder;
101
+ }
102
+ export {};
@@ -0,0 +1,170 @@
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.WorkspacePlugin = void 0;
17
+ const plugin_1 = require("../plugin");
18
+ const logger_1 = require("../util/logger");
19
+ const merge_1 = require("./merge");
20
+ /**
21
+ * The plugin generalizes the logic for handling a workspace and
22
+ * will bump dependencies of managed packages if those dependencies
23
+ * are being updated.
24
+ *
25
+ * If multiple in-scope packages are being updated, it will merge them
26
+ * into a single package.
27
+ *
28
+ * This class is templatized with `T` which should be information about
29
+ * the package including the name and current version.
30
+ */
31
+ class WorkspacePlugin extends plugin_1.ManifestPlugin {
32
+ constructor(github, targetBranch, repositoryConfig, options = {}) {
33
+ var _a;
34
+ super(github, targetBranch, repositoryConfig);
35
+ this.updateAllPackages = (_a = options.updateAllPackages) !== null && _a !== void 0 ? _a : false;
36
+ }
37
+ async run(candidates) {
38
+ logger_1.logger.info('Running workspace plugin');
39
+ const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => {
40
+ if (!candidate.pullRequest.version) {
41
+ logger_1.logger.warn('pull request missing version', candidate);
42
+ return collection;
43
+ }
44
+ if (this.inScope(candidate)) {
45
+ collection[0].push(candidate);
46
+ }
47
+ else {
48
+ collection[1].push(candidate);
49
+ }
50
+ return collection;
51
+ }, [[], []]);
52
+ logger_1.logger.info(`Found ${inScopeCandidates.length} in-scope releases`);
53
+ if (inScopeCandidates.length === 0) {
54
+ return outOfScopeCandidates;
55
+ }
56
+ logger_1.logger.info('Building list of all packages');
57
+ const { allPackages, candidatesByPackage } = await this.buildAllPackages(inScopeCandidates);
58
+ logger_1.logger.info(`Building dependency graph for ${allPackages.length} packages`);
59
+ const graph = await this.buildGraph(allPackages);
60
+ const packageNamesToUpdate = this.updateAllPackages
61
+ ? allPackages.map(this.packageNameFromPackage)
62
+ : Object.keys(candidatesByPackage);
63
+ const orderedPackages = this.buildGraphOrder(graph, packageNamesToUpdate);
64
+ logger_1.logger.info(`Updating ${orderedPackages.length} packages`);
65
+ const updatedVersions = new Map();
66
+ for (const pkg of orderedPackages) {
67
+ const packageName = this.packageNameFromPackage(pkg);
68
+ logger_1.logger.debug(`package: ${packageName}`);
69
+ const existingCandidate = candidatesByPackage[packageName];
70
+ if (existingCandidate) {
71
+ const version = existingCandidate.pullRequest.version;
72
+ logger_1.logger.debug(`version: ${version} from release-please`);
73
+ updatedVersions.set(packageName, version);
74
+ }
75
+ else {
76
+ const version = this.bumpVersion(pkg);
77
+ logger_1.logger.debug(`version: ${version} forced bump`);
78
+ updatedVersions.set(packageName, version);
79
+ }
80
+ }
81
+ let newCandidates = [];
82
+ for (const pkg of orderedPackages) {
83
+ const packageName = this.packageNameFromPackage(pkg);
84
+ const existingCandidate = candidatesByPackage[packageName];
85
+ if (existingCandidate) {
86
+ // if already has an pull request, update the changelog and update
87
+ logger_1.logger.info(`Updating exising candidate pull request for ${this.packageNameFromPackage(pkg)}`);
88
+ const newCandidate = this.updateCandidate(existingCandidate, pkg, updatedVersions);
89
+ newCandidates.push(newCandidate);
90
+ }
91
+ else {
92
+ // otherwise, build a new pull request with changelog and entry update
93
+ logger_1.logger.info(`Creating new candidate pull request for ${this.packageNameFromPackage(pkg)}`);
94
+ const newCandidate = this.newCandidate(pkg, updatedVersions);
95
+ newCandidates.push(newCandidate);
96
+ }
97
+ }
98
+ logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`);
99
+ const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig);
100
+ newCandidates = await mergePlugin.run(newCandidates);
101
+ return [...outOfScopeCandidates, ...newCandidates];
102
+ }
103
+ /**
104
+ * Helper to invert the graph from package => packages that it depends on
105
+ * to package => packages that depend on it.
106
+ * @param {DependencyGraph<T>} graph
107
+ * @returns {DependencyGraph<T>}
108
+ */
109
+ invertGraph(graph) {
110
+ const dependentGraph = new Map();
111
+ for (const [packageName, node] of graph) {
112
+ dependentGraph.set(packageName, {
113
+ deps: [],
114
+ value: node.value,
115
+ });
116
+ }
117
+ for (const [packageName, node] of graph) {
118
+ for (const depName of node.deps) {
119
+ if (dependentGraph.has(depName)) {
120
+ dependentGraph.get(depName).deps.push(packageName);
121
+ }
122
+ }
123
+ }
124
+ return dependentGraph;
125
+ }
126
+ /**
127
+ * Determine all the packages which need to be updated and sort them.
128
+ * @param {DependencyGraph<T>} graph The graph of package => packages it depends on
129
+ * @param {string} packageNamesToUpdate Names of the packages which are already
130
+ * being updated.
131
+ */
132
+ buildGraphOrder(graph, packageNamesToUpdate) {
133
+ // invert the graph so it's dependency name => packages that depend on it
134
+ const dependentGraph = this.invertGraph(graph);
135
+ const visited = new Set();
136
+ // we're iterating the `Map` in insertion order (as per ECMA262), but
137
+ // that does not reflect any particular traversal of the graph, so we
138
+ // visit all nodes, opportunistically short-circuiting leafs when we've
139
+ // already visited them.
140
+ for (const name of packageNamesToUpdate) {
141
+ this.visitPostOrder(dependentGraph, name, visited, []);
142
+ }
143
+ return Array.from(visited).sort((a, b) => this.packageNameFromPackage(a).localeCompare(this.packageNameFromPackage(b)));
144
+ }
145
+ visitPostOrder(graph, name, visited, path) {
146
+ if (path.indexOf(name) !== -1) {
147
+ throw new Error(`found cycle in dependency graph: ${path.join(' -> ')} -> ${name}`);
148
+ }
149
+ const node = graph.get(name);
150
+ if (!node) {
151
+ logger_1.logger.warn(`Didn't find node: ${name} in graph`);
152
+ return;
153
+ }
154
+ const nextPath = [...path, name];
155
+ for (const depName of node.deps) {
156
+ const dep = graph.get(depName);
157
+ if (!dep) {
158
+ logger_1.logger.warn(`dependency not found in graph: ${depName}`);
159
+ return;
160
+ }
161
+ this.visitPostOrder(graph, depName, visited, nextPath);
162
+ }
163
+ if (!visited.has(node.value)) {
164
+ logger_1.logger.debug(`marking ${name} as visited and adding ${this.packageNameFromPackage(node.value)} to order`);
165
+ visited.add(node.value);
166
+ }
167
+ }
168
+ }
169
+ exports.WorkspacePlugin = WorkspacePlugin;
170
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1,10 @@
1
+ export interface PullRequest {
2
+ headBranchName: string;
3
+ baseBranchName: string;
4
+ number: number;
5
+ title: string;
6
+ body: string;
7
+ labels: string[];
8
+ files: string[];
9
+ sha?: string;
10
+ }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2019 Google LLC
2
+ // Copyright 2021 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -13,9 +13,4 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Readme = void 0;
17
- const java_update_1 = require("./java_update");
18
- class Readme extends java_update_1.JavaUpdate {
19
- }
20
- exports.Readme = Readme;
21
- //# sourceMappingURL=readme.js.map
16
+ //# sourceMappingURL=pull-request.js.map
@@ -0,0 +1,29 @@
1
+ import { ConventionalCommit } from './commit';
2
+ export interface ChangelogSection {
3
+ type: string;
4
+ section: string;
5
+ hidden?: boolean;
6
+ }
7
+ interface ReleaseNotesOptions {
8
+ changelogSections?: ChangelogSection[];
9
+ commitPartial?: string;
10
+ headerPartial?: string;
11
+ mainTemplate?: string;
12
+ }
13
+ interface BuildNotesOptions {
14
+ host?: string;
15
+ owner: string;
16
+ repository: string;
17
+ version: string;
18
+ previousTag?: string;
19
+ currentTag: string;
20
+ }
21
+ export declare class ReleaseNotes {
22
+ private changelogSections?;
23
+ private commitPartial?;
24
+ private headerPartial?;
25
+ private mainTemplate?;
26
+ constructor(options?: ReleaseNotesOptions);
27
+ buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
28
+ }
29
+ 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.ReleaseNotes = 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
+ class ReleaseNotes {
22
+ constructor(options = {}) {
23
+ this.changelogSections = options.changelogSections;
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 || 'https://github.com',
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 (this.changelogSections) {
40
+ config.types = this.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.ReleaseNotes = ReleaseNotes;
71
+ //# sourceMappingURL=release-notes.js.map
@@ -0,0 +1,13 @@
1
+ import { Update } from './update';
2
+ import { Version } from './version';
3
+ import { PullRequestBody } from './util/pull-request-body';
4
+ import { PullRequestTitle } from './util/pull-request-title';
5
+ export interface ReleasePullRequest {
6
+ title: PullRequestTitle;
7
+ body: PullRequestBody;
8
+ updates: Update[];
9
+ labels: string[];
10
+ headRefName: string;
11
+ version?: Version;
12
+ draft: boolean;
13
+ }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2019 Google LLC
2
+ // Copyright 2021 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -13,9 +13,4 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.PomXML = void 0;
17
- const java_update_1 = require("./java_update");
18
- class PomXML extends java_update_1.JavaUpdate {
19
- }
20
- exports.PomXML = PomXML;
21
- //# sourceMappingURL=pom-xml.js.map
16
+ //# sourceMappingURL=release-pull-request.js.map
@@ -0,0 +1,6 @@
1
+ import { TagName } from './util/tag-name';
2
+ export interface Release {
3
+ readonly tag: TagName;
4
+ readonly sha: string;
5
+ readonly notes: string;
6
+ }
@@ -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=release.js.map
@@ -0,0 +1,5 @@
1
+ export interface Repository {
2
+ readonly owner: string;
3
+ readonly repo: string;
4
+ readonly defaultBranch: string;
5
+ }
@@ -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=repository.js.map
@@ -0,0 +1,8 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Dart extends Strategy {
4
+ private pubspecYmlContents?;
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ getDefaultPackageName(): Promise<string | undefined>;
7
+ private getPubspecYmlContents;
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.Dart = void 0;
17
+ // Generic
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const yaml = require("js-yaml");
20
+ // pubspec
21
+ const pubspec_yaml_1 = require("../updaters/dart/pubspec-yaml");
22
+ const strategy_1 = require("../strategy");
23
+ class Dart 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('pubspec.yaml'),
37
+ createIfMissing: false,
38
+ cachedFileContents: this.pubspecYmlContents,
39
+ updater: new pubspec_yaml_1.PubspecYaml({
40
+ version,
41
+ }),
42
+ });
43
+ return updates;
44
+ }
45
+ async getDefaultPackageName() {
46
+ const pubspecYmlContents = await this.getPubspecYmlContents();
47
+ const pubspec = yaml.load(pubspecYmlContents.parsedContent, { json: true });
48
+ if (typeof pubspec === 'object') {
49
+ return pubspec.name;
50
+ }
51
+ else {
52
+ return undefined;
53
+ }
54
+ }
55
+ async getPubspecYmlContents() {
56
+ if (!this.pubspecYmlContents) {
57
+ this.pubspecYmlContents = await this.github.getFileContentsOnBranch(this.addPath('pubspec.yaml'), this.targetBranch);
58
+ }
59
+ return this.pubspecYmlContents;
60
+ }
61
+ }
62
+ exports.Dart = Dart;
63
+ //# sourceMappingURL=dart.js.map
@@ -0,0 +1,5 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Elixir extends Strategy {
4
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
+ }
@@ -14,26 +14,30 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Elixir = void 0;
17
- const release_pr_1 = require("../release-pr");
18
17
  // Generic
19
18
  const changelog_1 = require("../updaters/changelog");
20
19
  // mix.exs support
21
- const elixir_mix_exs_1 = require("../updaters/elixir-mix-exs");
22
- class Elixir extends release_pr_1.ReleasePR {
23
- async buildUpdates(changelogEntry, candidate, packageName) {
20
+ const elixir_mix_exs_1 = require("../updaters/elixir/elixir-mix-exs");
21
+ const strategy_1 = require("../strategy");
22
+ class Elixir extends strategy_1.Strategy {
23
+ async buildUpdates(options) {
24
24
  const updates = [];
25
- updates.push(new changelog_1.Changelog({
25
+ const version = options.newVersion;
26
+ updates.push({
26
27
  path: this.addPath(this.changelogPath),
27
- changelogEntry,
28
- version: candidate.version,
29
- packageName: packageName.name,
30
- }));
31
- updates.push(new elixir_mix_exs_1.ElixirMixExs({
28
+ createIfMissing: true,
29
+ updater: new changelog_1.Changelog({
30
+ version,
31
+ changelogEntry: options.changelogEntry,
32
+ }),
33
+ });
34
+ updates.push({
32
35
  path: this.addPath('mix.exs'),
33
- changelogEntry,
34
- version: candidate.version,
35
- packageName: packageName.name,
36
- }));
36
+ createIfMissing: false,
37
+ updater: new elixir_mix_exs_1.ElixirMixExs({
38
+ version,
39
+ }),
40
+ });
37
41
  return updates;
38
42
  }
39
43
  }
@@ -0,0 +1,13 @@
1
+ import { Strategy, BuildUpdatesOptions, StrategyOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ import { ConventionalCommit } from '../commit';
4
+ import { Version } from '../version';
5
+ import { TagName } from '../util/tag-name';
6
+ import { Release } from '../release';
7
+ export declare class GoYoshi extends Strategy {
8
+ constructor(options: StrategyOptions);
9
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
10
+ protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
11
+ protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
12
+ protected initialReleaseVersion(): Version;
13
+ }