@react-native-community/cli-tools
Advanced tools
Comparing version 14.0.0-alpha.5 to 14.0.0-alpha.6
@@ -1,2 +0,2 @@ | ||
import { RequestInit as FetchOptions, Request, Headers } from 'node-fetch'; | ||
/// <reference types="node" /> | ||
/** | ||
@@ -7,3 +7,3 @@ * Downloads the given `url` to the OS's temp folder and | ||
declare const fetchToTemp: (url: string) => Promise<string>; | ||
declare const fetch: (url: string | Request, options?: FetchOptions) => Promise<{ | ||
declare const fetch: (url: string | Request, options?: RequestInit) => Promise<{ | ||
status: number; | ||
@@ -10,0 +10,0 @@ data: any; |
@@ -28,5 +28,5 @@ "use strict"; | ||
} | ||
function _nodeFetch() { | ||
const data = _interopRequireDefault(require("node-fetch")); | ||
_nodeFetch = function () { | ||
function stream() { | ||
const data = _interopRequireWildcard(require("stream")); | ||
stream = function () { | ||
return data; | ||
@@ -59,12 +59,16 @@ }; | ||
const tmpDir = path().join(os().tmpdir(), fileName); | ||
(0, _nodeFetch().default)(url).then(result => { | ||
global.fetch(url).then(result => { | ||
if (result.status >= 400) { | ||
return reject(`Fetch request failed with status ${result.status}`); | ||
} | ||
if (result.body === null) { | ||
return reject('Fetch request failed - empty body'); | ||
} | ||
const dest = fs().createWriteStream(tmpDir); | ||
result.body.pipe(dest); | ||
result.body.on('end', () => { | ||
const body = stream().Readable.fromWeb(result.body); | ||
body.pipe(dest); | ||
body.on('end', () => { | ||
resolve(tmpDir); | ||
}); | ||
result.body.on('error', reject); | ||
body.on('error', reject); | ||
}); | ||
@@ -79,3 +83,3 @@ }); | ||
const fetch = async (url, options) => { | ||
const result = await (0, _nodeFetch().default)(url, options); | ||
const result = await global.fetch(url, options); | ||
const data = await unwrapFetchResult(result); | ||
@@ -82,0 +86,0 @@ if (result.status >= 400) { |
@@ -56,3 +56,3 @@ "use strict"; | ||
changelogUrl: buildChangelogUrl(stable), | ||
diffUrl: buildDiffUrl(currentVersion) | ||
diffUrl: buildDiffUrl(currentVersion, stable) | ||
}; | ||
@@ -69,4 +69,4 @@ } | ||
} | ||
function buildDiffUrl(version) { | ||
return `https://react-native-community.github.io/upgrade-helper/?from=${version}`; | ||
function buildDiffUrl(oldVersion, newVersion) { | ||
return `https://react-native-community.github.io/upgrade-helper/?from=${oldVersion}&to=${newVersion}`; | ||
} | ||
@@ -73,0 +73,0 @@ /** |
{ | ||
"name": "@react-native-community/cli-tools", | ||
"version": "14.0.0-alpha.5", | ||
"version": "14.0.0-alpha.6", | ||
"license": "MIT", | ||
@@ -15,3 +15,2 @@ "main": "build/index.js", | ||
"mime": "^2.4.1", | ||
"node-fetch": "^2.6.0", | ||
"open": "^6.2.0", | ||
@@ -24,7 +23,6 @@ "ora": "^5.4.1", | ||
"devDependencies": { | ||
"@react-native-community/cli-types": "14.0.0-alpha.5", | ||
"@react-native-community/cli-types": "14.0.0-alpha.6", | ||
"@types/lodash": "^4.14.149", | ||
"@types/mime": "^2.0.1", | ||
"@types/node": "^18.0.0", | ||
"@types/node-fetch": "^2.5.5", | ||
"@types/shell-quote": "^1.7.1" | ||
@@ -43,3 +41,3 @@ }, | ||
}, | ||
"gitHead": "0bcdb73b48fd9c8755b5031326fc0f93bbe69789" | ||
"gitHead": "3e225892eedc9335ad7dc8c64a4014939d2838a5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
201595
10
5
2238
- Removednode-fetch@^2.6.0
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)