@release-please-oss/release-please 0.0.0 → 17.11.3

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 (310) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +280 -0
  3. package/build/src/bin/release-please.d.ts +22 -0
  4. package/build/src/bin/release-please.js +727 -0
  5. package/build/src/bootstrapper.d.ts +18 -0
  6. package/build/src/bootstrapper.js +64 -0
  7. package/build/src/changelog-notes/default.d.ts +15 -0
  8. package/build/src/changelog-notes/default.js +96 -0
  9. package/build/src/changelog-notes/github.d.ts +8 -0
  10. package/build/src/changelog-notes/github.js +29 -0
  11. package/build/src/changelog-notes.d.ts +22 -0
  12. package/build/src/changelog-notes.js +40 -0
  13. package/build/src/commit.d.ts +33 -0
  14. package/build/src/commit.js +422 -0
  15. package/build/src/errors/index.d.ts +36 -0
  16. package/build/src/errors/index.js +77 -0
  17. package/build/src/factories/changelog-notes-factory.d.ts +16 -0
  18. package/build/src/factories/changelog-notes-factory.js +44 -0
  19. package/build/src/factories/plugin-factory.d.ts +23 -0
  20. package/build/src/factories/plugin-factory.js +94 -0
  21. package/build/src/factories/versioning-strategy-factory.d.ts +16 -0
  22. package/build/src/factories/versioning-strategy-factory.js +52 -0
  23. package/build/src/factory.d.ts +18 -0
  24. package/build/src/factory.js +161 -0
  25. package/build/src/github-api.d.ts +260 -0
  26. package/build/src/github-api.js +714 -0
  27. package/build/src/github.d.ts +306 -0
  28. package/build/src/github.js +769 -0
  29. package/build/src/index.d.ts +17 -0
  30. package/build/src/index.js +41 -0
  31. package/build/src/local-github.d.ts +270 -0
  32. package/build/src/local-github.js +756 -0
  33. package/build/src/manifest.d.ts +370 -0
  34. package/build/src/manifest.js +1142 -0
  35. package/build/src/plugin.d.ts +37 -0
  36. package/build/src/plugin.js +57 -0
  37. package/build/src/plugins/cargo-workspace.d.ts +58 -0
  38. package/build/src/plugins/cargo-workspace.js +339 -0
  39. package/build/src/plugins/group-priority.d.ts +29 -0
  40. package/build/src/plugins/group-priority.js +82 -0
  41. package/build/src/plugins/linked-versions.d.ts +36 -0
  42. package/build/src/plugins/linked-versions.js +137 -0
  43. package/build/src/plugins/maven-workspace.d.ts +81 -0
  44. package/build/src/plugins/maven-workspace.js +431 -0
  45. package/build/src/plugins/merge.d.ts +27 -0
  46. package/build/src/plugins/merge.js +99 -0
  47. package/build/src/plugins/node-workspace.d.ts +50 -0
  48. package/build/src/plugins/node-workspace.js +352 -0
  49. package/build/src/plugins/sentence-case.d.ts +19 -0
  50. package/build/src/plugins/sentence-case.js +80 -0
  51. package/build/src/plugins/workspace.d.ts +173 -0
  52. package/build/src/plugins/workspace.js +308 -0
  53. package/build/src/pull-request.d.ts +11 -0
  54. package/build/src/pull-request.js +16 -0
  55. package/build/src/release-pull-request.d.ts +14 -0
  56. package/build/src/release-pull-request.js +16 -0
  57. package/build/src/release.d.ts +7 -0
  58. package/build/src/release.js +16 -0
  59. package/build/src/repository.d.ts +5 -0
  60. package/build/src/repository.js +16 -0
  61. package/build/src/scm.d.ts +80 -0
  62. package/build/src/scm.js +16 -0
  63. package/build/src/strategies/base.d.ts +162 -0
  64. package/build/src/strategies/base.js +494 -0
  65. package/build/src/strategies/bazel.d.ts +7 -0
  66. package/build/src/strategies/bazel.js +49 -0
  67. package/build/src/strategies/dart.d.ts +8 -0
  68. package/build/src/strategies/dart.js +73 -0
  69. package/build/src/strategies/dotnet-yoshi.d.ts +13 -0
  70. package/build/src/strategies/dotnet-yoshi.js +109 -0
  71. package/build/src/strategies/elixir.d.ts +5 -0
  72. package/build/src/strategies/elixir.js +46 -0
  73. package/build/src/strategies/expo.d.ts +15 -0
  74. package/build/src/strategies/expo.js +51 -0
  75. package/build/src/strategies/go-librarian.d.ts +11 -0
  76. package/build/src/strategies/go-librarian.js +84 -0
  77. package/build/src/strategies/go-yoshi.d.ts +14 -0
  78. package/build/src/strategies/go-yoshi.js +168 -0
  79. package/build/src/strategies/go.d.ts +7 -0
  80. package/build/src/strategies/go.js +53 -0
  81. package/build/src/strategies/helm.d.ts +8 -0
  82. package/build/src/strategies/helm.js +73 -0
  83. package/build/src/strategies/java-yoshi-mono-repo.d.ts +22 -0
  84. package/build/src/strategies/java-yoshi-mono-repo.js +308 -0
  85. package/build/src/strategies/java-yoshi.d.ts +20 -0
  86. package/build/src/strategies/java-yoshi.js +210 -0
  87. package/build/src/strategies/java.d.ts +28 -0
  88. package/build/src/strategies/java.js +176 -0
  89. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  90. package/build/src/strategies/krm-blueprint.js +65 -0
  91. package/build/src/strategies/maven.d.ts +9 -0
  92. package/build/src/strategies/maven.js +56 -0
  93. package/build/src/strategies/node-librarian.d.ts +10 -0
  94. package/build/src/strategies/node-librarian.js +121 -0
  95. package/build/src/strategies/node.d.ts +10 -0
  96. package/build/src/strategies/node.js +111 -0
  97. package/build/src/strategies/ocaml.d.ts +5 -0
  98. package/build/src/strategies/ocaml.js +86 -0
  99. package/build/src/strategies/php-librarian.d.ts +6 -0
  100. package/build/src/strategies/php-librarian.js +35 -0
  101. package/build/src/strategies/php-yoshi.d.ts +13 -0
  102. package/build/src/strategies/php-yoshi.js +255 -0
  103. package/build/src/strategies/php.d.ts +6 -0
  104. package/build/src/strategies/php.js +76 -0
  105. package/build/src/strategies/python-librarian.d.ts +6 -0
  106. package/build/src/strategies/python-librarian.js +35 -0
  107. package/build/src/strategies/python.d.ts +11 -0
  108. package/build/src/strategies/python.js +175 -0
  109. package/build/src/strategies/r.d.ts +8 -0
  110. package/build/src/strategies/r.js +67 -0
  111. package/build/src/strategies/ruby-librarian.d.ts +6 -0
  112. package/build/src/strategies/ruby-librarian.js +35 -0
  113. package/build/src/strategies/ruby-yoshi.d.ts +13 -0
  114. package/build/src/strategies/ruby-yoshi.js +97 -0
  115. package/build/src/strategies/ruby.d.ts +9 -0
  116. package/build/src/strategies/ruby.js +71 -0
  117. package/build/src/strategies/rust.d.ts +17 -0
  118. package/build/src/strategies/rust.js +149 -0
  119. package/build/src/strategies/sfdx.d.ts +9 -0
  120. package/build/src/strategies/sfdx.js +67 -0
  121. package/build/src/strategies/simple.d.ts +7 -0
  122. package/build/src/strategies/simple.js +51 -0
  123. package/build/src/strategies/terraform-module.d.ts +7 -0
  124. package/build/src/strategies/terraform-module.js +90 -0
  125. package/build/src/strategy.d.ts +68 -0
  126. package/build/src/strategy.js +16 -0
  127. package/build/src/update.d.ts +24 -0
  128. package/build/src/update.js +16 -0
  129. package/build/src/updaters/base-xml.d.ts +19 -0
  130. package/build/src/updaters/base-xml.js +43 -0
  131. package/build/src/updaters/bazel/module-bazel.d.ts +7 -0
  132. package/build/src/updaters/bazel/module-bazel.js +33 -0
  133. package/build/src/updaters/changelog-json.d.ts +29 -0
  134. package/build/src/updaters/changelog-json.js +100 -0
  135. package/build/src/updaters/changelog.d.ts +13 -0
  136. package/build/src/updaters/changelog.js +55 -0
  137. package/build/src/updaters/composite.d.ts +20 -0
  138. package/build/src/updaters/composite.js +65 -0
  139. package/build/src/updaters/dart/pubspec-yaml.d.ts +13 -0
  140. package/build/src/updaters/dart/pubspec-yaml.js +50 -0
  141. package/build/src/updaters/default.d.ts +21 -0
  142. package/build/src/updaters/default.js +36 -0
  143. package/build/src/updaters/dotnet/apis.d.ts +18 -0
  144. package/build/src/updaters/dotnet/apis.js +45 -0
  145. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  146. package/build/src/updaters/dotnet/csproj.js +33 -0
  147. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +13 -0
  148. package/build/src/updaters/elixir/elixir-mix-exs.js +42 -0
  149. package/build/src/updaters/expo/app-json.d.ts +31 -0
  150. package/build/src/updaters/expo/app-json.js +67 -0
  151. package/build/src/updaters/generic-json.d.ts +14 -0
  152. package/build/src/updaters/generic-json.js +54 -0
  153. package/build/src/updaters/generic-toml.d.ts +21 -0
  154. package/build/src/updaters/generic-toml.js +66 -0
  155. package/build/src/updaters/generic-xml.d.ts +8 -0
  156. package/build/src/updaters/generic-xml.js +38 -0
  157. package/build/src/updaters/generic-yaml.d.ts +23 -0
  158. package/build/src/updaters/generic-yaml.js +85 -0
  159. package/build/src/updaters/generic.d.ts +54 -0
  160. package/build/src/updaters/generic.js +187 -0
  161. package/build/src/updaters/go/version-go.d.ts +4 -0
  162. package/build/src/updaters/go/version-go.js +24 -0
  163. package/build/src/updaters/helm/chart-yaml.d.ts +13 -0
  164. package/build/src/updaters/helm/chart-yaml.js +41 -0
  165. package/build/src/updaters/java/java-released.d.ts +28 -0
  166. package/build/src/updaters/java/java-released.js +59 -0
  167. package/build/src/updaters/java/java-update.d.ts +21 -0
  168. package/build/src/updaters/java/java-update.js +80 -0
  169. package/build/src/updaters/java/pom-xml.d.ts +29 -0
  170. package/build/src/updaters/java/pom-xml.js +135 -0
  171. package/build/src/updaters/java/versions-manifest.d.ts +19 -0
  172. package/build/src/updaters/java/versions-manifest.js +71 -0
  173. package/build/src/updaters/krm/krm-blueprint-version.d.ts +13 -0
  174. package/build/src/updaters/krm/krm-blueprint-version.js +46 -0
  175. package/build/src/updaters/librarian-yaml.d.ts +45 -0
  176. package/build/src/updaters/librarian-yaml.js +149 -0
  177. package/build/src/updaters/node/package-json.d.ts +46 -0
  178. package/build/src/updaters/node/package-json.js +106 -0
  179. package/build/src/updaters/node/package-lock-json.d.ts +14 -0
  180. package/build/src/updaters/node/package-lock-json.js +83 -0
  181. package/build/src/updaters/node/samples-package-json.d.ts +24 -0
  182. package/build/src/updaters/node/samples-package-json.js +49 -0
  183. package/build/src/updaters/ocaml/dune-project.d.ts +13 -0
  184. package/build/src/updaters/ocaml/dune-project.js +37 -0
  185. package/build/src/updaters/ocaml/esy-json.d.ts +13 -0
  186. package/build/src/updaters/ocaml/esy-json.js +37 -0
  187. package/build/src/updaters/ocaml/opam.d.ts +13 -0
  188. package/build/src/updaters/ocaml/opam.js +37 -0
  189. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  190. package/build/src/updaters/php/php-client-version.js +32 -0
  191. package/build/src/updaters/php/root-composer-update-packages.d.ts +13 -0
  192. package/build/src/updaters/php/root-composer-update-packages.js +60 -0
  193. package/build/src/updaters/python/pyproject-toml.d.ts +29 -0
  194. package/build/src/updaters/python/pyproject-toml.js +53 -0
  195. package/build/src/updaters/python/python-file-with-version.d.ts +12 -0
  196. package/build/src/updaters/python/python-file-with-version.js +32 -0
  197. package/build/src/updaters/python/setup-cfg.d.ts +12 -0
  198. package/build/src/updaters/python/setup-cfg.js +32 -0
  199. package/build/src/updaters/python/setup-py.d.ts +12 -0
  200. package/build/src/updaters/python/setup-py.js +32 -0
  201. package/build/src/updaters/r/description.d.ts +12 -0
  202. package/build/src/updaters/r/description.js +32 -0
  203. package/build/src/updaters/r/news.d.ts +12 -0
  204. package/build/src/updaters/r/news.js +49 -0
  205. package/build/src/updaters/raw-content.d.ts +19 -0
  206. package/build/src/updaters/raw-content.js +39 -0
  207. package/build/src/updaters/release-please-config.d.ts +8 -0
  208. package/build/src/updaters/release-please-config.js +80 -0
  209. package/build/src/updaters/release-please-manifest.d.ts +4 -0
  210. package/build/src/updaters/release-please-manifest.js +34 -0
  211. package/build/src/updaters/ruby/common.d.ts +17 -0
  212. package/build/src/updaters/ruby/common.js +46 -0
  213. package/build/src/updaters/ruby/gemfile-lock.d.ts +24 -0
  214. package/build/src/updaters/ruby/gemfile-lock.js +53 -0
  215. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  216. package/build/src/updaters/ruby/version-rb.js +34 -0
  217. package/build/src/updaters/rust/cargo-lock.d.ts +16 -0
  218. package/build/src/updaters/rust/cargo-lock.js +64 -0
  219. package/build/src/updaters/rust/cargo-toml.d.ts +13 -0
  220. package/build/src/updaters/rust/cargo-toml.js +89 -0
  221. package/build/src/updaters/rust/common.d.ts +54 -0
  222. package/build/src/updaters/rust/common.js +35 -0
  223. package/build/src/updaters/sfdx/sfdx-project-json.d.ts +21 -0
  224. package/build/src/updaters/sfdx/sfdx-project-json.js +41 -0
  225. package/build/src/updaters/terraform/metadata-version.d.ts +13 -0
  226. package/build/src/updaters/terraform/metadata-version.js +37 -0
  227. package/build/src/updaters/terraform/module-version.d.ts +13 -0
  228. package/build/src/updaters/terraform/module-version.js +37 -0
  229. package/build/src/updaters/terraform/readme.d.ts +12 -0
  230. package/build/src/updaters/terraform/readme.js +32 -0
  231. package/build/src/util/branch-name.d.ts +20 -0
  232. package/build/src/util/branch-name.js +225 -0
  233. package/build/src/util/code-suggester/default-options-handler.d.ts +10 -0
  234. package/build/src/util/code-suggester/default-options-handler.js +45 -0
  235. package/build/src/util/code-suggester/errors.d.ts +4 -0
  236. package/build/src/util/code-suggester/errors.js +24 -0
  237. package/build/src/util/code-suggester/github/branch.d.ts +45 -0
  238. package/build/src/util/code-suggester/github/branch.js +118 -0
  239. package/build/src/util/code-suggester/github/commit-and-push.d.ts +51 -0
  240. package/build/src/util/code-suggester/github/commit-and-push.js +141 -0
  241. package/build/src/util/code-suggester/github/create-commit.d.ts +20 -0
  242. package/build/src/util/code-suggester/github/create-commit.js +60 -0
  243. package/build/src/util/code-suggester/github/fork.d.ts +15 -0
  244. package/build/src/util/code-suggester/github/fork.js +48 -0
  245. package/build/src/util/code-suggester/github/labels.d.ts +14 -0
  246. package/build/src/util/code-suggester/github/labels.js +42 -0
  247. package/build/src/util/code-suggester/github/open-pull-request.d.ts +16 -0
  248. package/build/src/util/code-suggester/github/open-pull-request.js +56 -0
  249. package/build/src/util/code-suggester/index.d.ts +28 -0
  250. package/build/src/util/code-suggester/index.js +110 -0
  251. package/build/src/util/code-suggester/logger.d.ts +4 -0
  252. package/build/src/util/code-suggester/logger.js +37 -0
  253. package/build/src/util/code-suggester/types.d.ts +109 -0
  254. package/build/src/util/code-suggester/types.js +30 -0
  255. package/build/src/util/coerce-option.d.ts +1 -0
  256. package/build/src/util/coerce-option.js +40 -0
  257. package/build/src/util/commit-exclude.d.ts +10 -0
  258. package/build/src/util/commit-exclude.js +49 -0
  259. package/build/src/util/commit-split.d.ts +26 -0
  260. package/build/src/util/commit-split.js +100 -0
  261. package/build/src/util/commit-utils.d.ts +1 -0
  262. package/build/src/util/commit-utils.js +34 -0
  263. package/build/src/util/filter-commits.d.ts +12 -0
  264. package/build/src/util/filter-commits.js +59 -0
  265. package/build/src/util/indent-commit.d.ts +2 -0
  266. package/build/src/util/indent-commit.js +39 -0
  267. package/build/src/util/json-stringify.d.ts +1 -0
  268. package/build/src/util/json-stringify.js +22 -0
  269. package/build/src/util/logger.d.ts +24 -0
  270. package/build/src/util/logger.js +54 -0
  271. package/build/src/util/pull-request-body.d.ts +25 -0
  272. package/build/src/util/pull-request-body.js +147 -0
  273. package/build/src/util/pull-request-overflow-handler.d.ts +54 -0
  274. package/build/src/util/pull-request-overflow-handler.js +78 -0
  275. package/build/src/util/pull-request-title.d.ts +22 -0
  276. package/build/src/util/pull-request-title.js +146 -0
  277. package/build/src/util/signoff-commit-message.d.ts +1 -0
  278. package/build/src/util/signoff-commit-message.js +35 -0
  279. package/build/src/util/tag-name.d.ts +10 -0
  280. package/build/src/util/tag-name.js +42 -0
  281. package/build/src/util/toml-edit.d.ts +16 -0
  282. package/build/src/util/toml-edit.js +126 -0
  283. package/build/src/version.d.ts +35 -0
  284. package/build/src/version.js +74 -0
  285. package/build/src/versioning-strategies/always-bump-major.d.ts +10 -0
  286. package/build/src/versioning-strategies/always-bump-major.js +28 -0
  287. package/build/src/versioning-strategies/always-bump-minor.d.ts +10 -0
  288. package/build/src/versioning-strategies/always-bump-minor.js +28 -0
  289. package/build/src/versioning-strategies/always-bump-patch.d.ts +11 -0
  290. package/build/src/versioning-strategies/always-bump-patch.js +29 -0
  291. package/build/src/versioning-strategies/default.d.ts +48 -0
  292. package/build/src/versioning-strategies/default.js +102 -0
  293. package/build/src/versioning-strategies/dependency-manifest.d.ts +15 -0
  294. package/build/src/versioning-strategies/dependency-manifest.js +103 -0
  295. package/build/src/versioning-strategies/java-add-snapshot.d.ts +13 -0
  296. package/build/src/versioning-strategies/java-add-snapshot.js +54 -0
  297. package/build/src/versioning-strategies/java-snapshot.d.ts +13 -0
  298. package/build/src/versioning-strategies/java-snapshot.js +70 -0
  299. package/build/src/versioning-strategies/prerelease.d.ts +20 -0
  300. package/build/src/versioning-strategies/prerelease.js +163 -0
  301. package/build/src/versioning-strategies/service-pack.d.ts +12 -0
  302. package/build/src/versioning-strategies/service-pack.js +47 -0
  303. package/build/src/versioning-strategy.d.ts +90 -0
  304. package/build/src/versioning-strategy.js +82 -0
  305. package/package.json +113 -4
  306. package/schemas/config.json +513 -0
  307. package/schemas/manifest.json +9 -0
  308. package/templates/commit.hbs +2 -0
  309. package/templates/header.hbs +9 -0
  310. package/templates/template.hbs +19 -0
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ // Copyright 2023 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.ChangelogJson = void 0;
17
+ const logger_1 = require("../util/logger");
18
+ const default_1 = require("./default");
19
+ const crypto_1 = require("crypto");
20
+ const BREAKING_CHANGE_TITLE = 'BREAKING CHANGE';
21
+ const COMMIT_PREFIX = /^[^:]+: ?/;
22
+ const PR_SUFFIX_REGEX = / ?\(#(?<pr>[0-9]+)\)$/;
23
+ /**
24
+ * Maintains a machine readable CHANGELOG in chnagelog.json.
25
+ * See: https://gist.github.com/bcoe/50ef0a0024bbf107cd5bc0adbdc04758
26
+ */
27
+ class ChangelogJson extends default_1.DefaultUpdater {
28
+ /**
29
+ * Instantiate a new SamplesPackageJson updater
30
+ * @param options
31
+ */
32
+ constructor(options) {
33
+ super(options);
34
+ this.language = options.language;
35
+ this.artifactName = options.artifactName;
36
+ this.commits = options.commits;
37
+ }
38
+ /**
39
+ * Given initial file contents, return updated contents.
40
+ * @param {string} content The initial content
41
+ * @returns {string} The updated content
42
+ */
43
+ updateContent(content, logger = logger_1.logger) {
44
+ var _a;
45
+ const parsed = JSON.parse(content);
46
+ logger.info(`adding release ${this.version} for ${this.artifactName}`);
47
+ const changes = [];
48
+ for (const commit of this.commits) {
49
+ const issues = new Set();
50
+ // The commit.message field contains the type/scope prefix.
51
+ let message = commit.message.replace(COMMIT_PREFIX, '');
52
+ // When squashing commits, GitHub adds a suffix refrencing
53
+ // the # of the PR, e.g., chore(main): release 15.5.1 (#1838)
54
+ // this logic removes this suffix and prepends it to the
55
+ // issues array.
56
+ const match = message.match(PR_SUFFIX_REGEX);
57
+ if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.pr)) {
58
+ message = message.replace(match[0], '');
59
+ issues.add(match.groups.pr);
60
+ }
61
+ // Array.from(someSet) will maintain elements in insertion
62
+ // order, given this we add references after the pr suffix.
63
+ for (const ref of commit.references) {
64
+ issues.add(ref.issue);
65
+ }
66
+ const change = {
67
+ type: commit.type,
68
+ sha: commit.sha,
69
+ message: message,
70
+ issues: Array.from(issues),
71
+ };
72
+ if (commit.scope)
73
+ change.scope = commit.scope;
74
+ for (const note of commit.notes) {
75
+ if (note.title === BREAKING_CHANGE_TITLE) {
76
+ change.breakingChangeNote = note.text;
77
+ }
78
+ }
79
+ changes.push(change);
80
+ }
81
+ // If all commits were ignored, simply return the original changelog.json.
82
+ if (changes.length === 0) {
83
+ return content;
84
+ }
85
+ const time = new Date().toISOString();
86
+ const release = {
87
+ changes,
88
+ version: this.version.toString(),
89
+ language: this.language,
90
+ artifactName: this.artifactName,
91
+ id: (0, crypto_1.randomUUID)(),
92
+ createTime: time,
93
+ };
94
+ parsed.entries.unshift(release);
95
+ parsed.updateTime = time;
96
+ return JSON.stringify(parsed, null, 2);
97
+ }
98
+ }
99
+ exports.ChangelogJson = ChangelogJson;
100
+ //# sourceMappingURL=changelog-json.js.map
@@ -0,0 +1,13 @@
1
+ import { DefaultUpdater, UpdateOptions } from './default';
2
+ interface ChangelogOptions extends UpdateOptions {
3
+ changelogEntry: string;
4
+ versionHeaderRegex?: string;
5
+ }
6
+ export declare class Changelog extends DefaultUpdater {
7
+ changelogEntry: string;
8
+ readonly versionHeaderRegex: RegExp;
9
+ constructor(options: ChangelogOptions);
10
+ updateContent(content: string | undefined): string;
11
+ private header;
12
+ }
13
+ export {};
@@ -0,0 +1,55 @@
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.Changelog = void 0;
17
+ const default_1 = require("./default");
18
+ const DEFAULT_VERSION_HEADER_REGEX = '\n###? v?[0-9[]';
19
+ class Changelog extends default_1.DefaultUpdater {
20
+ constructor(options) {
21
+ var _a;
22
+ super(options);
23
+ this.changelogEntry = options.changelogEntry;
24
+ this.versionHeaderRegex = new RegExp((_a = options.versionHeaderRegex) !== null && _a !== void 0 ? _a : DEFAULT_VERSION_HEADER_REGEX, 's');
25
+ }
26
+ updateContent(content) {
27
+ content = content || '';
28
+ // Handle both H2 (features/BREAKING CHANGES) and H3 (fixes).
29
+ const lastEntryIndex = content.search(this.versionHeaderRegex);
30
+ if (lastEntryIndex === -1) {
31
+ if (content) {
32
+ return `${this.header()}\n${this.changelogEntry}\n\n${adjustHeaders(content).trim()}\n`;
33
+ }
34
+ else {
35
+ return `${this.header()}\n${this.changelogEntry}\n`;
36
+ }
37
+ }
38
+ else {
39
+ const before = content.slice(0, lastEntryIndex);
40
+ const after = content.slice(lastEntryIndex);
41
+ return `${before}\n${this.changelogEntry}\n${after}`.trim() + '\n';
42
+ }
43
+ }
44
+ header() {
45
+ return `\
46
+ # Changelog
47
+ `;
48
+ }
49
+ }
50
+ exports.Changelog = Changelog;
51
+ // Helper to increase markdown H1 headers to H2
52
+ function adjustHeaders(content) {
53
+ return content.replace(/^#(\s)/gm, '##$1');
54
+ }
55
+ //# sourceMappingURL=changelog.js.map
@@ -0,0 +1,20 @@
1
+ import { Updater, Update } from '../update';
2
+ /**
3
+ * The CompositeUpdater chains 0...n updaters and updates
4
+ * the content in order.
5
+ */
6
+ export declare class CompositeUpdater implements Updater {
7
+ readonly updaters: Updater[];
8
+ /**
9
+ * Instantiate a new CompositeUpdater
10
+ * @param {Updater[]} updaters The updaters to chain together
11
+ */
12
+ constructor(...updaters: Updater[]);
13
+ /**
14
+ * Given initial file contents, return updated contents.
15
+ * @param {string} content The initial content
16
+ * @returns {string} The updated content
17
+ */
18
+ updateContent(content: string | undefined): string;
19
+ }
20
+ export declare function mergeUpdates(updates: Update[]): Update[];
@@ -0,0 +1,65 @@
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.mergeUpdates = exports.CompositeUpdater = void 0;
17
+ /**
18
+ * The CompositeUpdater chains 0...n updaters and updates
19
+ * the content in order.
20
+ */
21
+ class CompositeUpdater {
22
+ /**
23
+ * Instantiate a new CompositeUpdater
24
+ * @param {Updater[]} updaters The updaters to chain together
25
+ */
26
+ constructor(...updaters) {
27
+ this.updaters = updaters;
28
+ }
29
+ /**
30
+ * Given initial file contents, return updated contents.
31
+ * @param {string} content The initial content
32
+ * @returns {string} The updated content
33
+ */
34
+ updateContent(content) {
35
+ for (const updater of this.updaters) {
36
+ content = updater.updateContent(content);
37
+ }
38
+ return content || '';
39
+ }
40
+ }
41
+ exports.CompositeUpdater = CompositeUpdater;
42
+ function mergeUpdates(updates) {
43
+ const updatesByPath = {};
44
+ for (const update of updates) {
45
+ if (updatesByPath[update.path]) {
46
+ updatesByPath[update.path].push(update);
47
+ }
48
+ else {
49
+ updatesByPath[update.path] = [update];
50
+ }
51
+ }
52
+ const newUpdates = [];
53
+ for (const path in updatesByPath) {
54
+ const update = updatesByPath[path];
55
+ const updaters = update.map(u => u.updater);
56
+ newUpdates.push({
57
+ path,
58
+ createIfMissing: update[0].createIfMissing,
59
+ updater: updaters.length === 1 ? updaters[0] : new CompositeUpdater(...updaters),
60
+ });
61
+ }
62
+ return newUpdates;
63
+ }
64
+ exports.mergeUpdates = mergeUpdates;
65
+ //# sourceMappingURL=composite.js.map
@@ -0,0 +1,13 @@
1
+ import { Logger } from '../../util/logger';
2
+ import { DefaultUpdater } from '../default';
3
+ /**
4
+ * Updates a Dart pubspec.yaml file.
5
+ */
6
+ export declare class PubspecYaml extends DefaultUpdater {
7
+ /**
8
+ * Given initial file contents, return updated contents.
9
+ * @param {string} content The initial content
10
+ * @returns {string} The updated content
11
+ */
12
+ updateContent(content: string, logger?: Logger): string;
13
+ }
@@ -0,0 +1,50 @@
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.PubspecYaml = void 0;
17
+ const logger_1 = require("../../util/logger");
18
+ const default_1 = require("../default");
19
+ /**
20
+ * Updates a Dart pubspec.yaml file.
21
+ */
22
+ class PubspecYaml extends default_1.DefaultUpdater {
23
+ /**
24
+ * Given initial file contents, return updated contents.
25
+ * @param {string} content The initial content
26
+ * @returns {string} The updated content
27
+ */
28
+ updateContent(content, logger = logger_1.logger) {
29
+ const oldVersion = content.match(/^version: ([0-9.]+)\+?(.*$)/m);
30
+ let buildNumber = '';
31
+ if (oldVersion) {
32
+ buildNumber = oldVersion[2];
33
+ const parsedBuild = parseInt(buildNumber);
34
+ if (!isNaN(parsedBuild)) {
35
+ buildNumber = `+${parsedBuild + 1}`;
36
+ logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`);
37
+ }
38
+ else if (buildNumber.length > 0) {
39
+ buildNumber = `+${buildNumber}`;
40
+ logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`);
41
+ }
42
+ else {
43
+ logger.info(`updating from ${oldVersion[1]} to ${this.version}`);
44
+ }
45
+ }
46
+ return content.replace(/^version: .*$/m, `version: ${this.version}${buildNumber}`);
47
+ }
48
+ }
49
+ exports.PubspecYaml = PubspecYaml;
50
+ //# sourceMappingURL=pubspec-yaml.js.map
@@ -0,0 +1,21 @@
1
+ import { Updater } from '../update';
2
+ import { Version, VersionsMap } from '../version';
3
+ export interface UpdateOptions {
4
+ version: Version;
5
+ versionsMap?: VersionsMap;
6
+ }
7
+ /**
8
+ * This updater writes a plain file with the version string as the
9
+ * only content.
10
+ */
11
+ export declare class DefaultUpdater implements Updater {
12
+ version: Version;
13
+ versionsMap?: VersionsMap;
14
+ constructor(options: UpdateOptions);
15
+ /**
16
+ * Given initial file contents, return updated contents.
17
+ * @param {string} content The initial content
18
+ * @returns {string} The updated content
19
+ */
20
+ updateContent(_content: string): string;
21
+ }
@@ -0,0 +1,36 @@
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.DefaultUpdater = void 0;
17
+ /**
18
+ * This updater writes a plain file with the version string as the
19
+ * only content.
20
+ */
21
+ class DefaultUpdater {
22
+ constructor(options) {
23
+ this.version = options.version;
24
+ this.versionsMap = options.versionsMap;
25
+ }
26
+ /**
27
+ * Given initial file contents, return updated contents.
28
+ * @param {string} content The initial content
29
+ * @returns {string} The updated content
30
+ */
31
+ updateContent(_content) {
32
+ return this.version + '\n';
33
+ }
34
+ }
35
+ exports.DefaultUpdater = DefaultUpdater;
36
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1,18 @@
1
+ import { Updater } from '../../update';
2
+ import { Version } from '../../version';
3
+ import { Logger } from '../../util/logger';
4
+ /**
5
+ * Updates the apis.json format. See
6
+ * https://github.com/googleapis/google-cloud-dotnet/blob/main/apis/README.md.
7
+ */
8
+ export declare class Apis implements Updater {
9
+ private version;
10
+ private component;
11
+ constructor(component: string, version: Version);
12
+ /**
13
+ * Given initial file contents, return updated contents.
14
+ * @param {string} content The initial content
15
+ * @returns {string} The updated content
16
+ */
17
+ updateContent(content: string, logger?: Logger): string;
18
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // Copyright 2022 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.Apis = void 0;
17
+ const logger_1 = require("../../util/logger");
18
+ const json_stringify_1 = require("../../util/json-stringify");
19
+ /**
20
+ * Updates the apis.json format. See
21
+ * https://github.com/googleapis/google-cloud-dotnet/blob/main/apis/README.md.
22
+ */
23
+ class Apis {
24
+ constructor(component, version) {
25
+ this.component = component;
26
+ this.version = version;
27
+ }
28
+ /**
29
+ * Given initial file contents, return updated contents.
30
+ * @param {string} content The initial content
31
+ * @returns {string} The updated content
32
+ */
33
+ updateContent(content, logger = logger_1.logger) {
34
+ const data = JSON.parse(content);
35
+ const api = data.apis.find(api => api.id === this.component);
36
+ if (!api) {
37
+ logger.warn(`Failed to find component: ${this.component} in apis.json`);
38
+ return content;
39
+ }
40
+ api.version = this.version.toString();
41
+ return (0, json_stringify_1.jsonStringify)(data, content);
42
+ }
43
+ }
44
+ exports.Apis = Apis;
45
+ //# sourceMappingURL=apis.js.map
@@ -0,0 +1,12 @@
1
+ import { DefaultUpdater } from '../default';
2
+ /**
3
+ * Updates a .NET .csproj.
4
+ */
5
+ export declare class CsProj extends DefaultUpdater {
6
+ /**
7
+ * Given initial file contents, return updated contents.
8
+ * @param {string} content The initial content
9
+ * @returns {string} The updated content
10
+ */
11
+ updateContent(content: string): string;
12
+ }
@@ -0,0 +1,33 @@
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.CsProj = void 0;
17
+ const default_1 = require("../default");
18
+ const VERSION_ATTR_REGEX = /<Version>\d+\.\d+\.\d+(-[^+]+)?(\+.*)?<\/Version>/;
19
+ /**
20
+ * Updates a .NET .csproj.
21
+ */
22
+ class CsProj extends default_1.DefaultUpdater {
23
+ /**
24
+ * Given initial file contents, return updated contents.
25
+ * @param {string} content The initial content
26
+ * @returns {string} The updated content
27
+ */
28
+ updateContent(content) {
29
+ return content.replace(VERSION_ATTR_REGEX, `<Version>${this.version}</Version>`);
30
+ }
31
+ }
32
+ exports.CsProj = CsProj;
33
+ //# sourceMappingURL=csproj.js.map
@@ -0,0 +1,13 @@
1
+ import { Logger } from '../../util/logger';
2
+ import { DefaultUpdater } from '../default';
3
+ /**
4
+ * Updates an Elixir mix.exs file and looks for a version string.
5
+ */
6
+ export declare class ElixirMixExs extends DefaultUpdater {
7
+ /**
8
+ * Given initial file contents, return updated contents.
9
+ * @param {string} content The initial content
10
+ * @returns {string} The updated content
11
+ */
12
+ updateContent(content: string, logger?: Logger): string;
13
+ }
@@ -0,0 +1,42 @@
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.ElixirMixExs = void 0;
17
+ const logger_1 = require("../../util/logger");
18
+ const default_1 = require("../default");
19
+ /**
20
+ * Updates an Elixir mix.exs file and looks for a version string.
21
+ */
22
+ class ElixirMixExs extends default_1.DefaultUpdater {
23
+ /**
24
+ * Given initial file contents, return updated contents.
25
+ * @param {string} content The initial content
26
+ * @returns {string} The updated content
27
+ */
28
+ updateContent(content, logger = logger_1.logger) {
29
+ const oldModuleAttributeVersion = content.match(/@version "([A-Za-z0-9_\-+.~]+)"/);
30
+ if (oldModuleAttributeVersion) {
31
+ logger.info(`updating module attribute version from ${oldModuleAttributeVersion[1]} to ${this.version}`);
32
+ return content.replace(/@version "[A-Za-z0-9_\-+.~]+"/, `@version "${this.version}"`);
33
+ }
34
+ const oldInlineVersion = content.match(/version: "([A-Za-z0-9_\-+.~]+)"/);
35
+ if (oldInlineVersion) {
36
+ logger.info(`updating inline version from ${oldInlineVersion[1]} to ${this.version}`);
37
+ }
38
+ return content.replace(/version: "[A-Za-z0-9_\-+.~]+",/, `version: "${this.version}",`);
39
+ }
40
+ }
41
+ exports.ElixirMixExs = ElixirMixExs;
42
+ //# sourceMappingURL=elixir-mix-exs.js.map
@@ -0,0 +1,31 @@
1
+ import { Logger } from '../../util/logger';
2
+ import { DefaultUpdater, UpdateOptions } from '../default';
3
+ import { Version } from '../../version';
4
+ export interface AppJson {
5
+ expo: {
6
+ version: string;
7
+ ios?: {
8
+ buildNumber?: string;
9
+ };
10
+ android?: {
11
+ versionCode?: number;
12
+ };
13
+ };
14
+ }
15
+ export interface AppJsonOptions extends UpdateOptions {
16
+ expoSDKVersion: Version;
17
+ }
18
+ /**
19
+ * This updates a React Natve Expo project app.json file's main, ios and android
20
+ * versions. All values except the `android.versionCode` are standard semver
21
+ * version numbers. For the `android.versionCode`, the semver number is used as
22
+ * the basis for the `versionCode`.
23
+ */
24
+ export declare class AppJson extends DefaultUpdater {
25
+ expoSDKVersion: Version;
26
+ constructor(options: AppJsonOptions);
27
+ /**
28
+ * Given initial file contents, return updated contents.
29
+ */
30
+ updateContent(content: string, logger?: Logger): string;
31
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ // Copyright 2022 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.AppJson = void 0;
17
+ const json_stringify_1 = require("../../util/json-stringify");
18
+ const logger_1 = require("../../util/logger");
19
+ const default_1 = require("../default");
20
+ /**
21
+ * This updates a React Natve Expo project app.json file's main, ios and android
22
+ * versions. All values except the `android.versionCode` are standard semver
23
+ * version numbers. For the `android.versionCode`, the semver number is used as
24
+ * the basis for the `versionCode`.
25
+ */
26
+ class AppJson extends default_1.DefaultUpdater {
27
+ constructor(options) {
28
+ super(options);
29
+ this.expoSDKVersion = options.expoSDKVersion;
30
+ }
31
+ /**
32
+ * Given initial file contents, return updated contents.
33
+ */
34
+ updateContent(content, logger = logger_1.logger) {
35
+ var _a, _b;
36
+ const parsed = JSON.parse(content);
37
+ logger.info(`updating Expo version from ${parsed.expo.version} to ${this.version}`);
38
+ parsed.expo.version = this.version.toString();
39
+ if ((_a = parsed.expo.ios) === null || _a === void 0 ? void 0 : _a.buildNumber) {
40
+ logger.info(`updating iOS version from ${parsed.expo.ios.buildNumber} to ${this.version}`);
41
+ parsed.expo.ios.buildNumber = this.version.toString();
42
+ }
43
+ if ((_b = parsed.expo.android) === null || _b === void 0 ? void 0 : _b.versionCode) {
44
+ // Android versionCode
45
+ // https://developer.android.com/studio/publish/versioning#appversioning
46
+ let expoMajorVersion = 0;
47
+ try {
48
+ expoMajorVersion = this.expoSDKVersion.major;
49
+ }
50
+ catch (e) {
51
+ // Rethrow with a nice error message.
52
+ throw new Error('Unable to determine the Expo SDK version for this project. Make sure that the expo package is installed for your project.');
53
+ }
54
+ // Implements the `versionCode` strategy described by Maxi Rosson
55
+ // @see https://medium.com/@maxirosson/versioning-android-apps-d6ec171cfd82
56
+ const versionCode = expoMajorVersion * 10000000 +
57
+ this.version.major * 10000 +
58
+ this.version.minor * 100 +
59
+ this.version.patch;
60
+ logger.info(`updating Android version from ${parsed.expo.android.versionCode} to ${versionCode}`);
61
+ parsed.expo.android.versionCode = versionCode;
62
+ }
63
+ return (0, json_stringify_1.jsonStringify)(parsed, content);
64
+ }
65
+ }
66
+ exports.AppJson = AppJson;
67
+ //# sourceMappingURL=app-json.js.map
@@ -0,0 +1,14 @@
1
+ import { Updater } from '../update';
2
+ import { Version } from '../version';
3
+ import { Logger } from '../util/logger';
4
+ export declare class GenericJson implements Updater {
5
+ readonly jsonpath: string;
6
+ readonly version: Version;
7
+ constructor(jsonpath: string, version: Version);
8
+ /**
9
+ * Given initial file contents, return updated contents.
10
+ * @param {string} content The initial content
11
+ * @returns {string} The updated content
12
+ */
13
+ updateContent(content: string, logger?: Logger): string;
14
+ }