release-please 12.3.0 → 12.6.1

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 (140) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +5 -0
  3. package/build/src/bin/release-please.d.ts +2 -0
  4. package/build/src/bin/release-please.js +7 -0
  5. package/build/src/bootstrapper.d.ts +12 -0
  6. package/build/src/bootstrapper.js +60 -0
  7. package/build/src/changelog-notes/default.d.ts +15 -0
  8. package/build/src/changelog-notes/default.js +71 -0
  9. package/build/src/changelog-notes/github.d.ts +8 -0
  10. package/build/src/changelog-notes/github.js +26 -0
  11. package/build/src/changelog-notes.d.ts +19 -0
  12. package/build/src/changelog-notes.js +16 -0
  13. package/build/src/commit.d.ts +26 -0
  14. package/build/src/commit.js +316 -0
  15. package/build/src/constants.d.ts +1 -0
  16. package/build/src/constants.js +2 -1
  17. package/build/src/factory.js +2 -1
  18. package/build/src/github.d.ts +1 -0
  19. package/build/src/github.js +3 -2
  20. package/build/src/index.d.ts +1 -0
  21. package/build/src/plugin.d.ts +20 -0
  22. package/build/src/plugin.js +31 -0
  23. package/build/src/plugins/merge.d.ts +11 -0
  24. package/build/src/plugins/merge.js +83 -0
  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/pull-request.js +16 -0
  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/release-pull-request.js +16 -0
  33. package/build/src/release.d.ts +6 -0
  34. package/build/src/release.js +16 -0
  35. package/build/src/releasers/dart.d.ts +9 -0
  36. package/build/src/releasers/dart.js +65 -0
  37. package/build/src/releasers/index.d.ts +1 -1
  38. package/build/src/releasers/index.js +4 -0
  39. package/build/src/releasers/java-backport.d.ts +9 -0
  40. package/build/src/releasers/java-backport.js +43 -0
  41. package/build/src/repository.d.ts +5 -0
  42. package/build/src/repository.js +16 -0
  43. package/build/src/strategies/dart.d.ts +8 -0
  44. package/build/src/strategies/dart.js +63 -0
  45. package/build/src/strategies/elixir.d.ts +5 -0
  46. package/build/src/strategies/elixir.js +45 -0
  47. package/build/src/strategies/go-yoshi.d.ts +13 -0
  48. package/build/src/strategies/go-yoshi.js +114 -0
  49. package/build/src/strategies/go.d.ts +5 -0
  50. package/build/src/strategies/go.js +36 -0
  51. package/build/src/strategies/helm.d.ts +8 -0
  52. package/build/src/strategies/helm.js +63 -0
  53. package/build/src/strategies/java-yoshi.d.ts +25 -0
  54. package/build/src/strategies/java-yoshi.js +259 -0
  55. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  56. package/build/src/strategies/krm-blueprint.js +64 -0
  57. package/build/src/strategies/node.d.ts +9 -0
  58. package/build/src/strategies/node.js +82 -0
  59. package/build/src/strategies/ocaml.d.ts +5 -0
  60. package/build/src/strategies/ocaml.js +75 -0
  61. package/build/src/strategies/php-yoshi.d.ts +10 -0
  62. package/build/src/strategies/php-yoshi.js +214 -0
  63. package/build/src/strategies/php.d.ts +6 -0
  64. package/build/src/strategies/php.js +67 -0
  65. package/build/src/strategies/python.d.ts +8 -0
  66. package/build/src/strategies/python.js +117 -0
  67. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  68. package/build/src/strategies/ruby-yoshi.js +116 -0
  69. package/build/src/strategies/ruby.d.ts +13 -0
  70. package/build/src/strategies/ruby.js +61 -0
  71. package/build/src/strategies/rust.d.ts +20 -0
  72. package/build/src/strategies/rust.js +120 -0
  73. package/build/src/strategies/simple.d.ts +5 -0
  74. package/build/src/strategies/simple.js +45 -0
  75. package/build/src/strategies/terraform-module.d.ts +7 -0
  76. package/build/src/strategies/terraform-module.js +72 -0
  77. package/build/src/strategy.d.ts +103 -0
  78. package/build/src/strategy.js +249 -0
  79. package/build/src/update.d.ts +23 -0
  80. package/build/src/update.js +16 -0
  81. package/build/src/updaters/composite.d.ts +19 -0
  82. package/build/src/updaters/composite.js +42 -0
  83. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  84. package/build/src/updaters/dart/pubspec-yaml.js +45 -0
  85. package/build/src/updaters/default.d.ts +21 -0
  86. package/build/src/updaters/default.js +36 -0
  87. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  88. package/build/src/updaters/dotnet/csproj.js +33 -0
  89. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  90. package/build/src/updaters/elixir/elixir-mix-exs.js +37 -0
  91. package/build/src/updaters/go/version-go.d.ts +4 -0
  92. package/build/src/updaters/go/version-go.js +24 -0
  93. package/build/src/updaters/java/java-update.d.ts +14 -0
  94. package/build/src/updaters/java/java-update.js +76 -0
  95. package/build/src/updaters/node/package-json.d.ts +12 -0
  96. package/build/src/updaters/node/package-json.js +37 -0
  97. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  98. package/build/src/updaters/node/package-lock-json.js +36 -0
  99. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  100. package/build/src/updaters/node/samples-package-json.js +49 -0
  101. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  102. package/build/src/updaters/php/php-client-version.js +32 -0
  103. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  104. package/build/src/updaters/php/php-manifest.js +55 -0
  105. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  106. package/build/src/updaters/php/root-composer-update-packages.js +47 -0
  107. package/build/src/updaters/pubspec-yaml.d.ts +13 -0
  108. package/build/src/updaters/pubspec-yaml.js +44 -0
  109. package/build/src/updaters/raw-content.d.ts +19 -0
  110. package/build/src/updaters/raw-content.js +39 -0
  111. package/build/src/updaters/release-please-config.d.ts +8 -0
  112. package/build/src/updaters/release-please-config.js +41 -0
  113. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  114. package/build/src/updaters/ruby/version-rb.js +32 -0
  115. package/build/src/updaters/rust/cargo-toml.js +5 -1
  116. package/build/src/util/commit-split.d.ts +11 -0
  117. package/build/src/util/commit-split.js +94 -0
  118. package/build/src/util/pull-request-body.d.ts +20 -0
  119. package/build/src/util/pull-request-body.js +129 -0
  120. package/build/src/util/tag-name.d.ts +9 -0
  121. package/build/src/util/tag-name.js +41 -0
  122. package/build/src/util/toml-edit.d.ts +8 -0
  123. package/build/src/util/toml-edit.js +125 -0
  124. package/build/src/version.d.ts +11 -0
  125. package/build/src/version.js +45 -0
  126. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  127. package/build/src/versioning-strategies/always-bump-patch.js +25 -0
  128. package/build/src/versioning-strategies/default.d.ts +15 -0
  129. package/build/src/versioning-strategies/default.js +67 -0
  130. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  131. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  132. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  133. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  134. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  135. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  136. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  137. package/build/src/versioning-strategies/service-pack.js +40 -0
  138. package/build/src/versioning-strategy.d.ts +28 -0
  139. package/build/src/versioning-strategy.js +55 -0
  140. package/package.json +3 -3
@@ -0,0 +1,6 @@
1
+ import { TagName } from './util/tag-name';
2
+ export interface Release {
3
+ readonly tag: TagName;
4
+ readonly sha: string;
5
+ readonly notes: string;
6
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright 2021 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ //# sourceMappingURL=release.js.map
@@ -0,0 +1,9 @@
1
+ import { ReleasePR, ReleaseCandidate, PackageName } from '../release-pr';
2
+ import { Update } from '../updaters/update';
3
+ export declare class Dart extends ReleasePR {
4
+ private pubspecYmlContents?;
5
+ private _packageName?;
6
+ protected buildUpdates(changelogEntry: string, candidate: ReleaseCandidate, packageName: PackageName): Promise<Update[]>;
7
+ getPackageName(): Promise<PackageName>;
8
+ private getPubspecYmlContents;
9
+ }
@@ -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.Dart = void 0;
17
+ const release_pr_1 = require("../release-pr");
18
+ // Generic
19
+ const changelog_1 = require("../updaters/changelog");
20
+ const yaml = require("js-yaml");
21
+ // pubspec
22
+ const pubspec_yaml_1 = require("../updaters/pubspec-yaml");
23
+ class Dart extends release_pr_1.ReleasePR {
24
+ async buildUpdates(changelogEntry, candidate, packageName) {
25
+ const updates = [];
26
+ updates.push(new changelog_1.Changelog({
27
+ path: this.addPath(this.changelogPath),
28
+ changelogEntry,
29
+ version: candidate.version,
30
+ packageName: packageName.name,
31
+ }));
32
+ updates.push(new pubspec_yaml_1.PubspecYaml({
33
+ path: this.addPath('pubspec.yaml'),
34
+ changelogEntry,
35
+ version: candidate.version,
36
+ packageName: packageName.name,
37
+ }));
38
+ return updates;
39
+ }
40
+ async getPackageName() {
41
+ var _a;
42
+ if (this._packageName === undefined) {
43
+ const pubspecYmlContents = await this.getPubspecYmlContents();
44
+ const pubspec = yaml.load(pubspecYmlContents.parsedContent, { json: true });
45
+ if (typeof pubspec === 'object') {
46
+ this.packageName = this._packageName = (_a = pubspec.name) !== null && _a !== void 0 ? _a : this.packageName;
47
+ }
48
+ else {
49
+ this._packageName = this.packageName;
50
+ }
51
+ }
52
+ return {
53
+ name: this.packageName,
54
+ getComponent: () => this.packageName,
55
+ };
56
+ }
57
+ async getPubspecYmlContents() {
58
+ if (!this.pubspecYmlContents) {
59
+ this.pubspecYmlContents = await this.gh.getFileContents(this.addPath('pubspec.yaml'));
60
+ }
61
+ return this.pubspecYmlContents;
62
+ }
63
+ }
64
+ exports.Dart = Dart;
65
+ //# sourceMappingURL=dart.js.map
@@ -1,5 +1,5 @@
1
1
  import { ReleasePR } from '../release-pr';
2
- export declare type ReleaseType = 'go' | 'go-yoshi' | 'java-bom' | 'java-lts' | 'java-yoshi' | 'krm-blueprint' | 'node' | 'ocaml' | 'php' | 'php-yoshi' | 'python' | 'ruby' | 'ruby-yoshi' | 'rust' | 'simple' | 'terraform-module' | 'helm' | 'elixir';
2
+ export declare type ReleaseType = 'go' | 'go-yoshi' | 'java-backport' | 'java-bom' | 'java-lts' | 'java-yoshi' | 'krm-blueprint' | 'node' | 'ocaml' | 'php' | 'php-yoshi' | 'python' | 'ruby' | 'ruby-yoshi' | 'rust' | 'simple' | 'terraform-module' | 'helm' | 'elixir' | 'dart';
3
3
  declare type Releasers = Record<ReleaseType, typeof ReleasePR>;
4
4
  export declare function getReleasers(): Releasers;
5
5
  export declare function getReleaserNames(): string[];
@@ -32,9 +32,12 @@ const rust_1 = require("./rust");
32
32
  const ocaml_1 = require("./ocaml");
33
33
  const helm_1 = require("./helm");
34
34
  const elixir_1 = require("./elixir");
35
+ const java_backport_1 = require("./java-backport");
36
+ const dart_1 = require("./dart");
35
37
  const releasers = {
36
38
  go: go_1.Go,
37
39
  'go-yoshi': go_yoshi_1.GoYoshi,
40
+ 'java-backport': java_backport_1.JavaBackport,
38
41
  'java-bom': java_bom_1.JavaBom,
39
42
  'java-lts': java_lts_1.JavaLTS,
40
43
  'java-yoshi': java_yoshi_1.JavaYoshi,
@@ -51,6 +54,7 @@ const releasers = {
51
54
  'terraform-module': terraform_module_1.TerraformModule,
52
55
  helm: helm_1.Helm,
53
56
  elixir: elixir_1.Elixir,
57
+ dart: dart_1.Dart,
54
58
  };
55
59
  function getReleasers() {
56
60
  return releasers;
@@ -0,0 +1,9 @@
1
+ import { ReleaseCandidate } from '../release-pr';
2
+ import { ConventionalCommits } from '../conventional-commits';
3
+ import { GitHubTag } from '../github';
4
+ import { VersionsMap } from '../updaters/update';
5
+ import { JavaYoshi } from './java-yoshi';
6
+ export declare class JavaBackport extends JavaYoshi {
7
+ protected coerceVersions(_cc: ConventionalCommits, _candidate: ReleaseCandidate, _latestTag: GitHubTag | undefined, currentVersions: VersionsMap): Promise<VersionsMap>;
8
+ protected coerceReleaseCandidate(cc: ConventionalCommits, latestTag: GitHubTag | undefined, _preRelease?: boolean): Promise<ReleaseCandidate>;
9
+ }
@@ -0,0 +1,43 @@
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.JavaBackport = void 0;
17
+ // Java
18
+ const version_1 = require("./java/version");
19
+ const java_yoshi_1 = require("./java-yoshi");
20
+ // This release strategy always bumps the patch version
21
+ class JavaBackport extends java_yoshi_1.JavaYoshi {
22
+ async coerceVersions(_cc, _candidate, _latestTag, currentVersions) {
23
+ const bumpType = this.snapshot ? 'snapshot' : 'patch';
24
+ const newVersions = new Map();
25
+ for (const [k, version] of currentVersions) {
26
+ newVersions.set(k, version_1.Version.parse(version).bump(bumpType).toString());
27
+ }
28
+ return newVersions;
29
+ }
30
+ async coerceReleaseCandidate(cc, latestTag, _preRelease = false) {
31
+ var _a;
32
+ const bumpType = this.snapshot ? 'snapshot' : 'patch';
33
+ const version = version_1.Version.parse((_a = latestTag === null || latestTag === void 0 ? void 0 : latestTag.version) !== null && _a !== void 0 ? _a : this.defaultInitialVersion())
34
+ .bump(bumpType)
35
+ .toString();
36
+ return {
37
+ previousTag: latestTag === null || latestTag === void 0 ? void 0 : latestTag.version,
38
+ version,
39
+ };
40
+ }
41
+ }
42
+ exports.JavaBackport = JavaBackport;
43
+ //# sourceMappingURL=java-backport.js.map
@@ -0,0 +1,5 @@
1
+ export interface Repository {
2
+ readonly owner: string;
3
+ readonly repo: string;
4
+ readonly defaultBranch: string;
5
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright 2021 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ //# sourceMappingURL=repository.js.map
@@ -0,0 +1,8 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Dart extends Strategy {
4
+ private pubspecYmlContents?;
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ getDefaultPackageName(): Promise<string | undefined>;
7
+ private getPubspecYmlContents;
8
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ // Copyright 2021 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.Dart = void 0;
17
+ // Generic
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const yaml = require("js-yaml");
20
+ // pubspec
21
+ const pubspec_yaml_1 = require("../updaters/dart/pubspec-yaml");
22
+ const strategy_1 = require("../strategy");
23
+ class Dart extends strategy_1.Strategy {
24
+ async buildUpdates(options) {
25
+ const updates = [];
26
+ const version = options.newVersion;
27
+ updates.push({
28
+ path: this.addPath(this.changelogPath),
29
+ createIfMissing: true,
30
+ updater: new changelog_1.Changelog({
31
+ version,
32
+ changelogEntry: options.changelogEntry,
33
+ }),
34
+ });
35
+ updates.push({
36
+ path: this.addPath('pubspec.yaml'),
37
+ createIfMissing: false,
38
+ cachedFileContents: this.pubspecYmlContents,
39
+ updater: new pubspec_yaml_1.PubspecYaml({
40
+ version,
41
+ }),
42
+ });
43
+ return updates;
44
+ }
45
+ async getDefaultPackageName() {
46
+ const pubspecYmlContents = await this.getPubspecYmlContents();
47
+ const pubspec = yaml.load(pubspecYmlContents.parsedContent, { json: true });
48
+ if (typeof pubspec === 'object') {
49
+ return pubspec.name;
50
+ }
51
+ else {
52
+ return undefined;
53
+ }
54
+ }
55
+ async getPubspecYmlContents() {
56
+ if (!this.pubspecYmlContents) {
57
+ this.pubspecYmlContents = await this.github.getFileContentsOnBranch(this.addPath('pubspec.yaml'), this.targetBranch);
58
+ }
59
+ return this.pubspecYmlContents;
60
+ }
61
+ }
62
+ exports.Dart = Dart;
63
+ //# sourceMappingURL=dart.js.map
@@ -0,0 +1,5 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Elixir extends Strategy {
4
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
+ }
@@ -0,0 +1,45 @@
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.Elixir = void 0;
17
+ // Generic
18
+ const changelog_1 = require("../updaters/changelog");
19
+ // mix.exs support
20
+ const elixir_mix_exs_1 = require("../updaters/elixir/elixir-mix-exs");
21
+ const strategy_1 = require("../strategy");
22
+ class Elixir extends strategy_1.Strategy {
23
+ async buildUpdates(options) {
24
+ const updates = [];
25
+ const version = options.newVersion;
26
+ updates.push({
27
+ path: this.addPath(this.changelogPath),
28
+ createIfMissing: true,
29
+ updater: new changelog_1.Changelog({
30
+ version,
31
+ changelogEntry: options.changelogEntry,
32
+ }),
33
+ });
34
+ updates.push({
35
+ path: this.addPath('mix.exs'),
36
+ createIfMissing: false,
37
+ updater: new elixir_mix_exs_1.ElixirMixExs({
38
+ version,
39
+ }),
40
+ });
41
+ return updates;
42
+ }
43
+ }
44
+ exports.Elixir = Elixir;
45
+ //# sourceMappingURL=elixir.js.map
@@ -0,0 +1,13 @@
1
+ import { Strategy, BuildUpdatesOptions, StrategyOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ import { ConventionalCommit } from '../commit';
4
+ import { Version } from '../version';
5
+ import { TagName } from '../util/tag-name';
6
+ import { Release } from '../release';
7
+ export declare class GoYoshi extends Strategy {
8
+ constructor(options: StrategyOptions);
9
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
10
+ protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
11
+ protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
12
+ protected initialReleaseVersion(): Version;
13
+ }
@@ -0,0 +1,114 @@
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.GoYoshi = void 0;
17
+ const strategy_1 = require("../strategy");
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const version_1 = require("../version");
20
+ const version_go_1 = require("../updaters/go/version-go");
21
+ // Commits containing a scope prefixed with an item in this array will be
22
+ // ignored when generating a release PR for the parent module.
23
+ const IGNORED_SUB_MODULES = new Set([
24
+ 'bigtable',
25
+ 'bigquery',
26
+ 'datastore',
27
+ 'firestore',
28
+ 'logging',
29
+ 'pubsub',
30
+ 'pubsublite',
31
+ 'spanner',
32
+ 'storage',
33
+ ]);
34
+ const REGEN_PR_REGEX = /.*auto-regenerate.*/;
35
+ const REGEN_ISSUE_REGEX = /(?<prefix>.*)\(#(?<pr>.*)\)(\n|$)/;
36
+ class GoYoshi extends strategy_1.Strategy {
37
+ constructor(options) {
38
+ var _a;
39
+ options.changelogPath = (_a = options.changelogPath) !== null && _a !== void 0 ? _a : 'CHANGES.md';
40
+ super(options);
41
+ }
42
+ async buildUpdates(options) {
43
+ const updates = [];
44
+ const version = options.newVersion;
45
+ updates.push({
46
+ path: this.addPath(this.changelogPath),
47
+ createIfMissing: true,
48
+ updater: new changelog_1.Changelog({
49
+ version,
50
+ changelogEntry: options.changelogEntry,
51
+ }),
52
+ });
53
+ updates.push({
54
+ path: this.addPath('internal/version.go'),
55
+ createIfMissing: false,
56
+ updater: new version_go_1.VersionGo({
57
+ version,
58
+ }),
59
+ });
60
+ return updates;
61
+ }
62
+ postProcessCommits(commits) {
63
+ let regenCommit;
64
+ return commits.filter(commit => {
65
+ var _a, _b;
66
+ // ignore commits whose scope is in the list of ignored modules
67
+ if (IGNORED_SUB_MODULES.has(commit.scope || '')) {
68
+ return false;
69
+ }
70
+ // Only have a single entry of the nightly regen listed in the changelog.
71
+ // If there are more than one of these commits, append associated PR.
72
+ if (this.repository.owner === 'googleapis' &&
73
+ this.repository.repo === 'google-api-go-client' &&
74
+ REGEN_PR_REGEX.test(commit.message)) {
75
+ if (regenCommit) {
76
+ const match = commit.message.match(REGEN_ISSUE_REGEX);
77
+ if ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.pr) {
78
+ regenCommit.references.push({
79
+ action: 'refs',
80
+ issue: match.groups.pr,
81
+ prefix: '#',
82
+ });
83
+ }
84
+ return false;
85
+ }
86
+ else {
87
+ commit.sha = '';
88
+ regenCommit = commit;
89
+ const match = commit.bareMessage.match(REGEN_ISSUE_REGEX);
90
+ if ((_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.pr) {
91
+ regenCommit.references.push({
92
+ action: 'refs',
93
+ issue: match.groups.pr,
94
+ prefix: '#',
95
+ });
96
+ regenCommit.bareMessage = match.groups.prefix.trim();
97
+ }
98
+ }
99
+ }
100
+ return true;
101
+ });
102
+ }
103
+ // "closes" is a little presumptuous, let's just indicate that the
104
+ // PR references these other commits:
105
+ async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
106
+ const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
107
+ return releaseNotes.replace(/, closes /g, ', refs ');
108
+ }
109
+ initialReleaseVersion() {
110
+ return version_1.Version.parse('0.1.0');
111
+ }
112
+ }
113
+ exports.GoYoshi = GoYoshi;
114
+ //# sourceMappingURL=go-yoshi.js.map
@@ -0,0 +1,5 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Go extends Strategy {
4
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
+ }
@@ -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.Go = void 0;
17
+ // Generic
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const strategy_1 = require("../strategy");
20
+ class Go extends strategy_1.Strategy {
21
+ async buildUpdates(options) {
22
+ const updates = [];
23
+ const version = options.newVersion;
24
+ updates.push({
25
+ path: this.addPath(this.changelogPath),
26
+ createIfMissing: true,
27
+ updater: new changelog_1.Changelog({
28
+ version,
29
+ changelogEntry: options.changelogEntry,
30
+ }),
31
+ });
32
+ return updates;
33
+ }
34
+ }
35
+ exports.Go = Go;
36
+ //# sourceMappingURL=go.js.map
@@ -0,0 +1,8 @@
1
+ import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { Update } from '../update';
3
+ export declare class Helm extends Strategy {
4
+ private chartYmlContents?;
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ getDefaultPackageName(): Promise<string | undefined>;
7
+ private getChartYmlContents;
8
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ // Copyright 2021 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.Helm = void 0;
17
+ // Generic
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const yaml = require("js-yaml");
20
+ // helm
21
+ const chart_yaml_1 = require("../updaters/helm/chart-yaml");
22
+ const strategy_1 = require("../strategy");
23
+ class Helm extends strategy_1.Strategy {
24
+ async buildUpdates(options) {
25
+ const updates = [];
26
+ const version = options.newVersion;
27
+ updates.push({
28
+ path: this.addPath(this.changelogPath),
29
+ createIfMissing: true,
30
+ updater: new changelog_1.Changelog({
31
+ version,
32
+ changelogEntry: options.changelogEntry,
33
+ }),
34
+ });
35
+ updates.push({
36
+ path: this.addPath('Chart.yaml'),
37
+ createIfMissing: false,
38
+ cachedFileContents: this.chartYmlContents,
39
+ updater: new chart_yaml_1.ChartYaml({
40
+ version,
41
+ }),
42
+ });
43
+ return updates;
44
+ }
45
+ async getDefaultPackageName() {
46
+ const chartYmlContents = await this.getChartYmlContents();
47
+ const chart = yaml.load(chartYmlContents.parsedContent, { json: true });
48
+ if (typeof chart === 'object') {
49
+ return chart.name;
50
+ }
51
+ else {
52
+ return undefined;
53
+ }
54
+ }
55
+ async getChartYmlContents() {
56
+ if (!this.chartYmlContents) {
57
+ this.chartYmlContents = await this.github.getFileContents(this.addPath('Chart.yaml'));
58
+ }
59
+ return this.chartYmlContents;
60
+ }
61
+ }
62
+ exports.Helm = Helm;
63
+ //# sourceMappingURL=helm.js.map
@@ -0,0 +1,25 @@
1
+ import { Update } from '../update';
2
+ import { Version, VersionsMap } from '../version';
3
+ import { Strategy, StrategyOptions, BuildUpdatesOptions } from '../strategy';
4
+ import { GitHubFileContents } from '../github';
5
+ import { Commit, ConventionalCommit } from '../commit';
6
+ import { Release } from '../release';
7
+ import { ReleasePullRequest } from '../release-pull-request';
8
+ interface JavaStrategyOptions extends StrategyOptions {
9
+ extraFiles?: string[];
10
+ }
11
+ export declare class JavaYoshi extends Strategy {
12
+ readonly extraFiles: string[];
13
+ private versionsContent?;
14
+ private snapshotVersioning;
15
+ constructor(options: JavaStrategyOptions);
16
+ buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest | undefined>;
17
+ private buildSnapshotPullRequest;
18
+ private needsSnapshot;
19
+ protected buildVersionsMap(): Promise<VersionsMap>;
20
+ protected getVersionsContent(): Promise<GitHubFileContents>;
21
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
22
+ protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
23
+ protected initialReleaseVersion(): Version;
24
+ }
25
+ export {};