[cli][client][tests] update to node14-compatible target (drop support for node12) (#7865)

Node 12 is EOL and we're starting to reference packages that don't install on node lower than 14, such as nuxt@3 and remix. Let's update to 14 for now.

---

Reimplements: https://github.com/vercel/vercel/pull/7819
This commit is contained in:
Sean Massa
2022-06-02 14:01:34 -05:00
committed by GitHub
parent 8d15f30579
commit e0900128d6
24 changed files with 74 additions and 59 deletions

View File

@@ -1,11 +1,17 @@
const fetch = require('node-fetch');
const retryBailByDefault = require('./retry-bail-by-default.js');
async function fetchRetry(...args) {
const ABSOLUTE_URL_PATTERN = /^https?:\/\//i;
async function fetchRetry(url, ...rest) {
if (!ABSOLUTE_URL_PATTERN.test(url)) {
throw new Error(`fetch url must be absolute: "${url}"`);
}
return await retryBailByDefault(
async canRetry => {
try {
return await fetch(...args);
return await fetch(url, ...rest);
} catch (error) {
if (error.type === 'request-timeout') {
// FetchError: network timeout at: ...