Skip to content

Commit c255973

Browse files
committed
Require fetch
1 parent b27f2d6 commit c255973

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

dist/index.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -7340,13 +7340,17 @@ exports.knownLibFilesForCompilerOptions = knownLibFilesForCompilerOptions;
73407340

73417341
"use strict";
73427342

7343+
var __importDefault = (this && this.__importDefault) || function (mod) {
7344+
return (mod && mod.__esModule) ? mod : { "default": mod };
7345+
};
73437346
Object.defineProperty(exports, "__esModule", { value: true });
73447347
exports.getBreakageInfo = exports.binarySearch = exports.extractDateAndVersionMetadata = void 0;
73457348
const downloadTSVersions_1 = __webpack_require__(580);
73467349
const runTwoslashRuns_1 = __webpack_require__(303);
7350+
const node_fetch_1 = __importDefault(__webpack_require__(454));
73477351
// Grab every version of TypeScript
73487352
const downloadAllTSVersions = async () => {
7349-
const response = await fetch('http://registry.npmjs.org/typescript');
7353+
const response = await (0, node_fetch_1.default)('http://registry.npmjs.org/typescript');
73507354
const json = await response.json();
73517355
return (0, exports.extractDateAndVersionMetadata)(json);
73527356
};
@@ -7396,8 +7400,8 @@ const getBreakageInfo = async (run, results) => {
73967400
const comparer = compareResults(run, latestResults);
73977401
const version = await binarySearch(allVersions, comparer);
73987402
const info = {
7399-
estimatedVersion: version[0],
7400-
estimatedDate: version[1]
7403+
estimatedVersion: version ? version[0] : "N/A",
7404+
estimatedDate: version ? version[1] : "N/A"
74017405
};
74027406
return info;
74037407
};

src/setupBreakingInfo.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {downloadTypeScriptVersions, ensureTSVersionExists} from './downloadTSVer
22
import {TwoslashRun} from './issuesToTwoslashRuns'
33
import {requireTS, runTwoSlash, runTwoslashRuns, TwoslashResults} from './runTwoslashRuns'
44
import {BreakageInfo} from './updatesIssue'
5+
import fetch from 'node-fetch'
56

67
export type BisectVersion = [version: string, date: string]
78

@@ -63,8 +64,8 @@ export const getBreakageInfo = async (run: TwoslashRun, results: TwoslashResults
6364
const version = await binarySearch(allVersions, comparer)
6465

6566
const info: BreakageInfo = {
66-
estimatedVersion: version[0],
67-
estimatedDate: version[1]
67+
estimatedVersion: version ? version[0] : 'N/A',
68+
estimatedDate: version ? version[1] : 'N/A'
6869
}
6970

7071
return info

0 commit comments

Comments
 (0)