release-please 14.6.1 → 14.7.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,26 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [14.7.1](https://github.com/googleapis/release-please/compare/v14.7.0...v14.7.1) (2022-09-22)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * Handle pull request files returned as null ([#1651](https://github.com/googleapis/release-please/issues/1651)) ([4cea3dd](https://github.com/googleapis/release-please/commit/4cea3dd1b17ee31e27c1d246e83fcf39f28f0677))
13
+ * **node:** Rethrow missing file error for package.json as a configuration error ([#1652](https://github.com/googleapis/release-please/issues/1652)) ([65ee57b](https://github.com/googleapis/release-please/commit/65ee57b433f67d87db3c2530dad4207218dae6d2))
14
+
15
+ ## [14.7.0](https://github.com/googleapis/release-please/compare/v14.6.1...v14.7.0) (2022-09-20)
16
+
17
+
18
+ ### Features
19
+
20
+ * Easy proxy configuration ([#1639](https://github.com/googleapis/release-please/issues/1639)) ([4bb4c65](https://github.com/googleapis/release-please/commit/4bb4c658e3c30150432802b5ccc2aa5a96332f1e))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **commit-split:** Detect overlapping prefixes ([#1638](https://github.com/googleapis/release-please/issues/1638)) ([db51b29](https://github.com/googleapis/release-please/commit/db51b295d711e657ee5928bc32a3dbb88c793969)), closes [#1637](https://github.com/googleapis/release-please/issues/1637)
26
+
7
27
  ## [14.6.1](https://github.com/googleapis/release-please/compare/v14.6.0...v14.6.1) (2022-09-20)
8
28
 
9
29
 
@@ -24,6 +24,10 @@ export interface GitHubOptions {
24
24
  octokitAPIs: OctokitAPIs;
25
25
  logger?: Logger;
26
26
  }
27
+ interface ProxyOption {
28
+ host: string;
29
+ port: number;
30
+ }
27
31
  interface GitHubCreateOptions {
28
32
  owner: string;
29
33
  repo: string;
@@ -33,6 +37,7 @@ interface GitHubCreateOptions {
33
37
  octokitAPIs?: OctokitAPIs;
34
38
  token?: string;
35
39
  logger?: Logger;
40
+ proxy?: ProxyOption;
36
41
  }
37
42
  declare type CommitFilter = (commit: Commit) => boolean;
38
43
  interface CommitIteratorOptions {
@@ -76,6 +81,7 @@ export declare class GitHub {
76
81
  private fileCache;
77
82
  private logger;
78
83
  private constructor();
84
+ static createDefaultAgent(baseUrl: string, defaultProxy?: ProxyOption): import("https-proxy-agent/dist/agent").default | import("http-proxy-agent/dist/agent").default | undefined;
79
85
  /**
80
86
  * Build a new GitHub client with auto-detected default branch.
81
87
  *
@@ -28,6 +28,8 @@ const logger_1 = require("./util/logger");
28
28
  const manifest_1 = require("./manifest");
29
29
  const signoff_commit_message_1 = require("./util/signoff-commit-message");
30
30
  const git_file_utils_1 = require("@google-automations/git-file-utils");
31
+ const https_proxy_agent_1 = require("https-proxy-agent");
32
+ const http_proxy_agent_1 = require("http-proxy-agent");
31
33
  class GitHub {
32
34
  constructor(options) {
33
35
  var _a;
@@ -344,6 +346,21 @@ class GitHub {
344
346
  this.fileCache = new git_file_utils_1.RepositoryFileCache(this.octokit, this.repository);
345
347
  this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : logger_1.logger;
346
348
  }
349
+ static createDefaultAgent(baseUrl, defaultProxy) {
350
+ if (!defaultProxy) {
351
+ return undefined;
352
+ }
353
+ const { host, port } = defaultProxy;
354
+ return new URL(baseUrl).protocol.replace(':', '') === 'http'
355
+ ? new http_proxy_agent_1.HttpProxyAgent({
356
+ host,
357
+ port,
358
+ })
359
+ : new https_proxy_agent_1.HttpsProxyAgent({
360
+ host,
361
+ port,
362
+ });
363
+ }
347
364
  /**
348
365
  * Build a new GitHub client with auto-detected default branch.
349
366
  *
@@ -367,6 +384,9 @@ class GitHub {
367
384
  octokit: new rest_1.Octokit({
368
385
  baseUrl: apiUrl,
369
386
  auth: options.token,
387
+ request: {
388
+ agent: this.createDefaultAgent(apiUrl, options.proxy),
389
+ },
370
390
  }),
371
391
  request: request_1.request.defaults({
372
392
  baseUrl: apiUrl,
@@ -470,7 +490,7 @@ class GitHub {
470
490
  }
471
491
  }
472
492
  async mergeCommitsGraphQL(targetBranch, cursor, options = {}) {
473
- var _a, _b;
493
+ var _a, _b, _c, _d;
474
494
  this.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
475
495
  const query = `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) {
476
496
  repository(owner: $owner, name: $repo) {
@@ -551,7 +571,7 @@ class GitHub {
551
571
  return pr.mergeCommit && pr.mergeCommit.oid === graphCommit.sha;
552
572
  });
553
573
  if (pullRequest) {
554
- const files = pullRequest.files.nodes.map(node => node.path);
574
+ const files = (((_b = pullRequest.files) === null || _b === void 0 ? void 0 : _b.nodes) || []).map(node => node.path);
555
575
  commit.pullRequest = {
556
576
  sha: commit.sha,
557
577
  number: pullRequest.number,
@@ -562,7 +582,7 @@ class GitHub {
562
582
  labels: pullRequest.labels.nodes.map(node => node.name),
563
583
  files,
564
584
  };
565
- if (((_b = pullRequest.files.pageInfo) === null || _b === void 0 ? void 0 : _b.hasNextPage) && options.backfillFiles) {
585
+ if (((_d = (_c = pullRequest.files) === null || _c === void 0 ? void 0 : _c.pageInfo) === null || _d === void 0 ? void 0 : _d.hasNextPage) && options.backfillFiles) {
566
586
  this.logger.info(`PR #${pullRequest.number} has many files, backfilling`);
567
587
  commit.files = await this.getCommitFiles(graphCommit.sha);
568
588
  }
@@ -19,6 +19,7 @@ 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
+ const errors_1 = require("../errors");
22
23
  class Node extends base_1.BaseStrategy {
23
24
  async buildUpdates(options) {
24
25
  var _a;
@@ -74,7 +75,15 @@ class Node extends base_1.BaseStrategy {
74
75
  }
75
76
  async getPkgJsonContents() {
76
77
  if (!this.pkgJsonContents) {
77
- this.pkgJsonContents = await this.github.getFileContentsOnBranch(this.addPath('package.json'), this.targetBranch);
78
+ try {
79
+ this.pkgJsonContents = await this.github.getFileContentsOnBranch(this.addPath('package.json'), this.targetBranch);
80
+ }
81
+ catch (e) {
82
+ if (e instanceof errors_1.FileNotFoundError) {
83
+ throw new errors_1.MissingRequiredFileError(this.addPath('package.json'), 'node', `${this.repository.owner}/${this.repository.repo}`);
84
+ }
85
+ throw e;
86
+ }
78
87
  }
79
88
  return this.pkgJsonContents;
80
89
  }
@@ -44,7 +44,7 @@ class CommitSplit {
44
44
  for (let exPath of paths) {
45
45
  exPath = exPath.replace(/$/, '/');
46
46
  exPath = exPath.replace(/^/, '/');
47
- if (newPath.indexOf(exPath) >= 0 || exPath.indexOf(newPath) >= 0) {
47
+ if (newPath.startsWith(exPath) || exPath.startsWith(newPath)) {
48
48
  throw new Error(`Path prefixes must be unique: ${newPath}, ${exPath}`);
49
49
  }
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "14.6.1",
3
+ "version": "14.7.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",
@@ -88,6 +88,8 @@
88
88
  "detect-indent": "^6.1.0",
89
89
  "diff": "^5.0.0",
90
90
  "figures": "^3.0.0",
91
+ "http-proxy-agent": "^5.0.0",
92
+ "https-proxy-agent": "^5.0.1",
91
93
  "js-yaml": "^4.0.0",
92
94
  "jsonpath": "^1.1.1",
93
95
  "node-html-parser": "^6.0.0",