@semantic-release/github 8.0.9 → 9.0.0-beta.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/lib/success.js CHANGED
@@ -1,20 +1,23 @@
1
- const {isNil, uniqBy, template, flatten, isEmpty} = require('lodash');
2
- const pFilter = require('p-filter');
3
- const AggregateError = require('aggregate-error');
4
- const issueParser = require('issue-parser');
5
- const debug = require('debug')('semantic-release:github');
6
- const parseGithubUrl = require('./parse-github-url');
7
- const resolveConfig = require('./resolve-config');
8
- const getClient = require('./get-client');
9
- const getSearchQueries = require('./get-search-queries');
10
- const getSuccessComment = require('./get-success-comment');
11
- const findSRIssues = require('./find-sr-issues');
12
- const {RELEASE_NAME} = require('./definitions/constants');
13
- const getReleaseLinks = require('./get-release-links');
14
-
15
- module.exports = async (pluginConfig, context) => {
1
+ import { isNil, uniqBy, template, flatten, isEmpty } from "lodash-es";
2
+ import pFilter from "p-filter";
3
+ import AggregateError from "aggregate-error";
4
+ import issueParser from "issue-parser";
5
+ import debugFactory from "debug";
6
+
7
+ import parseGithubUrl from "./parse-github-url.js";
8
+ import resolveConfig from "./resolve-config.js";
9
+ import { toOctokitOptions, SemanticReleaseOctokit } from "./octokit.js";
10
+ import getSearchQueries from "./get-search-queries.js";
11
+ import getSuccessComment from "./get-success-comment.js";
12
+ import findSRIssues from "./find-sr-issues.js";
13
+ import { RELEASE_NAME } from "./definitions/constants.js";
14
+ import getReleaseLinks from "./get-release-links.js";
15
+
16
+ const debug = debugFactory("semantic-release:github");
17
+
18
+ export default async function success(pluginConfig, context, { Octokit }) {
16
19
  const {
17
- options: {repositoryUrl},
20
+ options: { repositoryUrl },
18
21
  commits,
19
22
  nextRelease,
20
23
  releases,
@@ -32,95 +35,144 @@ module.exports = async (pluginConfig, context) => {
32
35
  addReleases,
33
36
  } = resolveConfig(pluginConfig, context);
34
37
 
35
- const octokit = getClient({githubToken, githubUrl, githubApiPathPrefix, proxy});
38
+ const octokit = new Octokit(
39
+ toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy })
40
+ );
41
+
36
42
  // In case the repo changed name, get the new `repo`/`owner` as the search API will not follow redirects
37
- const {data: repoData} = await octokit.request('GET /repos/{owner}/{repo}', parseGithubUrl(repositoryUrl));
38
- const [owner, repo] = repoData.full_name.split('/');
43
+ const { data: repoData } = await octokit.request(
44
+ "GET /repos/{owner}/{repo}",
45
+ parseGithubUrl(repositoryUrl)
46
+ );
47
+ const [owner, repo] = repoData.full_name.split("/");
39
48
 
40
49
  const errors = [];
41
50
 
42
51
  if (successComment === false) {
43
- logger.log('Skip commenting on issues and pull requests.');
52
+ logger.log("Skip commenting on issues and pull requests.");
44
53
  } else {
45
- const parser = issueParser('github', githubUrl ? {hosts: [githubUrl]} : {});
54
+ const parser = issueParser(
55
+ "github",
56
+ githubUrl ? { hosts: [githubUrl] } : {}
57
+ );
46
58
  const releaseInfos = releases.filter((release) => Boolean(release.name));
47
- const shas = commits.map(({hash}) => hash);
48
-
49
- const searchQueries = getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged`, shas).map(
50
- async (q) => (await octokit.request('GET /search/issues', {q})).data.items
59
+ const shas = commits.map(({ hash }) => hash);
60
+
61
+ const searchQueries = getSearchQueries(
62
+ `repo:${owner}/${repo}+type:pr+is:merged`,
63
+ shas
64
+ ).map(
65
+ async (q) =>
66
+ (await octokit.request("GET /search/issues", { q })).data.items
51
67
  );
52
68
 
53
69
  const searchQueriesResults = await Promise.all(searchQueries);
54
- const uniqueSearchQueriesResults = uniqBy(flatten(searchQueriesResults), 'number');
55
- const prs = await pFilter(uniqueSearchQueriesResults, async ({number}) => {
56
- const commits = await octokit.paginate('GET /repos/{owner}/{repo}/pulls/{pull_number}/commits', {
57
- owner,
58
- repo,
59
- pull_number: number,
60
- });
61
- const matchingCommit = commits.find(({sha}) => shas.includes(sha));
62
- if (matchingCommit) return matchingCommit;
63
-
64
- const {data: pullRequest} = await octokit.request('GET /repos/{owner}/{repo}/pulls/{pull_number}', {
65
- owner,
66
- repo,
67
- pull_number: number,
68
- });
69
- return shas.includes(pullRequest.merge_commit_sha);
70
- });
70
+ const uniqueSearchQueriesResults = uniqBy(
71
+ flatten(searchQueriesResults),
72
+ "number"
73
+ );
74
+ const prs = await pFilter(
75
+ uniqueSearchQueriesResults,
76
+ async ({ number }) => {
77
+ const commits = await octokit.paginate(
78
+ "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
79
+ {
80
+ owner,
81
+ repo,
82
+ pull_number: number,
83
+ }
84
+ );
85
+ const matchingCommit = commits.find(({ sha }) => shas.includes(sha));
86
+ if (matchingCommit) return matchingCommit;
87
+
88
+ const { data: pullRequest } = await octokit.request(
89
+ "GET /repos/{owner}/{repo}/pulls/{pull_number}",
90
+ {
91
+ owner,
92
+ repo,
93
+ pull_number: number,
94
+ }
95
+ );
96
+ return shas.includes(pullRequest.merge_commit_sha);
97
+ }
98
+ );
71
99
 
72
100
  debug(
73
- 'found pull requests: %O',
101
+ "found pull requests: %O",
74
102
  prs.map((pr) => pr.number)
75
103
  );
76
104
 
77
105
  // Parse the release commits message and PRs body to find resolved issues/PRs via comment keyworkds
78
- const issues = [...prs.map((pr) => pr.body), ...commits.map((commit) => commit.message)].reduce(
79
- (issues, message) => {
80
- return message
106
+ const issues = [
107
+ ...prs.map((pr) => pr.body),
108
+ ...commits.map((commit) => commit.message),
109
+ ].reduce(
110
+ (issues, message) =>
111
+ message
81
112
  ? issues.concat(
82
113
  parser(message)
83
- .actions.close.filter((action) => isNil(action.slug) || action.slug === `${owner}/${repo}`)
84
- .map((action) => ({number: Number.parseInt(action.issue, 10)}))
114
+ .actions.close.filter(
115
+ (action) =>
116
+ isNil(action.slug) || action.slug === `${owner}/${repo}`
117
+ )
118
+ .map((action) => ({
119
+ number: Number.parseInt(action.issue, 10),
120
+ }))
85
121
  )
86
- : issues;
87
- },
122
+ : issues,
88
123
  []
89
124
  );
90
125
 
91
- debug('found issues via comments: %O', issues);
126
+ debug("found issues via comments: %O", issues);
92
127
 
93
128
  await Promise.all(
94
- uniqBy([...prs, ...issues], 'number').map(async (issue) => {
129
+ uniqBy([...prs, ...issues], "number").map(async (issue) => {
95
130
  const body = successComment
96
- ? template(successComment)({...context, issue})
131
+ ? template(successComment)({ ...context, issue })
97
132
  : getSuccessComment(issue, releaseInfos, nextRelease);
98
133
  try {
99
- const comment = {owner, repo, issue_number: issue.number, body};
100
- debug('create comment: %O', comment);
134
+ const comment = { owner, repo, issue_number: issue.number, body };
135
+ debug("create comment: %O", comment);
101
136
  const {
102
- data: {html_url: url},
103
- } = await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', comment);
104
- logger.log('Added comment to issue #%d: %s', issue.number, url);
137
+ data: { html_url: url },
138
+ } = await octokit.request(
139
+ "POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
140
+ comment
141
+ );
142
+ logger.log("Added comment to issue #%d: %s", issue.number, url);
105
143
 
106
144
  if (releasedLabels) {
107
- const labels = releasedLabels.map((label) => template(label)(context));
108
- await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/labels', {
109
- owner,
110
- repo,
111
- issue_number: issue.number,
112
- data: labels,
113
- });
114
- logger.log('Added labels %O to issue #%d', labels, issue.number);
145
+ const labels = releasedLabels.map((label) =>
146
+ template(label)(context)
147
+ );
148
+ await octokit.request(
149
+ "POST /repos/{owner}/{repo}/issues/{issue_number}/labels",
150
+ {
151
+ owner,
152
+ repo,
153
+ issue_number: issue.number,
154
+ data: labels,
155
+ }
156
+ );
157
+ logger.log("Added labels %O to issue #%d", labels, issue.number);
115
158
  }
116
159
  } catch (error) {
117
160
  if (error.status === 403) {
118
- logger.error('Not allowed to add a comment to the issue #%d.', issue.number);
161
+ logger.error(
162
+ "Not allowed to add a comment to the issue #%d.",
163
+ issue.number
164
+ );
119
165
  } else if (error.status === 404) {
120
- logger.error("Failed to add a comment to the issue #%d as it doesn't exist.", issue.number);
166
+ logger.error(
167
+ "Failed to add a comment to the issue #%d as it doesn't exist.",
168
+ issue.number
169
+ );
121
170
  } else {
122
171
  errors.push(error);
123
- logger.error('Failed to add a comment to the issue #%d.', issue.number);
172
+ logger.error(
173
+ "Failed to add a comment to the issue #%d.",
174
+ issue.number
175
+ );
124
176
  // Don't throw right away and continue to update other issues
125
177
  }
126
178
  }
@@ -129,25 +181,33 @@ module.exports = async (pluginConfig, context) => {
129
181
  }
130
182
 
131
183
  if (failComment === false || failTitle === false) {
132
- logger.log('Skip closing issue.');
184
+ logger.log("Skip closing issue.");
133
185
  } else {
134
186
  const srIssues = await findSRIssues(octokit, failTitle, owner, repo);
135
187
 
136
- debug('found semantic-release issues: %O', srIssues);
188
+ debug("found semantic-release issues: %O", srIssues);
137
189
 
138
190
  await Promise.all(
139
191
  srIssues.map(async (issue) => {
140
- debug('close issue: %O', issue);
192
+ debug("close issue: %O", issue);
141
193
  try {
142
- const updateIssue = {owner, repo, issue_number: issue.number, state: 'closed'};
143
- debug('closing issue: %O', updateIssue);
194
+ const updateIssue = {
195
+ owner,
196
+ repo,
197
+ issue_number: issue.number,
198
+ state: "closed",
199
+ };
200
+ debug("closing issue: %O", updateIssue);
144
201
  const {
145
- data: {html_url: url},
146
- } = await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', updateIssue);
147
- logger.log('Closed issue #%d: %s.', issue.number, url);
202
+ data: { html_url: url },
203
+ } = await octokit.request(
204
+ "PATCH /repos/{owner}/{repo}/issues/{issue_number}",
205
+ updateIssue
206
+ );
207
+ logger.log("Closed issue #%d: %s.", issue.number, url);
148
208
  } catch (error) {
149
209
  errors.push(error);
150
- logger.error('Failed to close the issue #%d.', issue.number);
210
+ logger.error("Failed to close the issue #%d.", issue.number);
151
211
  // Don't throw right away and continue to close other issues
152
212
  }
153
213
  })
@@ -155,21 +215,26 @@ module.exports = async (pluginConfig, context) => {
155
215
  }
156
216
 
157
217
  if (addReleases !== false && errors.length === 0) {
158
- const ghRelease = releases.find((release) => release.name && release.name === RELEASE_NAME);
218
+ const ghRelease = releases.find(
219
+ (release) => release.name && release.name === RELEASE_NAME
220
+ );
159
221
  if (!isNil(ghRelease)) {
160
222
  const ghRelaseId = ghRelease.id;
161
223
  const additionalReleases = getReleaseLinks(releases);
162
224
  if (!isEmpty(additionalReleases) && !isNil(ghRelaseId)) {
163
225
  const newBody =
164
- addReleases === 'top'
165
- ? additionalReleases.concat('\n---\n', nextRelease.notes)
166
- : nextRelease.notes.concat('\n---\n', additionalReleases);
167
- await octokit.request('PATCH /repos/{owner}/{repo}/releases/{release_id}', {
168
- owner,
169
- repo,
170
- release_id: ghRelaseId,
171
- body: newBody,
172
- });
226
+ addReleases === "top"
227
+ ? additionalReleases.concat("\n---\n", nextRelease.notes)
228
+ : nextRelease.notes.concat("\n---\n", additionalReleases);
229
+ await octokit.request(
230
+ "PATCH /repos/{owner}/{repo}/releases/{release_id}",
231
+ {
232
+ owner,
233
+ repo,
234
+ release_id: ghRelaseId,
235
+ body: newBody,
236
+ }
237
+ );
173
238
  }
174
239
  }
175
240
  }
@@ -177,4 +242,4 @@ module.exports = async (pluginConfig, context) => {
177
242
  if (errors.length > 0) {
178
243
  throw new AggregateError(errors);
179
244
  }
180
- };
245
+ }
package/lib/verify.js CHANGED
@@ -1,24 +1,41 @@
1
- const {isString, isPlainObject, isNil, isArray, isNumber} = require('lodash');
2
- const urlJoin = require('url-join');
3
- const AggregateError = require('aggregate-error');
4
- const parseGithubUrl = require('./parse-github-url');
5
- const resolveConfig = require('./resolve-config');
6
- const getClient = require('./get-client');
7
- const getError = require('./get-error');
1
+ import {
2
+ isString,
3
+ isPlainObject,
4
+ isNil,
5
+ isArray,
6
+ isNumber,
7
+ isBoolean,
8
+ } from "lodash-es";
9
+ import urlJoin from "url-join";
10
+ import AggregateError from "aggregate-error";
11
+
12
+ import parseGithubUrl from "./parse-github-url.js";
13
+ import resolveConfig from "./resolve-config.js";
14
+ import { toOctokitOptions, SemanticReleaseOctokit } from "./octokit.js";
15
+ import getError from "./get-error.js";
8
16
 
9
17
  const isNonEmptyString = (value) => isString(value) && value.trim();
10
- const oneOf = (enumArray) => (value) => enumArray.some((element) => element === value);
18
+ const oneOf = (enumArray) => (value) => enumArray.includes(value);
11
19
  const isStringOrStringArray = (value) =>
12
- isNonEmptyString(value) || (isArray(value) && value.every((string) => isNonEmptyString(string)));
13
- const isArrayOf = (validator) => (array) => isArray(array) && array.every((value) => validator(value));
14
- const canBeDisabled = (validator) => (value) => value === false || validator(value);
20
+ isNonEmptyString(value) ||
21
+ (isArray(value) && value.every((string) => isNonEmptyString(string)));
22
+ const isArrayOf = (validator) => (array) =>
23
+ isArray(array) && array.every((value) => validator(value));
24
+ const canBeDisabled = (validator) => (value) =>
25
+ value === false || validator(value);
15
26
 
16
27
  const VALIDATORS = {
17
28
  proxy: canBeDisabled(
18
- (proxy) => isNonEmptyString(proxy) || (isPlainObject(proxy) && isNonEmptyString(proxy.host) && isNumber(proxy.port))
29
+ (proxy) =>
30
+ isNonEmptyString(proxy) ||
31
+ (isPlainObject(proxy) &&
32
+ isNonEmptyString(proxy.host) &&
33
+ isNumber(proxy.port))
19
34
  ),
20
35
  assets: isArrayOf(
21
- (asset) => isStringOrStringArray(asset) || (isPlainObject(asset) && isStringOrStringArray(asset.path))
36
+ (asset) =>
37
+ isStringOrStringArray(asset) ||
38
+ (isPlainObject(asset) && isStringOrStringArray(asset.path))
22
39
  ),
23
40
  successComment: canBeDisabled(isNonEmptyString),
24
41
  failTitle: canBeDisabled(isNonEmptyString),
@@ -26,36 +43,49 @@ const VALIDATORS = {
26
43
  labels: canBeDisabled(isArrayOf(isNonEmptyString)),
27
44
  assignees: isArrayOf(isNonEmptyString),
28
45
  releasedLabels: canBeDisabled(isArrayOf(isNonEmptyString)),
29
- addReleases: canBeDisabled(oneOf(['bottom', 'top'])),
46
+ addReleases: canBeDisabled(oneOf(["bottom", "top"])),
47
+ draftRelease: isBoolean,
30
48
  };
31
49
 
32
- module.exports = async (pluginConfig, context) => {
50
+ export default async function verify(pluginConfig, context, { Octokit }) {
33
51
  const {
34
52
  env,
35
- options: {repositoryUrl},
53
+ options: { repositoryUrl },
36
54
  logger,
37
55
  } = context;
38
- const {githubToken, githubUrl, githubApiPathPrefix, proxy, ...options} = resolveConfig(pluginConfig, context);
56
+ const { githubToken, githubUrl, githubApiPathPrefix, proxy, ...options } =
57
+ resolveConfig(pluginConfig, context);
39
58
 
40
- const errors = Object.entries({...options, proxy}).reduce(
59
+ const errors = Object.entries({ ...options, proxy }).reduce(
41
60
  (errors, [option, value]) =>
42
61
  !isNil(value) && !VALIDATORS[option](value)
43
- ? [...errors, getError(`EINVALID${option.toUpperCase()}`, {[option]: value})]
62
+ ? [
63
+ ...errors,
64
+ getError(`EINVALID${option.toUpperCase()}`, { [option]: value }),
65
+ ]
44
66
  : errors,
45
67
  []
46
68
  );
47
69
 
48
70
  if (githubUrl) {
49
- logger.log('Verify GitHub authentication (%s)', urlJoin(githubUrl, githubApiPathPrefix));
71
+ logger.log(
72
+ "Verify GitHub authentication (%s)",
73
+ urlJoin(githubUrl, githubApiPathPrefix)
74
+ );
50
75
  } else {
51
- logger.log('Verify GitHub authentication');
76
+ logger.log("Verify GitHub authentication");
52
77
  }
53
78
 
54
- const {repo, owner} = parseGithubUrl(repositoryUrl);
79
+ const { repo, owner } = parseGithubUrl(repositoryUrl);
55
80
  if (!owner || !repo) {
56
- errors.push(getError('EINVALIDGITHUBURL'));
57
- } else if (githubToken && !errors.find(({code}) => code === 'EINVALIDPROXY')) {
58
- const octokit = getClient({githubToken, githubUrl, githubApiPathPrefix, proxy});
81
+ errors.push(getError("EINVALIDGITHUBURL"));
82
+ } else if (
83
+ githubToken &&
84
+ !errors.find(({ code }) => code === "EINVALIDPROXY")
85
+ ) {
86
+ const octokit = new Octokit(
87
+ toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy })
88
+ );
59
89
 
60
90
  // https://github.com/semantic-release/github/issues/182
61
91
  // Do not check for permissions in GitHub actions, as the provided token is an installation access token.
@@ -68,25 +98,29 @@ module.exports = async (pluginConfig, context) => {
68
98
  try {
69
99
  const {
70
100
  data: {
71
- permissions: {push},
101
+ permissions: { push },
72
102
  },
73
- } = await octokit.request('GET /repos/{owner}/{repo}', {repo, owner});
103
+ } = await octokit.request("GET /repos/{owner}/{repo}", { repo, owner });
74
104
  if (!push) {
75
105
  // If authenticated as GitHub App installation, `push` will always be false.
76
106
  // We send another request to check if current authentication is an installation.
77
107
  // Note: we cannot check if the installation has all required permissions, it's
78
108
  // up to the user to make sure it has
79
- if (await octokit.request('HEAD /installation/repositories', {per_page: 1}).catch(() => false)) {
109
+ if (
110
+ await octokit
111
+ .request("HEAD /installation/repositories", { per_page: 1 })
112
+ .catch(() => false)
113
+ ) {
80
114
  return;
81
115
  }
82
116
 
83
- errors.push(getError('EGHNOPERMISSION', {owner, repo}));
117
+ errors.push(getError("EGHNOPERMISSION", { owner, repo }));
84
118
  }
85
119
  } catch (error) {
86
120
  if (error.status === 401) {
87
- errors.push(getError('EINVALIDGHTOKEN', {owner, repo}));
121
+ errors.push(getError("EINVALIDGHTOKEN", { owner, repo }));
88
122
  } else if (error.status === 404) {
89
- errors.push(getError('EMISSINGREPO', {owner, repo}));
123
+ errors.push(getError("EMISSINGREPO", { owner, repo }));
90
124
  } else {
91
125
  throw error;
92
126
  }
@@ -94,10 +128,10 @@ module.exports = async (pluginConfig, context) => {
94
128
  }
95
129
 
96
130
  if (!githubToken) {
97
- errors.push(getError('ENOGHTOKEN', {owner, repo}));
131
+ errors.push(getError("ENOGHTOKEN", { owner, repo }));
98
132
  }
99
133
 
100
134
  if (errors.length > 0) {
101
135
  throw new AggregateError(errors);
102
136
  }
103
- };
137
+ }
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@semantic-release/github",
3
3
  "description": "semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues",
4
- "version": "8.0.9",
4
+ "version": "9.0.0-beta.1",
5
+ "type": "module",
5
6
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
6
7
  "ava": {
7
8
  "files": [
8
9
  "test/**/*.test.js"
10
+ ],
11
+ "nodeArguments": [
12
+ "--no-warnings"
9
13
  ]
10
14
  },
11
15
  "bugs": {
@@ -19,37 +23,32 @@
19
23
  "@octokit/core": "^4.2.1",
20
24
  "@octokit/plugin-paginate-rest": "^6.1.2",
21
25
  "@octokit/plugin-retry": "^4.1.3",
22
- "@octokit/plugin-throttling": "^5.2.3",
26
+ "@octokit/plugin-throttling": "^6.0.0",
23
27
  "@semantic-release/error": "^3.0.0",
24
- "aggregate-error": "^3.0.0",
25
- "debug": "^4.0.0",
26
- "dir-glob": "^3.0.0",
27
- "fs-extra": "^11.0.0",
28
- "globby": "^11.0.0",
28
+ "aggregate-error": "^4.0.1",
29
+ "debug": "^4.3.4",
30
+ "dir-glob": "^3.0.1",
31
+ "globby": "^13.1.4",
29
32
  "http-proxy-agent": "^7.0.0",
30
33
  "https-proxy-agent": "^7.0.0",
31
34
  "issue-parser": "^6.0.0",
32
- "lodash": "^4.17.4",
35
+ "lodash-es": "^4.17.21",
33
36
  "mime": "^3.0.0",
34
- "p-filter": "^2.0.0",
35
- "url-join": "^4.0.0"
37
+ "p-filter": "^3.0.0",
38
+ "url-join": "^5.0.0"
36
39
  },
37
40
  "devDependencies": {
38
- "ava": "5.1.0",
39
- "clear-module": "4.1.2",
40
- "codecov": "3.8.3",
41
- "nock": "13.3.1",
42
- "nyc": "15.1.0",
43
- "proxy": "1.0.2",
44
- "proxyquire": "2.1.3",
41
+ "ava": "5.3.0",
42
+ "c8": "7.14.0",
43
+ "cpy": "10.1.0",
44
+ "fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
45
+ "prettier": "2.8.8",
45
46
  "semantic-release": "21.0.2",
46
- "server-destroy": "1.0.1",
47
47
  "sinon": "15.1.0",
48
- "tempy": "1.0.1",
49
- "xo": "0.36.1"
48
+ "tempy": "3.0.0"
50
49
  },
51
50
  "engines": {
52
- "node": ">=14.17"
51
+ "node": ">=18"
53
52
  },
54
53
  "files": [
55
54
  "lib",
@@ -68,8 +67,8 @@
68
67
  "version"
69
68
  ],
70
69
  "license": "MIT",
71
- "main": "index.js",
72
- "nyc": {
70
+ "exports": "./index.js",
71
+ "c8": {
73
72
  "include": [
74
73
  "lib/**/*.js",
75
74
  "index.js"
@@ -82,11 +81,7 @@
82
81
  "all": true
83
82
  },
84
83
  "peerDependencies": {
85
- "semantic-release": ">=18.0.0-beta.1"
86
- },
87
- "prettier": {
88
- "printWidth": 120,
89
- "trailingComma": "es5"
84
+ "semantic-release": ">=20.1.0"
90
85
  },
91
86
  "publishConfig": {
92
87
  "access": "public",
@@ -98,25 +93,10 @@
98
93
  },
99
94
  "scripts": {
100
95
  "codecov": "codecov -f coverage/coverage-final.json",
101
- "lint": "xo",
102
- "pretest": "npm run lint",
96
+ "lint": "prettier --check \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
97
+ "lint:fix": "prettier --write \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
103
98
  "semantic-release": "semantic-release",
104
- "test": "nyc ava -v",
105
- "test:ci": "nyc ava -v"
106
- },
107
- "xo": {
108
- "prettier": true,
109
- "space": true,
110
- "rules": {
111
- "camelcase": [
112
- "error",
113
- {
114
- "properties": "never"
115
- }
116
- ],
117
- "unicorn/string-content": "off",
118
- "unicorn/no-reduce": "off"
119
- }
99
+ "test": "c8 ava -v"
120
100
  },
121
101
  "renovate": {
122
102
  "extends": [
package/lib/get-client.js DELETED
@@ -1,24 +0,0 @@
1
- const urljoin = require('url-join');
2
- const {HttpProxyAgent} = require('http-proxy-agent');
3
- const {HttpsProxyAgent} = require('https-proxy-agent');
4
-
5
- const SemanticReleaseOctokit = require('./semantic-release-octokit');
6
-
7
- module.exports = ({githubToken, githubUrl, githubApiPathPrefix, proxy}) => {
8
- const baseUrl = githubUrl && urljoin(githubUrl, githubApiPathPrefix);
9
- const octokit = new SemanticReleaseOctokit({
10
- auth: `token ${githubToken}`,
11
- baseUrl,
12
- request: {
13
- agent: proxy
14
- ? baseUrl && new URL(baseUrl).protocol.replace(':', '') === 'http'
15
- ? // Some `proxy.headers` need to be passed as second arguments since version 6 or 7
16
- // For simplicity, we just pass the same proxy object twice. It works 🤷🏻
17
- new HttpProxyAgent(proxy, proxy)
18
- : new HttpsProxyAgent(proxy, proxy)
19
- : undefined,
20
- },
21
- });
22
-
23
- return octokit;
24
- };