release-please 12.5.0 → 13.0.0-candidate.2

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 (253) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +4 -0
  3. package/build/src/bin/release-please.d.ts +55 -11
  4. package/build/src/bin/release-please.js +419 -152
  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 +17 -0
  8. package/build/src/changelog-notes/default.js +72 -0
  9. package/build/src/changelog-notes.d.ts +17 -0
  10. package/build/src/{updaters/java/readme.js → changelog-notes.js} +2 -7
  11. package/build/src/commit.d.ts +26 -0
  12. package/build/src/{util/to-conventional-changelog-format.js → commit.js} +97 -2
  13. package/build/src/errors/index.d.ts +0 -5
  14. package/build/src/errors/index.js +1 -10
  15. package/build/src/factory.d.ts +25 -37
  16. package/build/src/factory.js +160 -150
  17. package/build/src/github.d.ts +154 -884
  18. package/build/src/github.js +608 -1036
  19. package/build/src/manifest.d.ts +191 -47
  20. package/build/src/manifest.js +599 -487
  21. package/build/src/plugin.d.ts +20 -0
  22. package/build/src/{plugins/plugin.js → plugin.js} +10 -9
  23. package/build/src/plugins/cargo-workspace.d.ts +48 -18
  24. package/build/src/plugins/cargo-workspace.js +247 -328
  25. package/build/src/plugins/merge.d.ts +11 -0
  26. package/build/src/plugins/merge.js +83 -0
  27. package/build/src/plugins/node-workspace.d.ts +35 -17
  28. package/build/src/plugins/node-workspace.js +234 -271
  29. package/build/src/plugins/workspace.d.ts +102 -0
  30. package/build/src/plugins/workspace.js +170 -0
  31. package/build/src/pull-request.d.ts +10 -0
  32. package/build/src/{updaters/java/pom-xml.js → pull-request.js} +2 -7
  33. package/build/src/release-notes.d.ts +29 -0
  34. package/build/src/release-notes.js +71 -0
  35. package/build/src/release-pull-request.d.ts +13 -0
  36. package/build/src/release-pull-request.js +16 -0
  37. package/build/src/release.d.ts +6 -0
  38. package/build/src/release.js +16 -0
  39. package/build/src/repository.d.ts +5 -0
  40. package/build/src/repository.js +16 -0
  41. package/build/src/strategies/dart.d.ts +8 -0
  42. package/build/src/strategies/dart.js +63 -0
  43. package/build/src/strategies/elixir.d.ts +5 -0
  44. package/build/src/{releasers → strategies}/elixir.js +18 -14
  45. package/build/src/strategies/go-yoshi.d.ts +13 -0
  46. package/build/src/strategies/go-yoshi.js +106 -0
  47. package/build/src/strategies/go.d.ts +5 -0
  48. package/build/src/{releasers → strategies}/go.js +11 -12
  49. package/build/src/strategies/helm.d.ts +8 -0
  50. package/build/src/strategies/helm.js +63 -0
  51. package/build/src/strategies/java-yoshi.d.ts +24 -0
  52. package/build/src/strategies/java-yoshi.js +203 -0
  53. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  54. package/build/src/{releasers → strategies}/krm-blueprint.js +26 -22
  55. package/build/src/strategies/node.d.ts +9 -0
  56. package/build/src/strategies/node.js +82 -0
  57. package/build/src/strategies/ocaml.d.ts +5 -0
  58. package/build/src/{releasers → strategies}/ocaml.js +34 -28
  59. package/build/src/strategies/php-yoshi.d.ts +10 -0
  60. package/build/src/strategies/php-yoshi.js +213 -0
  61. package/build/src/strategies/php.d.ts +6 -0
  62. package/build/src/{releasers → strategies}/php.js +24 -23
  63. package/build/src/strategies/python.d.ts +8 -0
  64. package/build/src/strategies/python.js +117 -0
  65. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  66. package/build/src/strategies/ruby-yoshi.js +116 -0
  67. package/build/src/strategies/ruby.d.ts +13 -0
  68. package/build/src/{releasers → strategies}/ruby.js +26 -27
  69. package/build/src/strategies/rust.d.ts +20 -0
  70. package/build/src/strategies/rust.js +120 -0
  71. package/build/src/strategies/simple.d.ts +5 -0
  72. package/build/src/{releasers → strategies}/simple.js +18 -14
  73. package/build/src/strategies/terraform-module.d.ts +7 -0
  74. package/build/src/{releasers → strategies}/terraform-module.js +29 -23
  75. package/build/src/strategy.d.ts +100 -0
  76. package/build/src/strategy.js +233 -0
  77. package/build/src/update.d.ts +23 -0
  78. package/build/src/{updaters/update.js → update.js} +1 -1
  79. package/build/src/updaters/changelog.d.ts +7 -10
  80. package/build/src/updaters/changelog.js +3 -9
  81. package/build/src/updaters/changelog.js.map +1 -1
  82. package/build/src/updaters/composite.d.ts +19 -0
  83. package/build/src/updaters/composite.js +42 -0
  84. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  85. package/build/src/updaters/{pubspec-yaml.js → dart/pubspec-yaml.js} +13 -12
  86. package/build/src/updaters/default.d.ts +21 -0
  87. package/build/src/updaters/{version-txt.js → default.js} +16 -10
  88. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  89. package/build/src/updaters/{java/google-utils.js → dotnet/csproj.js} +16 -13
  90. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  91. package/build/src/updaters/{elixir-mix-exs.js → elixir/elixir-mix-exs.js} +12 -10
  92. package/build/src/updaters/helm/chart-yaml.d.ts +10 -11
  93. package/build/src/updaters/helm/chart-yaml.js +12 -10
  94. package/build/src/updaters/java/java-update.d.ts +14 -0
  95. package/build/src/updaters/java/{java_update.js → java-update.js} +22 -22
  96. package/build/src/updaters/java/versions-manifest.d.ts +12 -2
  97. package/build/src/updaters/java/versions-manifest.js +20 -4
  98. package/build/src/updaters/krm/krm-blueprint-version.d.ts +10 -11
  99. package/build/src/updaters/krm/krm-blueprint-version.js +13 -12
  100. package/build/src/updaters/node/package-json.d.ts +12 -0
  101. package/build/src/updaters/{package-json.js → node/package-json.js} +14 -16
  102. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  103. package/build/src/updaters/node/package-lock-json.js +36 -0
  104. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  105. package/build/src/updaters/{samples-package-json.js → node/samples-package-json.js} +19 -8
  106. package/build/src/updaters/ocaml/dune-project.d.ts +10 -11
  107. package/build/src/updaters/ocaml/dune-project.js +11 -9
  108. package/build/src/updaters/ocaml/esy-json.d.ts +10 -11
  109. package/build/src/updaters/ocaml/esy-json.js +12 -10
  110. package/build/src/updaters/ocaml/opam.d.ts +10 -11
  111. package/build/src/updaters/ocaml/opam.js +11 -9
  112. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  113. package/build/src/updaters/{php-client-version.js → php/php-client-version.js} +10 -9
  114. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  115. package/build/src/updaters/{php-manifest.js → php/php-manifest.js} +17 -15
  116. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  117. package/build/src/updaters/{root-composer-update-packages.js → php/root-composer-update-packages.js} +17 -16
  118. package/build/src/updaters/python/pyproject-toml.d.ts +10 -11
  119. package/build/src/updaters/python/pyproject-toml.js +13 -11
  120. package/build/src/updaters/python/python-file-with-version.d.ts +7 -11
  121. package/build/src/updaters/python/python-file-with-version.js +7 -8
  122. package/build/src/updaters/python/setup-cfg.d.ts +10 -11
  123. package/build/src/updaters/python/setup-cfg.js +10 -8
  124. package/build/src/updaters/python/setup-py.d.ts +10 -11
  125. package/build/src/updaters/python/setup-py.js +10 -8
  126. package/build/src/updaters/raw-content.d.ts +19 -0
  127. package/build/src/{plugins/index.js → updaters/raw-content.js} +23 -12
  128. package/build/src/updaters/release-please-config.d.ts +8 -0
  129. package/build/src/updaters/release-please-config.js +41 -0
  130. package/build/src/updaters/release-please-manifest.d.ts +2 -11
  131. package/build/src/updaters/release-please-manifest.js +11 -14
  132. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  133. package/build/src/updaters/{version-rb.js → ruby/version-rb.js} +10 -8
  134. package/build/src/updaters/rust/cargo-lock.d.ts +7 -11
  135. package/build/src/updaters/rust/cargo-lock.js +14 -16
  136. package/build/src/updaters/rust/cargo-toml.d.ts +7 -11
  137. package/build/src/updaters/rust/cargo-toml.js +19 -21
  138. package/build/src/updaters/terraform/module-version.d.ts +10 -11
  139. package/build/src/updaters/terraform/module-version.js +11 -9
  140. package/build/src/updaters/terraform/readme.d.ts +10 -11
  141. package/build/src/updaters/terraform/readme.js +11 -10
  142. package/build/src/updaters/terraform/readme.js.map +1 -1
  143. package/build/src/util/branch-name.d.ts +5 -4
  144. package/build/src/util/branch-name.js +13 -10
  145. package/build/src/{commit-split.d.ts → util/commit-split.d.ts} +2 -4
  146. package/build/src/{commit-split.js → util/commit-split.js} +4 -2
  147. package/build/src/util/indent-commit.d.ts +1 -1
  148. package/build/src/util/logger.d.ts +5 -2
  149. package/build/src/util/logger.js +9 -4
  150. package/build/src/util/pull-request-body.d.ts +20 -0
  151. package/build/src/util/pull-request-body.js +129 -0
  152. package/build/src/util/pull-request-title.d.ts +8 -6
  153. package/build/src/util/pull-request-title.js +20 -6
  154. package/build/src/util/tag-name.d.ts +9 -0
  155. package/build/src/util/tag-name.js +41 -0
  156. package/build/src/{updaters → util}/toml-edit.d.ts +0 -0
  157. package/build/src/{updaters → util}/toml-edit.js +0 -0
  158. package/build/src/version.d.ts +11 -0
  159. package/build/src/version.js +45 -0
  160. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  161. package/build/src/{updaters/package-lock-json.js → versioning-strategies/always-bump-patch.js} +8 -11
  162. package/build/src/versioning-strategies/default.d.ts +15 -0
  163. package/build/src/versioning-strategies/default.js +67 -0
  164. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  165. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  166. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  167. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  168. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  169. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  170. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  171. package/build/src/versioning-strategies/service-pack.js +40 -0
  172. package/build/src/versioning-strategy.d.ts +28 -0
  173. package/build/src/versioning-strategy.js +55 -0
  174. package/package.json +9 -8
  175. package/build/src/constants.d.ts +0 -6
  176. package/build/src/constants.js +0 -23
  177. package/build/src/conventional-commits.d.ts +0 -53
  178. package/build/src/conventional-commits.js +0 -167
  179. package/build/src/github-release.d.ts +0 -34
  180. package/build/src/github-release.js +0 -92
  181. package/build/src/graphql-to-commits.d.ts +0 -60
  182. package/build/src/graphql-to-commits.js +0 -112
  183. package/build/src/index.d.ts +0 -94
  184. package/build/src/index.js +0 -32
  185. package/build/src/plugins/index.d.ts +0 -5
  186. package/build/src/plugins/plugin.d.ts +0 -21
  187. package/build/src/release-pr.d.ts +0 -101
  188. package/build/src/release-pr.js +0 -461
  189. package/build/src/releasers/dart.d.ts +0 -9
  190. package/build/src/releasers/dart.js +0 -65
  191. package/build/src/releasers/elixir.d.ts +0 -5
  192. package/build/src/releasers/go-yoshi.d.ts +0 -10
  193. package/build/src/releasers/go-yoshi.js +0 -162
  194. package/build/src/releasers/go.d.ts +0 -6
  195. package/build/src/releasers/helm.d.ts +0 -9
  196. package/build/src/releasers/helm.js +0 -66
  197. package/build/src/releasers/index.d.ts +0 -7
  198. package/build/src/releasers/index.js +0 -76
  199. package/build/src/releasers/java/bump_type.d.ts +0 -4
  200. package/build/src/releasers/java/bump_type.js +0 -38
  201. package/build/src/releasers/java/stability.d.ts +0 -5
  202. package/build/src/releasers/java/stability.js +0 -37
  203. package/build/src/releasers/java/version.d.ts +0 -13
  204. package/build/src/releasers/java/version.js +0 -112
  205. package/build/src/releasers/java-backport.d.ts +0 -9
  206. package/build/src/releasers/java-backport.js +0 -43
  207. package/build/src/releasers/java-bom.d.ts +0 -16
  208. package/build/src/releasers/java-bom.js +0 -83
  209. package/build/src/releasers/java-lts.d.ts +0 -9
  210. package/build/src/releasers/java-lts.js +0 -47
  211. package/build/src/releasers/java-yoshi.d.ts +0 -28
  212. package/build/src/releasers/java-yoshi.js +0 -304
  213. package/build/src/releasers/krm-blueprint.d.ts +0 -6
  214. package/build/src/releasers/node.d.ts +0 -10
  215. package/build/src/releasers/node.js +0 -84
  216. package/build/src/releasers/ocaml.d.ts +0 -5
  217. package/build/src/releasers/php-yoshi.d.ts +0 -5
  218. package/build/src/releasers/php-yoshi.js +0 -191
  219. package/build/src/releasers/php.d.ts +0 -7
  220. package/build/src/releasers/python.d.ts +0 -11
  221. package/build/src/releasers/python.js +0 -127
  222. package/build/src/releasers/ruby-yoshi.d.ts +0 -5
  223. package/build/src/releasers/ruby-yoshi.js +0 -142
  224. package/build/src/releasers/ruby.d.ts +0 -11
  225. package/build/src/releasers/rust.d.ts +0 -30
  226. package/build/src/releasers/rust.js +0 -163
  227. package/build/src/releasers/simple.d.ts +0 -5
  228. package/build/src/releasers/terraform-module.d.ts +0 -6
  229. package/build/src/updaters/elixir-mix-exs.d.ts +0 -13
  230. package/build/src/updaters/java/google-utils.d.ts +0 -13
  231. package/build/src/updaters/java/java_update.d.ts +0 -13
  232. package/build/src/updaters/java/pom-xml.d.ts +0 -3
  233. package/build/src/updaters/java/readme.d.ts +0 -3
  234. package/build/src/updaters/java/readme.js.map +0 -1
  235. package/build/src/updaters/package-json.d.ts +0 -16
  236. package/build/src/updaters/package-lock-json.d.ts +0 -7
  237. package/build/src/updaters/php-client-version.d.ts +0 -13
  238. package/build/src/updaters/php-manifest.d.ts +0 -13
  239. package/build/src/updaters/pubspec-yaml.d.ts +0 -13
  240. package/build/src/updaters/root-composer-update-package.d.ts +0 -13
  241. package/build/src/updaters/root-composer-update-package.js +0 -45
  242. package/build/src/updaters/root-composer-update-packages.d.ts +0 -13
  243. package/build/src/updaters/samples-package-json.d.ts +0 -13
  244. package/build/src/updaters/update.d.ts +0 -20
  245. package/build/src/updaters/version-rb.d.ts +0 -13
  246. package/build/src/updaters/version-txt.d.ts +0 -12
  247. package/build/src/updaters/version.d.ts +0 -13
  248. package/build/src/updaters/version.js +0 -31
  249. package/build/src/util/checkpoint.d.ts +0 -6
  250. package/build/src/util/checkpoint.js +0 -33
  251. package/build/src/util/release-notes.d.ts +0 -7
  252. package/build/src/util/release-notes.js +0 -34
  253. package/build/src/util/to-conventional-changelog-format.d.ts +0 -2
