Merge pull request #21497 from storybookjs/tom/21432-replace-isomorphic-unfetch

Telemetry: Replace isomorphic-unfetch with node-fetch in telemetry
This commit is contained in:
Michael Shilman 2023-03-09 17:44:40 +08:00 committed by GitHub
commit 44284e4ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 7 deletions

View File

@ -45,12 +45,13 @@
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.64",
"@storybook/core-common": "7.0.0-beta.64",
"@types/node-fetch": "^2.5.7",
"chalk": "^4.1.0",
"detect-package-manager": "^2.0.1",
"fetch-retry": "^5.0.2",
"fs-extra": "^11.1.0",
"isomorphic-unfetch": "^3.1.0",
"nanoid": "^3.3.1",
"node-fetch": "^2.6.7",
"read-pkg-up": "^7.0.1"
},
"devDependencies": {

View File

@ -1,12 +1,12 @@
/// <reference types="@types/jest" />;
import fetch from 'isomorphic-unfetch';
import fetch from 'node-fetch';
import { sendTelemetry } from './telemetry';
jest.mock('isomorphic-unfetch');
jest.mock('node-fetch');
const fetchMock = fetch as jest.Mock;
const fetchMock = fetch as any as jest.Mock;
beforeEach(() => {
fetchMock.mockResolvedValue({ status: 200 });

View File

@ -1,4 +1,4 @@
import originalFetch from 'isomorphic-unfetch';
import originalFetch from 'node-fetch';
import retry from 'fetch-retry';
import { nanoid } from 'nanoid';
import type { Options, TelemetryData } from './types';
@ -7,7 +7,7 @@ import { set as saveToCache } from './event-cache';
const URL = process.env.STORYBOOK_TELEMETRY_URL || 'https://storybook.js.org/event-log';
const fetch = retry(originalFetch);
const fetch = retry(originalFetch as any);
let tasks: Promise<any>[] = [];

View File

@ -7106,12 +7106,13 @@ __metadata:
dependencies:
"@storybook/client-logger": 7.0.0-beta.64
"@storybook/core-common": 7.0.0-beta.64
"@types/node-fetch": ^2.5.7
chalk: ^4.1.0
detect-package-manager: ^2.0.1
fetch-retry: ^5.0.2
fs-extra: ^11.1.0
isomorphic-unfetch: ^3.1.0
nanoid: ^3.3.1
node-fetch: ^2.6.7
read-pkg-up: ^7.0.1
typescript: ~4.9.3
languageName: unknown