Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5429dfd

Browse files
wolfy1339nickfloyd
andauthored
feat: v20 (#305)
BREAKING CHANGE: Drop support for NodeJS v14, v16 BREAKING CHANGE: Remove previews support for the REST API BREAKING CHANGE: remove agent option from `octokit.request()` --------- Co-authored-by: Nick Floyd <[email protected]>
1 parent 64ca2b9 commit 5429dfd

28 files changed

+1076
-10874
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ jobs:
1818
strategy:
1919
matrix:
2020
node_version:
21-
- 14
22-
- 16
2321
- 18
22+
- 20
2423
steps:
2524
- uses: actions/checkout@v3
2625
- name: Test with Node.js ${{ matrix.node_version }}
2726
uses: actions/setup-node@v3
2827
with:
2928
cache: npm
30-
node-version: 16
29+
node-version: ${{ matrix.node_version }}
3130
- run: npm ci
3231
- run: npm run start-fixtures-server &
3332
- run: sleep 3

.github/workflows/update-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v3
1111
- uses: actions/setup-node@v3
1212
with:
13-
node-version: 16
13+
node-version: 18
1414
cache: npm
1515
- run: npm ci
1616
- run: npm --prefix ./docs ci ./docs

.github/workflows/update-prettier.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/setup-node@v3
1212
with:
1313
cache: npm
14-
node-version: 16
14+
node-version: 18
1515
- run: npm ci
1616
- run: npm run lint:fix
1717
- uses: gr2m/[email protected]

package-lock.json

Lines changed: 1018 additions & 10800 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,30 @@
3232
],
3333
"repository": "github:octokit/rest.js",
3434
"dependencies": {
35-
"@octokit/core": "^4.2.1",
36-
"@octokit/plugin-paginate-rest": "^6.1.2",
35+
"@octokit/core": "^5.0.0",
36+
"@octokit/plugin-paginate-rest": "^8.0.0",
3737
"@octokit/plugin-request-log": "^1.0.4",
38-
"@octokit/plugin-rest-endpoint-methods": "^7.1.2"
38+
"@octokit/plugin-rest-endpoint-methods": "^9.0.0"
3939
},
4040
"devDependencies": {
41-
"@octokit/auth-action": "^2.0.3",
42-
"@octokit/auth-app": "^4.0.13",
41+
"@octokit/auth-action": "^4.0.0",
42+
"@octokit/auth-app": "^6.0.0",
4343
"@octokit/fixtures-server": "^7.0.0",
44-
"@octokit/request": "^6.2.5",
44+
"@octokit/request": "^8.0.4",
4545
"@octokit/tsconfig": "^2.0.0",
4646
"@types/jest": "^29.0.0",
4747
"@types/node": "^18.0.0",
4848
"esbuild": "^0.18.0",
49-
"fetch-mock": "^9.0.0",
49+
"fetch-mock": "npm:@gr2m/[email protected]",
5050
"glob": "^10.2.5",
5151
"jest": "^29.0.0",
52+
"nock": "^13.3.1",
5253
"prettier": "3.0.0",
5354
"semantic-release": "^21.0.0",
5455
"semantic-release-plugin-update-version-in-files": "^1.0.0",
5556
"ts-jest": "^29.0.0",
56-
"typescript": "^5.0.0"
57+
"typescript": "^5.0.0",
58+
"undici": "^5.22.1"
5759
},
5860
"scripts": {
5961
"build": "node scripts/build.mjs && tsc -p tsconfig.json",
@@ -120,6 +122,6 @@
120122
]
121123
},
122124
"engines": {
123-
"node": ">= 14"
125+
"node": ">= 18"
124126
}
125127
}

test/integration/agent-ca/agent-ca-test.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
const https = require("https");
21
const { readFileSync } = require("fs");
32
const { resolve } = require("path");
3+
const { fetch: undiciFetch, Agent } = require("undici");
44

55
const { Octokit } = require("../../..");
66
const ca = readFileSync(resolve(__dirname, "./ca.crt"));
77

