release-please 13.0.0-candidate.5 → 13.0.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 (75) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +33 -131
  3. package/build/src/bin/release-please.js +12 -1
  4. package/build/src/changelog-notes.d.ts +1 -0
  5. package/build/src/changelog-notes.js +24 -0
  6. package/build/src/commit.d.ts +1 -1
  7. package/build/src/commit.js +14 -1
  8. package/build/src/github.d.ts +41 -7
  9. package/build/src/github.js +51 -14
  10. package/build/src/manifest.js +76 -20
  11. package/build/src/plugins/cargo-workspace.js +2 -2
  12. package/build/src/plugins/merge.js +4 -1
  13. package/build/src/plugins/node-workspace.js +2 -2
  14. package/build/src/pull-request.d.ts +8 -8
  15. package/build/src/release-pull-request.d.ts +6 -6
  16. package/build/src/strategies/base.d.ts +108 -0
  17. package/build/src/strategies/base.js +253 -0
  18. package/build/src/strategies/dart.d.ts +2 -2
  19. package/build/src/strategies/dart.js +2 -2
  20. package/build/src/strategies/elixir.d.ts +2 -2
  21. package/build/src/strategies/elixir.js +2 -2
  22. package/build/src/strategies/go-yoshi.d.ts +3 -3
  23. package/build/src/strategies/go-yoshi.js +2 -2
  24. package/build/src/strategies/go.d.ts +2 -2
  25. package/build/src/strategies/go.js +2 -2
  26. package/build/src/strategies/helm.d.ts +2 -2
  27. package/build/src/strategies/helm.js +2 -2
  28. package/build/src/strategies/java-yoshi.d.ts +3 -3
  29. package/build/src/strategies/java-yoshi.js +2 -2
  30. package/build/src/strategies/krm-blueprint.d.ts +2 -2
  31. package/build/src/strategies/krm-blueprint.js +3 -3
  32. package/build/src/strategies/node.d.ts +2 -2
  33. package/build/src/strategies/node.js +2 -2
  34. package/build/src/strategies/ocaml.d.ts +2 -2
  35. package/build/src/strategies/ocaml.js +2 -2
  36. package/build/src/strategies/php-yoshi.d.ts +3 -3
  37. package/build/src/strategies/php-yoshi.js +2 -2
  38. package/build/src/strategies/php.d.ts +3 -3
  39. package/build/src/strategies/php.js +2 -2
  40. package/build/src/strategies/python.d.ts +2 -2
  41. package/build/src/strategies/python.js +2 -2
  42. package/build/src/strategies/ruby-yoshi.d.ts +3 -3
  43. package/build/src/strategies/ruby-yoshi.js +7 -2
  44. package/build/src/strategies/ruby.d.ts +3 -3
  45. package/build/src/strategies/ruby.js +2 -2
  46. package/build/src/strategies/rust.d.ts +2 -2
  47. package/build/src/strategies/rust.js +2 -2
  48. package/build/src/strategies/simple.d.ts +2 -2
  49. package/build/src/strategies/simple.js +2 -2
  50. package/build/src/strategies/terraform-module.d.ts +2 -2
  51. package/build/src/strategies/terraform-module.js +2 -2
  52. package/build/src/strategy.d.ts +8 -73
  53. package/build/src/strategy.js +0 -233
  54. package/build/src/updaters/rust/cargo-toml.js +5 -1
  55. package/build/src/util/commit-split.js +3 -0
  56. package/build/src/util/pull-request-title.js +1 -0
  57. package/build/src/version.d.ts +28 -5
  58. package/build/src/version.js +26 -0
  59. package/build/src/versioning-strategies/always-bump-patch.d.ts +4 -0
  60. package/build/src/versioning-strategies/always-bump-patch.js +4 -0
  61. package/build/src/versioning-strategies/default.d.ts +31 -0
  62. package/build/src/versioning-strategies/default.js +31 -0
  63. package/build/src/versioning-strategies/dependency-manifest.d.ts +8 -0
  64. package/build/src/versioning-strategies/dependency-manifest.js +8 -0
  65. package/build/src/versioning-strategies/java-add-snapshot.d.ts +4 -0
  66. package/build/src/versioning-strategies/java-add-snapshot.js +6 -5
  67. package/build/src/versioning-strategies/java-snapshot.d.ts +4 -0
  68. package/build/src/versioning-strategies/java-snapshot.js +4 -1
  69. package/build/src/versioning-strategies/service-pack.d.ts +5 -0
  70. package/build/src/versioning-strategies/service-pack.js +10 -3
  71. package/build/src/versioning-strategy.d.ts +67 -5
  72. package/build/src/versioning-strategy.js +37 -10
  73. package/package.json +3 -3
  74. package/build/src/release-notes.d.ts +0 -29
  75. package/build/src/release-notes.js +0 -71