@@ -0,0 +1,55 @@
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.CustomVersionUpdate = exports.PatchVersionUpdate = exports.MinorVersionUpdate = exports.MajorVersionUpdate = void 0;
17
+ const version_1 = require("./version");
18
+ class MajorVersionUpdate {
19
+ constructor() {
20
+ this.name = 'major';
21
+ }
22
+ bump(version) {
23
+ return new version_1.Version(version.major + 1, 0, 0, version.preRelease, version.build);
24
+ }
25
+ }
26
+ exports.MajorVersionUpdate = MajorVersionUpdate;
27
+ class MinorVersionUpdate {
28
+ constructor() {
29
+ this.name = 'minor';
30
+ }
31
+ bump(version) {
32
+ return new version_1.Version(version.major, version.minor + 1, 0, version.preRelease, version.build);
33
+ }
34
+ }
35
+ exports.MinorVersionUpdate = MinorVersionUpdate;
36
+ class PatchVersionUpdate {
37
+ constructor() {
38
+ this.name = 'patch';
39
+ }
40
+ bump(version) {
41
+ return new version_1.Version(version.major, version.minor, version.patch + 1, version.preRelease, version.build);
42
+ }
43
+ }
44
+ exports.PatchVersionUpdate = PatchVersionUpdate;
45
+ class CustomVersionUpdate {
46
+ constructor(versionString) {
47
+ this.name = 'custom';
48
+ this.versionString = versionString;
49
+ }
50
+ bump(_version) {
51
+ return version_1.Version.parse(this.versionString);
52
+ }
53
+ }
54
+ exports.CustomVersionUpdate = CustomVersionUpdate;
55
+ //# sourceMappingURL=versioning-strategy.js.map
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "12.5.0",
3
+ "version": "13.0.0-candidate.2",
4
4
  "description": "generate release PRs based on the conventionalcommits.org spec",
