Merge pull request #25319 from backstage/freben/destroy
Only bootstrap global-agent in the CLI if it's actually being used
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Only bootstrap global-agent if it's actually being used
|
||||
@@ -94,6 +94,7 @@
|
||||
"dependencies": {
|
||||
"@backstage/errors": "workspace:^",
|
||||
"@manypkg/get-packages": "^1.1.3",
|
||||
"@types/global-agent": "^2.1.3",
|
||||
"@useoptic/optic": "^0.50.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { bootstrap } from 'global-agent';
|
||||
|
||||
if (shouldUseGlobalAgent()) {
|
||||
bootstrap();
|
||||
}
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import chalk from 'chalk';
|
||||
import ora from 'ora';
|
||||
@@ -38,10 +44,22 @@ import {
|
||||
getManifestByVersion,
|
||||
ReleaseManifest,
|
||||
} from '@backstage/release-manifests';
|
||||
import 'global-agent/bootstrap';
|
||||
import { PackageGraph } from '@backstage/cli-node';
|
||||
import { migrateMovedPackages } from './migrate';
|
||||
|
||||
function shouldUseGlobalAgent(): boolean {
|
||||
// see https://www.npmjs.com/package/global-agent
|
||||
const namespace =
|
||||
process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? 'GLOBAL_AGENT_';
|
||||
if (
|
||||
process.env[`${namespace}HTTP_PROXY`] ||
|
||||
process.env[`${namespace}HTTPS_PROXY`]
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const DEP_TYPES = [
|
||||
'dependencies',
|
||||
'devDependencies',
|
||||
|
||||
@@ -17173,6 +17173,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/global-agent@npm:^2.1.3":
|
||||
version: 2.1.3
|
||||
resolution: "@types/global-agent@npm:2.1.3"
|
||||
checksum: 6129b6d5ba871b9d111ddf91e6f9a1725d3f28bf2aa6869ec83bebd14c688cde4275ebea6fa45b0b1c00d78109d022c935f952e9e4876d76289d4706484776c3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/google-protobuf@npm:^3.7.2":
|
||||
version: 3.15.12
|
||||
resolution: "@types/google-protobuf@npm:3.15.12"
|
||||
@@ -39395,6 +39402,7 @@ __metadata:
|
||||
"@spotify/eslint-plugin": ^15.0.0
|
||||
"@spotify/prettier-config": ^15.0.0
|
||||
"@techdocs/cli": "workspace:*"
|
||||
"@types/global-agent": ^2.1.3
|
||||
"@types/node": ^18.17.8
|
||||
"@types/webpack": ^5.28.0
|
||||
"@useoptic/optic": ^0.50.10
|
||||
|
||||
Reference in New Issue
Block a user