release-please 14.1.1 → 14.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/build/src/commit.d.ts +2 -1
  3. package/build/src/commit.js +2 -2
  4. package/build/src/github.d.ts +4 -0
  5. package/build/src/github.js +30 -27
  6. package/build/src/manifest.d.ts +3 -0
  7. package/build/src/manifest.js +66 -65
  8. package/build/src/plugin.d.ts +3 -1
  9. package/build/src/plugin.js +3 -1
  10. package/build/src/plugins/cargo-workspace.js +9 -10
  11. package/build/src/plugins/linked-versions.d.ts +2 -0
  12. package/build/src/plugins/linked-versions.js +5 -6
  13. package/build/src/plugins/maven-workspace.js +14 -14
  14. package/build/src/plugins/merge.js +1 -2
  15. package/build/src/plugins/node-workspace.js +11 -12
  16. package/build/src/plugins/workspace.d.ts +3 -1
  17. package/build/src/plugins/workspace.js +20 -20
  18. package/build/src/strategies/base.d.ts +3 -0
  19. package/build/src/strategies/base.js +26 -24
  20. package/build/src/strategies/dotnet-yoshi.js +2 -3
  21. package/build/src/strategies/go-yoshi.js +7 -8
  22. package/build/src/strategies/java-yoshi.js +1 -2
  23. package/build/src/strategies/java.js +9 -8
  24. package/build/src/strategies/php-yoshi.js +4 -5
  25. package/build/src/strategies/python.js +2 -3
  26. package/build/src/strategies/rust.js +8 -9
  27. package/build/src/update.d.ts +2 -1
  28. package/build/src/updaters/dart/pubspec-yaml.d.ts +2 -1
  29. package/build/src/updaters/dart/pubspec-yaml.js +4 -4
  30. package/build/src/updaters/dotnet/apis.d.ts +2 -1
  31. package/build/src/updaters/dotnet/apis.js +2 -2
  32. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +2 -1
  33. package/build/src/updaters/elixir/elixir-mix-exs.js +2 -2
  34. package/build/src/updaters/generic-json.d.ts +2 -1
  35. package/build/src/updaters/generic-json.js +2 -2
  36. package/build/src/updaters/generic-yaml.d.ts +2 -1
  37. package/build/src/updaters/generic-yaml.js +3 -3
  38. package/build/src/updaters/generic.d.ts +2 -1
  39. package/build/src/updaters/generic.js +2 -2
  40. package/build/src/updaters/helm/chart-yaml.d.ts +2 -1
  41. package/build/src/updaters/helm/chart-yaml.js +2 -2
  42. package/build/src/updaters/java/java-update.d.ts +2 -1
  43. package/build/src/updaters/java/java-update.js +2 -2
  44. package/build/src/updaters/java/versions-manifest.d.ts +2 -1
  45. package/build/src/updaters/java/versions-manifest.js +2 -2
  46. package/build/src/updaters/krm/krm-blueprint-version.d.ts +2 -1
  47. package/build/src/updaters/krm/krm-blueprint-version.js +2 -2
  48. package/build/src/updaters/node/package-json.d.ts +2 -1
  49. package/build/src/updaters/node/package-json.js +2 -2
  50. package/build/src/updaters/node/package-lock-json.d.ts +2 -1
  51. package/build/src/updaters/node/package-lock-json.js +2 -2
  52. package/build/src/updaters/node/samples-package-json.d.ts +2 -1
  53. package/build/src/updaters/node/samples-package-json.js +2 -2
  54. package/build/src/updaters/ocaml/dune-project.d.ts +2 -1
  55. package/build/src/updaters/ocaml/dune-project.js +2 -2
  56. package/build/src/updaters/ocaml/esy-json.d.ts +2 -1
  57. package/build/src/updaters/ocaml/esy-json.js +2 -2
  58. package/build/src/updaters/ocaml/opam.d.ts +2 -1
  59. package/build/src/updaters/ocaml/opam.js +2 -2
  60. package/build/src/updaters/php/php-manifest.d.ts +2 -1
  61. package/build/src/updaters/php/php-manifest.js +3 -3
  62. package/build/src/updaters/php/root-composer-update-packages.d.ts +2 -1
  63. package/build/src/updaters/php/root-composer-update-packages.js +3 -3
  64. package/build/src/updaters/python/pyproject-toml.d.ts +2 -1
  65. package/build/src/updaters/python/pyproject-toml.js +2 -2
  66. package/build/src/updaters/rust/cargo-lock.d.ts +2 -1
  67. package/build/src/updaters/rust/cargo-lock.js +3 -3
  68. package/build/src/updaters/rust/cargo-toml.d.ts +2 -1
  69. package/build/src/updaters/rust/cargo-toml.js +7 -7
  70. package/build/src/updaters/terraform/module-version.d.ts +2 -1
  71. package/build/src/updaters/terraform/module-version.js +2 -2
  72. package/build/src/util/branch-name.d.ts +2 -1
  73. package/build/src/util/branch-name.js +2 -2
  74. package/build/src/util/pull-request-body.d.ts +2 -1
  75. package/build/src/util/pull-request-body.js +9 -9
  76. package/build/src/util/pull-request-title.d.ts +3 -2
  77. package/build/src/util/pull-request-title.js +8 -7
  78. package/build/src/versioning-strategies/default.d.ts +3 -0
  79. package/build/src/versioning-strategies/default.js +3 -1
  80. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [14.2.1](https://github.com/googleapis/release-please/compare/v14.2.0...v14.2.1) (2022-08-25)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * allow providing logger to GitHub.create ([#1603](https://github.com/googleapis/release-please/issues/1603)) ([a14e906](https://github.com/googleapis/release-please/commit/a14e906991e0120d0a85d1c4d739999cd6c9f1e4))
13
+
14
+ ## [14.2.0](https://github.com/googleapis/release-please/compare/v14.1.2...v14.2.0) (2022-08-25)
15
+
16
+
17
+ ### Features
18
+
19
+ * maintain an instance logger ([#1599](https://github.com/googleapis/release-please/issues/1599)) ([adb8053](https://github.com/googleapis/release-please/commit/adb805357d6344f1737bb3541ec7354e76f45cdc))
20
+
21
+ ## [14.1.2](https://github.com/googleapis/release-please/compare/v14.1.1...v14.1.2) (2022-08-25)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **deps:** update code-suggester to 4.1.0 ([#1600](https://github.com/googleapis/release-please/issues/1600)) ([e123a39](https://github.com/googleapis/release-please/commit/e123a392798e30ce75808f3b74e9b9836832725f))
27
+
7
28
  ## [14.1.1](https://github.com/googleapis/release-please/compare/v14.1.0...v14.1.1) (2022-08-23)
8
29
 
9
30
 
@@ -1,4 +1,5 @@
1
1
  import { PullRequest } from './pull-request';
2
+ import { Logger } from './util/logger';
2
3
  import * as parser from '@conventional-commits/parser';
3
4
  export interface Commit {
4
5
  sha: string;
@@ -23,4 +24,4 @@ export interface ConventionalCommit extends Commit {
23
24
  * more commits returned as a single raw commit may contain multiple release
24
25
  * messages.
25
26
  */
26
- export declare function parseConventionalCommits(commits: Commit[]): ConventionalCommit[];
27
+ export declare function parseConventionalCommits(commits: Commit[], logger?: Logger): ConventionalCommit[];
@@ -292,7 +292,7 @@ function parseCommits(message) {
292
292
  * more commits returned as a single raw commit may contain multiple release
293
293
  * messages.
294
294
  */
295
- function parseConventionalCommits(commits) {
295
+ function parseConventionalCommits(commits, logger = logger_1.logger) {
296
296
  const conventionalCommits = [];
297
297
  for (const commit of commits) {
298
298
  const commitMessage = preprocessCommitMessage(commit);
@@ -315,7 +315,7 @@ function parseConventionalCommits(commits) {
315
315
  }
316
316
  }
317
317
  catch (_err) {
318
- logger_1.logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`);
318
+ logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`);
319
319
  }
320
320
  }
321
321
  return conventionalCommits;
@@ -10,6 +10,7 @@ import { ReleasePullRequest } from './release-pull-request';
10
10
  import { Update } from './update';
11
11
  import { Release } from './release';
12
12
  import { GitHubFileContents } from '@google-automations/git-file-utils';
13
+ import { Logger } from 'code-suggester/build/src/types';
13
14
  declare type RequestBuilderType = typeof request;
14
15
  declare type DefaultFunctionType = RequestBuilderType['defaults'];
15
16
  declare type RequestFunctionType = ReturnType<DefaultFunctionType>;
@@ -21,6 +22,7 @@ export interface OctokitAPIs {
21
22
  export interface GitHubOptions {
22
23
  repository: Repository;
23
24
  octokitAPIs: OctokitAPIs;
25
+ logger?: Logger;
24
26
  }
25
27
  interface GitHubCreateOptions {
26
28
  owner: string;
@@ -30,6 +32,7 @@ interface GitHubCreateOptions {
30
32
  graphqlUrl?: string;
31
33
  octokitAPIs?: OctokitAPIs;
32
34
  token?: string;
35
+ logger?: Logger;
33
36
  }
34
37
  declare type CommitFilter = (commit: Commit) => boolean;
35
38
  interface CommitIteratorOptions {
@@ -71,6 +74,7 @@ export declare class GitHub {
71
74
  private request;
72
75
  private graphql;
73
76
  private fileCache;
77
+ private logger;
74
78
  private constructor();
75
79
  /**
76
80
  * Build a new GitHub client with auto-detected default branch.
@@ -30,6 +30,7 @@ const signoff_commit_message_1 = require("./util/signoff-commit-message");
30
30
  const git_file_utils_1 = require("@google-automations/git-file-utils");
31
31
  class GitHub {
32
32
  constructor(options) {
33
+ var _a;
33
34
  /**
34
35
  * Get the list of file paths modified in a given commit.
35
36
  *
@@ -38,7 +39,7 @@ class GitHub {
38
39
  * @throws {GitHubAPIError} on an API error
39
40
  */
40
41
  this.getCommitFiles = wrapAsync(async (sha) => {
41
- logger_1.logger.debug(`Backfilling file list for commit: ${sha}`);
42
+ this.logger.debug(`Backfilling file list for commit: ${sha}`);
42
43
  const files = [];
43
44
  for await (const resp of this.octokit.paginate.iterator(this.octokit.repos.getCommit, {
44
45
  owner: this.repository.owner,
@@ -52,10 +53,10 @@ class GitHub {
52
53
  }
53
54
  }
54
55
  if (files.length >= 3000) {
55
- logger_1.logger.warn(`Found ${files.length} files. This may not include all the files.`);
56
+ this.logger.warn(`Found ${files.length} files. This may not include all the files.`);
56
57
  }
57
58
  else {
58
- logger_1.logger.debug(`Found ${files.length} files`);
59
+ this.logger.debug(`Found ${files.length} files`);
59
60
  }
60
61
  return files;
61
62
  });
@@ -69,26 +70,26 @@ class GitHub {
69
70
  if (response) {
70
71
  return response;
71
72
  }
72
- logger_1.logger.trace('no GraphQL response, retrying');
73
+ this.logger.trace('no GraphQL response, retrying');
73
74
  }
74
75
  catch (err) {
75
76
  if (err.status !== 502) {
76
77
  throw err;
77
78
  }
78
79
  if (maxRetries === 0) {
79
- logger_1.logger.warn('ran out of retries and response is required');
80
+ this.logger.warn('ran out of retries and response is required');
80
81
  throw err;
81
82
  }
82
- logger_1.logger.info(`received 502 error, ${maxRetries} attempts remaining`);
83
+ this.logger.info(`received 502 error, ${maxRetries} attempts remaining`);
83
84
  }
84
85
  maxRetries -= 1;
85
86
  if (maxRetries >= 0) {
86
- logger_1.logger.trace(`sleeping ${seconds} seconds`);
87
+ this.logger.trace(`sleeping ${seconds} seconds`);
87
88
  await (0, exports.sleepInMs)(1000 * seconds);
88
89
  seconds = Math.min(seconds * 2, MAX_SLEEP_SECONDS);
89
90
  }
90
91
  }
91
- logger_1.logger.trace('ran out of retries');
92
+ this.logger.trace('ran out of retries');
92
93
  return undefined;
93
94
  });
94
95
  /**
@@ -106,7 +107,7 @@ class GitHub {
106
107
  if (prefix) {
107
108
  prefix = normalizePrefix(prefix);
108
109
  }
109
- logger_1.logger.debug(`finding files by filename: ${filename}, ref: ${ref}, prefix: ${prefix}`);
110
+ this.logger.debug(`finding files by filename: ${filename}, ref: ${ref}, prefix: ${prefix}`);
110
111
  return await this.fileCache.findFilesByFilename(filename, ref, prefix);
111
112
  });
112
113
  this.createPullRequest = wrapAsync(async (pullRequest, targetBranch, message, updates, options) => {
@@ -122,7 +123,7 @@ class GitHub {
122
123
  force: true,
123
124
  fork: !!(options === null || options === void 0 ? void 0 : options.fork),
124
125
  message,
125
- logger: logger_1.logger,
126
+ logger: this.logger,
126
127
  draft: !!(options === null || options === void 0 ? void 0 : options.draft),
127
128
  labels: pullRequest.labels,
128
129
  });
@@ -178,11 +179,11 @@ class GitHub {
178
179
  force: true,
179
180
  fork: (options === null || options === void 0 ? void 0 : options.fork) === false ? false : true,
180
181
  message,
181
- logger: logger_1.logger,
182
+ logger: this.logger,
182
183
  draft: releasePullRequest.draft,
183
184
  });
184
185
  if (prNumber !== number) {
185
- logger_1.logger.warn(`updated code for ${prNumber}, but update requested for ${number}`);
186
+ this.logger.warn(`updated code for ${prNumber}, but update requested for ${number}`);
186
187
  }
187
188
  const response = await this.octokit.pulls.update({
188
189
  owner: this.repository.owner,
@@ -273,7 +274,7 @@ class GitHub {
273
274
  * @throws {GitHubAPIError} on an API error
274
275
  */
275
276
  this.commentOnIssue = wrapAsync(async (comment, number) => {
276
- logger_1.logger.debug(`adding comment to https://github.com/${this.repository.owner}/${this.repository.repo}/issue/${number}`);
277
+ this.logger.debug(`adding comment to https://github.com/${this.repository.owner}/${this.repository.repo}/issue/${number}`);
277
278
  const resp = await this.octokit.issues.createComment({
278
279
  owner: this.repository.owner,
279
280
  repo: this.repository.repo,
@@ -292,7 +293,7 @@ class GitHub {
292
293
  if (labels.length === 0) {
293
294
  return;
294
295
  }
295
- logger_1.logger.debug(`removing labels: ${labels} from issue/pull ${number}`);
296
+ this.logger.debug(`removing labels: ${labels} from issue/pull ${number}`);
296
297
  await Promise.all(labels.map(label => this.octokit.issues.removeLabel({
297
298
  owner: this.repository.owner,
298
299
  repo: this.repository.repo,
@@ -310,7 +311,7 @@ class GitHub {
310
311
  if (labels.length === 0) {
311
312
  return;
312
313
  }
313
- logger_1.logger.debug(`adding labels: ${labels} from issue/pull ${number}`);
314
+ this.logger.debug(`adding labels: ${labels} from issue/pull ${number}`);
314
315
  await this.octokit.issues.addLabels({
315
316
  owner: this.repository.owner,
316
317
  repo: this.repository.repo,
@@ -323,6 +324,7 @@ class GitHub {
323
324
  this.request = options.octokitAPIs.request;
324
325
  this.graphql = options.octokitAPIs.graphql;
325
326
  this.fileCache = new git_file_utils_1.RepositoryFileCache(this.octokit, this.repository);
327
+ this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : logger_1.logger;
326
328
  }
327
329
  /**
328
330
  * Build a new GitHub client with auto-detected default branch.
@@ -371,6 +373,7 @@ class GitHub {
371
373
  defaultBranch: (_d = options.defaultBranch) !== null && _d !== void 0 ? _d : (await GitHub.defaultBranch(options.owner, options.repo, apis.octokit)),
372
374
  },
373
375
  octokitAPIs: apis,
376
+ logger: options.logger,
374
377
  };
375
378
  return new GitHub(opts);
376
379
  }
@@ -450,7 +453,7 @@ class GitHub {
450
453
  }
451
454
  async mergeCommitsGraphQL(targetBranch, cursor, options = {}) {
452
455
  var _a, _b;
453
- logger_1.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
456
+ this.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
454
457
  const query = `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) {
455
458
  repository(owner: $owner, name: $repo) {
456
459
  ref(qualifiedName: $targetBranch) {
@@ -510,12 +513,12 @@ class GitHub {
510
513
  ...params,
511
514
  });
512
515
  if (!response) {
513
- logger_1.logger.warn(`Did not receive a response for query: ${query}`, params);
516
+ this.logger.warn(`Did not receive a response for query: ${query}`, params);
514
517
  return null;
515
518
  }
516
519
  // if the branch does exist, return null
517
520
  if (!((_a = response.repository) === null || _a === void 0 ? void 0 : _a.ref)) {
518
- logger_1.logger.warn(`Could not find commits for branch ${targetBranch} - it likely does not exist.`);
521
+ this.logger.warn(`Could not find commits for branch ${targetBranch} - it likely does not exist.`);
519
522
  return null;
520
523
  }
521
524
  const history = response.repository.ref.target.history;
@@ -542,7 +545,7 @@ class GitHub {
542
545
  files,
543
546
  };
544
547
  if (((_b = pullRequest.files.pageInfo) === null || _b === void 0 ? void 0 : _b.hasNextPage) && options.backfillFiles) {
545
- logger_1.logger.info(`PR #${pullRequest.number} has many files, backfilling`);
548
+ this.logger.info(`PR #${pullRequest.number} has many files, backfilling`);
546
549
  commit.files = await this.getCommitFiles(graphCommit.sha);
547
550
  }
548
551
  else {
@@ -671,7 +674,7 @@ class GitHub {
671
674
  */
672
675
  async pullRequestsGraphQL(targetBranch, states = 'MERGED', cursor) {
673
676
  var _a;
674
- logger_1.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`);
677
+ this.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`);
675
678
  const response = await this.graphqlRequest({
676
679
  query: `query mergedPullRequests($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $states: [PullRequestState!], $cursor: String) {
677
680
  repository(owner: $owner, name: $repo) {
@@ -716,7 +719,7 @@ class GitHub {
716
719
  maxFilesChanged: 64,
717
720
  });
718
721
  if (!((_a = response === null || response === void 0 ? void 0 : response.repository) === null || _a === void 0 ? void 0 : _a.pullRequests)) {
719
- logger_1.logger.warn(`Could not find merged pull requests for branch ${targetBranch} - it likely does not exist.`);
722
+ this.logger.warn(`Could not find merged pull requests for branch ${targetBranch} - it likely does not exist.`);
720
723
  return null;
721
724
  }
722
725
  const pullRequests = (response.repository.pullRequests.nodes ||
@@ -770,7 +773,7 @@ class GitHub {
770
773
  }
771
774
  }
772
775
  async releaseGraphQL(cursor) {
773
- logger_1.logger.debug(`Fetching releases with cursor ${cursor}`);
776
+ this.logger.debug(`Fetching releases with cursor ${cursor}`);
774
777
  const response = await this.graphqlRequest({
775
778
  query: `query releases($owner: String!, $repo: String!, $num: Int!, $cursor: String) {
776
779
  repository(owner: $owner, name: $repo) {
@@ -800,7 +803,7 @@ class GitHub {
800
803
  num: 25,
801
804
  });
802
805
  if (!response.repository.releases.nodes.length) {
803
- logger_1.logger.warn('Could not find releases.');
806
+ this.logger.warn('Could not find releases.');
804
807
  return null;
805
808
  }
806
809
  const releases = response.repository.releases.nodes;
@@ -810,7 +813,7 @@ class GitHub {
810
813
  .filter(release => !!release.tagCommit)
811
814
  .map(release => {
812
815
  if (!release.tag || !release.tagCommit) {
813
- logger_1.logger.debug(release);
816
+ this.logger.debug(release);
814
817
  }
815
818
  return {
816
819
  name: release.name || undefined,
@@ -871,7 +874,7 @@ class GitHub {
871
874
  * @throws {GitHubAPIError} on other API errors
872
875
  */
873
876
  async getFileContentsOnBranch(path, branch) {
874
- logger_1.logger.debug(`Fetching ${path} from branch ${branch}`);
877
+ this.logger.debug(`Fetching ${path} from branch ${branch}`);
875
878
  try {
876
879
  return await this.fileCache.getFileContents(path, branch);
877
880
  }
@@ -950,14 +953,14 @@ class GitHub {
950
953
  // if the file is missing and create = false, just continue
951
954
  // to the next update, otherwise create the file.
952
955
  if (!update.createIfMissing) {
953
- logger_1.logger.warn(`file ${update.path} did not exist`);
956
+ this.logger.warn(`file ${update.path} did not exist`);
954
957
  continue;
955
958
  }
956
959
  }
957
960
  const contentText = content
958
961
  ? Buffer.from(content.content, 'base64').toString('utf8')
959
962
  : undefined;
960
- const updatedContent = update.updater.updateContent(contentText);
963
+ const updatedContent = update.updater.updateContent(contentText, this.logger);
961
964
  if (updatedContent) {
962
965
  changes.set(update.path, {
963
966
  content: updatedContent,
@@ -2,6 +2,7 @@ import { ChangelogSection } from './changelog-notes';
2
2
  import { GitHub, GitHubRelease } from './github';
3
3
  import { Version } from './version';
4
4
  import { PullRequest } from './pull-request';
5
+ import { Logger } from './util/logger';
5
6
  import { ReleasePullRequest } from './release-pull-request';
6
7
  import { ReleaseType, VersioningStrategyType, ChangelogNotesType } from './factory';
7
8
  import { Release } from './release';
@@ -114,6 +115,7 @@ export interface ManifestOptions {
114
115
  groupPullRequestTitlePattern?: string;
115
116
  releaseSearchDepth?: number;
116
117
  commitSearchDepth?: number;
118
+ logger?: Logger;
117
119
  }
118
120
  export interface ReleaserPackageConfig extends ReleaserConfigJson {
119
121
  'package-name'?: string;
@@ -192,6 +194,7 @@ export declare class Manifest {
192
194
  private groupPullRequestTitlePattern?;
193
195
  readonly releaseSearchDepth: number;
194
196
  readonly commitSearchDepth: number;
197
+ readonly logger: Logger;
195
198
  /**
196
199
  * Create a Manifest from explicit config in code. This assumes that the
197
200
  * repository has a single component at the root path.