@@ -1,11 +1,11 @@
1
- import { Strategy, BuildUpdatesOptions, StrategyOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { Update } from '../update';
3
3
  import { ConventionalCommit } from '../commit';
4
4
  import { Version } from '../version';
5
5
  import { TagName } from '../util/tag-name';
6
6
  import { Release } from '../release';
7
- export declare class GoYoshi extends Strategy {
8
- constructor(options: StrategyOptions);
7
+ export declare class GoYoshi extends BaseStrategy {
8
+ constructor(options: BaseStrategyOptions);
9
9
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
10
10
  protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
11
11
  protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.GoYoshi = void 0;
17
- const strategy_1 = require("../strategy");
17
+ const base_1 = require("./base");
18
18
  const changelog_1 = require("../updaters/changelog");
19
19
  const version_1 = require("../version");
20
20
  const version_go_1 = require("../updaters/go/version-go");
@@ -33,7 +33,7 @@ const IGNORED_SUB_MODULES = new Set([
33
33
  ]);
34
34
  const REGEN_PR_REGEX = /.*auto-regenerate.*/;
35
35
  const REGEN_ISSUE_REGEX = /(?<prefix>.*)\(#(?<pr>.*)\)(\n|$)/;
36
- class GoYoshi extends strategy_1.Strategy {
36
+ class GoYoshi extends base_1.BaseStrategy {
37
37
  constructor(options) {
38
38
  var _a;
39
39
  options.changelogPath = (_a = options.changelogPath) !== null && _a !== void 0 ? _a : 'CHANGES.md';
@@ -1,5 +1,5 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
- export declare class Go extends Strategy {
3
+ export declare class Go extends BaseStrategy {
4
4
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
5
  }
@@ -16,8 +16,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Go = void 0;
17
17
  // Generic
18
18
  const changelog_1 = require("../updaters/changelog");
19
- const strategy_1 = require("../strategy");
20
- class Go extends strategy_1.Strategy {
19
+ const base_1 = require("./base");
20
+ class Go extends base_1.BaseStrategy {
21
21
  async buildUpdates(options) {
22
22
  const updates = [];
23
23
  const version = options.newVersion;
@@ -1,6 +1,6 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
- export declare class Helm extends Strategy {
3
+ export declare class Helm extends BaseStrategy {
4
4
  private chartYmlContents?;
5
5
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
6
  getDefaultPackageName(): Promise<string | undefined>;
@@ -19,8 +19,8 @@ const changelog_1 = require("../updaters/changelog");
19
19
  const yaml = require("js-yaml");
20
20
  // helm
21
21
  const chart_yaml_1 = require("../updaters/helm/chart-yaml");
22
- const strategy_1 = require("../strategy");
23
- class Helm extends strategy_1.Strategy {
22
+ const base_1 = require("./base");
23
+ class Helm extends base_1.BaseStrategy {
24
24
  async buildUpdates(options) {
25
25
  const updates = [];
26
26
  const version = options.newVersion;
@@ -1,14 +1,14 @@
1
1
  import { Update } from '../update';
2
2
  import { Version, VersionsMap } from '../version';
3
- import { Strategy, StrategyOptions, BuildUpdatesOptions } from '../strategy';
3
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
4
4
  import { GitHubFileContents } from '../github';
5
5
  import { Commit, ConventionalCommit } from '../commit';
6
6
  import { Release } from '../release';
7
7
  import { ReleasePullRequest } from '../release-pull-request';
8
- interface JavaStrategyOptions extends StrategyOptions {
8
+ interface JavaStrategyOptions extends BaseStrategyOptions {
9
9
  extraFiles?: string[];
10
10
  }
11
- export declare class JavaYoshi extends Strategy {
11
+ export declare class JavaYoshi extends BaseStrategy {
12
12
  readonly extraFiles: string[];
13
13
  private versionsContent?;
14
14
  private snapshotVersioning;
@@ -17,7 +17,7 @@ exports.JavaYoshi = void 0;
17
17
  const versions_manifest_1 = require("../updaters/java/versions-manifest");
18
18
  const version_1 = require("../version");
19
19
  const java_update_1 = require("../updaters/java/java-update");
20
- const strategy_1 = require("../strategy");
20
+ const base_1 = require("./base");
21
21
  const changelog_1 = require("../updaters/changelog");
22
22
  const java_snapshot_1 = require("../versioning-strategies/java-snapshot");
23
23
  const errors_1 = require("../errors");
@@ -41,7 +41,7 @@ const CHANGELOG_SECTIONS = [
41
41
  { type: 'build', section: 'Build System', hidden: true },
42
42
  { type: 'ci', section: 'Continuous Integration', hidden: true },
43
43
  ];
44
- class JavaYoshi extends strategy_1.Strategy {
44
+ class JavaYoshi extends base_1.BaseStrategy {
45
45
  constructor(options) {
46
46
  var _a;
47
47
  options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
@@ -1,7 +1,7 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
3
  import { Version } from '../version';
4
- export declare class KRMBlueprint extends Strategy {
4
+ export declare class KRMBlueprint extends BaseStrategy {
5
5
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
6
  protected initialReleaseVersion(): Version;
7
7
  }
@@ -18,11 +18,11 @@ exports.KRMBlueprint = void 0;
18
18
  const changelog_1 = require("../updaters/changelog");
19
19
  // KRM specific.
20
20
  const krm_blueprint_version_1 = require("../updaters/krm/krm-blueprint-version");
21
- const strategy_1 = require("../strategy");
21
+ const base_1 = require("./base");
22
22
  const version_1 = require("../version");
23
23
  const KRMBlueprintAttribAnnotation = 'cnrm.cloud.google.com/blueprint';
24
24
  const hasKRMBlueprintAttrib = (content) => content.includes(KRMBlueprintAttribAnnotation);
25
- class KRMBlueprint extends strategy_1.Strategy {
25
+ class KRMBlueprint extends base_1.BaseStrategy {
26
26
  async buildUpdates(options) {
27
27
  const updates = [];
28
28
  const version = options.newVersion;
@@ -39,7 +39,7 @@ class KRMBlueprint extends strategy_1.Strategy {
39
39
  versionsMap.set('previousVersion', options.latestVersion);
40
40
  }
41
41
  // Update version in all yaml files with attribution annotation
42
- const yamlPaths = await this.github.findFilesByExtension('yaml', this.path);
42
+ const yamlPaths = await this.github.findFilesByExtensionAndRef('yaml', this.targetBranch, this.path);
43
43
  for (const yamlPath of yamlPaths) {
44
44
  const contents = await this.github.getFileContents(this.addPath(yamlPath));
45
45
  if (hasKRMBlueprintAttrib(contents.parsedContent)) {
@@ -1,6 +1,6 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
- export declare class Node extends Strategy {
3
+ export declare class Node extends BaseStrategy {
4
4
  private pkgJsonContents?;
5
5
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
6
  getDefaultPackageName(): Promise<string | undefined>;
@@ -14,12 +14,12 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Node = void 0;
17
- const strategy_1 = require("../strategy");
17
+ const base_1 = require("./base");
18
18
  const package_lock_json_1 = require("../updaters/node/package-lock-json");
19
19
  const samples_package_json_1 = require("../updaters/node/samples-package-json");
20
20
  const changelog_1 = require("../updaters/changelog");
21
21
  const package_json_1 = require("../updaters/node/package-json");
22
- class Node extends strategy_1.Strategy {
22
+ class Node extends base_1.BaseStrategy {
23
23
  async buildUpdates(options) {
24
24
  const updates = [];
25
25
  const version = options.newVersion;
@@ -1,5 +1,5 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
- export declare class OCaml extends Strategy {
3
+ export declare class OCaml extends BaseStrategy {
4
4
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
5
  }
@@ -20,9 +20,9 @@ const changelog_1 = require("../updaters/changelog");
20
20
  const opam_1 = require("../updaters/ocaml/opam");
21
21
  const esy_json_1 = require("../updaters/ocaml/esy-json");
22
22
  const dune_project_1 = require("../updaters/ocaml/dune-project");
23
- const strategy_1 = require("../strategy");
23
+ const base_1 = require("./base");
24
24
  const notEsyLock = (path) => !path.startsWith('esy.lock');
25
- class OCaml extends strategy_1.Strategy {
25
+ class OCaml extends base_1.BaseStrategy {
26
26
  async buildUpdates(options) {
27
27
  const updates = [];
28
28
  const version = options.newVersion;
@@ -1,10 +1,10 @@
1
- import { Strategy, BuildUpdatesOptions, StrategyOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { Update } from '../update';
3
3
  import { Commit } from '../commit';
4
4
  import { Release } from '../release';
5
5
  import { ReleasePullRequest } from '../release-pull-request';
6
- export declare class PHPYoshi extends Strategy {
7
- constructor(options: StrategyOptions);
6
+ export declare class PHPYoshi extends BaseStrategy {
7
+ constructor(options: BaseStrategyOptions);
8
8
  buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest>;
9
9
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
10
10
  }
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.PHPYoshi = void 0;
17
- const strategy_1 = require("../strategy");
17
+ const base_1 = require("./base");
18
18
  const changelog_1 = require("../updaters/changelog");
19
19
  const root_composer_update_packages_1 = require("../updaters/php/root-composer-update-packages");
20
20
  const php_manifest_1 = require("../updaters/php/php-manifest");
@@ -41,7 +41,7 @@ const CHANGELOG_SECTIONS = [
41
41
  { type: 'build', section: 'Build System', hidden: true },
42
42
  { type: 'ci', section: 'Continuous Integration', hidden: true },
43
43
  ];
44
- class PHPYoshi extends strategy_1.Strategy {
44
+ class PHPYoshi extends base_1.BaseStrategy {
45
45
  constructor(options) {
46
46
  super({
47
47
  ...options,
@@ -1,6 +1,6 @@
1
- import { Strategy, BuildUpdatesOptions, StrategyOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { Update } from '../update';
3
- export declare class PHP extends Strategy {
4
- constructor(options: StrategyOptions);
3
+ export declare class PHP extends BaseStrategy {
4
+ constructor(options: BaseStrategyOptions);
5
5
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
6
  }
@@ -18,7 +18,7 @@ exports.PHP = void 0;
18
18
  const changelog_1 = require("../updaters/changelog");
19
19
  // PHP Specific.
20
20
  const root_composer_update_packages_1 = require("../updaters/php/root-composer-update-packages");
21
- const strategy_1 = require("../strategy");
21
+ const base_1 = require("./base");
22
22
  const CHANGELOG_SECTIONS = [
23
23
  { type: 'feat', section: 'Features' },
24
24
  { type: 'fix', section: 'Bug Fixes' },
@@ -32,7 +32,7 @@ const CHANGELOG_SECTIONS = [
32
32
  { type: 'build', section: 'Build System', hidden: true },
33
33
  { type: 'ci', section: 'Continuous Integration', hidden: true },
34
34
  ];
35
- class PHP extends strategy_1.Strategy {
35
+ class PHP extends base_1.BaseStrategy {
36
36
  constructor(options) {
37
37
  var _a;
38
38
  options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
@@ -1,7 +1,7 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
3
  import { Version } from '../version';
4
- export declare class Python extends Strategy {
4
+ export declare class Python extends BaseStrategy {
5
5
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
6
  private getPyProject;
7
7
  protected initialReleaseVersion(): Version;
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Python = void 0;
17
- const strategy_1 = require("../strategy");
17
+ const base_1 = require("./base");
18
18
  const changelog_1 = require("../updaters/changelog");
19
19
  const version_1 = require("../version");
20
20
  const setup_cfg_1 = require("../updaters/python/setup-cfg");
@@ -22,7 +22,7 @@ const setup_py_1 = require("../updaters/python/setup-py");
22
22
  const pyproject_toml_1 = require("../updaters/python/pyproject-toml");
23
23
  const logger_1 = require("../util/logger");
24
24
  const python_file_with_version_1 = require("../updaters/python/python-file-with-version");
25
- class Python extends strategy_1.Strategy {
25
+ class Python extends base_1.BaseStrategy {
26
26
  async buildUpdates(options) {
27
27
  var _a;
28
28
  const updates = [];
@@ -1,13 +1,13 @@
1
- import { StrategyOptions, Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { ConventionalCommit } from '../commit';
3
3
  import { Update } from '../update';
4
4
  import { Release } from '../release';
5
5
  import { Version } from '../version';
6
6
  import { TagName } from '../util/tag-name';
7
- interface RubyYoshiStrategyOptions extends StrategyOptions {
7
+ interface RubyYoshiStrategyOptions extends BaseStrategyOptions {
8
8
  versionFile?: string;
9
9
  }
10
- export declare class RubyYoshi extends Strategy {
10
+ export declare class RubyYoshi extends BaseStrategy {
11
11
  readonly versionFile: string;
12
12
  constructor(options: RubyYoshiStrategyOptions);
13
13
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
@@ -19,10 +19,11 @@ const indent_commit_1 = require("../util/indent-commit");
19
19
  const changelog_1 = require("../updaters/changelog");
20
20
  // RubyYoshi
21
21
  const version_rb_1 = require("../updaters/ruby/version-rb");
22
- const strategy_1 = require("../strategy");
22
+ const base_1 = require("./base");
23
23
  const fs_1 = require("fs");
24
24
  const path_1 = require("path");
25
25
  const manifest_1 = require("../manifest");
26
+ const logger_1 = require("../util/logger");
26
27
  const CHANGELOG_SECTIONS = [
27
28
  { type: 'feat', section: 'Features' },
28
29
  { type: 'fix', section: 'Bug Fixes' },
@@ -36,7 +37,7 @@ const CHANGELOG_SECTIONS = [
36
37
  { type: 'build', section: 'Build System', hidden: true },
37
38
  { type: 'ci', section: 'Continuous Integration', hidden: true },
38
39
  ];
39
- class RubyYoshi extends strategy_1.Strategy {
40
+ class RubyYoshi extends base_1.BaseStrategy {
40
41
  constructor(options) {
41
42
  var _a;
42
43
  super({
@@ -97,6 +98,10 @@ class RubyYoshi extends strategy_1.Strategy {
97
98
  .slice(1)
98
99
  .join('\n')}</code></pre>\n`;
99
100
  }
101
+ if (commit.files === undefined) {
102
+ logger_1.logger.error('No files for commit - this is likely a bug.');
103
+ continue;
104
+ }
100
105
  commit.files.forEach(file => {
101
106
  if (this.path === manifest_1.ROOT_PROJECT_PATH || file.startsWith(this.path)) {
102
107
  updatedFiles[file] = true;
@@ -1,10 +1,10 @@
1
- import { StrategyOptions, Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { ConventionalCommit } from '../commit';
3
3
  import { Update } from '../update';
4
- interface RubyStrategyOptions extends StrategyOptions {
4
+ interface RubyStrategyOptions extends BaseStrategyOptions {
5
5
  versionFile?: string;
6
6
  }
7
- export declare class Ruby extends Strategy {
7
+ export declare class Ruby extends BaseStrategy {
8
8
  readonly versionFile: string;
9
9
  constructor(options: RubyStrategyOptions);
10
10
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
@@ -19,8 +19,8 @@ const indent_commit_1 = require("../util/indent-commit");
19
19
  const changelog_1 = require("../updaters/changelog");
20
20
  // Ruby
21
21
  const version_rb_1 = require("../updaters/ruby/version-rb");
22
- const strategy_1 = require("../strategy");
23
- class Ruby extends strategy_1.Strategy {
22
+ const base_1 = require("./base");
23
+ class Ruby extends base_1.BaseStrategy {
24
24
  constructor(options) {
25
25
  var _a;
26
26
  super(options);
@@ -1,8 +1,8 @@
1
1
  import { CargoManifest } from '../updaters/rust/common';
2
- import { Strategy, BuildUpdatesOptions } from '../strategy';
2
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
3
3
  import { Version } from '../version';
4
4
  import { Update } from '../update';
5
- export declare class Rust extends Strategy {
5
+ export declare class Rust extends BaseStrategy {
6
6
  private packageManifest?;
7
7
  private workspaceManifest?;
8
8
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
@@ -21,9 +21,9 @@ const cargo_toml_1 = require("../updaters/rust/cargo-toml");
21
21
  const cargo_lock_1 = require("../updaters/rust/cargo-lock");
22
22
  const common_1 = require("../updaters/rust/common");
23
23
  const logger_1 = require("../util/logger");
24
- const strategy_1 = require("../strategy");
24
+ const base_1 = require("./base");
25
25
  const version_1 = require("../version");
26
- class Rust extends strategy_1.Strategy {
26
+ class Rust extends base_1.BaseStrategy {
27
27
  async buildUpdates(options) {
28
28
  const updates = [];
29
29
  const version = options.newVersion;
@@ -1,5 +1,5 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
- export declare class Simple extends Strategy {
3
+ export declare class Simple extends BaseStrategy {
4
4
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
5
5
  }
@@ -17,9 +17,9 @@ exports.Simple = void 0;
17
17
  // Generic
18
18
  const changelog_1 = require("../updaters/changelog");
19
19
  // version.txt support
20
- const strategy_1 = require("../strategy");
20
+ const base_1 = require("./base");
21
21
  const default_1 = require("../updaters/default");
22
- class Simple extends strategy_1.Strategy {
22
+ class Simple extends base_1.BaseStrategy {
23
23
  async buildUpdates(options) {
24
24
  const updates = [];
25
25
  const version = options.newVersion;
@@ -1,7 +1,7 @@
1
- import { Strategy, BuildUpdatesOptions } from '../strategy';
1
+ import { BaseStrategy, BuildUpdatesOptions } from './base';
2
2
  import { Update } from '../update';
3
3
  import { Version } from '../version';
4
- export declare class TerraformModule extends Strategy {
4
+ export declare class TerraformModule extends BaseStrategy {
5
5
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
6
  protected initialReleaseVersion(): Version;
7
7
  }
@@ -19,9 +19,9 @@ const changelog_1 = require("../updaters/changelog");
19
19
  // Terraform specific.
20
20
  const readme_1 = require("../updaters/terraform/readme");
21
21
  const module_version_1 = require("../updaters/terraform/module-version");
22
- const strategy_1 = require("../strategy");
22
+ const base_1 = require("./base");
23
23
  const version_1 = require("../version");
24
- class TerraformModule extends strategy_1.Strategy {
24
+ class TerraformModule extends base_1.BaseStrategy {
25
25
  async buildUpdates(options) {
26
26
  const updates = [];
27
27
  const version = options.newVersion;
@@ -1,78 +1,17 @@
1
1
  import { ReleasePullRequest } from './release-pull-request';
2
2
  import { Release } from './release';
3
- import { GitHub } from './github';
4
- import { Version, VersionsMap } from './version';
5
- import { Commit, ConventionalCommit } from './commit';
6
- import { VersioningStrategy } from './versioning-strategy';
7
- import { ChangelogNotes, ChangelogSection } from './changelog-notes';
8
- import { Update } from './update';
9
- import { Repository } from './repository';
10
3
  import { PullRequest } from './pull-request';
11
- import { TagName } from './util/tag-name';
12
- export interface BuildUpdatesOptions {
13
- changelogEntry: string;
14
- newVersion: Version;
15
- versionsMap: VersionsMap;
16
- latestVersion?: Version;
17
- }
18
- export interface StrategyOptions {
19
- path?: string;
20
- bumpMinorPreMajor?: boolean;
21
- bumpPatchForMinorPreMajor?: boolean;
22
- github: GitHub;
23
- component?: string;
24
- packageName?: string;
25
- versioningStrategy?: VersioningStrategy;
26
- targetBranch: string;
27
- changelogPath?: string;
28
- changelogSections?: ChangelogSection[];
29
- commitPartial?: string;
30
- headerPartial?: string;
31
- mainTemplate?: string;
32
- tagSeparator?: string;
33
- skipGitHubRelease?: boolean;
34
- releaseAs?: string;
35
- changelogNotes?: ChangelogNotes;
36
- includeComponentInTag?: boolean;
37
- pullRequestTitlePattern?: string;
38
- }
4
+ import { Commit } from './commit';
5
+ import { VersioningStrategy } from './versioning-strategy';
6
+ import { ChangelogNotes } from './changelog-notes';
39
7
  /**
40
8
  * A strategy is responsible for determining which files are
41
9
  * necessary to update in a release pull request.
42
10
  */
43
- export declare abstract class Strategy {
11
+ export interface Strategy {
12
+ readonly changelogNotes: ChangelogNotes;
44
13
  readonly path: string;
45
- protected github: GitHub;
46
- readonly component?: string;
47
- protected packageName?: string;
48
14
  readonly versioningStrategy: VersioningStrategy;
49
- protected targetBranch: string;
50
- protected repository: Repository;
51
- readonly changelogPath: string;
52
- protected tagSeparator?: string;
53
- private skipGitHubRelease;
54
- private releaseAs?;
55
- private includeComponentInTag;
56
- private pullRequestTitlePattern?;
57
- readonly changelogNotes: ChangelogNotes;
58
- protected changelogSections?: ChangelogSection[];
59
- constructor(options: StrategyOptions);
60
- /**
61
- * Specify the files necessary to update in a release pull request.
62
- * @param {BuildUpdatesOptions} options
63
- */
64
- protected abstract buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
65
- getComponent(): Promise<string | undefined>;
66
- getDefaultComponent(): Promise<string | undefined>;
67
- getDefaultPackageName(): Promise<string | undefined>;
68
- protected normalizeComponent(component: string | undefined): string;
69
- /**
70
- * Override this method to post process commits
71
- * @param {ConventionalCommit[]} commits parsed commits
72
- * @returns {ConventionalCommit[]} modified commits
73
- */
74
- protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
75
- protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
76
15
  /**
77
16
  * Builds a candidate release pull request
78
17
  * @param {Commit[]} commits Raw commits to consider for this release.
@@ -85,10 +24,6 @@ export declare abstract class Strategy {
85
24
  * open a pull request.
86
25
  */
87
26
  buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest | undefined>;
88
- protected changelogEmpty(changelogEntry: string): boolean;
89
- protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
90
- protected buildNewVersion(conventionalCommits: ConventionalCommit[], latestRelease?: Release): Promise<Version>;
91
- protected buildVersionsMap(_conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
92
27
  /**
93
28
  * Given a merged pull request, build the candidate release.
94
29
  * @param {PullRequest} mergedPullRequest The merged release pull request.
@@ -96,8 +31,8 @@ export declare abstract class Strategy {
96
31
  */
97
32
  buildRelease(mergedPullRequest: PullRequest): Promise<Release | undefined>;
98
33
  /**
99
- * Override this to handle the initial version of a new library.
34
+ * Return the component for this strategy. This may be a computed field.
35
+ * @returns {string}
100
36
  */
101
- protected initialReleaseVersion(): Version;
102
- protected addPath(file: string): string;
37
+ getComponent(): Promise<string | undefined>;
103
38
  }