8-
require("../../mocha-node-setup");
9-
108
describe("custom client certificate", () => {
119
let server;
1210
before((done) => {
@@ -28,13 +26,23 @@ describe("custom client certificate", () => {
2826
server.listen(0, done);
2927
});
3028

31-
it("https.Agent({ca})", () => {
32-
const agent = new https.Agent({
33-
ca,
29+
it("undici.Agent({ca})", () => {
30+
const agent = new Agent({
31+
keepAliveTimeout: 10,
32+
keepAliveMaxTimeout: 10,
33+
connect: { ca: ca },
3434
});
35+
const myFetch = (url, opts) => {
36+
return undiciFetch(url, {
37+
...opts,
38+
dispatcher: agent,
39+
});
40+
};
3541
const octokit = new Octokit({
3642
baseUrl: "https://localhost:" + server.address().port,
37-
request: { agent },
43+
request: {
44+
fetch: myFetch,
45+
},
3846
});
3947

4048
return octokit.rest.repos.get({
@@ -43,14 +51,26 @@ describe("custom client certificate", () => {
4351
});
4452
});
4553

46-
it("https.Agent({ca, rejectUnauthorized})", () => {
47-
const agent = new https.Agent({
48-
ca: "invalid",
49-
rejectUnauthorized: false,
54+
it("undici.Agent({ca, rejectUnauthorized})", () => {
55+
const agent = new Agent({
56+
keepAliveTimeout: 10,
57+
keepAliveMaxTimeout: 10,
58+
connect: {
59+
ca: "invalid",
60+
rejectUnauthorized: true,
61+
},
5062
});
63+
const myFetch = (url, opts) => {
64+
return undiciFetch(url, {
65+
...opts,
66+
dispatcher: agent,
67+
});
68+
};
5169
const octokit = new Octokit({
5270
baseUrl: "https://localhost:" + server.address().port,
53-
request: { agent },
71+
request: {
72+
fetch: myFetch,
73+
},
5474
});
5575

5676
return octokit.rest.repos.get({

test/integration/apps-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const { Octokit } = require("../../");
44
const BEARER_TOKEN =
55
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTM4MTkzMTIsImV4cCI6MTU1MzgxOTM3MiwiaXNzIjoxfQ.etiSZ4LFQZ8tiMGJVqKDoGn8hxMCgwL4iLvU5xBUqbAPr4pbk_jJZmMQjuxTlOnRxq4e7NouTizGCdfohRMb3R1mpLzGPzOH9_jqSA_BWYxolsRP_WDSjuNcw6nSxrPRueMVRBKFHrqcTOZJej0djRB5pI61hDZJ_-DGtiOIFexlK3iuVKaqBkvJS5-TbTekGuipJ652g06gXuz-l8i0nHiFJldcuIruwn28hTUrjgtPbjHdSBVn_QQLKc2Fhij8OrhcGqp_D_fvb_KovVmf1X6yWiwXV5VXqWARS-JGD9JTAr2495ZlLV_E4WPxdDpz1jl6XS9HUhMuwBpaCOuipw";
66

7-
require("../mocha-node-setup");
8-
97
describe("apps", () => {
108
let octokit;
119

test/integration/authentication-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const { createActionAuth } = require("@octokit/auth-action");
55

66
const { Octokit } = require("../..");
77

8-
require("../mocha-node-setup");
9-
108
describe("authentication", () => {
119
it("unauthenticated", () => {
1210
nock("https://authentication-test-host.com").get("/").reply(200, {});

test/integration/conditional-request-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const nock = require("nock");
22

33
const { Octokit } = require("../../");
44

5-
require("../mocha-node-setup");
6-
75
describe("request 304s", () => {
86
let octokit;
97

test/integration/deprecations-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const nock = require("nock");
44
const DeprecatedOctokit = require("../../");
55
const { Octokit } = DeprecatedOctokit;
66

7-
require("../mocha-node-setup");
8-
97
const Mocktokit = Octokit.plugin((octokit) => {
108
octokit.hook.wrap("request", () => null);
119
});

0 commit comments

Comments
 (0)