remove most usages of node-fetch

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-11-29 16:54:28 +01:00
parent f19c16fad2
commit 5c9cc05eee
75 changed files with 93 additions and 163 deletions
+38
View File
@@ -0,0 +1,38 @@
---
'@backstage/plugin-auth-backend-module-cloudflare-access-provider': patch
'@backstage/plugin-auth-backend-module-bitbucket-server-provider': patch
'@backstage/plugin-search-backend-module-stack-overflow-collator': patch
'@backstage/plugin-scaffolder-backend-module-bitbucket-server': patch
'@backstage/plugin-scaffolder-backend-module-bitbucket-cloud': patch
'@backstage/plugin-catalog-backend-module-bitbucket-server': patch
'@backstage/plugin-auth-backend-module-microsoft-provider': patch
'@backstage/plugin-auth-backend-module-aws-alb-provider': patch
'@backstage/plugin-scaffolder-backend-module-bitbucket': patch
'@backstage/plugin-scaffolder-backend-module-gerrit': patch
'@backstage/plugin-scaffolder-backend-module-sentry': patch
'@backstage/plugin-catalog-backend-module-puppetdb': patch
'@backstage/plugin-scaffolder-backend-module-gitea': patch
'@backstage/plugin-catalog-backend-module-msgraph': patch
'@backstage/plugin-search-backend-module-techdocs': patch
'@backstage/plugin-catalog-backend-module-gerrit': patch
'@backstage/plugin-catalog-backend-module-gitlab': patch
'@backstage/plugin-search-backend-module-explore': patch
'@backstage/plugin-catalog-backend-module-azure': patch
'@backstage/plugin-notifications-backend': patch
'@backstage/plugin-notifications-node': patch
'@backstage/plugin-permission-backend': patch
'@backstage/backend-app-api': patch
'@backstage/plugin-devtools-backend': patch
'@backstage/plugin-techdocs-backend': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-signals-backend': patch
'@backstage/config-loader': patch
'@backstage/plugin-proxy-backend': patch
'@backstage/plugin-auth-backend': patch
'@backstage/create-app': patch
'@backstage/plugin-app-backend': patch
'@backstage/plugin-auth-node': patch
'@backstage/cli': patch
---
Use native fetch instead of node-fetch
+3 -3
View File
@@ -49,9 +49,9 @@
"storybook": "yarn ./storybook run storybook",
"techdocs-cli": "node scripts/techdocs-cli.js",
"techdocs-cli:dev": "cross-env TECHDOCS_CLI_DEV_MODE=true node scripts/techdocs-cli.js",
"test": "backstage-cli repo test",
"test:all": "backstage-cli repo test --coverage",
"test:e2e": "playwright test",
"test": "NODE_OPTIONS=--no-node-snapshot backstage-cli repo test",
"test:all": "NODE_OPTIONS=--no-node-snapshot backstage-cli repo test --coverage",
"test:e2e": "NODE_OPTIONS=--no-node-snapshot playwright test",
"tsc": "tsc",
"tsc:full": "backstage-cli repo clean && tsc --skipLibCheck false --incremental false"
},
-1
View File
@@ -71,7 +71,6 @@
"minimatch": "^9.0.0",
"minimist": "^1.2.5",
"morgan": "^1.10.0",
"node-fetch": "^2.7.0",
"node-forge": "^1.3.1",
"path-to-regexp": "^8.0.0",
"selfsigned": "^2.0.0",
-1
View File
@@ -122,7 +122,6 @@
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.4.2",
"minimatch": "^9.0.0",
"node-fetch": "^2.7.0",
"node-libs-browser": "^2.2.1",
"npm-packlist": "^5.0.0",
"ora": "^5.3.0",
@@ -20,7 +20,6 @@ import { stringify as stringifyYaml } from 'yaml';
import inquirer, { Question, Answers } from 'inquirer';
import { paths } from '../../lib/paths';
import { GithubCreateAppServer } from './GithubCreateAppServer';
import fetch from 'node-fetch';
import openBrowser from 'react-dev-utils/openBrowser';
// This is an experimental command that at this point does not support GitHub Enterprise
-1
View File
@@ -49,7 +49,6 @@
"json-schema-traverse": "^1.0.0",
"lodash": "^4.17.21",
"minimist": "^1.2.5",
"node-fetch": "^2.7.0",
"typescript-json-schema": "^0.65.0",
"yaml": "^2.0.0"
},
@@ -21,7 +21,6 @@ import {
durationToMilliseconds,
} from '@backstage/types';
import isEqual from 'lodash/isEqual';
import fetch from 'node-fetch';
import { ConfigTransformer, createConfigTransformer } from './transform';
import {
AsyncConfigSourceGenerator,
@@ -137,7 +136,7 @@ export class RemoteConfigSource implements ConfigSource {
async #load(signal?: AbortSignal): Promise<JsonObject> {
const res = await fetch(this.#url, {
signal: signal as import('node-fetch').RequestInit['signal'],
signal: signal as RequestInit['signal'],
});
if (!res.ok) {
throw await ResponseError.fromResponse(res);
+1 -2
View File
@@ -49,7 +49,6 @@
"fs-extra": "^11.2.0",
"handlebars": "^4.7.3",
"inquirer": "^8.2.0",
"node-fetch": "^2.7.0",
"ora": "^5.3.0",
"recursive-readdir": "^2.2.2"
},
@@ -61,7 +60,7 @@
"@types/inquirer": "^8.1.3",
"@types/node": "^20.16.0",
"@types/recursive-readdir": "^2.2.0",
"msw": "^1.0.0",
"msw": "^2.0.0",
"nodemon": "^3.0.1"
}
}
+8 -11
View File
@@ -33,7 +33,7 @@ import {
createMockDirectory,
registerMswTestHooks,
} from '@backstage/backend-test-utils';
import { rest } from 'msw';
import { http, HttpResponse, delay } from 'msw';
import { setupServer } from 'msw/node';
jest.spyOn(Task, 'log').mockReturnValue(undefined);
@@ -402,12 +402,10 @@ describe('tasks', () => {
it('should fetch the yarn.lock seed file', async () => {
worker.use(
rest.get(
http.get(
'https://raw.githubusercontent.com/backstage/backstage/master/packages/create-app/seed-yarn.lock',
(_, res, ctx) =>
res(
ctx.status(200),
ctx.text(`# the-lockfile-header
() =>
HttpResponse.text(`# the-lockfile-header
// some comments
// in the file
@@ -418,7 +416,6 @@ describe('tasks', () => {
"@backstage/cli@1.0.0":
some info
`),
),
),
);
@@ -438,9 +435,9 @@ describe('tasks', () => {
it('should fail gracefully', async () => {
worker.use(
rest.get(
http.get(
'https://raw.githubusercontent.com/backstage/backstage/master/packages/create-app/seed-yarn.lock',
(_, res, ctx) => res(ctx.status(404)),
() => new HttpResponse(null, { status: 404 }),
),
);
@@ -453,9 +450,9 @@ describe('tasks', () => {
it('should time out if it takes too long to fetch', async () => {
worker.use(
rest.get(
http.get(
'https://raw.githubusercontent.com/backstage/backstage/master/packages/create-app/seed-yarn.lock',
(_, res, ctx) => res(ctx.delay(5000)),
() => delay(5000),
),
);
-1
View File
@@ -25,7 +25,6 @@ import {
resolve as resolvePath,
relative as relativePath,
} from 'path';
import fetch from 'node-fetch';
import { exec as execCb } from 'child_process';
import { packageVersions } from './versions';
import { promisify } from 'util';
-1
View File
@@ -83,7 +83,6 @@
"@backstage/cli": "workspace:^",
"@backstage/types": "workspace:^",
"@types/supertest": "^2.0.8",
"node-fetch": "^2.7.0",
"supertest": "^7.0.0"
},
"configSchema": "config.d.ts"
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import fetch from 'node-fetch';
import {
createMockDirectory,
mockServices,
@@ -42,8 +42,7 @@
"@backstage/plugin-auth-backend": "workspace:^",
"@backstage/plugin-auth-node": "workspace:^",
"jose": "^5.0.0",
"node-cache": "^5.1.2",
"node-fetch": "^2.7.0"
"node-cache": "^5.1.2"
},
"devDependencies": {
"@backstage/backend-test-utils": "workspace:^",
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { KeyObject } from 'crypto';
import * as crypto from 'crypto';
import { JWTHeaderParameters, decodeJwt } from 'jose';
import NodeCache from 'node-cache';
import fetch from 'node-fetch';
import { PassportProfile, ProfileInfo } from '@backstage/plugin-auth-node';
import { AuthenticationError } from '@backstage/errors';
@@ -36,7 +36,6 @@
"dependencies": {
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/plugin-auth-node": "workspace:^",
"node-fetch": "^2.7.0",
"passport": "^0.7.0",
"passport-oauth2": "^1.6.1"
},
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import fetch from 'node-fetch';
import { PassportProfile } from '@backstage/plugin-auth-node';
export async function fetchProfile(options: {
@@ -39,8 +39,7 @@
"@backstage/errors": "workspace:^",
"@backstage/plugin-auth-node": "workspace:^",
"express": "^4.18.2",
"jose": "^5.0.0",
"node-fetch": "^2.7.0"
"jose": "^5.0.0"
},
"devDependencies": {
"@backstage/backend-defaults": "workspace:^",
@@ -23,7 +23,6 @@ import {
} from '@backstage/errors';
import express from 'express';
import { createRemoteJWKSet, jwtVerify } from 'jose';
import fetch, { Headers } from 'node-fetch';
import {
CACHE_PREFIX,
CF_JWT_HEADER,
@@ -87,8 +86,7 @@ export class AuthHelper {
// Only throw if both are not provided by Cloudflare Access since either
// can be used.
throw new AuthenticationError(
`Missing ${this.jwtHeaderName} and
${this.authorizationCookieName} from Cloudflare Access`,
`Missing ${this.jwtHeaderName} and ${this.authorizationCookieName} from Cloudflare Access`,
);
}
@@ -38,7 +38,6 @@
"@backstage/plugin-auth-node": "workspace:^",
"express": "^4.18.2",
"jose": "^5.0.0",
"node-fetch": "^2.7.0",
"passport-microsoft": "^1.0.0"
},
"devDependencies": {
@@ -16,7 +16,6 @@
import { PassportProfile } from '@backstage/plugin-auth-node';
import { decodeJwt } from 'jose';
import fetch from 'node-fetch';
import { Strategy as MicrosoftStrategy } from 'passport-microsoft';
export class ExtendedMicrosoftStrategy extends MicrosoftStrategy {
@@ -103,9 +102,9 @@ export class ExtendedMicrosoftStrategy extends MicrosoftStrategy {
},
},
);
const data = await res.buffer();
const data = await res.arrayBuffer();
return `data:image/jpeg;base64,${data.toString('base64')}`;
return `data:image/jpeg;base64,${Buffer.from(data).toString('base64')}`;
} catch (error) {
return undefined;
}
-1
View File
@@ -89,7 +89,6 @@
"minimatch": "^9.0.0",
"morgan": "^1.10.0",
"node-cache": "^5.1.2",
"node-fetch": "^2.7.0",
"openid-client": "^5.2.1",
"passport": "^0.7.0",
"passport-auth0": "^1.4.3",
-1
View File
@@ -49,7 +49,6 @@
"express": "^4.17.1",
"jose": "^5.0.0",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"passport": "^0.7.0",
"winston": "^3.2.1",
"zod": "^3.22.4",
@@ -58,7 +58,6 @@
"@backstage/integration": "workspace:^",
"@backstage/plugin-catalog-common": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0"
},
"devDependencies": {
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import fetch from 'node-fetch';
import {
AzureDevOpsCredentialsProvider,
AzureIntegrationConfig,
@@ -56,8 +56,6 @@
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"@types/node-fetch": "^2.5.12",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0"
},
"devDependencies": {
@@ -11,7 +11,6 @@ import { EntityProvider } from '@backstage/plugin-catalog-node';
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
import { LocationSpec } from '@backstage/plugin-catalog-node';
import { LoggerService } from '@backstage/backend-plugin-api';
import { Response as Response_2 } from 'node-fetch';
import { SchedulerService } from '@backstage/backend-plugin-api';
import { SchedulerServiceTaskRunner } from '@backstage/backend-plugin-api';
@@ -27,7 +26,7 @@ export class BitbucketServerClient {
projectKey: string;
repo: string;
path: string;
}): Promise<Response_2>;
}): Promise<Response>;
// (undocumented)
getRepository(options: {
projectKey: string;
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import fetch, { Request, Response } from 'node-fetch';
import {
BitbucketServerIntegrationConfig,
getBitbucketServerRequestOptions,
@@ -53,7 +53,6 @@
"@backstage/integration": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"fs-extra": "^11.2.0",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0"
},
"devDependencies": {
@@ -22,7 +22,6 @@ import {
LocationSpec,
locationSpecToLocationEntity,
} from '@backstage/plugin-catalog-node';
import fetch, { Response } from 'node-fetch';
import {
GerritIntegration,
getGerritProjectsApiUrl,
@@ -61,7 +61,6 @@
"@backstage/plugin-events-node": "workspace:^",
"@gitbeaker/rest": "^40.0.3",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0"
},
"devDependencies": {
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
getGitLabRequestOptions,
GitLabIntegrationConfig,
} from '@backstage/integration';
import fetch from 'node-fetch';
import { LoggerService } from '@backstage/backend-plugin-api';
import {
GitLabDescendantGroupsResponse,
GitLabGroup,
@@ -58,9 +58,7 @@
"@backstage/plugin-catalog-common": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"@microsoft/microsoft-graph-types": "^2.6.0",
"@types/node-fetch": "^2.5.12",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"p-limit": "^3.0.2",
"qs": "^6.9.4",
"uuid": "^11.0.0"
@@ -17,7 +17,6 @@ import { LoggerService } from '@backstage/backend-plugin-api';
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
import { OrganizationTransformer as OrganizationTransformer_2 } from '@backstage/plugin-catalog-backend-module-msgraph';
import { ProviderConfigTransformer as ProviderConfigTransformer_2 } from '@backstage/plugin-catalog-backend-module-msgraph';
import { Response as Response_2 } from 'node-fetch';
import { SchedulerService } from '@backstage/backend-plugin-api';
import { SchedulerServiceTaskRunner } from '@backstage/backend-plugin-api';
import { SchedulerServiceTaskScheduleDefinition } from '@backstage/backend-plugin-api';
@@ -114,7 +113,7 @@ export class MicrosoftGraphClient {
path: string,
query?: ODataQuery,
headers?: Record<string, string>,
): Promise<Response_2>;
): Promise<Response>;
requestCollection<T>(
path: string,
query?: ODataQuery,
@@ -124,7 +123,7 @@ export class MicrosoftGraphClient {
url: string,
headers?: Record<string, string>,
retryCount?: number,
): Promise<Response_2>;
): Promise<Response>;
}
// @public
@@ -20,7 +20,6 @@ import {
ClientSecretCredential,
} from '@azure/identity';
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
import fetch, { Response } from 'node-fetch';
import qs from 'qs';
import { MicrosoftGraphProviderConfig } from './config';
@@ -61,7 +61,6 @@
"@backstage/types": "workspace:^",
"lodash": "^4.17.21",
"luxon": "^3.0.0",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0"
},
"devDependencies": {
@@ -18,7 +18,6 @@ import { PuppetDbEntityProviderConfig } from '../providers';
import { PuppetNode, ResourceTransformer } from './types';
import { ResourceEntity } from '@backstage/catalog-model';
import { defaultResourceTransformer } from './transformers';
import fetch from 'node-fetch';
import { ResponseError } from '@backstage/errors';
import { ENDPOINT_FACTSETS } from './constants';
import { LoggerService } from '@backstage/backend-plugin-api';
-1
View File
@@ -89,7 +89,6 @@
"lodash": "^4.17.21",
"luxon": "^3.0.0",
"minimatch": "^9.0.0",
"node-fetch": "^2.7.0",
"p-limit": "^3.0.2",
"prom-client": "^15.0.0",
"uuid": "^11.0.0",
-1
View File
@@ -55,7 +55,6 @@
"express-promise-router": "^4.1.0",
"fs-extra": "^11.0.0",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"ping": "^0.4.1",
"semver": "^7.5.3",
"yn": "^4.0.0"
@@ -24,9 +24,7 @@ import {
ExternalDependencyStatus,
PackageDependency,
} from '@backstage/plugin-devtools-common';
import { JsonObject } from '@backstage/types';
import fetch from 'node-fetch';
import { findPaths } from '@backstage/cli-common';
import { getPackages } from '@manypkg/get-packages';
import ping from 'ping';
@@ -53,7 +53,6 @@
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"knex": "^3.0.0",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0",
"winston": "^3.2.1",
"yn": "^4.0.0"
-1
View File
@@ -43,7 +43,6 @@
"@backstage/plugin-notifications-common": "workspace:^",
"@backstage/plugin-signals-node": "workspace:^",
"knex": "^3.0.0",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0"
},
"devDependencies": {
@@ -17,7 +17,6 @@
import { NotificationService } from './NotificationService';
import { AuthService, DiscoveryService } from '@backstage/backend-plugin-api';
import { NotificationPayload } from '@backstage/plugin-notifications-common';
import fetch from 'node-fetch';
/** @public */
export type NotificationServiceOptions = {
-1
View File
@@ -63,7 +63,6 @@
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"yn": "^4.0.0",
"zod": "^3.22.4"
},
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import fetch from 'node-fetch';
import { z } from 'zod';
import {
AuthorizeResult,
+1 -2
View File
@@ -77,8 +77,7 @@
"@backstage/errors": "workspace:^",
"@types/http-proxy-middleware": "^1.0.0",
"@types/yup": "^0.32.0",
"msw": "^2.0.0",
"node-fetch": "^2.7.0"
"msw": "^2.0.0"
},
"configSchema": "config.d.ts"
}
@@ -29,7 +29,6 @@ import {
} from '@backstage/config-loader';
import { HttpResponse, http, passthrough } from 'msw';
import { setupServer } from 'msw/node';
import fetch from 'node-fetch';
// this test is stored in its own file to work around the mocked
// http-proxy-middleware module used in the main test file
@@ -25,7 +25,6 @@ import { ResponseError } from '@backstage/errors';
import { JsonObject } from '@backstage/types';
import { HttpResponse, http, passthrough } from 'msw';
import { setupServer } from 'msw/node';
import fetch from 'node-fetch';
// this test is stored in its own file to work around the mocked
// http-proxy-middleware module used in the main test file
@@ -49,7 +49,6 @@
"@backstage/plugin-bitbucket-cloud-common": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"fs-extra": "^11.2.0",
"node-fetch": "^2.7.0",
"yaml": "^2.0.0"
},
"devDependencies": {
@@ -22,7 +22,6 @@ import {
getRepoSourceDirectory,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
import fetch, { Response, RequestInit } from 'node-fetch';
import { Config } from '@backstage/config';
import { getAuthorizationHeader } from './helpers';
@@ -16,7 +16,6 @@
import { examples } from './bitbucketCloudPipelinesRun.examples';
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import fetch, { Response } from 'node-fetch';
import * as inputProps from './inputProperties';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { getAuthorizationHeader } from './helpers';
@@ -24,7 +24,6 @@ import {
cloneRepo,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
import fetch, { RequestInit, Response } from 'node-fetch';
import { Config } from '@backstage/config';
import fs from 'fs-extra';
import { getAuthorizationHeader } from './helpers';
@@ -48,7 +48,6 @@
"@backstage/integration": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"fs-extra": "^11.2.0",
"node-fetch": "^2.7.0",
"yaml": "^2.0.0"
},
"devDependencies": {
@@ -25,7 +25,6 @@ import {
getRepoSourceDirectory,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
import fetch, { Response, RequestInit } from 'node-fetch';
import { Config } from '@backstage/config';
import { examples } from './bitbucketServer.examples';
@@ -27,7 +27,6 @@ import {
cloneRepo,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
import fetch, { RequestInit, Response } from 'node-fetch';
import { Config } from '@backstage/config';
import fs from 'fs-extra';
import { examples } from './bitbucketServerPullRequest.examples';
@@ -50,7 +50,6 @@
"@backstage/plugin-scaffolder-backend-module-bitbucket-server": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"fs-extra": "^11.2.0",
"node-fetch": "^2.7.0",
"yaml": "^2.0.0"
},
"devDependencies": {
@@ -25,7 +25,6 @@ import {
getRepoSourceDirectory,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
import fetch, { Response, RequestInit } from 'node-fetch';
import { Config } from '@backstage/config';
import { examples } from './bitbucket.examples';
@@ -47,7 +47,6 @@
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"node-fetch": "^2.7.0",
"yaml": "^2.0.0"
},
"devDependencies": {
@@ -28,7 +28,6 @@ import {
getRepoSourceDirectory,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
import fetch, { Response, RequestInit } from 'node-fetch';
import { examples } from './gerrit.examples';
const createGerritProject = async (
@@ -47,7 +47,6 @@
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"node-fetch": "^2.7.0",
"yaml": "^2.0.0"
},
"devDependencies": {
@@ -30,7 +30,6 @@ import {
} from '@backstage/plugin-scaffolder-node';
import { examples } from './gitea.examples';
import crypto from 'crypto';
import fetch, { Response, RequestInit } from 'node-fetch';
const checkGiteaContentUrl = async (
config: GiteaIntegrationConfig,
@@ -46,7 +46,6 @@
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"node-fetch": "^2.7.0",
"yaml": "^2.3.3"
},
"devDependencies": {
@@ -17,7 +17,6 @@
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import { InputError } from '@backstage/errors';
import { Config } from '@backstage/config';
import fetch from 'node-fetch';
/**
* Creates the `sentry:project:create` Scaffolder action.
@@ -53,8 +53,7 @@
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/plugin-search-backend-node": "workspace:^",
"@backstage/plugin-search-common": "workspace:^",
"node-fetch": "^2.7.0"
"@backstage/plugin-search-common": "workspace:^"
},
"devDependencies": {
"@backstage/backend-test-utils": "workspace:^",
@@ -29,7 +29,6 @@ import {
DocumentCollatorFactory,
IndexableDocument,
} from '@backstage/plugin-search-common';
import fetch from 'node-fetch';
import { Readable } from 'stream';
/**
@@ -39,7 +39,6 @@
"@backstage/config": "workspace:^",
"@backstage/plugin-search-backend-node": "workspace:^",
"@backstage/plugin-search-common": "workspace:^",
"node-fetch": "^2.7.0",
"qs": "^6.9.4"
},
"devDependencies": {
@@ -20,7 +20,7 @@ import {
} from '@backstage/plugin-search-common';
import { Config } from '@backstage/config';
import { Readable } from 'stream';
import fetch from 'node-fetch';
import qs from 'qs';
import { LoggerService } from '@backstage/backend-plugin-api';
@@ -60,7 +60,6 @@
"@backstage/plugin-search-common": "workspace:^",
"@backstage/plugin-techdocs-node": "workspace:^",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"p-limit": "^3.1.0"
},
"devDependencies": {
@@ -34,7 +34,6 @@ import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/al
import { Permission } from '@backstage/plugin-permission-common';
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
import { TechDocsDocument } from '@backstage/plugin-techdocs-node';
import fetch from 'node-fetch';
import pLimit from 'p-limit';
import { Readable } from 'stream';
import { TechDocsCollatorEntityTransformer } from './TechDocsCollatorEntityTransformer';
-1
View File
@@ -48,7 +48,6 @@
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"http-proxy-middleware": "^2.0.0",
"node-fetch": "^2.7.0",
"uuid": "^11.0.0",
"winston": "^3.2.1",
"ws": "^8.18.0",
+1 -2
View File
@@ -77,7 +77,6 @@
"fs-extra": "^11.2.0",
"knex": "^3.0.0",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"p-limit": "^3.1.0",
"winston": "^3.2.1"
},
@@ -85,7 +84,7 @@
"@backstage/backend-defaults": "workspace:^",
"@backstage/backend-test-utils": "workspace:^",
"@backstage/cli": "workspace:^",
"msw": "^1.0.0",
"msw": "^2.0.0",
"supertest": "^7.0.0"
},
"configSchema": "config.d.ts"
@@ -22,7 +22,7 @@ import {
registerMswTestHooks,
} from '@backstage/backend-test-utils';
import { setupServer } from 'msw/node';
import { rest } from 'msw';
import { http, HttpResponse } from 'msw';
import { ConfigReader } from '@backstage/config';
import { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';
import { DiscoveryService } from '@backstage/backend-plugin-api';
@@ -106,12 +106,12 @@ describe('TechDocs Collator', () => {
});
worker.use(
rest.get(
http.get(
'http://test-backend/static/docs/default/Component/test-entity-with-docs/search/search_index.json',
(_, res, ctx) => res(ctx.status(200), ctx.json(mockSearchDocIndex)),
() => HttpResponse.json(mockSearchDocIndex),
),
rest.get('http://test-backend/entities', (_, res, ctx) =>
res(ctx.status(200), ctx.json(expectedEntities)),
http.get('http://test-backend/entities', () =>
HttpResponse.json(expectedEntities),
),
);
});
@@ -164,12 +164,12 @@ describe('TechDocs Collator', () => {
});
worker.use(
rest.get(
http.get(
'http://test-backend/static/docs/default/component/test-entity-with-docs/search/search_index.json',
(_, res, ctx) => res(ctx.status(200), ctx.json(mockSearchDocIndex)),
() => HttpResponse.json(mockSearchDocIndex),
),
rest.get('http://test-backend/entities', (_, res, ctx) =>
res(ctx.status(200), ctx.json(expectedEntities)),
http.get('http://test-backend/entities', () =>
HttpResponse.json(expectedEntities),
),
);
});
@@ -21,7 +21,6 @@ import {
RELATION_OWNED_BY,
stringifyEntityRef,
} from '@backstage/catalog-model';
import fetch from 'node-fetch';
import unescape from 'lodash/unescape';
import { Logger } from 'winston';
import pLimit from 'p-limit';
@@ -27,28 +27,23 @@ import * as winston from 'winston';
import { TechDocsCache } from '../cache';
import { DocsBuilder, shouldCheckForUpdate } from '../DocsBuilder';
import { DocsSynchronizer, DocsSynchronizerSyncOpts } from './DocsSynchronizer';
import { mockServices } from '@backstage/backend-test-utils';
import {
mockServices,
registerMswTestHooks,
} from '@backstage/backend-test-utils';
import { DiscoveryService } from '@backstage/backend-plugin-api';
import { http, HttpResponse } from 'msw';
import { setupServer } from 'msw/node';
jest.mock('../DocsBuilder');
jest.useFakeTimers();
jest.mock('node-fetch', () => ({
__esModule: true,
default: async () => {
return {
json: async () => {
return {
build_timestamp: 123,
};
},
};
},
}));
const MockedDocsBuilder = DocsBuilder as jest.MockedClass<typeof DocsBuilder>;
describe('DocsSynchronizer', () => {
const worker = setupServer();
registerMswTestHooks(worker);
const preparers: jest.Mocked<PreparerBuilder> = {
register: jest.fn(),
get: jest.fn(),
@@ -101,6 +96,13 @@ describe('DocsSynchronizer', () => {
scmIntegrations: ScmIntegrations.fromConfig(new ConfigReader({})),
cache,
});
worker.use(
http.get(
'http://backstage.local/api/techdocs/static/docs/default/component/test/techdocs_metadata.json',
() => HttpResponse.json({ build_timestamp: 123 }),
),
);
});
afterEach(() => {
@@ -27,7 +27,6 @@ import {
PreparerBuilder,
PublisherBase,
} from '@backstage/plugin-techdocs-node';
import fetch from 'node-fetch';
import pLimit, { Limit } from 'p-limit';
import { PassThrough } from 'stream';
import * as winston from 'winston';
+3 -39
View File
@@ -3481,7 +3481,6 @@ __metadata:
minimist: ^1.2.5
morgan: ^1.10.0
msw: ^1.0.0
node-fetch: ^2.7.0
node-forge: ^1.3.1
path-to-regexp: ^8.0.0
selfsigned: ^2.0.0
@@ -4048,7 +4047,6 @@ __metadata:
mini-css-extract-plugin: ^2.4.2
minimatch: ^9.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
node-libs-browser: ^2.2.1
nodemon: ^3.0.1
npm-packlist: ^5.0.0
@@ -4155,7 +4153,6 @@ __metadata:
lodash: ^4.17.21
minimist: ^1.2.5
msw: ^1.0.0
node-fetch: ^2.7.0
typescript-json-schema: ^0.65.0
yaml: ^2.0.0
zen-observable: ^0.10.0
@@ -4584,8 +4581,7 @@ __metadata:
fs-extra: ^11.2.0
handlebars: ^4.7.3
inquirer: ^8.2.0
msw: ^1.0.0
node-fetch: ^2.7.0
msw: ^2.0.0
nodemon: ^3.0.1
ora: ^5.3.0
recursive-readdir: ^2.2.2
@@ -5101,7 +5097,6 @@ __metadata:
knex: ^3.0.0
lodash: ^4.17.21
luxon: ^3.0.0
node-fetch: ^2.7.0
supertest: ^7.0.0
yn: ^4.0.0
languageName: unknown
@@ -5259,7 +5254,6 @@ __metadata:
jose: ^5.0.0
msw: ^2.0.8
node-cache: ^5.1.2
node-fetch: ^2.7.0
languageName: unknown
linkType: soft
@@ -5309,7 +5303,6 @@ __metadata:
"@backstage/plugin-auth-backend": "workspace:^"
"@backstage/plugin-auth-node": "workspace:^"
"@types/passport-oauth2": ^1.4.15
node-fetch: ^2.7.0
passport: ^0.7.0
passport-oauth2: ^1.6.1
supertest: ^7.0.0
@@ -5332,7 +5325,6 @@ __metadata:
express: ^4.18.2
jose: ^5.0.0
msw: ^2.0.0
node-fetch: ^2.7.0
node-mocks-http: ^1.0.0
uuid: ^11.0.0
languageName: unknown
@@ -5432,7 +5424,6 @@ __metadata:
express: ^4.18.2
jose: ^5.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
passport-microsoft: ^1.0.0
supertest: ^7.0.0
languageName: unknown
@@ -5632,7 +5623,6 @@ __metadata:
morgan: ^1.10.0
msw: ^1.0.0
node-cache: ^5.1.2
node-fetch: ^2.7.0
openid-client: ^5.2.1
passport: ^0.7.0
passport-auth0: ^1.4.3
@@ -5695,7 +5685,6 @@ __metadata:
jose: ^5.0.0
lodash: ^4.17.21
msw: ^1.0.0
node-fetch: ^2.7.0
passport: ^0.7.0
supertest: ^7.0.0
uuid: ^11.0.0
@@ -5797,7 +5786,6 @@ __metadata:
"@backstage/plugin-catalog-node": "workspace:^"
luxon: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
uuid: ^11.0.0
languageName: unknown
linkType: soft
@@ -5855,10 +5843,8 @@ __metadata:
"@backstage/errors": "workspace:^"
"@backstage/integration": "workspace:^"
"@backstage/plugin-catalog-node": "workspace:^"
"@types/node-fetch": ^2.5.12
luxon: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
uuid: ^11.0.0
languageName: unknown
linkType: soft
@@ -5893,7 +5879,6 @@ __metadata:
fs-extra: ^11.2.0
luxon: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
uuid: ^11.0.0
languageName: unknown
linkType: soft
@@ -5978,7 +5963,6 @@ __metadata:
lodash: ^4.17.21
luxon: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
uuid: ^11.0.0
languageName: unknown
linkType: soft
@@ -6058,11 +6042,9 @@ __metadata:
"@backstage/plugin-catalog-node": "workspace:^"
"@microsoft/microsoft-graph-types": ^2.6.0
"@types/lodash": ^4.14.151
"@types/node-fetch": ^2.5.12
lodash: ^4.17.21
luxon: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
p-limit: ^3.0.2
qs: ^6.9.4
uuid: ^11.0.0
@@ -6107,7 +6089,6 @@ __metadata:
lodash: ^4.17.21
luxon: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
uuid: ^11.0.0
languageName: unknown
linkType: soft
@@ -6188,7 +6169,6 @@ __metadata:
luxon: ^3.0.0
minimatch: ^9.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
p-limit: ^3.0.2
prom-client: ^15.0.0
supertest: ^7.0.0
@@ -6579,7 +6559,6 @@ __metadata:
express-promise-router: ^4.1.0
fs-extra: ^11.0.0
lodash: ^4.17.21
node-fetch: ^2.7.0
ping: ^0.4.1
semver: ^7.5.3
supertest: ^7.0.0
@@ -7119,7 +7098,6 @@ __metadata:
express-promise-router: ^4.1.0
knex: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
supertest: ^7.0.0
uuid: ^11.0.0
winston: ^3.2.1
@@ -7151,7 +7129,6 @@ __metadata:
"@backstage/test-utils": "workspace:^"
knex: ^3.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
uuid: ^11.0.0
languageName: unknown
linkType: soft
@@ -7315,7 +7292,6 @@ __metadata:
express-promise-router: ^4.1.0
lodash: ^4.17.21
msw: ^1.0.0
node-fetch: ^2.7.0
supertest: ^7.0.0
yn: ^4.0.0
zod: ^3.22.4
@@ -7410,7 +7386,6 @@ __metadata:
http-proxy-middleware: ^2.0.0
morgan: ^1.10.0
msw: ^2.0.0
node-fetch: ^2.7.0
uuid: ^11.0.0
winston: ^3.2.1
yaml: ^2.0.0
@@ -7450,7 +7425,6 @@ __metadata:
"@backstage/plugin-scaffolder-node-test-utils": "workspace:^"
fs-extra: ^11.2.0
msw: ^1.0.0
node-fetch: ^2.7.0
yaml: ^2.0.0
languageName: unknown
linkType: soft
@@ -7469,7 +7443,6 @@ __metadata:
"@backstage/plugin-scaffolder-node-test-utils": "workspace:^"
fs-extra: ^11.2.0
msw: ^1.0.0
node-fetch: ^2.7.0
yaml: ^2.0.0
languageName: unknown
linkType: soft
@@ -7490,7 +7463,6 @@ __metadata:
"@backstage/plugin-scaffolder-node-test-utils": "workspace:^"
fs-extra: ^11.2.0
msw: ^1.0.0
node-fetch: ^2.7.0
yaml: ^2.0.0
languageName: unknown
linkType: soft
@@ -7571,7 +7543,6 @@ __metadata:
"@backstage/plugin-scaffolder-node": "workspace:^"
"@backstage/plugin-scaffolder-node-test-utils": "workspace:^"
msw: ^1.0.0
node-fetch: ^2.7.0
yaml: ^2.0.0
languageName: unknown
linkType: soft
@@ -7589,7 +7560,6 @@ __metadata:
"@backstage/plugin-scaffolder-node": "workspace:^"
"@backstage/plugin-scaffolder-node-test-utils": "workspace:^"
msw: ^1.0.0
node-fetch: ^2.7.0
yaml: ^2.0.0
languageName: unknown
linkType: soft
@@ -7694,7 +7664,6 @@ __metadata:
"@backstage/plugin-scaffolder-node-test-utils": "workspace:^"
"@backstage/types": "workspace:^"
msw: ^2.0.0
node-fetch: ^2.7.0
yaml: ^2.3.3
languageName: unknown
linkType: soft
@@ -8050,7 +8019,6 @@ __metadata:
"@backstage/plugin-search-backend-node": "workspace:^"
"@backstage/plugin-search-common": "workspace:^"
msw: ^1.2.1
node-fetch: ^2.7.0
languageName: unknown
linkType: soft
@@ -8082,7 +8050,6 @@ __metadata:
"@backstage/plugin-search-backend-node": "workspace:^"
"@backstage/plugin-search-common": "workspace:^"
msw: ^1.2.1
node-fetch: ^2.7.0
qs: ^6.9.4
languageName: unknown
linkType: soft
@@ -8106,7 +8073,6 @@ __metadata:
"@backstage/plugin-techdocs-node": "workspace:^"
lodash: ^4.17.21
msw: ^1.0.0
node-fetch: ^2.7.0
p-limit: ^3.1.0
languageName: unknown
linkType: soft
@@ -8281,7 +8247,6 @@ __metadata:
express-promise-router: ^4.1.0
http-proxy-middleware: ^2.0.0
msw: ^1.0.0
node-fetch: ^2.7.0
supertest: ^7.0.0
uuid: ^11.0.0
winston: ^3.2.1
@@ -8430,8 +8395,7 @@ __metadata:
fs-extra: ^11.2.0
knex: ^3.0.0
lodash: ^4.17.21
msw: ^1.0.0
node-fetch: ^2.7.0
msw: ^2.0.0
p-limit: ^3.1.0
supertest: ^7.0.0
winston: ^3.2.1
@@ -19682,7 +19646,7 @@ __metadata:
languageName: node
linkType: hard
"@types/node-fetch@npm:^2.5.12, @types/node-fetch@npm:^2.6.4, @types/node-fetch@npm:^2.6.9":
"@types/node-fetch@npm:^2.6.4, @types/node-fetch@npm:^2.6.9":
version: 2.6.12
resolution: "@types/node-fetch@npm:2.6.12"
dependencies: