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
@@ -1,16 +1,12 @@
1
- import { Update, UpdateOptions, VersionsMap } from '../update';
2
- import { GitHubFileContents } from '../../github';
1
+ import { DefaultUpdater } from '../default';
3
2
  /**
4
3
  * Updates `Cargo.toml` manifests, preserving formatting and comments.
5
4
  */
6
- export declare class CargoToml implements Update {
7
- path: string;
8
- changelogEntry: string;
9
- version: string;
10
- versions?: VersionsMap;
11
- packageName: string;
12
- create: boolean;
13
- contents?: GitHubFileContents;
14
- constructor(options: UpdateOptions);
5
+ export declare class CargoToml 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
+ */
15
11
  updateContent(content: string): string;
16
12
  }
@@ -14,37 +14,35 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CargoToml = void 0;
17
- const toml_edit_1 = require("../toml-edit");
17
+ const toml_edit_1 = require("../../util/toml-edit");
18
18
  const common_1 = require("./common");
19
19
  const logger_1 = require("../../util/logger");
20
+ const default_1 = require("../default");
20
21
  /**
21
22
  * Updates `Cargo.toml` manifests, preserving formatting and comments.
22
23
  */
23
- class CargoToml {
24
- constructor(options) {
25
- this.create = false;
26
- this.path = options.path;
27
- this.changelogEntry = options.changelogEntry;
28
- this.version = options.version;
29
- this.versions = options.versions;
30
- this.packageName = options.packageName;
31
- }
24
+ class CargoToml extends default_1.DefaultUpdater {
25
+ /**
26
+ * Given initial file contents, return updated contents.
27
+ * @param {string} content The initial content
28
+ * @returns {string} The updated content
29
+ */
32
30
  updateContent(content) {
33
31
  var _a;
34
32
  let payload = content;
35
- if (!this.versions) {
33
+ if (!this.versionsMap) {
36
34
  throw new Error('updateContent called with no versions');
37
35
  }
38
36
  const parsed = common_1.parseCargoManifest(payload);
39
37
  if (!parsed.package) {
40
- const msg = `${this.path} is not a package manifest (might be a cargo workspace)`;
38
+ const msg = 'is not a package manifest (might be a cargo workspace)';
41
39
  logger_1.logger.error(msg);
42
40
  throw new Error(msg);
43
41
  }
44
- for (const [pkgName, pkgVersion] of this.versions) {
42
+ for (const [pkgName, pkgVersion] of this.versionsMap) {
45
43
  if (parsed.package.name === pkgName) {
46
- logger_1.logger.info(`updating ${this.path}'s own version from ${(_a = parsed.package) === null || _a === void 0 ? void 0 : _a.version} to ${pkgVersion}`);
47
- payload = toml_edit_1.replaceTomlValue(payload, ['package', 'version'], pkgVersion);
44
+ logger_1.logger.info(`updating own version from ${(_a = parsed.package) === null || _a === void 0 ? void 0 : _a.version} to ${pkgVersion}`);
45
+ payload = toml_edit_1.replaceTomlValue(payload, ['package', 'version'], pkgVersion.toString());
48
46
  continue; // to next [pkgName, pkgVersion] pair
49
47
  }
50
48
  for (const depKind of common_1.DEP_KINDS) {
@@ -57,11 +55,11 @@ class CargoToml {
57
55
  }
58
56
  const dep = deps[pkgName];
59
57
  if (typeof dep === 'string' || typeof dep.path === 'undefined') {
60
- logger_1.logger.info(`skipping ${depKind}.${pkgName} in ${this.path}`);
58
+ logger_1.logger.info(`skipping ${depKind}.${pkgName} in`);
61
59
  continue; // to next depKind
62
60
  }
63
- logger_1.logger.info(`updating ${this.path} ${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`);
64
- payload = toml_edit_1.replaceTomlValue(payload, [depKind, pkgName, 'version'], pkgVersion);
61
+ logger_1.logger.info(`updating ${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`);
62
+ payload = toml_edit_1.replaceTomlValue(payload, [depKind, pkgName, 'version'], pkgVersion.toString());
65
63
  }
66
64
  // Update platform-specific dependencies
67
65
  if (parsed.target) {
@@ -76,11 +74,11 @@ class CargoToml {
76
74
  }
77
75
  const dep = deps[pkgName];
78
76
  if (typeof dep === 'string' || typeof dep.path === 'undefined') {
79
- logger_1.logger.info(`skipping target.${targetName}.${depKind}.${pkgName} in ${this.path}`);
77
+ logger_1.logger.info(`skipping target.${targetName}.${depKind}.${pkgName} in`);
80
78
  continue; // to next depKind
81
79
  }
82
- logger_1.logger.info(`updating ${this.path} target.${targetName}.${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`);
83
- payload = toml_edit_1.replaceTomlValue(payload, ['target', targetName, depKind, pkgName, 'version'], pkgVersion);
80
+ logger_1.logger.info(`updating target.${targetName}.${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`);
81
+ payload = toml_edit_1.replaceTomlValue(payload, ['target', targetName, depKind, pkgName, 'version'], pkgVersion.toString());
84
82
  }
85
83
  }
86
84
  }
@@ -1,13 +1,12 @@
1
- import { Update, UpdateOptions, VersionsMap } from '../update';
2
- import { GitHubFileContents } from '../../github';
3
- export declare class ModuleVersion implements Update {
4
- path: string;
5
- changelogEntry: string;
6
- version: string;
7
- versions?: VersionsMap;
8
- packageName: string;
9
- create: boolean;
10
- contents?: GitHubFileContents;
11
- constructor(options: UpdateOptions);
1
+ import { DefaultUpdater } from '../default';
2
+ /**
3
+ * Updates a Terraform Module versions.tf file.
4
+ */
5
+ export declare class ModuleVersion 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
+ */
12
11
  updateContent(content: string): string;
13
12
  }
@@ -15,18 +15,20 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ModuleVersion = void 0;
17
17
  const logger_1 = require("../../util/logger");
18
- class ModuleVersion {
19
- constructor(options) {
20
- this.create = false;
21
- this.path = options.path;
22
- this.changelogEntry = options.changelogEntry;
23
- this.version = options.version;
24
- this.packageName = options.packageName;
25
- }
18
+ const default_1 = require("../default");
19
+ /**
20
+ * Updates a Terraform Module versions.tf file.
21
+ */
22
+ class ModuleVersion 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
+ */
26
28
  updateContent(content) {
27
29
  const oldVersion = content.match(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/);
28
30
  if (oldVersion) {
29
- logger_1.logger.info(`updating ${this.path} from ${oldVersion} to v${this.version}`);
31
+ logger_1.logger.info(`updating from ${oldVersion} to v${this.version}`);
30
32
  }
31
33
  return content.replace(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/g, `v${this.version}`);
32
34
  }
@@ -1,13 +1,12 @@
1
- import { Update, UpdateOptions, VersionsMap } from '../update';
2
- import { GitHubFileContents } from '../../github';
3
- export declare class ReadMe implements Update {
4
- path: string;
5
- changelogEntry: string;
6
- version: string;
7
- versions?: VersionsMap;
8
- packageName: string;
9
- create: boolean;
10
- contents?: GitHubFileContents;
11
- constructor(options: UpdateOptions);
1
+ import { DefaultUpdater } from '../default';
2
+ /**
3
+ * Updates a Terraform module's README.
4
+ */
5
+ export declare class ReadMe 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
+ */
12
11
  updateContent(content: string): string;
13
12
  }
@@ -14,17 +14,18 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ReadMe = void 0;
17
- class ReadMe {
18
- constructor(options) {
19
- this.create = false;
20
- this.path = options.path;
21
- this.changelogEntry = options.changelogEntry;
22
- this.version = options.version;
23
- this.packageName = options.packageName;
24
- }
17
+ const default_1 = require("../default");
18
+ /**
19
+ * Updates a Terraform module's README.
20
+ */
21
+ class ReadMe extends default_1.DefaultUpdater {
22
+ /**
23
+ * Given initial file contents, return updated contents.
24
+ * @param {string} content The initial content
25
+ * @returns {string} The updated content
26
+ */
25
27
  updateContent(content) {
26
- const minorVersion = this.version.split('.').slice(0, 2).join('.');
27
- return content.replace(/version = "~> [\d]+.[\d]+"/, `version = "~> ${minorVersion}"`);
28
+ return content.replace(/version = "~> [\d]+.[\d]+"/, `version = "~> ${this.version.major}.${this.version.minor}"`);
28
29
  }
29
30
  }
30
31
  exports.ReadMe = ReadMe;
@@ -1 +1 @@
1
- {"version":3,"file":"readme.js","sourceRoot":"","sources":["../../../../src/updaters/terraform/readme.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAKjC,MAAa,MAAM;IASjB,YAAY,OAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;IAED,aAAa,CAAC,OAAe;QAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,OAAO,CACpB,4BAA4B,EAC5B,iBAAiB,YAAY,GAAG,CACjC,CAAC;IACJ,CAAC;CACF;AAxBD,wBAwBC"}
1
+ {"version":3,"file":"readme.js","sourceRoot":"","sources":["../../../../src/updaters/terraform/readme.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,wCAA0C;AAE1C;;GAEG;AACH,MAAa,MAAO,SAAQ,wBAAc;IACxC;;;;OAIG;IACH,aAAa,CAAC,OAAe;QAC3B,OAAO,OAAO,CAAC,OAAO,CACpB,4BAA4B,EAC5B,iBAAiB,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,CAC7D,CAAC;IACJ,CAAC;CACF;AAZD,wBAYC"}
@@ -1,16 +1,17 @@
1
+ import { Version } from '../version';
1
2
  export declare class BranchName {
2
3
  component?: string;
3
4
  targetBranch?: string;
4
- version?: string;
5
+ version?: Version;
5
6
  static parse(branchName: string): BranchName | undefined;
6
- static ofComponentVersion(branchPrefix: string, version: string): BranchName;
7
- static ofVersion(version: string): BranchName;
7
+ static ofComponentVersion(branchPrefix: string, version: Version): BranchName;
8
+ static ofVersion(version: Version): BranchName;
8
9
  static ofTargetBranch(targetBranch: string): BranchName;
9
10
  static ofComponentTargetBranch(component: string, targetBranch: string): BranchName;
10
11
  constructor(_branchName: string);
11
12
  static matches(_branchName: string): boolean;
12
13
  getTargetBranch(): string | undefined;
13
14
  getComponent(): string | undefined;
14
- getVersion(): string | undefined;
15
+ getVersion(): Version | undefined;
15
16
  toString(): string;
16
17
  }
@@ -14,10 +14,12 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.BranchName = void 0;
17
+ const version_1 = require("../version");
17
18
  // cannot import from '..' - transpiled code references to RELEASE_PLEASE
18
19
  // at the script level are undefined, they are only defined inside function
19
20
  // or instance methods/properties.
20
- const constants_1 = require("../constants");
21
+ // import {RELEASE_PLEASE} from '../constants';
22
+ const RELEASE_PLEASE = 'release-please';
21
23
  function getAllResourceNames() {
22
24
  return [AutoreleaseBranchName, ComponentBranchName, DefaultBranchName];
23
25
  }
@@ -39,10 +41,10 @@ class BranchName {
39
41
  return new AutoreleaseBranchName(`release-v${version}`);
40
42
  }
41
43
  static ofTargetBranch(targetBranch) {
42
- return new DefaultBranchName(`${constants_1.RELEASE_PLEASE}/branches/${targetBranch}`);
44
+ return new DefaultBranchName(`${RELEASE_PLEASE}/branches/${targetBranch}`);
43
45
  }
44
46
  static ofComponentTargetBranch(component, targetBranch) {
45
- return new ComponentBranchName(`${constants_1.RELEASE_PLEASE}/branches/${targetBranch}/components/${component}`);
47
+ return new ComponentBranchName(`${RELEASE_PLEASE}/branches/${targetBranch}/components/${component}`);
46
48
  }
47
49
  static matches(_branchName) {
48
50
  return false;
@@ -71,17 +73,18 @@ class AutoreleaseBranchName extends BranchName {
71
73
  const match = branchName.match(AUTORELEASE_PATTERN);
72
74
  if (match === null || match === void 0 ? void 0 : match.groups) {
73
75
  this.component = match.groups['component'];
74
- this.version = match.groups['version'];
76
+ this.version = version_1.Version.parse(match.groups['version']);
75
77
  }
76
78
  }
77
79
  toString() {
80
+ var _a, _b;
78
81
  if (this.component) {
79
- return `release-${this.component}-v${this.version}`;
82
+ return `release-${this.component}-v${(_a = this.version) === null || _a === void 0 ? void 0 : _a.toString()}`;
80
83
  }
81
- return `release-v${this.version}`;
84
+ return `release-v${(_b = this.version) === null || _b === void 0 ? void 0 : _b.toString()}`;
82
85
  }
83
86
  }
84
- const DEFAULT_PATTERN = `^${constants_1.RELEASE_PLEASE}/branches/(?<branch>[^/]+)$`;
87
+ const DEFAULT_PATTERN = `^${RELEASE_PLEASE}/branches/(?<branch>[^/]+)$`;
85
88
  class DefaultBranchName extends BranchName {
86
89
  static matches(branchName) {
87
90
  return !!branchName.match(DEFAULT_PATTERN);
@@ -94,10 +97,10 @@ class DefaultBranchName extends BranchName {
94
97
  }
95
98
  }
96
99
  toString() {
97
- return `${constants_1.RELEASE_PLEASE}/branches/${this.targetBranch}`;
100
+ return `${RELEASE_PLEASE}/branches/${this.targetBranch}`;
98
101
  }
99
102
  }
100
- const COMPONENT_PATTERN = `^${constants_1.RELEASE_PLEASE}/branches/(?<branch>[^/]+)/components/(?<component>[^/]+)$`;
103
+ const COMPONENT_PATTERN = `^${RELEASE_PLEASE}/branches/(?<branch>[^/]+)/components/(?<component>.+)$`;
101
104
  class ComponentBranchName extends BranchName {
102
105
  static matches(branchName) {
103
106
  return !!branchName.match(COMPONENT_PATTERN);
@@ -111,7 +114,7 @@ class ComponentBranchName extends BranchName {
111
114
  }
112
115
  }
113
116
  toString() {
114
- return `${constants_1.RELEASE_PLEASE}/branches/${this.targetBranch}/components/${this.component}`;
117
+ return `${RELEASE_PLEASE}/branches/${this.targetBranch}/components/${this.component}`;
115
118
  }
116
119
  }
117
120
  //# sourceMappingURL=branch-name.js.map
@@ -1,4 +1,4 @@
1
- import { Commit } from './graphql-to-commits';
1
+ import { Commit } from '../commit';
2
2
  export interface CommitSplitOptions {
3
3
  includeEmpty?: boolean;
4
4
  packagePaths?: string[];
@@ -7,7 +7,5 @@ export declare class CommitSplit {
7
7
  includeEmpty: boolean;
8
8
  packagePaths?: string[];
9
9
  constructor(opts?: CommitSplitOptions);
10
- split(commits: Commit[]): {
11
- [key: string]: Commit[];
12
- };
10
+ split<T extends Commit>(commits: T[]): Record<string, T[]>;
13
11
  }
@@ -14,6 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CommitSplit = void 0;
17
+ const manifest_1 = require("../manifest");
17
18
  class CommitSplit {
18
19
  constructor(opts) {
19
20
  opts = opts || {};
@@ -23,7 +24,7 @@ class CommitSplit {
23
24
  for (let newPath of opts.packagePaths) {
24
25
  // The special "." path, representing the root of the module, should be
25
26
  // ignored by commit-split as it is assigned all commits in manifest.ts
26
- if (newPath === '.') {
27
+ if (newPath === manifest_1.ROOT_PROJECT_PATH) {
27
28
  continue;
28
29
  }
29
30
  // normalize so that all paths have leading and trailing slashes for
@@ -49,9 +50,10 @@ class CommitSplit {
49
50
  this.packagePaths = paths;
50
51
  }
51
52
  }
53
+ // split(commits: Commit[]): Record<string, Commit[]>
52
54
  split(commits) {
53
55
  const splitCommits = {};
54
- commits.forEach((commit) => {
56
+ commits.forEach(commit => {
55
57
  const dedupe = new Set();
56
58
  for (let i = 0; i < commit.files.length; i++) {
57
59
  const file = commit.files[i];
@@ -1,2 +1,2 @@
1
- import { Commit } from '../graphql-to-commits';
1
+ import { Commit } from '../commit';
2
2
  export declare function indentCommit(commit: Commit): string;
@@ -9,13 +9,16 @@ export interface Logger {
9
9
  debug: LogFn;
10
10
  trace: LogFn;
11
11
  }
12
- declare class CheckpointLogger implements Logger {
12
+ export declare class CheckpointLogger implements Logger {
13
+ private includeDebug;
14
+ private includeTrace;
15
+ constructor(includeDebug?: boolean, includeTrace?: boolean);
13
16
  error: LogFn;
14
17
  warn: LogFn;
15
18
  info: LogFn;
16
19
  debug: LogFn;
17
20
  trace: LogFn;
18
21
  }
19
- export declare let logger: CheckpointLogger;
22
+ export declare let logger: Logger;
20
23
  export declare function setLogger(userLogger: Logger): void;
21
24
  export {};
@@ -13,7 +13,7 @@
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.setLogger = exports.logger = void 0;
16
+ exports.setLogger = exports.logger = exports.CheckpointLogger = void 0;
17
17
  const chalk = require("chalk");
18
18
  const figures = require("figures");
19
19
  const errorPrefix = chalk.red(figures.cross);
@@ -22,7 +22,7 @@ const infoPrefix = chalk.green(figures.tick);
22
22
  const debugPrefix = chalk.gray(figures.pointer);
23
23
  const tracePrefix = chalk.dim.gray(figures.pointerSmall);
24
24
  class CheckpointLogger {
25
- constructor() {
25
+ constructor(includeDebug = false, includeTrace = false) {
26
26
  this.error = (...args) => {
27
27
  console.error(`${errorPrefix}`, ...args);
28
28
  };
@@ -33,13 +33,18 @@ class CheckpointLogger {
33
33
  console.info(`${infoPrefix}`, ...args);
34
34
  };
35
35
  this.debug = (...args) => {
36
- console.debug(`${debugPrefix}`, ...args);
36
+ if (this.includeDebug)
37
+ console.debug(`${debugPrefix}`, ...args);
37
38
  };
38
39
  this.trace = (...args) => {
39
- console.trace(`${tracePrefix}`, ...args);
40
+ if (this.includeTrace)
41
+ console.debug(`${tracePrefix}`, ...args);
40
42
  };
43
+ this.includeDebug = includeDebug;
44
+ this.includeTrace = includeTrace;
41
45
  }
42
46
  }
47
+ exports.CheckpointLogger = CheckpointLogger;
43
48
  /* eslint-enable @typescript-eslint/no-explicit-any */
44
49
  exports.logger = new CheckpointLogger();
45
50
  function setLogger(userLogger) {
@@ -0,0 +1,20 @@
1
+ import { Version } from '../version';
2
+ interface PullRequestBodyOptions {
3
+ header?: string;
4
+ footer?: string;
5
+ }
6
+ export declare class PullRequestBody {
7
+ header: string;
8
+ footer: string;
9
+ releaseData: ReleaseData[];
10
+ constructor(releaseData: ReleaseData[], options?: PullRequestBodyOptions);
11
+ static parse(body: string): PullRequestBody | undefined;
12
+ notes(): string;
13
+ toString(): string;
14
+ }
15
+ export interface ReleaseData {
16
+ component?: string;
17
+ version?: Version;
18
+ notes: string;
19
+ }
20
+ export {};
@@ -0,0 +1,129 @@
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.PullRequestBody = void 0;
17
+ const logger_1 = require("./logger");
18
+ const node_html_parser_1 = require("node-html-parser");
19
+ const version_1 = require("../version");
20
+ const DEFAULT_HEADER = ':robot: I have created a release *beep* *boop*';
21
+ const DEFAULT_FOOTER = 'This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).';
22
+ const NOTES_DELIMITER = '---';
23
+ class PullRequestBody {
24
+ constructor(releaseData, options) {
25
+ this.header = (options === null || options === void 0 ? void 0 : options.header) || DEFAULT_HEADER;
26
+ this.footer = (options === null || options === void 0 ? void 0 : options.footer) || DEFAULT_FOOTER;
27
+ this.releaseData = releaseData;
28
+ }
29
+ static parse(body) {
30
+ const parts = splitBody(body);
31
+ if (!parts) {
32
+ logger_1.logger.error('Pull request body did not match');
33
+ return undefined;
34
+ }
35
+ let data = extractMultipleReleases(parts.content);
36
+ if (data.length === 0) {
37
+ data = extractSingleRelease(parts.content);
38
+ if (data.length === 0) {
39
+ logger_1.logger.warn('Failed to parse releases.');
40
+ }
41
+ }
42
+ return new PullRequestBody(data, {
43
+ header: parts.header,
44
+ footer: parts.footer,
45
+ });
46
+ }
47
+ notes() {
48
+ if (this.releaseData.length > 1) {
49
+ return this.releaseData
50
+ .map(release => {
51
+ var _a;
52
+ return `<details><summary>${release.component}: ${(_a = release.version) === null || _a === void 0 ? void 0 : _a.toString()}</summary>\n\n${release.notes}\n</details>`;
53
+ })
54
+ .join('\n\n');
55
+ }
56
+ return this.releaseData.map(release => release.notes).join('\n\n');
57
+ }
58
+ toString() {
59
+ const notes = this.notes();
60
+ return `${this.header}
61
+ ${NOTES_DELIMITER}
62
+
63
+
64
+ ${notes}
65
+
66
+ ${NOTES_DELIMITER}
67
+ ${this.footer}`;
68
+ }
69
+ }
70
+ exports.PullRequestBody = PullRequestBody;
71
+ function splitBody(body) {
72
+ const lines = body.trim().split('\n');
73
+ const index = lines.indexOf(NOTES_DELIMITER);
74
+ if (index === -1) {
75
+ return undefined;
76
+ }
77
+ let lastIndex = lines.lastIndexOf(NOTES_DELIMITER);
78
+ if (lastIndex === index) {
79
+ lastIndex = lines.length - 1;
80
+ }
81
+ const header = lines.slice(0, index).join('\n').trim();
82
+ const content = lines.slice(index + 1, lastIndex).join('\n');
83
+ const footer = lines.slice(lastIndex + 1).join('\n');
84
+ return {
85
+ header,
86
+ footer,
87
+ content,
88
+ };
89
+ }
90
+ const SUMMARY_PATTERN = /^(?<component>.*): (?<version>\d+\.\d+\.\d+.*)$/;
91
+ function extractMultipleReleases(notes) {
92
+ const data = [];
93
+ const root = node_html_parser_1.parse(notes);
94
+ for (const detail of root.getElementsByTagName('details')) {
95
+ const summaryNode = detail.getElementsByTagName('summary')[0];
96
+ const summary = summaryNode === null || summaryNode === void 0 ? void 0 : summaryNode.textContent;
97
+ const match = summary.match(SUMMARY_PATTERN);
98
+ if (!(match === null || match === void 0 ? void 0 : match.groups)) {
99
+ logger_1.logger.warn(`Summary: ${summary} did not match the expected pattern`);
100
+ continue;
101
+ }
102
+ detail.removeChild(summaryNode);
103
+ const notes = detail.textContent.trim();
104
+ data.push({
105
+ component: match.groups.component,
106
+ version: version_1.Version.parse(match.groups.version),
107
+ notes,
108
+ });
109
+ }
110
+ return data;
111
+ }
112
+ const COMPARE_REGEX = /^#{2,} \[(?<version>\d+\.\d+\.\d+.*)\]/;
113
+ function extractSingleRelease(body) {
114
+ var _a;
115
+ body = body.trim();
116
+ const match = body.match(COMPARE_REGEX);
117
+ const versionString = (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.version;
118
+ if (!versionString) {
119
+ logger_1.logger.warn('Failed to find version in release notes');
120
+ return [];
121
+ }
122
+ return [
123
+ {
124
+ version: version_1.Version.parse(versionString),
125
+ notes: body,
126
+ },
127
+ ];
128
+ }
129
+ //# sourceMappingURL=pull-request-body.js.map
@@ -1,18 +1,20 @@
1
+ import { Version } from '../version';
1
2
  export declare function generateMatchPattern(pullRequestTitlePattern?: string): RegExp;
2
3
  export declare class PullRequestTitle {
3
4
  component?: string;
4
5
  targetBranch?: string;
5
- version: string;
6
+ version?: Version;
6
7
  pullRequestTitlePattern: string;
7
8
  matchPattern: RegExp;
8
9
  private constructor();
9
10
  static parse(title: string, pullRequestTitlePattern?: string): PullRequestTitle | undefined;
10
- static ofComponentVersion(component: string, version: string, pullRequestTitlePattern?: string): PullRequestTitle;
11
- static ofVersion(version: string, pullRequestTitlePattern?: string): PullRequestTitle;
12
- static ofTargetBranchVersion(targetBranch: string, version: string, pullRequestTitlePattern?: string): PullRequestTitle;
13
- static ofComponentTargetBranchVersion(component: string, targetBranch: string, version: string, pullRequestTitlePattern?: string): PullRequestTitle;
11
+ static ofComponentVersion(component: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
12
+ static ofVersion(version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
13
+ static ofTargetBranchVersion(targetBranch: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
14
+ static ofComponentTargetBranchVersion(component: string, targetBranch: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
15
+ static ofTargetBranch(targetBranch: string, pullRequestTitlePattern?: string): PullRequestTitle;
14
16
  getTargetBranch(): string | undefined;
15
17
  getComponent(): string | undefined;
16
- getVersion(): string;
18
+ getVersion(): Version | undefined;
17
19
  toString(): string;
18
20
  }