release-please 12.3.0 → 13.0.0-candidate.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +5 -0
  3. package/build/src/bin/release-please.d.ts +51 -11
  4. package/build/src/bin/release-please.js +409 -150
  5. package/build/src/bootstrapper.d.ts +12 -0
  6. package/build/src/bootstrapper.js +60 -0
  7. package/build/src/commit.d.ts +26 -0
  8. package/build/src/{util/to-conventional-changelog-format.js → commit.js} +97 -2
  9. package/build/src/errors/index.d.ts +0 -5
  10. package/build/src/errors/index.js +1 -10
  11. package/build/src/factory.d.ts +25 -37
  12. package/build/src/factory.js +159 -150
  13. package/build/src/github.d.ts +151 -883
  14. package/build/src/github.js +584 -1013
  15. package/build/src/manifest.d.ts +177 -48
  16. package/build/src/manifest.js +583 -487
  17. package/build/src/plugin.d.ts +20 -0
  18. package/build/src/{plugins/plugin.js → plugin.js} +10 -9
  19. package/build/src/plugins/cargo-workspace.d.ts +48 -18
  20. package/build/src/plugins/cargo-workspace.js +247 -328
  21. package/build/src/plugins/merge.d.ts +11 -0
  22. package/build/src/plugins/merge.js +83 -0
  23. package/build/src/plugins/node-workspace.d.ts +35 -17
  24. package/build/src/plugins/node-workspace.js +234 -271
  25. package/build/src/plugins/workspace.d.ts +102 -0
  26. package/build/src/plugins/workspace.js +170 -0
  27. package/build/src/pull-request.d.ts +10 -0
  28. package/build/src/{updaters/java/readme.js → pull-request.js} +2 -7
  29. package/build/src/release-notes.d.ts +29 -0
  30. package/build/src/release-notes.js +71 -0
  31. package/build/src/release-pull-request.d.ts +13 -0
  32. package/build/src/{updaters/java/pom-xml.js → release-pull-request.js} +2 -7
  33. package/build/src/release.d.ts +6 -0
  34. package/build/src/release.js +16 -0
  35. package/build/src/repository.d.ts +5 -0
  36. package/build/src/repository.js +16 -0
  37. package/build/src/strategies/dart.d.ts +8 -0
  38. package/build/src/strategies/dart.js +63 -0
  39. package/build/src/strategies/elixir.d.ts +5 -0
  40. package/build/src/{releasers → strategies}/elixir.js +18 -14
  41. package/build/src/strategies/go-yoshi.d.ts +13 -0
  42. package/build/src/strategies/go-yoshi.js +106 -0
  43. package/build/src/strategies/go.d.ts +5 -0
  44. package/build/src/{releasers → strategies}/go.js +11 -12
  45. package/build/src/strategies/helm.d.ts +8 -0
  46. package/build/src/strategies/helm.js +63 -0
  47. package/build/src/strategies/java-yoshi.d.ts +24 -0
  48. package/build/src/strategies/java-yoshi.js +203 -0
  49. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  50. package/build/src/{releasers → strategies}/krm-blueprint.js +26 -22
  51. package/build/src/strategies/node.d.ts +9 -0
  52. package/build/src/strategies/node.js +82 -0
  53. package/build/src/strategies/ocaml.d.ts +5 -0
  54. package/build/src/{releasers → strategies}/ocaml.js +34 -28
  55. package/build/src/strategies/php-yoshi.d.ts +9 -0
  56. package/build/src/strategies/php-yoshi.js +214 -0
  57. package/build/src/strategies/php.d.ts +6 -0
  58. package/build/src/{releasers → strategies}/php.js +24 -23
  59. package/build/src/strategies/python.d.ts +8 -0
  60. package/build/src/strategies/python.js +117 -0
  61. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  62. package/build/src/strategies/ruby-yoshi.js +116 -0
  63. package/build/src/strategies/ruby.d.ts +13 -0
  64. package/build/src/{releasers → strategies}/ruby.js +26 -27
  65. package/build/src/strategies/rust.d.ts +20 -0
  66. package/build/src/strategies/rust.js +120 -0
  67. package/build/src/strategies/simple.d.ts +5 -0
  68. package/build/src/{releasers → strategies}/simple.js +18 -14
  69. package/build/src/strategies/terraform-module.d.ts +7 -0
  70. package/build/src/{releasers → strategies}/terraform-module.js +29 -23
  71. package/build/src/strategy.d.ts +99 -0
  72. package/build/src/strategy.js +237 -0
  73. package/build/src/update.d.ts +23 -0
  74. package/build/src/{updaters/update.js → update.js} +1 -1
  75. package/build/src/updaters/changelog.d.ts +7 -10
  76. package/build/src/updaters/changelog.js +3 -9
  77. package/build/src/updaters/changelog.js.map +1 -1
  78. package/build/src/updaters/composite.d.ts +19 -0
  79. package/build/src/updaters/composite.js +42 -0
  80. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  81. package/build/src/updaters/dart/pubspec-yaml.js +45 -0
  82. package/build/src/updaters/default.d.ts +21 -0
  83. package/build/src/updaters/{version-txt.js → default.js} +16 -10
  84. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  85. package/build/src/updaters/{java/google-utils.js → dotnet/csproj.js} +16 -13
  86. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  87. package/build/src/updaters/{elixir-mix-exs.js → elixir/elixir-mix-exs.js} +12 -10
  88. package/build/src/updaters/helm/chart-yaml.d.ts +10 -11
  89. package/build/src/updaters/helm/chart-yaml.js +12 -10
  90. package/build/src/updaters/java/java-update.d.ts +14 -0
  91. package/build/src/updaters/java/{java_update.js → java-update.js} +22 -22
  92. package/build/src/updaters/java/versions-manifest.d.ts +12 -2
  93. package/build/src/updaters/java/versions-manifest.js +20 -4
  94. package/build/src/updaters/krm/krm-blueprint-version.d.ts +10 -11
  95. package/build/src/updaters/krm/krm-blueprint-version.js +13 -12
  96. package/build/src/updaters/node/package-json.d.ts +12 -0
  97. package/build/src/updaters/{package-json.js → node/package-json.js} +14 -16
  98. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  99. package/build/src/updaters/node/package-lock-json.js +36 -0
  100. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  101. package/build/src/updaters/{samples-package-json.js → node/samples-package-json.js} +19 -8
  102. package/build/src/updaters/ocaml/dune-project.d.ts +10 -11
  103. package/build/src/updaters/ocaml/dune-project.js +11 -9
  104. package/build/src/updaters/ocaml/esy-json.d.ts +10 -11
  105. package/build/src/updaters/ocaml/esy-json.js +12 -10
  106. package/build/src/updaters/ocaml/opam.d.ts +10 -11
  107. package/build/src/updaters/ocaml/opam.js +11 -9
  108. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  109. package/build/src/updaters/{php-client-version.js → php/php-client-version.js} +10 -9
  110. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  111. package/build/src/updaters/{php-manifest.js → php/php-manifest.js} +17 -15
  112. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  113. package/build/src/updaters/{root-composer-update-packages.js → php/root-composer-update-packages.js} +17 -16
  114. package/build/src/updaters/python/pyproject-toml.d.ts +10 -11
  115. package/build/src/updaters/python/pyproject-toml.js +13 -11
  116. package/build/src/updaters/python/python-file-with-version.d.ts +7 -11
  117. package/build/src/updaters/python/python-file-with-version.js +7 -8
  118. package/build/src/updaters/python/setup-cfg.d.ts +10 -11
  119. package/build/src/updaters/python/setup-cfg.js +10 -8
  120. package/build/src/updaters/python/setup-py.d.ts +10 -11
  121. package/build/src/updaters/python/setup-py.js +10 -8
  122. package/build/src/updaters/raw-content.d.ts +19 -0
  123. package/build/src/{plugins/index.js → updaters/raw-content.js} +23 -12
  124. package/build/src/updaters/release-please-config.d.ts +8 -0
  125. package/build/src/updaters/release-please-config.js +41 -0
  126. package/build/src/updaters/release-please-manifest.d.ts +2 -11
  127. package/build/src/updaters/release-please-manifest.js +11 -14
  128. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  129. package/build/src/updaters/{version-rb.js → ruby/version-rb.js} +10 -8
  130. package/build/src/updaters/rust/cargo-lock.d.ts +7 -11
  131. package/build/src/updaters/rust/cargo-lock.js +14 -16
  132. package/build/src/updaters/rust/cargo-toml.d.ts +7 -11
  133. package/build/src/updaters/rust/cargo-toml.js +19 -21
  134. package/build/src/updaters/terraform/module-version.d.ts +10 -11
  135. package/build/src/updaters/terraform/module-version.js +11 -9
  136. package/build/src/updaters/terraform/readme.d.ts +10 -11
  137. package/build/src/updaters/terraform/readme.js +11 -10
  138. package/build/src/updaters/terraform/readme.js.map +1 -1
  139. package/build/src/util/branch-name.d.ts +5 -4
  140. package/build/src/util/branch-name.js +13 -10
  141. package/build/src/{commit-split.d.ts → util/commit-split.d.ts} +2 -4
  142. package/build/src/{commit-split.js → util/commit-split.js} +4 -2
  143. package/build/src/util/indent-commit.d.ts +1 -1
  144. package/build/src/util/logger.d.ts +5 -2
  145. package/build/src/util/logger.js +9 -4
  146. package/build/src/util/pull-request-body.d.ts +20 -0
  147. package/build/src/util/pull-request-body.js +129 -0
  148. package/build/src/util/pull-request-title.d.ts +8 -6
  149. package/build/src/util/pull-request-title.js +20 -6
  150. package/build/src/util/tag-name.d.ts +9 -0
  151. package/build/src/util/tag-name.js +41 -0
  152. package/build/src/{updaters → util}/toml-edit.d.ts +0 -0
  153. package/build/src/{updaters → util}/toml-edit.js +0 -0
  154. package/build/src/version.d.ts +11 -0
  155. package/build/src/version.js +45 -0
  156. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  157. package/build/src/{updaters/package-lock-json.js → versioning-strategies/always-bump-patch.js} +8 -11
  158. package/build/src/versioning-strategies/default.d.ts +15 -0
  159. package/build/src/versioning-strategies/default.js +67 -0
  160. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  161. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  162. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  163. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  164. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  165. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  166. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  167. package/build/src/versioning-strategies/service-pack.js +40 -0
  168. package/build/src/versioning-strategy.d.ts +28 -0
  169. package/build/src/versioning-strategy.js +55 -0
  170. package/package.json +9 -8
  171. package/build/src/constants.d.ts +0 -6
  172. package/build/src/constants.js +0 -23
  173. package/build/src/conventional-commits.d.ts +0 -53
  174. package/build/src/conventional-commits.js +0 -167
  175. package/build/src/github-release.d.ts +0 -34
  176. package/build/src/github-release.js +0 -92
  177. package/build/src/graphql-to-commits.d.ts +0 -60
  178. package/build/src/graphql-to-commits.js +0 -112
  179. package/build/src/index.d.ts +0 -94
  180. package/build/src/index.js +0 -32
  181. package/build/src/plugins/index.d.ts +0 -5
  182. package/build/src/plugins/plugin.d.ts +0 -21
  183. package/build/src/release-pr.d.ts +0 -101
  184. package/build/src/release-pr.js +0 -461
  185. package/build/src/releasers/elixir.d.ts +0 -5
  186. package/build/src/releasers/go-yoshi.d.ts +0 -10
  187. package/build/src/releasers/go-yoshi.js +0 -162
  188. package/build/src/releasers/go.d.ts +0 -6
  189. package/build/src/releasers/helm.d.ts +0 -9
  190. package/build/src/releasers/helm.js +0 -66
  191. package/build/src/releasers/index.d.ts +0 -7
  192. package/build/src/releasers/index.js +0 -72
  193. package/build/src/releasers/java/bump_type.d.ts +0 -4
  194. package/build/src/releasers/java/bump_type.js +0 -38
  195. package/build/src/releasers/java/stability.d.ts +0 -5
  196. package/build/src/releasers/java/stability.js +0 -37
  197. package/build/src/releasers/java/version.d.ts +0 -13
  198. package/build/src/releasers/java/version.js +0 -112
  199. package/build/src/releasers/java-bom.d.ts +0 -16
  200. package/build/src/releasers/java-bom.js +0 -83
  201. package/build/src/releasers/java-lts.d.ts +0 -9
  202. package/build/src/releasers/java-lts.js +0 -47
  203. package/build/src/releasers/java-yoshi.d.ts +0 -28
  204. package/build/src/releasers/java-yoshi.js +0 -304
  205. package/build/src/releasers/krm-blueprint.d.ts +0 -6
  206. package/build/src/releasers/node.d.ts +0 -10
  207. package/build/src/releasers/node.js +0 -84
  208. package/build/src/releasers/ocaml.d.ts +0 -5
  209. package/build/src/releasers/php-yoshi.d.ts +0 -5
  210. package/build/src/releasers/php-yoshi.js +0 -191
  211. package/build/src/releasers/php.d.ts +0 -7
  212. package/build/src/releasers/python.d.ts +0 -11
  213. package/build/src/releasers/python.js +0 -127
  214. package/build/src/releasers/ruby-yoshi.d.ts +0 -5
  215. package/build/src/releasers/ruby-yoshi.js +0 -142
  216. package/build/src/releasers/ruby.d.ts +0 -11
  217. package/build/src/releasers/rust.d.ts +0 -30
  218. package/build/src/releasers/rust.js +0 -163
  219. package/build/src/releasers/simple.d.ts +0 -5
  220. package/build/src/releasers/terraform-module.d.ts +0 -6
  221. package/build/src/updaters/elixir-mix-exs.d.ts +0 -13
  222. package/build/src/updaters/java/google-utils.d.ts +0 -13
  223. package/build/src/updaters/java/java_update.d.ts +0 -13
  224. package/build/src/updaters/java/pom-xml.d.ts +0 -3
  225. package/build/src/updaters/java/readme.d.ts +0 -3
  226. package/build/src/updaters/java/readme.js.map +0 -1
  227. package/build/src/updaters/package-json.d.ts +0 -16
  228. package/build/src/updaters/package-lock-json.d.ts +0 -7
  229. package/build/src/updaters/php-client-version.d.ts +0 -13
  230. package/build/src/updaters/php-manifest.d.ts +0 -13
  231. package/build/src/updaters/root-composer-update-package.d.ts +0 -13
  232. package/build/src/updaters/root-composer-update-package.js +0 -45
  233. package/build/src/updaters/root-composer-update-packages.d.ts +0 -13
  234. package/build/src/updaters/samples-package-json.d.ts +0 -13
  235. package/build/src/updaters/update.d.ts +0 -20
  236. package/build/src/updaters/version-rb.d.ts +0 -13
  237. package/build/src/updaters/version-txt.d.ts +0 -12
  238. package/build/src/updaters/version.d.ts +0 -13
  239. package/build/src/updaters/version.js +0 -31
  240. package/build/src/util/checkpoint.d.ts +0 -6
  241. package/build/src/util/checkpoint.js +0 -33
  242. package/build/src/util/release-notes.d.ts +0 -7
  243. package/build/src/util/release-notes.js +0 -34
  244. package/build/src/util/to-conventional-changelog-format.d.ts +0 -2
