release-please 13.4.5 → 13.4.6

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.4.6](https://github.com/googleapis/release-please/compare/v13.4.5...v13.4.6) (2022-02-01)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * cargo workspace cargo lock handling ([#1260](https://github.com/googleapis/release-please/issues/1260)) ([55e9d38](https://github.com/googleapis/release-please/commit/55e9d3822d4d36d3123231f22dccacf35910929e))
13
+ * krm blueprints should update yaml files ([#1269](https://github.com/googleapis/release-please/issues/1269)) ([d6ef98a](https://github.com/googleapis/release-please/commit/d6ef98a7031b599e38a505af2ffc51e85b3c6da6)), closes [#1268](https://github.com/googleapis/release-please/issues/1268)
14
+
7
15
  ### [13.4.5](https://github.com/googleapis/release-please/compare/v13.4.4...v13.4.5) (2022-02-01)
8
16
 
9
17
 
@@ -45,6 +45,7 @@ export declare class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
45
45
  protected bumpVersion(pkg: CrateInfo): Version;
46
46
  protected updateCandidate(existingCandidate: CandidateReleasePullRequest, pkg: CrateInfo, updatedVersions: VersionsMap): CandidateReleasePullRequest;
47
47
  protected newCandidate(pkg: CrateInfo, updatedVersions: VersionsMap): CandidateReleasePullRequest;
48
+ protected postProcessCandidates(candidates: CandidateReleasePullRequest[], updatedVersions: VersionsMap): CandidateReleasePullRequest[];
48
49
  protected buildGraph(allPackages: CrateInfo[]): Promise<DependencyGraph<CrateInfo>>;
49
50
  protected inScope(candidate: CandidateReleasePullRequest): boolean;
50
51
  protected packageNameFromPackage(pkg: CrateInfo): string;
@@ -113,10 +113,7 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
113
113
  update.updater.changelogEntry = appendDependenciesSectionToChangelog(update.updater.changelogEntry, dependencyNotes);
114
114
  }
115
115
  else if (update.path === addPath(existingCandidate.path, 'Cargo.lock')) {
116
- update.updater = new cargo_lock_1.CargoLock({
117
- version,
118
- versionsMap: updatedVersions,
119
- });
116
+ update.updater = new cargo_lock_1.CargoLock(updatedVersions);
120
117
  }
121
118
  return update;
122
119
  });
@@ -186,6 +183,18 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
186
183
  },
187
184
  };
188
185
  }
186
+ postProcessCandidates(candidates, updatedVersions) {
187
+ const rootCandidate = candidates.find(c => c.path === manifest_1.ROOT_PROJECT_PATH);
188
+ if (!rootCandidate) {
189
+ throw Error('Unable to find root candidate pull request');
190
+ }
191
+ rootCandidate.pullRequest.updates.push({
192
+ path: 'Cargo.lock',
193
+ createIfMissing: false,
194
+ updater: new cargo_lock_1.CargoLock(updatedVersions),
195
+ });
196
+ return candidates;
197
+ }
189
198
  async buildGraph(allPackages) {
190
199
  var _a, _b, _c;
191
200
  const workspaceCrateNames = new Set(allPackages.map(crateInfo => crateInfo.name));
@@ -29,6 +29,7 @@ export declare class NodeWorkspace extends WorkspacePlugin<Package> {
29
29
  protected bumpVersion(pkg: Package): Version;
30
30
  protected updateCandidate(existingCandidate: CandidateReleasePullRequest, pkg: Package, updatedVersions: VersionsMap): CandidateReleasePullRequest;
31
31
  protected newCandidate(pkg: Package, updatedVersions: VersionsMap): CandidateReleasePullRequest;
32
+ protected postProcessCandidates(candidates: CandidateReleasePullRequest[], _updatedVersions: VersionsMap): CandidateReleasePullRequest[];
32
33
  protected buildGraph(allPackages: Package[]): Promise<DependencyGraph<Package>>;
33
34
  protected inScope(candidate: CandidateReleasePullRequest): boolean;
34
35
  protected packageNameFromPackage(pkg: Package): string;
@@ -190,6 +190,10 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
190
190
  },
191
191
  };
192
192
  }