5
5
  "main": "./build/src/index.js",
6
6
  "bin": "./build/src/bin/release-please.js",
7
7
  "scripts": {
8
8
  "test": "cross-env ENVIRONMENT=test c8 mocha --recursive --timeout=5000 build/test",
9
- "docs-test": "echo add docs tests",
9
+ "docs": "echo add docs tests",
10
10
  "test:snap": "SNAPSHOT_UPDATE=1 npm test",
11
11
  "clean": "gts clean",
12
12
  "prepare": "npm run compile",
@@ -42,18 +42,18 @@
42
42
  "@types/iarna__toml": "^2.0.1",
43
43
  "@types/js-yaml": "^4.0.0",
44
44
  "@types/mocha": "^8.0.0",
45
- "@types/node": "^14.0.0",
46
- "@types/pino": "^6.3.0",
45
+ "@types/node": "^16.0.0",
46
+ "@types/pino": "^7.0.0",
47
47
  "@types/semver": "^7.0.0",
48
48
  "@types/sinon": "^10.0.0",
49
- "@types/yargs": "^16.0.0",
49
+ "@types/yargs": "^17.0.0",
50
50
  "c8": "^7.0.0",
51
51
  "chai": "^4.2.0",
52
52
  "cross-env": "^7.0.0",
53
53
  "gts": "^2.0.0",
54
54
  "mocha": "^8.0.0",
55
55
  "nock": "^13.0.0",
56
- "sinon": "11.1.2",
56
+ "sinon": "12.0.1",
57
57
  "snap-shot-it": "^7.0.0"
58
58
  },