@@ -0,0 +1,13 @@
1
+ import { DefaultUpdater } from '../default';
2
+ /**
3
+ * Updates a manifest.json file.
4
+ * @see https://github.com/googleapis/google-cloud-php/blob/master/docs/manifest.json
5
+ */
6
+ export declare class PHPManifest 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): string;
13
+ }
@@ -14,27 +14,29 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.PHPManifest = void 0;
17
- const logger_1 = require("../util/logger");
18
- const json_stringify_1 = require("../util/json-stringify");
19
- class PHPManifest {
20
- constructor(options) {
21
- this.create = false;
22
- this.path = options.path;
23
- this.changelogEntry = options.changelogEntry;
24
- this.version = options.version;
25
- this.versions = options.versions;
26
- this.packageName = options.packageName;
27
- }
17
+ const logger_1 = require("../../util/logger");
18
+ const json_stringify_1 = require("../../util/json-stringify");
19
+ const default_1 = require("../default");
20
+ /**
21
+ * Updates a manifest.json file.
22
+ * @see https://github.com/googleapis/google-cloud-php/blob/master/docs/manifest.json
23
+ */
24
+ class PHPManifest 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
+ */
28
30
  updateContent(content) {
29
- if (!this.versions || this.versions.size === 0) {
30
- logger_1.logger.info(`no updates necessary for ${this.path}`);
31
+ if (!this.versionsMap || this.versionsMap.size === 0) {
32
+ logger_1.logger.info('no updates necessary');
31
33
  return content;
32
34
  }
33
35
  const parsed = JSON.parse(content);
34
36
  parsed.modules.forEach((module) => {
35
- if (!this.versions)
37
+ if (!this.versionsMap)
36
38
  return;
37
- for (const [key, version] of this.versions) {
39
+ for (const [key, version] of this.versionsMap) {
38
40
  if (module.name === key) {
39
41
  logger_1.logger.info(`adding ${key}@${version} to manifest`);
40
42
  module.versions.unshift(`v${version}`);
@@ -0,0 +1,12 @@
1
+ import { DefaultUpdater } from '../default';
2
+ /**
3
+ * Updates a root composer.json
4
+ */
5
+ export declare class RootComposerUpdatePackages 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
+ }
@@ -14,29 +14,30 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.RootComposerUpdatePackages = void 0;
17
- const logger_1 = require("../util/logger");
18
- const json_stringify_1 = require("../util/json-stringify");
19
- class RootComposerUpdatePackages {
20
- constructor(options) {
21
- this.create = false;
22
- this.path = options.path;
23
- this.changelogEntry = options.changelogEntry;
24
- this.version = options.version;
25
- this.versions = options.versions;
26
- this.packageName = options.packageName;
27
- }
17
+ const logger_1 = require("../../util/logger");
18
+ const json_stringify_1 = require("../../util/json-stringify");
19
+ const default_1 = require("../default");
20
+ /**
21
+ * Updates a root composer.json
22
+ */
23
+ class RootComposerUpdatePackages extends default_1.DefaultUpdater {
24
+ /**
25
+ * Given initial file contents, return updated contents.
26
+ * @param {string} content The initial content
27
+ * @returns {string} The updated content
28
+ */
28
29
  updateContent(content) {
29
- if (!this.versions || this.versions.size === 0) {
30
- logger_1.logger.info(`no updates necessary for ${this.path}`);
30
+ if (!this.versionsMap || this.versionsMap.size === 0) {
31
+ logger_1.logger.info('no updates necessary');
31
32
  return content;
32
33
  }
33
34
  const parsed = JSON.parse(content);
34
- if (this.versions) {
35
+ if (this.versionsMap) {
35
36
  // eslint-disable-next-line prefer-const
36
- for (let [key, version] of this.versions.entries()) {
37
+ for (let [key, version] of this.versionsMap.entries()) {
37
38
  version = version || '1.0.0';
38
39
  logger_1.logger.info(`updating ${key} from ${parsed.replace[key]} to ${version}`);
39
- parsed.replace[key] = version;
40
+ parsed.replace[key] = version.toString();
40
41
  }
41
42
  }
42
43
  return json_stringify_1.jsonStringify(parsed, content);
@@ -1,5 +1,4 @@
1
- import { Update, UpdateOptions, VersionsMap } from '../update';
2
- import { GitHubFileContents } from '../../github';
1
+ import { DefaultUpdater } from '../default';
3
2
  interface PyProjectContent {
4
3
  name: string;
5
4
  version: string;
@@ -14,15 +13,15 @@ export interface PyProject {
14
13
  };
15
14
  }
16
15
  export declare function parsePyProject(content: string): PyProject;
17
- export declare class PyProjectToml implements Update {
18
- path: string;
19
- changelogEntry: string;
20
- version: string;
21
- versions?: VersionsMap;
22
- packageName: string;
23
- create: boolean;
24
- contents?: GitHubFileContents;
25
- constructor(options: UpdateOptions);
16
+ /**
17
+ * Updates a pyproject.toml file
18
+ */
19
+ export declare class PyProjectToml extends DefaultUpdater {
20
+ /**
21
+ * Given initial file contents, return updated contents.
22
+ * @param {string} content The initial content
23
+ * @returns {string} The updated content
24
+ */
26
25
  updateContent(content: string): string;
27
26
  }
28
27
  export {};
@@ -15,30 +15,32 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.PyProjectToml = exports.parsePyProject = void 0;
17
17
  const TOML = require("@iarna/toml");
18
- const toml_edit_1 = require("../toml-edit");
18
+ const toml_edit_1 = require("../../util/toml-edit");
19
19
  const logger_1 = require("../../util/logger");
20
+ const default_1 = require("../default");
20
21
  function parsePyProject(content) {
21
22
  return TOML.parse(content);
22
23
  }
23
24
  exports.parsePyProject = parsePyProject;
24
- class PyProjectToml {
25
- constructor(options) {
26
- this.create = false;
27
- this.path = options.path;
28
- this.changelogEntry = options.changelogEntry;
29
- this.version = options.version;
30
- this.packageName = options.packageName;
31
- }
25
+ /**
26
+ * Updates a pyproject.toml file
27
+ */
28
+ class PyProjectToml extends default_1.DefaultUpdater {
29
+ /**
30
+ * Given initial file contents, return updated contents.
31
+ * @param {string} content The initial content
32
+ * @returns {string} The updated content
33
+ */
32
34
  updateContent(content) {
33
35
  var _a;
34
36
  const parsed = parsePyProject(content);
35
37
  const project = parsed.project || ((_a = parsed.tool) === null || _a === void 0 ? void 0 : _a.poetry);
36
38
  if (!(project === null || project === void 0 ? void 0 : project.version)) {
37
- const msg = `invalid ${this.path}`;
39
+ const msg = 'invalid file';
38
40
  logger_1.logger.error(msg);
39
41
  throw new Error(msg);
40
42
  }
41
- return toml_edit_1.replaceTomlValue(content, (parsed.project ? ['project'] : ['tool', 'poetry']).concat('version'), this.version);
43
+ return toml_edit_1.replaceTomlValue(content, (parsed.project ? ['project'] : ['tool', 'poetry']).concat('version'), this.version.toString());
42
44
  }
43
45
  }
44
46
  exports.PyProjectToml = PyProjectToml;
@@ -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
  * Python file with a __version__ property (or attribute, or whatever).
5
4
  */
6
- export declare class PythonFileWithVersion 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 PythonFileWithVersion 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,17 +14,16 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.PythonFileWithVersion = void 0;
17
+ const default_1 = require("../default");
17
18
  /**
18
19
  * Python file with a __version__ property (or attribute, or whatever).
19
20
  */
20
- class PythonFileWithVersion {
21
- constructor(options) {
22
- this.create = false;
23
- this.path = options.path;
24
- this.changelogEntry = options.changelogEntry;
25
- this.version = options.version;
26
- this.packageName = options.packageName;
27
- }
21
+ class PythonFileWithVersion 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
+ */
28
27
  updateContent(content) {
29
28
  return content.replace(/(__version__ ?= ?["'])[0-9]+\.[0-9]+\.[0-9](?:-\w+)?(["'])/, `$1${this.version}$2`);
30
29
  }
@@ -1,13 +1,12 @@
1
- import { Update, UpdateOptions, VersionsMap } from '../update';
2
- import { GitHubFileContents } from '../../github';
3
- export declare class SetupCfg 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 setup.cfg file
4
+ */
5
+ export declare class SetupCfg 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,14 +14,16 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.SetupCfg = void 0;
17
- class SetupCfg {
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 setup.cfg file
20
+ */
21
+ class SetupCfg 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
28
  return content.replace(/(version ?= ?)[0-9]+\.[0-9]+\.[0-9](?:-\w+)?/, `$1${this.version}`);
27
29
  }
@@ -1,13 +1,12 @@
1
- import { Update, UpdateOptions, VersionsMap } from '../update';
2
- import { GitHubFileContents } from '../../github';
3
- export declare class SetupPy 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 setup.py file.
4
+ */
5
+ export declare class SetupPy 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,14 +14,16 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.SetupPy = void 0;
17
- class SetupPy {
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 setup.py file.
20
+ */
21
+ class SetupPy 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
28
  return content.replace(/(version ?= ?["'])[0-9]+\.[0-9]+\.[0-9](?:-\w+)?(["'])/, `$1${this.version}$2`);
27
29
  }
@@ -0,0 +1,19 @@
1
+ import { Updater } from '../update';
2
+ /**
3
+ * This updater ignores previous content and writes the provided
4
+ * content verbatim.
5
+ */
6
+ export declare class RawContent implements Updater {
7
+ rawContent: string;
8
+ /**
9
+ * Create a new RawContent instance
10
+ * @param {string} rawContent The raw content to set as the contents.
11
+ */
12
+ constructor(rawContent: string);
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
+ }
@@ -13,16 +13,27 @@
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.getPlugin = void 0;
17
- const node_workspace_1 = require("./node-workspace");
18
- const cargo_workspace_1 = require("./cargo-workspace");
19
- const plugins = {
20
- 'node-workspace': node_workspace_1.default,
21
- 'cargo-workspace': cargo_workspace_1.default,
22
- };
23
- function getPlugin(pluginType, github, config) {
24
- const plugin = plugins[pluginType];
25
- return new plugin(github, config, pluginType);
16
+ exports.RawContent = void 0;
17
+ /**
18
+ * This updater ignores previous content and writes the provided
19
+ * content verbatim.
20
+ */
21
+ class RawContent {
22
+ /**
23
+ * Create a new RawContent instance
24
+ * @param {string} rawContent The raw content to set as the contents.
25
+ */
26
+ constructor(rawContent) {
27
+ this.rawContent = rawContent;
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
+ return this.rawContent;
36
+ }
26
37
  }
27
- exports.getPlugin = getPlugin;
28
- //# sourceMappingURL=index.js.map
38
+ exports.RawContent = RawContent;
39
+ //# sourceMappingURL=raw-content.js.map
@@ -0,0 +1,8 @@
1
+ import { Updater } from '../update';
2
+ import { ReleaserConfig } from '../manifest';
3
+ export declare class ReleasePleaseConfig implements Updater {
4
+ path: string;
5
+ config: ReleaserConfig;
6
+ constructor(path: string, config: ReleaserConfig);
7
+ updateContent(content: string): string;
8
+ }
@@ -0,0 +1,41 @@
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.ReleasePleaseConfig = void 0;
17
+ const json_stringify_1 = require("../util/json-stringify");
18
+ class ReleasePleaseConfig {
19
+ constructor(path, config) {
20
+ this.path = path;
21
+ this.config = config;
22
+ }
23
+ updateContent(content) {
24
+ let parsed;
25
+ if (content) {
26
+ parsed = JSON.parse(content);
27
+ }
28
+ else {
29
+ parsed = { packages: {} };
30
+ }
31
+ parsed.packages[this.path] = this.config;
32
+ if (content) {
33
+ return json_stringify_1.jsonStringify(parsed, content);
34
+ }
35
+ else {
36
+ return JSON.stringify(parsed, null, 2);
37
+ }
38
+ }
39
+ }
40
+ exports.ReleasePleaseConfig = ReleasePleaseConfig;
41
+ //# sourceMappingURL=release-please-config.js.map
@@ -1,13 +1,4 @@
1
- import { Update, UpdateOptions, VersionsMap } from './update';
2
- import { GitHubFileContents } from '../github';
3
- export declare class ReleasePleaseManifest 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
+ export declare class ReleasePleaseManifest extends DefaultUpdater {
12
3
  updateContent(content: string): string;
13
4
  }
@@ -15,22 +15,19 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ReleasePleaseManifest = void 0;
17
17
  const json_stringify_1 = require("../util/json-stringify");
18
- class ReleasePleaseManifest {
19
- constructor(options) {
20
- this.changelogEntry = '';
21
- this.version = '';
22
- this.packageName = '';
23
- this.create = false;
24
- this.path = options.path;
25
- this.versions = options.versions;
26
- this.contents = options.contents;
27
- }
18
+ const default_1 = require("./default");
19
+ class ReleasePleaseManifest extends default_1.DefaultUpdater {
28
20
  updateContent(content) {
29
- const parsed = JSON.parse(content);
30
- for (const [path, version] of this.versions) {
31
- parsed[path] = version;
21
+ const parsed = content ? JSON.parse(content) : {};
22
+ for (const [path, version] of this.versionsMap) {
23
+ parsed[path] = version.toString();
24
+ }
25
+ if (content) {
26
+ return json_stringify_1.jsonStringify(parsed, content);
27
+ }
28
+ else {
29
+ return JSON.stringify(parsed, null, 2);
32
30
  }
33
- return json_stringify_1.jsonStringify(parsed, content, Object.keys(parsed).sort());
34
31
  }
35
32
  }
36
33
  exports.ReleasePleaseManifest = ReleasePleaseManifest;
@@ -0,0 +1,12 @@
1
+ import { DefaultUpdater } from '../default';
2
+ /**
3
+ * Updates a versions.rb file which is expected to have a version string.
4
+ */
5
+ export declare class VersionRB 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
+ }
@@ -14,14 +14,16 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.VersionRB = void 0;
17
- class VersionRB {
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 versions.rb file which is expected to have a version string.
20
+ */
21
+ class VersionRB 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
28
  return content.replace(/(["'])[0-9]+\.[0-9]+\.[0-9](-\w+)?["']/, `$1${this.version}$1`);
27
29
  }
@@ -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.lock` lockfiles, preserving formatting and comments.
5
4
  */
6
- export declare class CargoLock 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 CargoLock 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,30 +14,28 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CargoLock = 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.lock` lockfiles, preserving formatting and comments.
22
23
  */
23
- class CargoLock {
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 CargoLock 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
  let payload = content;
34
- if (!this.versions) {
32
+ if (!this.versionsMap) {
35
33
  throw new Error('updateContent called with no versions');
36
34
  }
37
35
  const parsed = common_1.parseCargoLockfile(payload);
38
36
  if (!parsed.package) {
39
- logger_1.logger.error(`${this.path} is not a Cargo lockfile`);
40
- throw new Error(`${this.path} is not a Cargo lockfile`);
37
+ logger_1.logger.error('is not a Cargo lockfile');
38
+ throw new Error('is not a Cargo lockfile');
41
39
  }
42
40
  // n.b for `replaceTomlString`, we need to keep track of the index
43
41
  // (position) of the package we're considering.
@@ -48,7 +46,7 @@ class CargoLock {
48
46
  // but if they don't, ignore them silently.
49
47
  continue; // to next package
50
48
  }
51
- const nextVersion = this.versions.get(pkg.name);
49
+ const nextVersion = this.versionsMap.get(pkg.name);
52
50
  if (!nextVersion) {
53
51
  // this package is not upgraded.
54
52
  continue; // to next package
@@ -57,8 +55,8 @@ class CargoLock {
57
55
  // which is lucky because `replaceTomlString` expect "all strings" in its
58
56
  // `path` argument.
59
57
  const packageIndex = i.toString();
60
- logger_1.logger.info(`updating ${pkg.name} in ${this.path}`);
61
- payload = toml_edit_1.replaceTomlValue(payload, ['package', packageIndex, 'version'], nextVersion);
58
+ logger_1.logger.info(`updating ${pkg.name} in`);
59
+ payload = toml_edit_1.replaceTomlValue(payload, ['package', packageIndex, 'version'], nextVersion.toString());
62
60
  }
63
61
  return payload;
64
62
  }