release-please 13.10.1 → 13.11.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [13.11.1](https://github.com/googleapis/release-please/compare/v13.11.0...v13.11.1) (2022-04-15)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **deps:** switch from `xmldom` to `@xmldom/xmldom` and update to v0.8.2 ([#1393](https://github.com/googleapis/release-please/issues/1393)) ([b6af677](https://github.com/googleapis/release-please/commit/b6af677da635493230d7e3a632aeedb5cfd1edb7))
13
+
14
+ ## [13.11.0](https://github.com/googleapis/release-please/compare/v13.10.2...v13.11.0) (2022-04-15)
15
+
16
+
17
+ ### Features
18
+
19
+ * **cli:** show file diff for release-pr command with --dry-run and --trace ([fa2cc34](https://github.com/googleapis/release-please/commit/fa2cc343c327864a98ab896ddc92ced89db9ae73))
20
+ * introduce extensible factories ([#1342](https://github.com/googleapis/release-please/issues/1342)) ([b54e90e](https://github.com/googleapis/release-please/commit/b54e90e09751945914feb987508561c39f27cbe3))
21
+
22
+ ### [13.10.2](https://github.com/googleapis/release-please/compare/v13.10.1...v13.10.2) (2022-04-14)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **java:** snapshots should bump versionsMap versions ([#1386](https://github.com/googleapis/release-please/issues/1386)) ([558331c](https://github.com/googleapis/release-please/commit/558331c160a066daeda476438f6524bf958f8d41)), closes [#1381](https://github.com/googleapis/release-please/issues/1381)
28
+ * **ruby-yoshi:** Remove bolded scope and fix link removal ([#1382](https://github.com/googleapis/release-please/issues/1382)) ([f6b3202](https://github.com/googleapis/release-please/commit/f6b32024998c4e414b723a4071166f253e95b1d2))
29
+
7
30
  ### [13.10.1](https://github.com/googleapis/release-please/compare/v13.10.0...v13.10.1) (2022-04-13)
8
31
 
9
32
 
@@ -10,6 +10,7 @@ interface ErrorObject {
10
10
  }
11
11
  interface GitHubArgs {
12
12
  dryRun?: boolean;
13
+ trace?: boolean;
13
14
  repoUrl?: string;
14
15
  token?: string;
15
16
  apiUrl?: string;
@@ -60,9 +61,9 @@ interface PullRequestStrategyArgs {
60
61
  interface BootstrapArgs extends GitHubArgs, ManifestArgs, ManifestConfigArgs, VersioningArgs, PullRequestArgs, PullRequestStrategyArgs, ReleaseArgs {
61
62
  initialVersion?: string;
62
63
  }
63
- export declare const parser: yargs.Argv<BootstrapArgs & {
64
+ export declare const parser: yargs.Argv<yargs.Omit<BootstrapArgs & {
64
65
  debug: boolean;
65
- } & {
66
+ }, "trace"> & {
66
67
  trace: boolean;
67
68
  }>;
68
69
  interface HandleError {
@@ -23,6 +23,7 @@ const changelog_notes_1 = require("../changelog-notes");
23
23
  const logger_1 = require("../util/logger");
24
24
  const factory_1 = require("../factory");
25
25
  const bootstrapper_1 = require("../bootstrapper");
26
+ const diff_1 = require("diff");
26
27
  // eslint-disable-next-line @typescript-eslint/no-var-requires
27
28
  const parseGithubRepoUrl = require('parse-github-repo-url');
28
29
  function gitHubOptions(yargs) {
@@ -302,10 +303,21 @@ const createReleasePullRequestCommand = {
302
303
  console.log('draft:', pullRequest.draft);
303
304
  console.log('body:', pullRequest.body.toString());
304
305
  console.log('updates:', pullRequest.updates.length);
306
+ const changes = await github.buildChangeSet(pullRequest.updates, targetBranch);
305
307
  for (const update of pullRequest.updates) {
306
308
  console.log(` ${update.path}: `,
307
309
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
308
310
  update.updater.constructor);
311
+ if (argv.trace) {
312
+ const change = changes.get(update.path);
313
+ if (change) {
314
+ const patch = diff_1.createPatch(update.path, change.originalContent || '', change.content || '');
315
+ console.log(patch);
316
+ }
317
+ else {
318
+ console.warn(`no change found for ${update.path}`);
319
+ }
320
+ }
309
321
  }
310
322
  }
311
323
  }
@@ -0,0 +1,16 @@
1
+ import { GitHub } from '../github';
2
+ import { ChangelogNotes, ChangelogSection } from '../changelog-notes';
3
+ export declare type ChangelogNotesType = string;
4
+ export interface ChangelogNotesFactoryOptions {
5
+ type: ChangelogNotesType;
6
+ github: GitHub;
7
+ changelogSections?: ChangelogSection[];
8
+ commitPartial?: string;
9
+ headerPartial?: string;
10
+ mainTemplate?: string;
11
+ }
12
+ export declare type ChangelogNotesBuilder = (options: ChangelogNotesFactoryOptions) => ChangelogNotes;
13
+ export declare function buildChangelogNotes(options: ChangelogNotesFactoryOptions): ChangelogNotes;
14
+ export declare function registerChangelogNotes(name: string, changelogNotesBuilder: ChangelogNotesBuilder): void;
15
+ export declare function unregisterChangelogNotes(name: string): void;
16
+ export declare function getChangelogTypes(): readonly ChangelogNotesType[];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getChangelogTypes = exports.unregisterChangelogNotes = exports.registerChangelogNotes = exports.buildChangelogNotes = void 0;
17
+ const github_1 = require("../changelog-notes/github");
18
+ const default_1 = require("../changelog-notes/default");
19
+ const changelogNotesFactories = {
20
+ github: options => new github_1.GitHubChangelogNotes(options.github),
21
+ default: options => new default_1.DefaultChangelogNotes(options),
22
+ };
23
+ function buildChangelogNotes(options) {
24
+ const builder = changelogNotesFactories[options.type];
25
+ if (builder) {
26
+ return builder(options);
27
+ }
28
+ throw new Error(`Unknown changelog type: ${options.type}`);
29
+ }
30
+ exports.buildChangelogNotes = buildChangelogNotes;
31
+ function registerChangelogNotes(name, changelogNotesBuilder) {
32
+ changelogNotesFactories[name] = changelogNotesBuilder;
33
+ }
34
+ exports.registerChangelogNotes = registerChangelogNotes;
35
+ function unregisterChangelogNotes(name) {
36
+ delete changelogNotesFactories[name];
37
+ }
38
+ exports.unregisterChangelogNotes = unregisterChangelogNotes;
39
+ function getChangelogTypes() {
40
+ return Object.keys(changelogNotesFactories).sort();
41
+ }
42
+ exports.getChangelogTypes = getChangelogTypes;
43
+ //# sourceMappingURL=changelog-notes-factory.js.map
@@ -0,0 +1,17 @@
1
+ import { PluginType, RepositoryConfig } from '../manifest';
2
+ import { GitHub } from '../github';
3
+ import { ManifestPlugin } from '../plugin';
4
+ import { VersioningStrategyType } from './versioning-strategy-factory';
5
+ export interface PluginFactoryOptions {
6
+ type: PluginType;
7
+ github: GitHub;
8
+ targetBranch: string;
9
+ repositoryConfig: RepositoryConfig;
10
+ alwaysLinkLocal?: boolean;
11
+ updateAllPackages?: boolean;
12
+ }
13
+ export declare type PluginBuilder = (options: PluginFactoryOptions) => ManifestPlugin;
14
+ export declare function buildPlugin(options: PluginFactoryOptions): ManifestPlugin;
15
+ export declare function registerPlugin(name: string, pluginBuilder: PluginBuilder): void;
16
+ export declare function unregisterPlugin(name: string): void;
17
+ export declare function getPluginTypes(): readonly VersioningStrategyType[];
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getPluginTypes = exports.unregisterPlugin = exports.registerPlugin = exports.buildPlugin = void 0;
17
+ const linked_versions_1 = require("../plugins/linked-versions");
18
+ const cargo_workspace_1 = require("../plugins/cargo-workspace");
19
+ const node_workspace_1 = require("../plugins/node-workspace");
20
+ const pluginFactories = {
21
+ 'linked-versions': options => new linked_versions_1.LinkedVersions(options.github, options.targetBranch, options.repositoryConfig, options.type.groupName, options.type.components),
22
+ 'cargo-workspace': options => new cargo_workspace_1.CargoWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
23
+ 'node-workspace': options => new node_workspace_1.NodeWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
24
+ };
25
+ function buildPlugin(options) {
26
+ if (typeof options.type === 'object') {
27
+ const builder = pluginFactories[options.type.type];
28
+ if (builder) {
29
+ return builder(options);
30
+ }
31
+ throw new Error(`Unknown plugin type: ${options.type.type}`);
32
+ }
33
+ else {
34
+ const builder = pluginFactories[options.type];
35
+ if (builder) {
36
+ return builder(options);
37
+ }
38
+ throw new Error(`Unknown plugin type: ${options.type}`);
39
+ }
40
+ }
41
+ exports.buildPlugin = buildPlugin;
42
+ function registerPlugin(name, pluginBuilder) {
43
+ pluginFactories[name] = pluginBuilder;
44
+ }
45
+ exports.registerPlugin = registerPlugin;
46
+ function unregisterPlugin(name) {
47
+ delete pluginFactories[name];
48
+ }
49
+ exports.unregisterPlugin = unregisterPlugin;
50
+ function getPluginTypes() {
51
+ return Object.keys(pluginFactories).sort();
52
+ }
53
+ exports.getPluginTypes = getPluginTypes;
54
+ //# sourceMappingURL=plugin-factory.js.map
@@ -0,0 +1,12 @@
1
+ import { VersioningStrategy } from '../versioning-strategy';
2
+ export declare type VersioningStrategyType = string;
3
+ export interface VersioningStrategyFactoryOptions {
4
+ type?: VersioningStrategyType;
5
+ bumpMinorPreMajor?: boolean;
6
+ bumpPatchForMinorPreMajor?: boolean;
7
+ }
8
+ export declare type VersioningStrategyBuilder = (options: VersioningStrategyFactoryOptions) => VersioningStrategy;
9
+ export declare function buildVersioningStrategy(options: VersioningStrategyFactoryOptions): VersioningStrategy;
10
+ export declare function registerVersioningStrategy(name: string, versioningStrategyBuilder: VersioningStrategyBuilder): void;
11
+ export declare function unregisterVersioningStrategy(name: string): void;
12
+ export declare function getVersioningStrategyTypes(): readonly VersioningStrategyType[];
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getVersioningStrategyTypes = exports.unregisterVersioningStrategy = exports.registerVersioningStrategy = exports.buildVersioningStrategy = void 0;
17
+ const default_1 = require("../versioning-strategies/default");
18
+ const always_bump_patch_1 = require("../versioning-strategies/always-bump-patch");
19
+ const service_pack_1 = require("../versioning-strategies/service-pack");
20
+ const versioningTypes = {
21
+ default: options => new default_1.DefaultVersioningStrategy(options),
22
+ 'always-bump-patch': options => new always_bump_patch_1.AlwaysBumpPatch(options),
23
+ 'service-pack': options => new service_pack_1.ServicePackVersioningStrategy(options),
24
+ };
25
+ function buildVersioningStrategy(options) {
26
+ const builder = versioningTypes[options.type || 'default'];
27
+ if (builder) {
28
+ return builder(options);
29
+ }
30
+ throw new Error(`Unknown versioning strategy type: ${options.type}`);
31
+ }
32
+ exports.buildVersioningStrategy = buildVersioningStrategy;
33
+ function registerVersioningStrategy(name, versioningStrategyBuilder) {
34
+ versioningTypes[name] = versioningStrategyBuilder;
35
+ }
36
+ exports.registerVersioningStrategy = registerVersioningStrategy;
37
+ function unregisterVersioningStrategy(name) {
38
+ delete versioningTypes[name];
39
+ }
40
+ exports.unregisterVersioningStrategy = unregisterVersioningStrategy;
41
+ function getVersioningStrategyTypes() {
42
+ return Object.keys(versioningTypes).sort();
43
+ }
44
+ exports.getVersioningStrategyTypes = getVersioningStrategyTypes;
45
+ //# sourceMappingURL=versioning-strategy-factory.js.map
@@ -1,39 +1,18 @@
1
1
  import { Strategy } from './strategy';
2
2
  import { GitHub } from './github';
3
- import { ReleaserConfig, PluginType, RepositoryConfig } from './manifest';
4
- import { ManifestPlugin } from './plugin';
5
- import { ChangelogNotes, ChangelogSection } from './changelog-notes';
6
- declare const allReleaseTypes: readonly ["dart", "dotnet-yoshi", "elixir", "go", "go-yoshi", "helm", "java", "java-backport", "java-bom", "java-lts", "java-yoshi", "krm-blueprint", "maven", "node", "ocaml", "php", "php-yoshi", "python", "ruby", "ruby-yoshi", "rust", "simple", "terraform-module"];
7
- export declare type ReleaseType = typeof allReleaseTypes[number];
8
- export declare function getReleaserTypes(): readonly ReleaseType[];
9
- export declare function getVersioningStrategyTypes(): readonly VersioningStrategyType[];
10
- export declare function getChangelogTypes(): readonly ChangelogNotesType[];
3
+ import { ReleaserConfig } from './manifest';
4
+ import { BaseStrategyOptions } from './strategies/base';
5
+ export * from './factories/changelog-notes-factory';
6
+ export * from './factories/plugin-factory';
7
+ export * from './factories/versioning-strategy-factory';
8
+ export declare type ReleaseType = string;
9
+ export declare type ReleaseBuilder = (options: BaseStrategyOptions) => Strategy;
11
10
  export interface StrategyFactoryOptions extends ReleaserConfig {
12
11
  github: GitHub;
13
12
  path?: string;
14
13
  targetBranch?: string;
15
14
  }
16
15
  export declare function buildStrategy(options: StrategyFactoryOptions): Promise<Strategy>;
17
- declare const allVersioningTypes: readonly ["default", "always-bump-patch", "service-pack"];
18
- export declare type VersioningStrategyType = typeof allVersioningTypes[number];
19
- interface PluginFactoryOptions {
20
- type: PluginType;
21
- github: GitHub;
22
- targetBranch: string;
23
- repositoryConfig: RepositoryConfig;
24
- alwaysLinkLocal?: boolean;
25
- updateAllPackages?: boolean;
26
- }
27
- export declare function buildPlugin(options: PluginFactoryOptions): ManifestPlugin;
28
- declare const allChangelogNotesTypes: readonly ["default", "github"];
29
- export declare type ChangelogNotesType = typeof allChangelogNotesTypes[number];
30
- interface ChangelogNotesFactoryOptions {
31
- type: ChangelogNotesType;
32
- github: GitHub;
33
- changelogSections?: ChangelogSection[];
34
- commitPartial?: string;
35
- headerPartial?: string;
36
- mainTemplate?: string;
37
- }
38
- export declare function buildChangelogNotes(options: ChangelogNotesFactoryOptions): ChangelogNotes;
39
- export {};
16
+ export declare function registerReleaseType(name: string, strategyBuilder: ReleaseBuilder): void;
17
+ export declare function unregisterReleaseType(name: string): void;
18
+ export declare function getReleaserTypes(): readonly ReleaseType[];
@@ -12,8 +12,18 @@
12
12
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
23
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
24
+ };
15
25
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.buildChangelogNotes = exports.buildPlugin = exports.buildStrategy = exports.getChangelogTypes = exports.getVersioningStrategyTypes = exports.getReleaserTypes = void 0;
26
+ exports.getReleaserTypes = exports.unregisterReleaseType = exports.registerReleaseType = exports.buildStrategy = void 0;
17
27
  const go_1 = require("./strategies/go");
18
28
  const go_yoshi_1 = require("./strategies/go-yoshi");
19
29
  const java_yoshi_1 = require("./strategies/java-yoshi");
@@ -31,219 +41,91 @@ const helm_1 = require("./strategies/helm");
31
41
  const elixir_1 = require("./strategies/elixir");
32
42
  const dart_1 = require("./strategies/dart");
33
43
  const node_1 = require("./strategies/node");
34
- const default_1 = require("./versioning-strategies/default");
35
44
  const always_bump_patch_1 = require("./versioning-strategies/always-bump-patch");
36
45
  const service_pack_1 = require("./versioning-strategies/service-pack");
37
46
  const dependency_manifest_1 = require("./versioning-strategies/dependency-manifest");
38
- const node_workspace_1 = require("./plugins/node-workspace");
39
- const cargo_workspace_1 = require("./plugins/cargo-workspace");
40
- const github_1 = require("./changelog-notes/github");
41
- const default_2 = require("./changelog-notes/default");
42
- const linked_versions_1 = require("./plugins/linked-versions");
43
47
  const dotnet_yoshi_1 = require("./strategies/dotnet-yoshi");
44
48
  const java_1 = require("./strategies/java");
45
49
  const maven_1 = require("./strategies/maven");
46
- // Factory shared by GitHub Action and CLI for creating Release PRs
47
- // and GitHub Releases:
48
- // add any new releasers you create to this type as well as the `releasers`
49
- // object below.
50
- const allReleaseTypes = [
51
- 'dart',
52
- 'dotnet-yoshi',
53
- 'elixir',
54
- 'go',
55
- 'go-yoshi',
56
- 'helm',
57
- 'java',
58
- 'java-backport',
59
- 'java-bom',
60
- 'java-lts',
61
- 'java-yoshi',
62
- 'krm-blueprint',
63
- 'maven',
64
- 'node',
65
- 'ocaml',
66
- 'php',
67
- 'php-yoshi',
68
- 'python',
69
- 'ruby',
70
- 'ruby-yoshi',
71
- 'rust',
72
- 'simple',
73
- 'terraform-module',
74
- ];
50
+ const versioning_strategy_factory_1 = require("./factories/versioning-strategy-factory");
51
+ const changelog_notes_factory_1 = require("./factories/changelog-notes-factory");
52
+ __exportStar(require("./factories/changelog-notes-factory"), exports);
53
+ __exportStar(require("./factories/plugin-factory"), exports);
54
+ __exportStar(require("./factories/versioning-strategy-factory"), exports);
75
55
  const releasers = {
76
56
  'dotnet-yoshi': options => new dotnet_yoshi_1.DotnetYoshi(options),
77
57
  go: options => new go_1.Go(options),
78
58
  'go-yoshi': options => new go_yoshi_1.GoYoshi(options),
59
+ java: options => new java_1.Java(options),
60
+ maven: options => new maven_1.Maven(options),
61
+ 'java-yoshi': options => new java_yoshi_1.JavaYoshi(options),
62
+ 'java-backport': options => new java_yoshi_1.JavaYoshi({
63
+ ...options,
64
+ versioningStrategy: new always_bump_patch_1.AlwaysBumpPatch(),
65
+ }),
66
+ 'java-bom': options => new java_yoshi_1.JavaYoshi({
67
+ ...options,
68
+ versioningStrategy: new dependency_manifest_1.DependencyManifest({
69
+ bumpMinorPreMajor: options.bumpMinorPreMajor,
70
+ bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
71
+ }),
72
+ }),
73
+ 'java-lts': options => new java_yoshi_1.JavaYoshi({
74
+ ...options,
75
+ versioningStrategy: new service_pack_1.ServicePackVersioningStrategy(),
76
+ }),
79
77
  'krm-blueprint': options => new krm_blueprint_1.KRMBlueprint(options),
80
78
  node: options => new node_1.Node(options),
81
79
  ocaml: options => new ocaml_1.OCaml(options),
82
80
  php: options => new php_1.PHP(options),
83
81
  'php-yoshi': options => new php_yoshi_1.PHPYoshi(options),
84
82
  python: options => new python_1.Python(options),
83
+ ruby: options => new ruby_1.Ruby(options),
84
+ 'ruby-yoshi': options => new ruby_yoshi_1.RubyYoshi(options),
85
85
  rust: options => new rust_1.Rust(options),
86
+ simple: options => new simple_1.Simple(options),
86
87
  'terraform-module': options => new terraform_module_1.TerraformModule(options),
87
88
  helm: options => new helm_1.Helm(options),
88
89
  elixir: options => new elixir_1.Elixir(options),
89
90
  dart: options => new dart_1.Dart(options),
90
91
  };
91
- function getReleaserTypes() {
92
- return allReleaseTypes;
93
- }
94
- exports.getReleaserTypes = getReleaserTypes;
95
- function getVersioningStrategyTypes() {
96
- return allVersioningTypes;
97
- }
98
- exports.getVersioningStrategyTypes = getVersioningStrategyTypes;
99
- function getChangelogTypes() {
100
- return allChangelogNotesTypes;
101
- }
102
- exports.getChangelogTypes = getChangelogTypes;
103
92
  async function buildStrategy(options) {
104
93
  var _a;
105
94
  const targetBranch = (_a = options.targetBranch) !== null && _a !== void 0 ? _a : options.github.repository.defaultBranch;
106
- const versioningStrategy = buildVersioningStrategy({
95
+ const versioningStrategy = versioning_strategy_factory_1.buildVersioningStrategy({
107
96
  type: options.versioning,
108
97
  bumpMinorPreMajor: options.bumpMinorPreMajor,
109
98
  bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
110
99
  });
111
- const changelogNotes = buildChangelogNotes({
100
+ const changelogNotes = changelog_notes_factory_1.buildChangelogNotes({
112
101
  type: options.changelogType || 'default',
113
102
  github: options.github,
114
103
  changelogSections: options.changelogSections,
115
104
  });
116
105
  const strategyOptions = {
117
- github: options.github,
106
+ skipGitHubRelease: options.skipGithubRelease,
107
+ ...options,
118
108
  targetBranch,
119
- path: options.path,
120
- bumpMinorPreMajor: options.bumpMinorPreMajor,
121
- bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
122
- component: options.component,
123
- packageName: options.packageName,
124
- changelogPath: options.changelogPath,
125
- changelogSections: options.changelogSections,
126
109
  versioningStrategy,
127
- skipGitHubRelease: options.skipGithubRelease,
128
- releaseAs: options.releaseAs,
129
- includeComponentInTag: options.includeComponentInTag,
130
110
  changelogNotes,
131
- pullRequestTitlePattern: options.pullRequestTitlePattern,
132
- extraFiles: options.extraFiles,
133
- tagSeparator: options.tagSeparator,
134
111
  };
135
- switch (options.releaseType) {
136
- case 'ruby': {
137
- return new ruby_1.Ruby({
138
- ...strategyOptions,
139
- versionFile: options.versionFile,
140
- });
141
- }
142
- case 'ruby-yoshi': {
143
- return new ruby_yoshi_1.RubyYoshi({
144
- ...strategyOptions,
145
- versionFile: options.versionFile,
146
- });
147
- }
148
- case 'java': {
149
- return new java_1.Java({
150
- ...strategyOptions,
151
- snapshotLabels: options.snapshotLabels,
152
- });
153
- }
154
- case 'maven': {
155
- return new maven_1.Maven({
156
- ...strategyOptions,
157
- snapshotLabels: options.snapshotLabels,
158
- });
159
- }
160
- case 'java-yoshi': {
161
- return new java_yoshi_1.JavaYoshi({
162
- ...strategyOptions,
163
- snapshotLabels: options.snapshotLabels,
164
- });
165
- }
166
- case 'java-backport': {
167
- return new java_yoshi_1.JavaYoshi({
168
- ...strategyOptions,
169
- versioningStrategy: new always_bump_patch_1.AlwaysBumpPatch(),
170
- });
171
- }
172
- case 'java-bom': {
173
- return new java_yoshi_1.JavaYoshi({
174
- ...strategyOptions,
175
- versioningStrategy: new dependency_manifest_1.DependencyManifest({
176
- bumpMinorPreMajor: options.bumpMinorPreMajor,
177
- bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
178
- }),
179
- });
180
- }
181
- case 'java-lts': {
182
- return new java_yoshi_1.JavaYoshi({
183
- ...strategyOptions,
184
- versioningStrategy: new service_pack_1.ServicePackVersioningStrategy(),
185
- });
186
- }
187
- case 'simple': {
188
- return new simple_1.Simple({
189
- ...strategyOptions,
190
- versionFile: options.versionFile,
191
- });
192
- }
193
- default: {
194
- const builder = releasers[options.releaseType];
195
- if (builder) {
196
- return builder(strategyOptions);
197
- }
198
- throw new Error(`Unknown release type: ${options.releaseType}`);
199
- }
112
+ const builder = releasers[options.releaseType];
113
+ if (builder) {
114
+ return builder(strategyOptions);
200
115
  }
116
+ throw new Error(`Unknown release type: ${options.releaseType}`);
201
117
  }
202
118
  exports.buildStrategy = buildStrategy;
203
- const allVersioningTypes = [
204
- 'default',
205
- 'always-bump-patch',
206
- 'service-pack',
207
- ];
208
- function buildVersioningStrategy(options) {
209
- switch (options.type) {
210
- case 'always-bump-patch':
211
- return new always_bump_patch_1.AlwaysBumpPatch(options);
212
- case 'service-pack':
213
- return new service_pack_1.ServicePackVersioningStrategy(options);
214
- default:
215
- return new default_1.DefaultVersioningStrategy(options);
216
- }
119
+ function registerReleaseType(name, strategyBuilder) {
120
+ releasers[name] = strategyBuilder;
217
121
  }
218
- function buildPlugin(options) {
219
- if (typeof options.type === 'object') {
220
- switch (options.type.type) {
221
- case 'linked-versions':
222
- return new linked_versions_1.LinkedVersions(options.github, options.targetBranch, options.repositoryConfig, options.type.groupName, options.type.components);
223
- default:
224
- throw new Error(`Unknown plugin type: ${options.type}`);
225
- }
226
- }
227
- switch (options.type) {
228
- case 'cargo-workspace':
229
- return new cargo_workspace_1.CargoWorkspace(options.github, options.targetBranch, options.repositoryConfig, options);
230
- case 'node-workspace':
231
- return new node_workspace_1.NodeWorkspace(options.github, options.targetBranch, options.repositoryConfig, options);
232
- default:
233
- throw new Error(`Unknown plugin type: ${options.type}`);
234
- }
122
+ exports.registerReleaseType = registerReleaseType;
123
+ function unregisterReleaseType(name) {
124
+ delete releasers[name];
235
125
  }
236
- exports.buildPlugin = buildPlugin;
237
- const allChangelogNotesTypes = ['default', 'github'];
238
- function buildChangelogNotes(options) {
239
- switch (options.type) {
240
- case 'github':
241
- return new github_1.GitHubChangelogNotes(options.github);
242
- case 'default':
243
- return new default_2.DefaultChangelogNotes(options);
244
- default:
245
- throw new Error(`Unknown changelog type: ${options.type}`);
246
- }
126
+ exports.unregisterReleaseType = unregisterReleaseType;
127
+ function getReleaserTypes() {
128
+ return Object.keys(releasers).sort();
247
129
  }
248
- exports.buildChangelogNotes = buildChangelogNotes;
130
+ exports.getReleaserTypes = getReleaserTypes;
249
131
  //# sourceMappingURL=factory.js.map
@@ -59,6 +59,12 @@ export interface GitHubTag {
59
59
  name: string;
60
60
  sha: string;
61
61
  }
62
+ interface FileDiff {
63
+ readonly mode: '100644' | '100755' | '040000' | '160000' | '120000';
64
+ readonly content: string | null;
65
+ readonly originalContent: string | null;
66
+ }
67
+ export declare type ChangeSet = Map<string, FileDiff>;
62
68
  export declare class GitHub {
63
69
  readonly repository: Repository;
64
70
  private octokit;
@@ -256,7 +262,7 @@ export declare class GitHub {
256
262
  * @return {Changes} The changeset to suggest.
257
263
  * @throws {GitHubAPIError} on an API error
258
264
  */
259
- private getChangeSet;
265
+ buildChangeSet(updates: Update[], defaultBranch: string): Promise<ChangeSet>;
260
266
  /**
261
267
  * Returns a list of paths to all files with a given file
262
268
  * extension.
@@ -127,7 +127,7 @@ class GitHub {
127
127
  });
128
128
  this.createPullRequest = wrapAsync(async (pullRequest, targetBranch, message, updates, options) => {
129
129
  // Update the files for the release if not already supplied
130
- const changes = await this.getChangeSet(updates, targetBranch);
130
+ const changes = await this.buildChangeSet(updates, targetBranch);
131
131
  const prNumber = await code_suggester_1.createPullRequest(this.octokit, changes, {
132
132
  upstreamOwner: this.repository.owner,
133
133
  upstreamRepo: this.repository.repo,
@@ -175,7 +175,7 @@ class GitHub {
175
175
  */
176
176
  this.updatePullRequest = wrapAsync(async (number, releasePullRequest, targetBranch, options) => {
177
177
  // Update the files for the release if not already supplied
178
- const changes = await this.getChangeSet(releasePullRequest.updates, targetBranch);
178
+ const changes = await this.buildChangeSet(releasePullRequest.updates, targetBranch);
179
179
  let message = releasePullRequest.title.toString();
180
180
  if (options === null || options === void 0 ? void 0 : options.signoffUser) {
181
181
  message = signoff_commit_message_1.signoffCommitMessage(message, options.signoffUser);
@@ -891,7 +891,7 @@ class GitHub {
891
891
  * @return {Changes} The changeset to suggest.
892
892
  * @throws {GitHubAPIError} on an API error
893
893
  */
894
- async getChangeSet(updates, defaultBranch) {
894
+ async buildChangeSet(updates, defaultBranch) {
895
895
  const changes = new Map();
896
896
  for (const update of updates) {
897
897
  let content;
@@ -915,6 +915,7 @@ class GitHub {
915
915
  if (updatedContent) {
916
916
  changes.set(update.path, {
917
917
  content: updatedContent,
918
+ originalContent: (content === null || content === void 0 ? void 0 : content.parsedContent) || null,
918
919
  mode: (content === null || content === void 0 ? void 0 : content.mode) || file_cache_1.DEFAULT_FILE_MODE,
919
920
  });
920
921
  }
@@ -1,5 +1,11 @@
1
1
  export * as Errors from './errors';
2
- export { Manifest, ReleaserConfig, ManifestOptions } from './manifest';
3
- export { ReleaseType, getReleaserTypes, VersioningStrategyType, getVersioningStrategyTypes, ChangelogNotesType, getChangelogTypes, } from './factory';
2
+ export { Manifest, ReleaserConfig, ManifestOptions, PluginType, } from './manifest';
3
+ export { Commit, ConventionalCommit } from './commit';
4
+ export { BaseStrategyOptions, BuildUpdatesOptions } from './strategies/base';
5
+ export { ReleaseBuilder, ReleaseType, getReleaserTypes, registerReleaseType, } from './factory';
6
+ export { ChangelogNotesBuilder, ChangelogNotesFactoryOptions, ChangelogNotesType, getChangelogTypes, registerChangelogNotes, } from './factories/changelog-notes-factory';
7
+ export { PluginBuilder, PluginFactoryOptions, getPluginTypes, registerPlugin, } from './factories/plugin-factory';
8
+ export { VersioningStrategyBuilder, VersioningStrategyFactoryOptions, VersioningStrategyType, getVersioningStrategyTypes, registerVersioningStrategy, } from './factories/versioning-strategy-factory';
9
+ export { BuildNotesOptions, ChangelogNotes, ChangelogSection, } from './changelog-notes';
4
10
  export { Logger, setLogger } from './util/logger';
5
11
  export { GitHub } from './github';
@@ -18,8 +18,16 @@ var manifest_1 = require("./manifest");
18
18
  Object.defineProperty(exports, "Manifest", { enumerable: true, get: function () { return manifest_1.Manifest; } });
19
19
  var factory_1 = require("./factory");
20
20
  Object.defineProperty(exports, "getReleaserTypes", { enumerable: true, get: function () { return factory_1.getReleaserTypes; } });
21
- Object.defineProperty(exports, "getVersioningStrategyTypes", { enumerable: true, get: function () { return factory_1.getVersioningStrategyTypes; } });
22
- Object.defineProperty(exports, "getChangelogTypes", { enumerable: true, get: function () { return factory_1.getChangelogTypes; } });
21
+ Object.defineProperty(exports, "registerReleaseType", { enumerable: true, get: function () { return factory_1.registerReleaseType; } });
22
+ var changelog_notes_factory_1 = require("./factories/changelog-notes-factory");
23
+ Object.defineProperty(exports, "getChangelogTypes", { enumerable: true, get: function () { return changelog_notes_factory_1.getChangelogTypes; } });
24
+ Object.defineProperty(exports, "registerChangelogNotes", { enumerable: true, get: function () { return changelog_notes_factory_1.registerChangelogNotes; } });
25
+ var plugin_factory_1 = require("./factories/plugin-factory");
26
+ Object.defineProperty(exports, "getPluginTypes", { enumerable: true, get: function () { return plugin_factory_1.getPluginTypes; } });
27
+ Object.defineProperty(exports, "registerPlugin", { enumerable: true, get: function () { return plugin_factory_1.registerPlugin; } });
28
+ var versioning_strategy_factory_1 = require("./factories/versioning-strategy-factory");
29
+ Object.defineProperty(exports, "getVersioningStrategyTypes", { enumerable: true, get: function () { return versioning_strategy_factory_1.getVersioningStrategyTypes; } });
30
+ Object.defineProperty(exports, "registerVersioningStrategy", { enumerable: true, get: function () { return versioning_strategy_factory_1.registerVersioningStrategy; } });
23
31
  var logger_1 = require("./util/logger");
24
32
  Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return logger_1.setLogger; } });
25
33
  var github_1 = require("./github");
@@ -74,8 +74,8 @@ interface ReleaserConfigJson {
74
74
  'changelog-type'?: ChangelogNotesType;
75
75
  'pull-request-title-pattern'?: string;
76
76
  'tag-separator'?: string;
77
- 'version-file'?: string;
78
77
  'extra-files'?: string[];
78
+ 'version-file'?: string;
79
79
  'snapshot-label'?: string;
80
80
  }
81
81
  export interface ManifestOptions {
@@ -100,13 +100,16 @@ interface ReleaserPackageConfig extends ReleaserConfigJson {
100
100
  component?: string;
101
101
  'changelog-path'?: string;
102
102
  }
103
- declare type DirectPluginType = 'node-workspace' | 'cargo-workspace';
104
- interface LinkedVersionPluginConfig {
103
+ export declare type DirectPluginType = string;
104
+ export interface ConfigurablePluginType {
105
+ type: string;
106
+ }
107
+ export interface LinkedVersionPluginConfig extends ConfigurablePluginType {
105
108
  type: 'linked-versions';
106
109
  groupName: string;
107
110
  components: string[];
108
111
  }
109
- export declare type PluginType = DirectPluginType | LinkedVersionPluginConfig;
112
+ export declare type PluginType = DirectPluginType | ConfigurablePluginType | LinkedVersionPluginConfig;
110
113
  /**
111
114
  * This is the schema of the manifest config json
112
115
  */
@@ -40,6 +40,8 @@ export interface BaseStrategyOptions {
40
40
  includeVInTag?: boolean;
41
41
  pullRequestTitlePattern?: string;
42
42
  extraFiles?: ExtraFile[];
43
+ versionFile?: string;
44
+ snapshotLabels?: string[];
43
45
  }
44
46
  /**
45
47
  * A strategy is responsible for determining which files are
@@ -204,14 +204,8 @@ class BaseStrategy {
204
204
  return changelogEntry.split('\n').length <= 1;
205
205
  }
206
206
  async updateVersionsMap(versionsMap, conventionalCommits, _newVersion) {
207
- for (const versionKey of versionsMap.keys()) {
208
- const version = versionsMap.get(versionKey);
209
- if (!version) {
210
- logger_1.logger.warn(`didn't find version for ${versionKey}`);
211
- continue;
212
- }
213
- const newVersion = await this.versioningStrategy.bump(version, conventionalCommits);
214
- versionsMap.set(versionKey, newVersion);
207
+ for (const [component, version] of versionsMap.entries()) {
208
+ versionsMap.set(component, await this.versioningStrategy.bump(version, conventionalCommits));
215
209
  }
216
210
  return versionsMap;
217
211
  }
@@ -5,9 +5,6 @@ import { Commit } from '../commit';
5
5
  import { Release } from '../release';
6
6
  import { ReleasePullRequest } from '../release-pull-request';
7
7
  import { VersioningStrategy } from '../versioning-strategy';
8
- export interface JavaStrategyOptions extends BaseStrategyOptions {
9
- snapshotLabels?: string[];
10
- }
11
8
  export interface JavaBuildUpdatesOption extends BuildUpdatesOptions {
12
9
  isSnapshot?: boolean;
13
10
  }
@@ -19,7 +16,7 @@ export interface JavaBuildUpdatesOption extends BuildUpdatesOptions {
19
16
  export declare class Java extends BaseStrategy {
20
17
  protected readonly snapshotVersioning: VersioningStrategy;
21
18
  protected readonly snapshotLabels: string[];
22
- constructor(options: JavaStrategyOptions);
19
+ constructor(options: BaseStrategyOptions);
23
20
  buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest | undefined>;
24
21
  protected buildSnapshotPullRequest(latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest>;
25
22
  isPublishedVersion(version: Version): boolean;
@@ -70,6 +70,9 @@ class Java extends base_1.BaseStrategy {
70
70
  ? await this.snapshotVersioning.bump(latestRelease.tag.version, [])
71
71
  : this.initialReleaseVersion();
72
72
  const versionsMap = await this.buildVersionsMap([]);
73
+ for (const [component, version] of versionsMap.entries()) {
74
+ versionsMap.set(component, await this.snapshotVersioning.bump(version, []));
75
+ }
73
76
  const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion);
74
77
  const branchName = component
75
78
  ? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
@@ -4,14 +4,10 @@ import { Update } from '../update';
4
4
  import { Release } from '../release';
5
5
  import { TagName } from '../util/tag-name';
6
6
  import { Version } from '../version';
7
- interface RubyYoshiStrategyOptions extends BaseStrategyOptions {
8
- versionFile?: string;
9
- }
10
7
  export declare class RubyYoshi extends BaseStrategy {
11
8
  readonly versionFile: string;
12
- constructor(options: RubyYoshiStrategyOptions);
9
+ constructor(options: BaseStrategyOptions);
13
10
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
14
11
  protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
15
12
  protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release, commits?: Commit[]): Promise<string>;
16
13
  }
17
- export {};
@@ -82,8 +82,10 @@ class RubyYoshi extends base_1.BaseStrategy {
82
82
  return (releaseNotes
83
83
  // Remove links in version title line and standardize on h3
84
84
  .replace(/^###? \[([\d.]+)\]\([^)]*\)/gm, '### $1')
85
+ // Remove bolded scope from change lines
86
+ .replace(/^\* \*\*[\w-]+:\*\* /gm, '* ')
85
87
  // Remove PR and commit links from pull request title suffixes
86
- .replace(/ \(\[#\d+\]\([^)]*\)\)( \(\[\w+\]\([^)]*\)\))?\s*$/gm, '')
88
+ .replace(/( \(\[(\w+|#\d+)\]\(https:\/\/github\.com\/[^)]*\)\))+\s*$/gm, '')
87
89
  // Standardize on h4 for change type subheaders
88
90
  .replace(/^### (Features|Bug Fixes|Documentation)$/gm, '#### $1')
89
91
  // Collapse 2 or more blank lines
@@ -1,13 +1,9 @@
1
1
  import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { ConventionalCommit } from '../commit';
3
3
  import { Update } from '../update';
4
- interface RubyStrategyOptions extends BaseStrategyOptions {
5
- versionFile?: string;
6
- }
7
4
  export declare class Ruby extends BaseStrategy {
8
5
  readonly versionFile: string;
9
- constructor(options: RubyStrategyOptions);
6
+ constructor(options: BaseStrategyOptions);
10
7
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
11
8
  protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
12
9
  }
13
- export {};
@@ -1,11 +1,7 @@
1
1
  import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { Update } from '../update';
3
- interface SimpleStrategyOptions extends BaseStrategyOptions {
4
- versionFile?: string;
5
- }
6
3
  export declare class Simple extends BaseStrategy {
7
4
  readonly versionFile: string;
8
- constructor(options: SimpleStrategyOptions);
5
+ constructor(options: BaseStrategyOptions);
9
6
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
10
7
  }
11
- export {};
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.BaseXml = void 0;
17
- const dom = require("xmldom");
17
+ const dom = require("@xmldom/xmldom");
18
18
  /**
19
19
  * Base class for all updaters working with XML files.
20
20
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.10.1",
3
+ "version": "13.11.1",
4
4
  "description": "generate release PRs based on the conventionalcommits.org spec",
5
5
  "main": "./build/src/index.js",
6
6
  "bin": "./build/src/bin/release-please.js",
@@ -39,6 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@octokit/types": "^6.1.0",
41
41
  "@types/chai": "^4.1.7",
42
+ "@types/diff": "^5.0.2",
42
43
  "@types/iarna__toml": "^2.0.1",
43
44
  "@types/js-yaml": "^4.0.0",
44
45
  "@types/jsonpath": "^0.2.0",
@@ -59,7 +60,7 @@
59
60
  "gts": "^3.0.0",
60
61
  "mocha": "^9.0.0",
61
62
  "nock": "^13.0.0",
62
- "sinon": "13.0.1",
63
+ "sinon": "13.0.2",
63
64
  "snap-shot-it": "^7.0.0"
64
65
  },
65
66
  "dependencies": {
@@ -74,12 +75,14 @@
74
75
  "@octokit/request-error": "^2.1.0",
75
76
  "@octokit/rest": "^18.12.0",
76
77
  "@types/npm-package-arg": "^6.1.0",
78
+ "@xmldom/xmldom": "^0.8.2",
77
79
  "chalk": "^4.0.0",
78
80
  "code-suggester": "^2.0.0",
79
81
  "conventional-changelog-conventionalcommits": "^4.6.0",
80
82
  "conventional-changelog-writer": "^5.0.0",
81
83
  "conventional-commits-filter": "^2.0.2",
82
84
  "detect-indent": "^6.1.0",
85
+ "diff": "^5.0.0",
83
86
  "figures": "^3.0.0",
84
87
  "js-yaml": "^4.0.0",
85
88
  "jsonpath": "^1.1.1",
@@ -90,7 +93,6 @@
90
93
  "typescript": "^3.8.3",
91
94
  "unist-util-visit": "^2.0.3",
92
95
  "unist-util-visit-parents": "^3.1.1",
93
- "xmldom": "^0.6.0",
94
96
  "xpath": "^0.0.32",
95
97
  "yargs": "^17.0.0"
96
98
  },