193
+ postProcessCandidates(candidates, _updatedVersions) {
194
+ // NOP for node workspaces
195
+ return candidates;
196
+ }
193
197
  async buildGraph(allPackages) {
194
198
  var _a, _b, _c, _d;
195
199
  const graph = new Map();
@@ -83,6 +83,19 @@ export declare abstract class WorkspacePlugin<T> extends ManifestPlugin {
83
83
  * @returns {string} The package name.
84
84
  */
85
85
  protected abstract packageNameFromPackage(pkg: T): string;
86
+ /**
87
+ * Amend any or all in-scope candidates once all other processing has occured.
88
+ *
89
+ * This gives the workspace plugin once last chance to tweak the pull-requests
90
+ * once all the underlying information has been collated.
91
+ * @param {CandidateReleasePullRequest[]} candidates - The list of candidates
92
+ * once all other workspace processing has occured.
93
+ * @param {VersionMap} updatedVersions - Map containing any component versions
94
+ * that have changed.
95
+ * @returns {CandidateReleasePullRequest[]} potentially amended list of
96
+ * candidates.
97
+ */
98
+ protected abstract postProcessCandidates(candidates: CandidateReleasePullRequest[], updatedVersions: VersionsMap): CandidateReleasePullRequest[];
86
99
  /**
87
100
  * Helper to invert the graph from package => packages that it depends on
88
101
  * to package => packages that depend on it.
@@ -98,6 +98,8 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
98
98
  logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`);
99
99
  const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig);
100
100
  newCandidates = await mergePlugin.run(newCandidates);
101
+ logger_1.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`);
102
+ newCandidates = this.postProcessCandidates(newCandidates, updatedVersions);
101
103
  return [...outOfScopeCandidates, ...newCandidates];
102
104
  }
103
105
  /**
@@ -102,10 +102,7 @@ class Rust extends base_1.BaseStrategy {
102
102
  updates.push({
103
103
  path: this.addPath('Cargo.lock'),
104
104
  createIfMissing: false,
105
- updater: new cargo_lock_1.CargoLock({
106
- version,
107
- versionsMap,
108
- }),
105
+ updater: new cargo_lock_1.CargoLock(versionsMap),
109
106
  });
110
107
  return updates;
111
108
  }
@@ -32,7 +32,7 @@ class KRMBlueprintVersion extends default_1.DefaultUpdater {
32
32
  let matchRegex = '(cnrm/.*/)(v[0-9]+.[0-9]+.[0-9]+)+(-w+)?';
33
33
  // if explicit previous version, match only that version
34
34
  if ((_a = this.versionsMap) === null || _a === void 0 ? void 0 : _a.has('previousVersion')) {
35
- matchRegex = `(cnrm/.*/)(${this.versionsMap.get('previousVersion')})+(-w+)?`;
35
+ matchRegex = `(cnrm/.*/)(v${this.versionsMap.get('previousVersion')})+(-w+)?`;
36
36
  }
37
37
  const oldVersion = content.match(new RegExp(matchRegex));
38
38
  if (oldVersion) {
@@ -1,8 +1,11 @@
1
- import { DefaultUpdater } from '../default';
1
+ import { Updater } from '../../update';
2
+ import { VersionsMap } from '../../version';
2
3
  /**
3
4
  * Updates `Cargo.lock` lockfiles, preserving formatting and comments.
4
5
  */
5
- export declare class CargoLock extends DefaultUpdater {
6
+ export declare class CargoLock implements Updater {
7
+ versionsMap: VersionsMap;
8
+ constructor(versionsMap: VersionsMap);
6
9
  /**
7
10
  * Given initial file contents, return updated contents.
8
11
  * @param {string} content The initial content
@@ -17,11 +17,13 @@ exports.CargoLock = void 0;
17
17
  const toml_edit_1 = require("../../util/toml-edit");
18
18
  const common_1 = require("./common");
19
19
  const logger_1 = require("../../util/logger");
20
- const default_1 = require("../default");
21
20
  /**
22
21
  * Updates `Cargo.lock` lockfiles, preserving formatting and comments.
23
22
  */
24
- class CargoLock extends default_1.DefaultUpdater {
23
+ class CargoLock {
24
+ constructor(versionsMap) {
25
+ this.versionsMap = versionsMap;
26
+ }
25
27
  /**
26
28
  * Given initial file contents, return updated contents.
27
29
  * @param {string} content The initial content
@@ -29,9 +31,6 @@ class CargoLock extends default_1.DefaultUpdater {
29
31
  */
30
32
  updateContent(content) {
31
33
  let payload = content;
32
- if (!this.versionsMap) {
33
- throw new Error('updateContent called with no versions');
34
- }
35
34
  const parsed = common_1.parseCargoLockfile(payload);
36
35
  if (!parsed.package) {
37
36
  logger_1.logger.error('is not a Cargo lockfile');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.4.5",
3
+ "version": "13.4.6",
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",