release-please 13.19.9 → 13.20.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [13.20.0](https://github.com/googleapis/release-please/compare/v13.19.9...v13.20.0) (2022-08-08)
8
+
9
+
10
+ ### Features
11
+
12
+ * allow plugins to skip merging in-scope pull requests ([#1550](https://github.com/googleapis/release-please/issues/1550)) ([354b1dc](https://github.com/googleapis/release-please/commit/354b1dc89c468e44b59507b4bb2f15d6723110ed))
13
+ * allow skipping snapshots for java strategies ([#1555](https://github.com/googleapis/release-please/issues/1555)) ([3430693](https://github.com/googleapis/release-please/commit/34306932e5fe21c89020b184a527c220d10c8390))
14
+
7
15
  ## [13.19.9](https://github.com/googleapis/release-please/compare/v13.19.8...v13.19.9) (2022-08-08)
8
16
 
9
17
 
@@ -29,7 +29,10 @@ function buildPlugin(options) {
29
29
  if (typeof options.type === 'object') {
30
30
  const builder = pluginFactories[options.type.type];
31
31
  if (builder) {
32
- return builder(options);
32
+ return builder({
33
+ ...options.type,
34
+ ...options,
35
+ });
33
36
  }
34
37
  throw new errors_1.ConfigurationError(`Unknown plugin type: ${options.type.type}`, 'core', `${options.github.repository.owner}/${options.github.repository.repo}`);
35
38
  }
@@ -54,6 +54,7 @@ export interface ReleaserConfig {
54
54
  versionFile?: string;
55
55
  extraFiles?: ExtraFile[];
56
56
  snapshotLabels?: string[];
57
+ skipSnapshot?: boolean;
57
58
  }
58
59
  export interface CandidateReleasePullRequest {
59
60
  path: string;
@@ -88,6 +89,7 @@ interface ReleaserConfigJson {
88
89
  'extra-files'?: ExtraFile[];
89
90
  'version-file'?: string;
90
91
  'snapshot-label'?: string;
92
+ 'skip-snapshot'?: boolean;
91
93
  }
92
94
  export interface ManifestOptions {
93
95
  bootstrapSha?: string;
@@ -123,8 +125,12 @@ export interface LinkedVersionPluginConfig extends ConfigurablePluginType {
123
125
  type: 'linked-versions';
124
126
  groupName: string;
125
127
  components: string[];
128
+ merge?: boolean;
126
129
  }
127
- export declare type PluginType = DirectPluginType | ConfigurablePluginType | LinkedVersionPluginConfig;
130
+ export interface WorkspacePluginConfig extends ConfigurablePluginType {
131
+ merge?: boolean;
132
+ }
133
+ export declare type PluginType = DirectPluginType | ConfigurablePluginType | LinkedVersionPluginConfig | WorkspacePluginConfig;
128
134
  /**
129
135
  * This is the schema of the manifest config json
130
136
  */
@@ -365,6 +365,7 @@ class Manifest {
365
365
  plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, this.groupPullRequestTitlePattern));
366
366
  }
367
367
  for (const plugin of plugins) {
368
+ logger_1.logger.debug(`running plugin: ${plugin.constructor.name}`);
368
369
  newReleasePullRequests = await plugin.run(newReleasePullRequests);
369
370
  }
370
371
  return newReleasePullRequests.map(pullRequestWithConfig => pullRequestWithConfig.pullRequest);
@@ -732,6 +733,7 @@ function extractReleaserConfig(config) {
732
733
  separatePullRequests: config['separate-pull-requests'],
733
734
  labels: (_a = config['label']) === null || _a === void 0 ? void 0 : _a.split(','),
734
735
  releaseLabels: (_b = config['release-label']) === null || _b === void 0 ? void 0 : _b.split(','),
736
+ skipSnapshot: config['skip-snapshot'],
735
737
  };
736
738
  }
737
739
  /**
@@ -936,7 +938,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
936
938
  return candidateTagVersion.sort((a, b) => b.compare(a))[0];
937
939
  }
938
940
  function mergeReleaserConfig(defaultConfig, pathConfig) {
939
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
941
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
940
942
  return {
941
943
  releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
942
944
  bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
@@ -958,6 +960,7 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
958
960
  tagSeparator: (_u = pathConfig.tagSeparator) !== null && _u !== void 0 ? _u : defaultConfig.tagSeparator,
959
961
  pullRequestTitlePattern: (_v = pathConfig.pullRequestTitlePattern) !== null && _v !== void 0 ? _v : defaultConfig.pullRequestTitlePattern,
960
962
  separatePullRequests: (_w = pathConfig.separatePullRequests) !== null && _w !== void 0 ? _w : defaultConfig.separatePullRequests,
963
+ skipSnapshot: (_x = pathConfig.skipSnapshot) !== null && _x !== void 0 ? _x : defaultConfig.skipSnapshot,
961
964
  };
962
965
  }
963
966
  /**
@@ -178,10 +178,16 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
178
178
  };
179
179
  }
180
180
  postProcessCandidates(candidates, updatedVersions) {
181
- const rootCandidate = candidates.find(c => c.path === manifest_1.ROOT_PROJECT_PATH);
181
+ let rootCandidate = candidates.find(c => c.path === manifest_1.ROOT_PROJECT_PATH);
182
182
  if (!rootCandidate) {
183
- throw Error('Unable to find root candidate pull request');
183
+ logger_1.logger.warn('Unable to find root candidate pull request');
184
+ rootCandidate = candidates.find(c => c.config.releaseType === 'rust');
184
185
  }
186
+ if (!rootCandidate) {
187
+ logger_1.logger.warn('Unable to find a rust candidate pull request');
188
+ return candidates;
189
+ }
190
+ // Update the root Cargo.lock if it exists
185
191
  rootCandidate.pullRequest.updates.push({
186
192
  path: 'Cargo.lock',
187
193
  createIfMissing: false,
@@ -4,6 +4,9 @@ import { GitHub } from '../github';
4
4
  import { Strategy } from '../strategy';
5
5
  import { Commit } from '../commit';
6
6
  import { Release } from '../release';
7
+ interface LinkedVersionsPluginOptions {
8
+ merge?: boolean;
9
+ }
7
10
  /**
8
11
  * This plugin reconfigures strategies by linking multiple components
9
12
  * together.
@@ -13,7 +16,8 @@ import { Release } from '../release';
13
16
  export declare class LinkedVersions extends ManifestPlugin {
14
17
  private groupName;
15
18
  private components;
16
- constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, groupName: string, components: string[]);
19
+ private merge;
20
+ constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, groupName: string, components: string[], options?: LinkedVersionsPluginOptions);
17
21
  /**
18
22
  * Pre-configure strategies.
19
23
  * @param {Record<string, Strategy>} strategiesByPath Strategies indexed by path
@@ -27,3 +31,4 @@ export declare class LinkedVersions extends ManifestPlugin {
27
31
  */
28
32
  run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
29
33
  }
34
+ export {};
@@ -25,10 +25,12 @@ const merge_1 = require("./merge");
25
25
  * Release notes are broken up using `<summary>`/`<details>` blocks.
26
26
  */
27
27
  class LinkedVersions extends plugin_1.ManifestPlugin {
28
- constructor(github, targetBranch, repositoryConfig, groupName, components) {
28
+ constructor(github, targetBranch, repositoryConfig, groupName, components, options = {}) {
29
+ var _a;
29
30
  super(github, targetBranch, repositoryConfig);
30
31
  this.groupName = groupName;
31
32
  this.components = new Set(components);
33
+ this.merge = (_a = options.merge) !== null && _a !== void 0 ? _a : true;
32
34
  }
33
35
  /**
34
36
  * Pre-configure strategies.
@@ -99,6 +101,9 @@ class LinkedVersions extends plugin_1.ManifestPlugin {
99
101
  * @returns {CandidateReleasePullRequest[]} Updated pull requests
100
102
  */
101
103
  async run(candidates) {
104
+ if (!this.merge) {
105
+ return candidates;
106
+ }
102
107
  const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => {
103
108
  if (!candidate.pullRequest.version) {
104
109
  logger_1.logger.warn('pull request missing version', candidate);
@@ -10,6 +10,7 @@ export interface DependencyNode<T> {
10
10
  export interface WorkspacePluginOptions {
11
11
  manifestPath?: string;
12
12
  updateAllPackages?: boolean;
13
+ merge?: boolean;
13
14
  }
14
15
  export interface AllPackages<T> {
15
16
  allPackages: T[];
@@ -29,6 +30,7 @@ export interface AllPackages<T> {
29
30
  export declare abstract class WorkspacePlugin<T> extends ManifestPlugin {
30
31
  private updateAllPackages;
31
32
  private manifestPath;
33
+ private merge;
32
34
  constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, options?: WorkspacePluginOptions);
33
35
  run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
34
36
  /**
@@ -32,10 +32,11 @@ const release_please_manifest_1 = require("../updaters/release-please-manifest")
32
32
  */
33
33
  class WorkspacePlugin extends plugin_1.ManifestPlugin {
34
34
  constructor(github, targetBranch, repositoryConfig, options = {}) {
35
- var _a, _b;
35
+ var _a, _b, _c;
36
36
  super(github, targetBranch, repositoryConfig);
37
37
  this.manifestPath = (_a = options.manifestPath) !== null && _a !== void 0 ? _a : manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST;
38
38
  this.updateAllPackages = (_b = options.updateAllPackages) !== null && _b !== void 0 ? _b : false;
39
+ this.merge = (_c = options.merge) !== null && _c !== void 0 ? _c : true;
39
40
  }
40
41
  async run(candidates) {
41
42
  logger_1.logger.info('Running workspace plugin');
@@ -100,23 +101,20 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
100
101
  newCandidates.push(newCandidate);
101
102
  }
102
103
  }
103
- logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`);
104
- const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig);
105
- newCandidates = await mergePlugin.run(newCandidates);
106
- if (newCandidates.length === 1) {
107
- const newUpdates = newCandidates[0].pullRequest.updates;
108
- newUpdates.push({
109
- path: this.manifestPath,
110
- createIfMissing: false,
111
- updater: new release_please_manifest_1.ReleasePleaseManifest({
112
- version: newCandidates[0].pullRequest.version,
113
- versionsMap: updatedPathVersions,
114
- }),
115
- });
116
- }
117
- else {
118
- logger_1.logger.warn(`Expected 1 merged candidate, got ${newCandidates.length}`);
104
+ if (this.merge) {
105
+ logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`);
106
+ const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig);
107
+ newCandidates = await mergePlugin.run(newCandidates);
119
108
  }
109
+ const newUpdates = newCandidates[0].pullRequest.updates;
110
+ newUpdates.push({
111
+ path: this.manifestPath,
112
+ createIfMissing: false,
113
+ updater: new release_please_manifest_1.ReleasePleaseManifest({
114
+ version: newCandidates[0].pullRequest.version,
115
+ versionsMap: updatedPathVersions,
116
+ }),
117
+ });
120
118
  logger_1.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`);
121
119
  newCandidates = this.postProcessCandidates(newCandidates, updatedVersions);
122
120
  return [...outOfScopeCandidates, ...newCandidates];
@@ -43,6 +43,7 @@ export interface BaseStrategyOptions {
43
43
  extraFiles?: ExtraFile[];
44
44
  versionFile?: string;
45
45
  snapshotLabels?: string[];
46
+ skipSnapshot?: boolean;
46
47
  }
47
48
  /**
48
49
  * A strategy is responsible for determining which files are
@@ -16,6 +16,7 @@ export interface JavaBuildUpdatesOption extends BuildUpdatesOptions {
16
16
  export declare class Java extends BaseStrategy {
17
17
  protected readonly snapshotVersioning: VersioningStrategy;
18
18
  protected readonly snapshotLabels: string[];
19
+ readonly skipSnapshot: boolean;
19
20
  constructor(options: BaseStrategyOptions);
20
21
  buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest | undefined>;
21
22
  protected buildSnapshotPullRequest(latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest>;
@@ -47,7 +47,7 @@ const CHANGELOG_SECTIONS = [
47
47
  */
48
48
  class Java extends base_1.BaseStrategy {
49
49
  constructor(options) {
50
- var _a;
50
+ var _a, _b;
51
51
  options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
52
52
  // wrap the configured versioning strategy with snapshotting
53
53
  const parentVersioningStrategy = options.versioningStrategy || new default_1.DefaultVersioningStrategy();
@@ -55,6 +55,7 @@ class Java extends base_1.BaseStrategy {
55
55
  super(options);
56
56
  this.snapshotVersioning = new java_add_snapshot_1.JavaAddSnapshot(parentVersioningStrategy);
57
57
  this.snapshotLabels = options.snapshotLabels || manifest_1.DEFAULT_SNAPSHOT_LABELS;
58
+ this.skipSnapshot = (_b = options.skipSnapshot) !== null && _b !== void 0 ? _b : false;
58
59
  }
59
60
  async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
60
61
  if (await this.needsSnapshot(commits, latestRelease)) {
@@ -107,6 +108,9 @@ class Java extends base_1.BaseStrategy {
107
108
  }
108
109
  async needsSnapshot(commits, latestRelease) {
109
110
  var _a;
111
+ if (this.skipSnapshot) {
112
+ return false;
113
+ }
110
114
  const component = await this.getComponent();
111
115
  logger_1.logger.debug('component:', component);
112
116
  const version = (_a = latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag) === null || _a === void 0 ? void 0 : _a.version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.19.9",
3
+ "version": "13.20.0",
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",
@@ -171,6 +171,10 @@
171
171
  "snapshot-label": {
172
172
  "description": "Label to add to snapshot pull request. Used by `java` strategies.",
173
173
  "type": "string"
174
+ },
175
+ "skip-snapshot": {
176
+ "description": "If set, do not propose snapshot pull requests. Used by `java` strategies.",
177
+ "type": "boolean"
174
178
  }
175
179
  }
176
180
  }
@@ -228,10 +232,33 @@
228
232
  "items": {
229
233
  "type": "string"
230
234
  }
235
+ },
236
+ "merge": {
237
+ "description": "Whether to merge in-scope pull requests into a combined release pull request. Defaults to `true`.",
238
+ "type": "boolean"
231
239
  }
232
240
  },
233
241
  "required": ["type", "groupName", "components"]
234
242
  },
243
+ {
244
+ "description": "Configuration for various `workspace` plugins.",
245
+ "type": "object",
246
+ "properties": {
247
+ "type": {
248
+ "description": "The name of the plugin.",
249
+ "type": "string",
250
+ "enum": ["cargo-workspace", "maven-workspace", "node-workspace"]
251
+ },
252
+ "updateAllPackages": {
253
+ "description": "Whether to force updating all packages regardless of the dependency tree. Defaults to `false`.",
254
+ "type": "boolean"
255
+ },
256
+ "merge": {
257
+ "description": "Whether to merge in-scope pull requests into a combined release pull request. Defaults to `true`.",
258
+ "type": "boolean"
259
+ }
260
+ }
261
+ },
235
262
  {
236
263
  "description": "Other plugins",
237
264
  "type": "object",