diff --git a/packages/cli-common/report.api.md b/packages/cli-common/report.api.md index d541166bf1..0e3c80afa4 100644 --- a/packages/cli-common/report.api.md +++ b/packages/cli-common/report.api.md @@ -6,15 +6,15 @@ // @public export const BACKSTAGE_JSON = 'backstage.json'; +// @public +export function bootstrapEnvProxyAgents(): void; + // @public export function findPaths(searchDir: string): Paths; // @public export function isChildPath(base: string, path: string): boolean; -// @public -export function maybeBootstrapProxy(): void; - // @public export type Paths = { ownDir: string; diff --git a/packages/cli-common/src/index.ts b/packages/cli-common/src/index.ts index 194644db95..11e5d05f4f 100644 --- a/packages/cli-common/src/index.ts +++ b/packages/cli-common/src/index.ts @@ -23,4 +23,4 @@ export { findPaths, BACKSTAGE_JSON } from './paths'; export { isChildPath } from './isChildPath'; export type { Paths, ResolveFunc } from './paths'; -export { maybeBootstrapProxy } from './proxyBootstrap'; +export { bootstrapEnvProxyAgents } from './proxyBootstrap'; diff --git a/packages/cli-common/src/proxyBootstrap.test.ts b/packages/cli-common/src/proxyBootstrap.test.ts index 1132e640f0..5b6bf295df 100644 --- a/packages/cli-common/src/proxyBootstrap.test.ts +++ b/packages/cli-common/src/proxyBootstrap.test.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { maybeBootstrapProxy } from './proxyBootstrap'; +import { bootstrapEnvProxyAgents } from './proxyBootstrap'; jest.mock('global-agent', () => ({ bootstrap: jest.fn(), @@ -24,7 +24,7 @@ jest.mock('undici', () => ({ EnvHttpProxyAgent: jest.fn(), })); -describe('maybeBootstrapProxy', () => { +describe('bootstrapEnvProxyAgents', () => { const originalEnv = process.env; beforeEach(() => { @@ -42,7 +42,7 @@ describe('maybeBootstrapProxy', () => { const { bootstrap } = require('global-agent') as typeof import('global-agent'); - maybeBootstrapProxy(); + bootstrapEnvProxyAgents(); expect(bootstrap).toHaveBeenCalledTimes(1); }); @@ -52,7 +52,7 @@ describe('maybeBootstrapProxy', () => { const { bootstrap } = require('global-agent') as typeof import('global-agent'); - maybeBootstrapProxy(); + bootstrapEnvProxyAgents(); expect(bootstrap).toHaveBeenCalledTimes(1); }); @@ -62,7 +62,7 @@ describe('maybeBootstrapProxy', () => { const { setGlobalDispatcher, EnvHttpProxyAgent } = require('undici') as typeof import('undici'); - maybeBootstrapProxy(); + bootstrapEnvProxyAgents(); expect(EnvHttpProxyAgent).toHaveBeenCalledTimes(1); expect(setGlobalDispatcher).toHaveBeenCalledWith( @@ -75,7 +75,7 @@ describe('maybeBootstrapProxy', () => { const { setGlobalDispatcher, EnvHttpProxyAgent } = require('undici') as typeof import('undici'); - maybeBootstrapProxy(); + bootstrapEnvProxyAgents(); expect(EnvHttpProxyAgent).toHaveBeenCalledTimes(1); expect(setGlobalDispatcher).toHaveBeenCalledWith( @@ -89,7 +89,7 @@ describe('maybeBootstrapProxy', () => { const { setGlobalDispatcher } = require('undici') as typeof import('undici'); - maybeBootstrapProxy(); + bootstrapEnvProxyAgents(); expect(bootstrap).not.toHaveBeenCalled(); expect(setGlobalDispatcher).not.toHaveBeenCalled(); @@ -101,7 +101,7 @@ describe('maybeBootstrapProxy', () => { const { bootstrap } = require('global-agent') as typeof import('global-agent'); - maybeBootstrapProxy(); + bootstrapEnvProxyAgents(); expect(bootstrap).toHaveBeenCalledTimes(1); }); diff --git a/packages/cli-common/src/proxyBootstrap.ts b/packages/cli-common/src/proxyBootstrap.ts index d338611cb1..b7375b6e55 100644 --- a/packages/cli-common/src/proxyBootstrap.ts +++ b/packages/cli-common/src/proxyBootstrap.ts @@ -28,7 +28,7 @@ * * @public */ -export function maybeBootstrapProxy() { +export function bootstrapEnvProxyAgents() { // see https://www.npmjs.com/package/global-agent const globalAgentNamespace = process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? 'GLOBAL_AGENT_'; diff --git a/packages/cli/src/modules/migrate/commands/versions/bump.ts b/packages/cli/src/modules/migrate/commands/versions/bump.ts index 010b3de673..b424d41576 100644 --- a/packages/cli/src/modules/migrate/commands/versions/bump.ts +++ b/packages/cli/src/modules/migrate/commands/versions/bump.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { BACKSTAGE_JSON, maybeBootstrapProxy } from '@backstage/cli-common'; +import { BACKSTAGE_JSON, bootstrapEnvProxyAgents } from '@backstage/cli-common'; -maybeBootstrapProxy(); +bootstrapEnvProxyAgents(); import fs from 'fs-extra'; import chalk from 'chalk'; diff --git a/packages/create-app/src/lib/tasks.ts b/packages/create-app/src/lib/tasks.ts index 1bd42a108a..0ab31dd5f4 100644 --- a/packages/create-app/src/lib/tasks.ts +++ b/packages/create-app/src/lib/tasks.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { maybeBootstrapProxy } from '@backstage/cli-common'; +import { bootstrapEnvProxyAgents } from '@backstage/cli-common'; -maybeBootstrapProxy(); +bootstrapEnvProxyAgents(); import chalk from 'chalk'; import fs from 'fs-extra';