Skip to content

Commit 3431fb5

Browse files
authored
Merge pull request #179 from Pana/deprecationWarning
chore: fix punycode deprecation warning
2 parents e450623 + 1ee0aac commit 3431fb5

File tree

5 files changed

+33
-40
lines changed

5 files changed

+33
-40
lines changed

Diff for: .changeset/metal-walls-flow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"nrm": patch
3+
---
4+
5+
Fixed `punycode` DeprecationWarning, replace [email protected] with undici.

Diff for: actions.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const open = require('open');
22
const chalk = require('chalk');
3-
const fetch = require('node-fetch');
4-
3+
const { fetch } = require('undici');
54
const {
65
exit,
76
readFile,
@@ -244,10 +243,10 @@ async function onTest(target) {
244243
let status = false;
245244
let isTimeout = false;
246245
try {
247-
const response = await fetch(registry + 'nrm', { timeout });
246+
const response = await fetch(registry + 'nrm', { signal: AbortSignal.timeout(timeout) });
248247
status = response.ok;
249248
} catch (error) {
250-
isTimeout = error.type === 'request-timeout';
249+
isTimeout = error.name === 'TimeoutError';
251250
}
252251
return {
253252
name,

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"chalk": "^4.1.2",
2828
"commander": "^8.3.0",
2929
"ini": "^2.0.0",
30-
"node-fetch": "2.6.6",
31-
"open": "^8.4.2"
30+
"open": "^8.4.2",
31+
"undici": "5.28.2"
3232
},
3333
"devDependencies": {
3434
"@changesets/cli": "^2.27.8",

Diff for: tests/cli.test.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ jest.mock('open', () => {
1313
});
1414
});
1515

16-
jest.mock('node-fetch', () => {
17-
return jest.fn(url => {
18-
return new Promise(resolve => {
19-
setTimeout(
20-
() => resolve({ ok: !url.includes('error.com') }),
21-
(Math.random() + 1)*1000,
22-
);
23-
});
24-
});
16+
jest.mock('undici', () => {
17+
return {
18+
fetch: jest.fn(url => {
19+
return new Promise(resolve => {
20+
setTimeout(
21+
() => resolve({ ok: !url.includes('error.com') }),
22+
(Math.random() + 1)*1000,
23+
);
24+
});
25+
})
26+
}
2527
});
2628

2729
beforeAll(async () => {

Diff for: yarn.lock

+12-25
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,11 @@
489489
human-id "^1.0.2"
490490
prettier "^2.7.1"
491491

492+
"@fastify/busboy@^2.0.0":
493+
version "2.1.1"
494+
resolved "https://r.cnpmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d"
495+
integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==
496+
492497
"@istanbuljs/load-nyc-config@^1.0.0":
493498
version "1.1.0"
494499
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
@@ -2439,13 +2444,6 @@ nice-try@^1.0.4:
24392444
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
24402445
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
24412446

2442-
2443-
version "2.6.6"
2444-
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
2445-
integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
2446-
dependencies:
2447-
whatwg-url "^5.0.0"
2448-
24492447
node-int64@^0.4.0:
24502448
version "0.4.0"
24512449
resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b"
@@ -2991,11 +2989,6 @@ tr46@^2.1.0:
29912989
dependencies:
29922990
punycode "^2.1.1"
29932991

2994-
tr46@~0.0.3:
2995-
version "0.0.3"
2996-
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
2997-
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
2998-
29992992
30002993
version "4.0.8"
30012994
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
@@ -3018,6 +3011,13 @@ undici-types@~6.19.2:
30183011
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
30193012
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
30203013

3014+
3015+
version "5.28.2"
3016+
resolved "https://r.cnpmjs.org/undici/-/undici-5.28.2.tgz#fea200eac65fc7ecaff80a023d1a0543423b4c91"
3017+
integrity sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==
3018+
dependencies:
3019+
"@fastify/busboy" "^2.0.0"
3020+
30213021
universalify@^0.1.0:
30223022
version "0.1.2"
30233023
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
@@ -3074,11 +3074,6 @@ walker@^1.0.7:
30743074
dependencies:
30753075
makeerror "1.0.12"
30763076

3077-
webidl-conversions@^3.0.0:
3078-
version "3.0.1"
3079-
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
3080-
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
3081-
30823077
webidl-conversions@^5.0.0:
30833078
version "5.0.0"
30843079
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
@@ -3101,14 +3096,6 @@ whatwg-mimetype@^2.3.0:
31013096
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
31023097
integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==
31033098

3104-
whatwg-url@^5.0.0:
3105-
version "5.0.0"
3106-
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
3107-
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
3108-
dependencies:
3109-
tr46 "~0.0.3"
3110-
webidl-conversions "^3.0.0"
3111-
31123099
whatwg-url@^8.0.0, whatwg-url@^8.5.0:
31133100
version "8.7.0"
31143101
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77"

0 commit comments

Comments
 (0)