59
59
  "dependencies": {
@@ -75,16 +75,17 @@
75
75
  "conventional-commits-filter": "^2.0.2",
76
76
  "figures": "^3.0.0",
77
77
  "js-yaml": "^4.0.0",
78
+ "node-html-parser": "^5.0.0",
78
79
  "parse-github-repo-url": "^1.4.1",
79
80
  "semver": "^7.0.0",
80
81
  "type-fest": "^1.0.0",
81
82
  "typescript": "^3.8.3",
82
83
  "unist-util-visit": "^2.0.3",
83
84
  "unist-util-visit-parents": "^3.1.1",
84
- "yargs": "^16.0.0",
85
+ "yargs": "^17.0.0",
85
86
  "detect-indent": "^6.1.0"
86
87
  },
87
88
  "engines": {
88
- "node": ">=10.12.0"
89
+ "node": ">=12.18.0"
89
90
  }
90
91
  }
@@ -1,6 +0,0 @@
1
- export declare const DEFAULT_LABELS: string[];
2
- export declare const GH_API_URL = "https://api.github.com";
3
- export declare const RELEASE_PLEASE = "release-please";
4
- export declare const RELEASE_PLEASE_CONFIG: string;
5
- export declare const RELEASE_PLEASE_MANIFEST: string;
6
- export declare const MAX_ISSUE_BODY_SIZE = 65536;
@@ -1,23 +0,0 @@
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.MAX_ISSUE_BODY_SIZE = exports.RELEASE_PLEASE_MANIFEST = exports.RELEASE_PLEASE_CONFIG = exports.RELEASE_PLEASE = exports.GH_API_URL = exports.DEFAULT_LABELS = void 0;
17
- exports.DEFAULT_LABELS = ['autorelease: pending'];
18
- exports.GH_API_URL = 'https://api.github.com';
19
- exports.RELEASE_PLEASE = 'release-please';
20
- exports.RELEASE_PLEASE_CONFIG = `${exports.RELEASE_PLEASE}-config.json`;
21
- exports.RELEASE_PLEASE_MANIFEST = `.${exports.RELEASE_PLEASE}-manifest.json`;
22
- exports.MAX_ISSUE_BODY_SIZE = 65536;
23
- //# sourceMappingURL=constants.js.map
@@ -1,53 +0,0 @@
1
- import { ReleaseType } from 'semver';
2
- import { Commit } from './graphql-to-commits';
3
- import { ConventionalChangelogCommit } from '@conventional-commits/parser';
4
- interface CommitWithHash extends ConventionalChangelogCommit {
5
- hash: string | null;
6
- }
7
- interface ConventionalCommitsOptions {
8
- commits: Commit[];
9
- owner: string;
10
- repository: string;
11
- host?: string;
12
- bumpMinorPreMajor?: boolean;
13
- bumpPatchForMinorPreMajor?: boolean;
14
- commitPartial?: string;
15
- headerPartial?: string;
16
- mainTemplate?: string;
17
- changelogSections?: ChangelogSection[];
18
- commitFilter?: (c: ConventionalChangelogCommit) => boolean;
19
- }
20
- export interface ChangelogSection {
21
- type: string;
22
- section: string;
23
- hidden?: boolean;
24
- }
25
- interface ChangelogEntryOptions {
26
- version: string;
27
- previousTag?: string;
28
- currentTag?: string;
29
- }
30
- interface BumpSuggestion {
31
- releaseType: ReleaseType;
32
- reason: string;
33
- level: number;
34
- }
35
- export declare class ConventionalCommits {
36
- commits: Commit[];
37
- host: string;
38
- owner: string;
39
- repository: string;
40
- bumpMinorPreMajor?: boolean;
41
- bumpPatchForMinorPreMajor?: boolean;
42
- commitPartial?: string;
43
- headerPartial?: string;
44
- mainTemplate?: string;
45
- changelogSections?: ChangelogSection[];
46
- private commitFilter?;
47
- parsedCommits: CommitWithHash[];
48
- constructor(options: ConventionalCommitsOptions);
49
- suggestBump(version: string): Promise<BumpSuggestion>;
50
- generateChangelogEntry(options: ChangelogEntryOptions): Promise<string>;
51
- private guessReleaseType;
52
- }
53
- export {};
@@ -1,167 +0,0 @@
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.ConventionalCommits = void 0;
17
- const chalk = require("chalk");
18
- const semver = require("semver");
19
- const logger_1 = require("./util/logger");
20
- const parser_1 = require("@conventional-commits/parser");
21
- const to_conventional_changelog_format_1 = require("./util/to-conventional-changelog-format");
22
- // eslint-disable-next-line @typescript-eslint/no-var-requires
23
- const conventionalCommitsFilter = require('conventional-commits-filter');
24
- // eslint-disable-next-line @typescript-eslint/no-var-requires
25
- const conventionalChangelogWriter = require('conventional-changelog-writer');
26
- // eslint-disable-next-line @typescript-eslint/no-var-requires
27
- const presetFactory = require('conventional-changelog-conventionalcommits');
28
- function getParsedCommits(commits, commitFilter = () => false) {
29
- const parsedCommits = [];
30
- for (const commit of commits) {
31
- try {
32
- for (const parsedCommit of to_conventional_changelog_format_1.default(parser_1.parser(commit.message))) {
33
- const commitWithHash = postProcessCommits(parsedCommit);
34
- if (commitFilter(parsedCommit)) {
35
- continue;
36
- }
37
- commitWithHash.hash = commit.sha;
38
- parsedCommits.push(commitWithHash);
39
- }
40
- }
41
- catch (_err) {
42
- // Commit is not in conventional commit format, it does not
43
- // contribute to the CHANGELOG generation.
44
- }
45
- }
46
- return parsedCommits;
47
- }
48
- // TODO(@bcoe): now that we walk the actual AST of conventional commits
49
- // we should be able to move post processing into
50
- // to-conventional-changelog.ts.
51
- function postProcessCommits(commit) {
52
- commit.notes.forEach(note => {
53
- let text = '';
54
- let i = 0;
55
- let extendedContext = false;
56
- for (const chunk of note.text.split(/\r?\n/)) {
57
- if (i > 0 && hasExtendedContext(chunk) && !extendedContext) {
58
- text = `${text.trim()}\n`;
59
- extendedContext = true;
60
- }
61
- if (chunk === '')
62
- break;
63
- else if (extendedContext) {
64
- text += ` ${chunk}\n`;
65
- }
66
- else {
67
- text += `${chunk} `;
68
- }
69
- i++;
70
- }
71
- note.text = text.trim();
72
- });
73
- return commit;
74
- }
75
- // If someone wishes to include additional contextual information for a
76
- // BREAKING CHANGE using markdown, they can do so by starting the line after the initial
77
- // breaking change description with either:
78
- //
79
- // 1. a fourth-level header.
80
- // 2. a bulleted list (using either '*' or '-').
81
- //
82
- // BREAKING CHANGE: there were breaking changes
83
- // #### Deleted Endpoints
84
- // - endpoint 1
85
- // - endpoint 2
86
- function hasExtendedContext(line) {
87
- if (line.match(/^#### |^[*-] /))
88
- return true;
89
- return false;
90
- }
91
- class ConventionalCommits {
92
- constructor(options) {
93
- this.commits = options.commits;
94
- this.parsedCommits = getParsedCommits(options.commits, options.commitFilter);
95
- this.bumpMinorPreMajor = options.bumpMinorPreMajor || false;
96
- this.bumpPatchForMinorPreMajor = options.bumpPatchForMinorPreMajor || false;
97
- this.host = options.host || 'https://www.github.com';
98
- this.owner = options.owner;
99
- this.repository = options.repository;
100
- // we allow some languages (currently Ruby) to provide their own
101
- // template style:
102
- this.commitPartial = options.commitPartial;
103
- this.headerPartial = options.headerPartial;
104
- this.mainTemplate = options.mainTemplate;
105
- this.changelogSections = options.changelogSections;
106
- this.commitFilter = options.commitFilter;
107
- }
108
- async suggestBump(version) {
109
- const preMajor = this.bumpMinorPreMajor
110
- ? semver.lt(version, 'v1.0.0')
111
- : false;
112
- const bump = await this.guessReleaseType(preMajor);
113
- logger_1.logger.info(`release as ${chalk.green(bump.releaseType)}: ${chalk.yellow(bump.reason)}`);
114
- return bump;
115
- }
116
- async generateChangelogEntry(options) {
117
- const context = {
118
- host: this.host,
119
- owner: this.owner,
120
- repository: this.repository,
121
- version: options.version,
122
- previousTag: options.previousTag,
123
- currentTag: options.currentTag,
124
- linkCompare: !!options.previousTag,
125
- };
126
- // allows the sections displayed in the CHANGELOG to be configured
127
- // as an example, Ruby displays docs:
128
- const config = {};
129
- if (this.changelogSections) {
130
- config.types = this.changelogSections;
131
- }
132
- const preset = await presetFactory(config);
133
- preset.writerOpts.commitPartial =
134
- this.commitPartial || preset.writerOpts.commitPartial;
135
- preset.writerOpts.headerPartial =
136
- this.headerPartial || preset.writerOpts.headerPartial;
137
- preset.writerOpts.mainTemplate =
138
- this.mainTemplate || preset.writerOpts.mainTemplate;
139
- const parsed = conventionalChangelogWriter
140
- .parseArray(this.parsedCommits, context, preset.writerOpts)
141
- .trim();
142
- return parsed;
143
- }
144
- async guessReleaseType(preMajor) {
145
- const VERSIONS = ['major', 'minor', 'patch'];
146
- const preset = await presetFactory({ preMajor });
147
- const commits = conventionalCommitsFilter(this.parsedCommits);
148
- let result = preset.recommendedBumpOpts.whatBump(commits, preset.recommendedBumpOpts);
149
- if (result && result.level !== null) {
150
- result.releaseType = VERSIONS[result.level];
151
- }
152
- else if (result === null) {
153
- result = {};
154
- }
155
- // we have slightly different logic than the default of conventional commits,
156
- // the minor should be bumped when features are introduced for pre 1.x.x libs:
157
- // turn off custom logic here by setting bumpPatchForMinorPreMajor = true
158
- if (result.reason.indexOf(' 0 features') === -1 &&
159
- result.releaseType === 'patch' &&
160
- !this.bumpPatchForMinorPreMajor) {
161
- result.releaseType = 'minor';
162
- }
163
- return result;
164
- }
165
- }
166
- exports.ConventionalCommits = ConventionalCommits;
167
- //# sourceMappingURL=conventional-commits.js.map
@@ -1,34 +0,0 @@
1
- import { GitHubReleaseConstructorOptions } from './';
2
- import { GitHub, MergedGitHubPR, ReleaseCreateResponse } from './github';
3
- import { ReleasePR, CandidateRelease } from './release-pr';
4
- export declare const GITHUB_RELEASE_LABEL = "autorelease: tagged";
5
- export interface GitHubReleaseResponse {
6
- major: number;
7
- minor: number;
8
- patch: number;
9
- version: string;
10
- sha: string;
11
- html_url: string;
12
- name: string;
13
- tag_name: string;
14
- upload_url: string;
15
- pr: number;
16
- draft: boolean;
17
- body: string;
18
- }
19
- export declare class GitHubRelease {
20
- releasePR: ReleasePR;
21
- gh: GitHub;
22
- draft: boolean;
23
- releaseLabel: string;
24
- constructor(options: GitHubReleaseConstructorOptions);
25
- createRelease(): Promise<[CandidateRelease, ReleaseCreateResponse] | [undefined, undefined]>;
26
- createRelease(version: string, mergedPR: MergedGitHubPR): Promise<ReleaseCreateResponse | undefined>;
27
- run(): Promise<GitHubReleaseResponse | undefined>;
28
- releaseResponse(params: {
29
- release: ReleaseCreateResponse;
30
- version: string;
31
- sha: string;
32
- number: number;
33
- }): GitHubReleaseResponse | undefined;
34
- }
@@ -1,92 +0,0 @@
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.GitHubRelease = exports.GITHUB_RELEASE_LABEL = void 0;
17
- const semver_1 = require("semver");
18
- const logger_1 = require("./util/logger");
19
- exports.GITHUB_RELEASE_LABEL = 'autorelease: tagged';
20
- class GitHubRelease {
21
- constructor(options) {
22
- var _a;
23
- this.draft = !!options.draft;
24
- this.gh = options.github;
25
- this.releasePR = options.releasePR;
26
- this.releaseLabel = (_a = options.releaseLabel) !== null && _a !== void 0 ? _a : exports.GITHUB_RELEASE_LABEL;
27
- }
28
- async createRelease(version, mergedPR) {
29
- let candidate;
30
- if (version && mergedPR) {
31
- candidate = await this.releasePR.buildReleaseForVersion(version, mergedPR);
32
- return await this.gh.createRelease(candidate.name, candidate.tag, candidate.sha, candidate.notes, this.draft);
33
- }
34
- else {
35
- candidate = await this.releasePR.buildRelease();
36
- }
37
- if (candidate !== undefined) {
38
- const release = await this.gh.createRelease(candidate.name, candidate.tag, candidate.sha, candidate.notes, this.draft);
39
- return [candidate, release];
40
- }
41
- else {
42
- logger_1.logger.error('Unable to build candidate');
43
- return [undefined, undefined];
44
- }
45
- }
46
- async run() {
47
- const [candidate, release] = await this.createRelease();
48
- if (!(candidate && release)) {
49
- return;
50
- }
51
- // Comment on the release PR with the
52
- await this.gh.commentOnIssue(`:robot: Release is at ${release.html_url} :sunflower:`, candidate.pullNumber);
53
- // Add a label indicating that a release has been created on GitHub,
54
- // but a publication has not yet occurred.
55
- await this.gh.addLabels([this.releaseLabel], candidate.pullNumber);
56
- // Remove 'autorelease: pending' which indicates a GitHub release
57
- // has not yet been created.
58
- await this.gh.removeLabels(this.releasePR.labels, candidate.pullNumber);
59
- return this.releaseResponse({
60
- release,
61
- version: candidate.version,
62
- sha: candidate.sha,
63
- number: candidate.pullNumber,
64
- });
65
- }
66
- releaseResponse(params) {
67
- logger_1.logger.info(`Created release: ${params.release.html_url}.`);
68
- const parsedVersion = semver_1.parse(params.version, { loose: true });
69
- if (parsedVersion) {
70
- return {
71
- major: parsedVersion.major,
72
- minor: parsedVersion.minor,
73
- patch: parsedVersion.patch,
74
- sha: params.sha,
75
- version: params.version,
76
- pr: params.number,
77
- html_url: params.release.html_url,
78
- name: params.release.name,
79
- tag_name: params.release.tag_name,
80
- upload_url: params.release.upload_url,
81
- draft: params.release.draft,
82
- body: params.release.body,
83
- };
84
- }
85
- else {
86
- logger_1.logger.warn(`failed to parse version information from ${params.version}`);
87
- return undefined;
88
- }
89
- }
90
- }
91
- exports.GitHubRelease = GitHubRelease;
92
- //# sourceMappingURL=github-release.js.map
@@ -1,60 +0,0 @@
1
- import { PageInfo, GitHub } from './github';
2
- export interface CommitsResponse {
3
- endCursor?: string;
4
- hasNextPage: boolean;
5
- commits: Commit[];
6
- }
7
- export interface Commit {
8
- sha: string | null;
9
- message: string;
10
- files: string[];
11
- }
12
- interface CommitHistoryGraphQLResponse {
13
- repository: {
14
- ref: {
15
- target: {
16
- history: CommitHistory;
17
- };
18
- };
19
- };
20
- }
21
- interface CommitHistory {
22
- edges: CommitEdge[];
23
- pageInfo: PageInfo;
24
- }
25
- interface CommitEdge {
26
- node: {
27
- message: string;
28
- oid: string;
29
- associatedPullRequests: {
30
- edges: PREdge[];
31
- };
32
- };
33
- }
34
- export interface PREdge {
35
- node: {
36
- number: number;
37
- mergeCommit: {
38
- oid: string;
39
- };
40
- files: {
41
- edges: FileEdge[];
42
- pageInfo: PageInfo;
43
- };
44
- labels: {
45
- edges: LabelEdge[];
46
- };
47
- };
48
- }
49
- interface FileEdge {
50
- node: {
51
- path: string;
52
- };
53
- }
54
- interface LabelEdge {
55
- node: {
56
- name: string;
57
- };
58
- }
59
- export declare function graphqlToCommits(github: GitHub, response: CommitHistoryGraphQLResponse): Promise<CommitsResponse>;
60
- export {};
@@ -1,112 +0,0 @@
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.graphqlToCommits = void 0;
17
- const logger_1 = require("./util/logger");
18
- const CONVENTIONAL_COMMIT_REGEX = /^[\w]+(\(\w+\))?!?: /;
19
- async function graphqlToCommits(github, response) {
20
- const commitHistory = response.repository.ref.target.history;
21
- const commits = {
22
- endCursor: commitHistory.pageInfo.endCursor,
23
- hasNextPage: commitHistory.pageInfo.hasNextPage,
24
- commits: [],
25
- };
26
- // For merge commits, prEdge.node.mergeCommit.oid references the SHA of the
27
- // commit at the top of the list of commits, vs., its own SHA. We track the
28
- // SHAs observed, and if the commit references a SHA from earlier in the list
29
- // of commitHistory.edges being processed, we accept it as a valid commit:
30
- const observedSHAs = new Set();
31
- for (let i = 0, commitEdge; i < commitHistory.edges.length; i++) {
32
- commitEdge = commitHistory.edges[i];
33
- const commit = await graphqlToCommit(github, commitEdge, observedSHAs);
34
- if (commit) {
35
- commits.commits.push(commit);
36
- }
37
- }
38
- return commits;
39
- }
40
- exports.graphqlToCommits = graphqlToCommits;
41
- async function graphqlToCommit(github, commitEdge, observedSHAs) {
42
- const commit = {
43
- sha: commitEdge.node.oid,
44
- message: commitEdge.node.message,
45
- files: [],
46
- };
47
- // TODO(bcoe): currently, due to limitations with the GitHub v4 API, we
48
- // are only able to fetch files associated with a commit if it has
49
- // an associated PR; this is a problem for code pushed directly to the
50
- // default branch. We should be mindful of this limitation, and fix when the
51
- // upstream API changes.
52
- if (commitEdge.node.associatedPullRequests.edges.length === 0)
53
- return commit;
54
- let prEdge = commitEdge.node.associatedPullRequests.edges[0];
55
- if (!commit.sha) {
56
- return undefined;
57
- }
58
- observedSHAs.add(commit.sha);
59
- // if, on the off chance, there are more than 100 files attached to a
60
- // PR, paginate in the additional files.
61
- while (true && prEdge.node.files) {
62
- for (let i = 0; i < prEdge.node.files.edges.length; i++) {
63
- commit.files.push(prEdge.node.files.edges[i].node.path);
64
- }
65
- if (prEdge.node.files.pageInfo.hasNextPage) {
66
- try {
67
- prEdge = await github.pullRequestFiles(prEdge.node.number, prEdge.node.files.pageInfo.endCursor);
68
- }
69
- catch (err) {
70
- // TODO: figure out why prEdge.node.number sometimes links to
71
- // data in GitHub that no longer exists, this would only cause
72
- // issues for mono-repos that use commit-split.
73
- logger_1.logger.warn(err);
74
- break;
75
- }
76
- continue;
77
- }
78
- if (prEdge.node.files.pageInfo.hasNextPage === false)
79
- break;
80
- }
81
- // to help some language teams transition to conventional commits, we allow
82
- // a label to be used as an alternative to a commit prefix.
83
- if (prEdge.node.labels &&
84
- CONVENTIONAL_COMMIT_REGEX.test(commit.message) === false) {
85
- const prefix = prefixFromLabel(prEdge.node.labels.edges);
86
- if (prefix) {
87
- commit.message = `${prefix}${commit.message}`;
88
- }
89
- }
90
- return commit;
91
- }
92
- function prefixFromLabel(labels) {
93
- let prefix = undefined;
94
- let breaking = false;
95
- for (let i = 0, labelEdge; i < labels.length; i++) {
96
- labelEdge = labels[i];
97
- if (labelEdge.node.name === 'feature') {
98
- prefix = 'feat';
99
- }
100
- else if (labelEdge.node.name === 'fix') {
101
- prefix = 'fix';
102
- }
103
- else if (labelEdge.node.name === 'semver: major') {
104
- breaking = true;
105
- }
106
- }
107
- if (prefix) {
108
- prefix = `${prefix}${breaking ? '!' : ''}: `;
109
- }
110
- return prefix;
111
- }
112
- //# sourceMappingURL=graphql-to-commits.js.map