@backstage/cli-common 0.1.15 → 0.1.16-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @backstage/cli-common
2
2
 
3
+ ## 0.1.16-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5cfb2a4: Added new `run`, `runOutput`, and `runCheck` utilities to help run child processes in a safe and portable way.
8
+
9
+ ## 0.1.16-next.0
10
+
11
+ ### Patch Changes
12
+
13
+ - c8c2329: Add proxy configuration from env-vars to create-app tasks
14
+
3
15
  ## 0.1.15
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var errors = require('@backstage/errors');
4
+
5
+ class ExitCodeError extends errors.CustomErrorBase {
6
+ code;
7
+ constructor(code, command) {
8
+ super(
9
+ command ? `Command '${command}' exited with code ${code}` : `Child exited with code ${code}`
10
+ );
11
+ this.code = code;
12
+ }
13
+ }
14
+
15
+ exports.ExitCodeError = ExitCodeError;
16
+ //# sourceMappingURL=errors.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.cjs.js","sources":["../src/errors.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CustomErrorBase } from '@backstage/errors';\n\n/**\n * Error thrown when a child process exits with a non-zero code.\n * @public\n */\nexport class ExitCodeError extends CustomErrorBase {\n readonly code: number;\n\n constructor(code: number, command?: string) {\n super(\n command\n ? `Command '${command}' exited with code ${code}`\n : `Child exited with code ${code}`,\n );\n this.code = code;\n }\n}\n"],"names":["CustomErrorBase"],"mappings":";;;;AAsBO,MAAM,sBAAsBA,sBAAA,CAAgB;AAAA,EACxC,IAAA;AAAA,EAET,WAAA,CAAY,MAAc,OAAA,EAAkB;AAC1C,IAAA,KAAA;AAAA,MACE,UACI,CAAA,SAAA,EAAY,OAAO,sBAAsB,IAAI,CAAA,CAAA,GAC7C,0BAA0B,IAAI,CAAA;AAAA,KACpC;AACA,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF;;;;"}
package/dist/index.cjs.js CHANGED
@@ -2,10 +2,18 @@
2
2
 
3
3
  var paths = require('./paths.cjs.js');
4
4
  var isChildPath = require('./isChildPath.cjs.js');
5
+ var proxyBootstrap = require('./proxyBootstrap.cjs.js');
6
+ var run = require('./run.cjs.js');
7
+ var errors = require('./errors.cjs.js');
5
8
 
6
9
 
7
10
 
8
11
  exports.BACKSTAGE_JSON = paths.BACKSTAGE_JSON;
9
12
  exports.findPaths = paths.findPaths;
10
13
  exports.isChildPath = isChildPath.isChildPath;
14
+ exports.bootstrapEnvProxyAgents = proxyBootstrap.bootstrapEnvProxyAgents;
15
+ exports.run = run.run;
16
+ exports.runCheck = run.runCheck;
17
+ exports.runOutput = run.runOutput;
18
+ exports.ExitCodeError = errors.ExitCodeError;
11
19
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { SpawnOptions, ChildProcess } from 'child_process';
2
+ import { CustomErrorBase } from '@backstage/errors';
3
+
1
4
  /**
2
5
  * A function that takes a set of path fragments and resolves them into a
3
6
  * single complete path, relative to some root.
@@ -44,4 +47,87 @@ declare const BACKSTAGE_JSON = "backstage.json";
44
47
  */
45
48
  declare function isChildPath(base: string, path: string): boolean;
46
49
 
47
- export { BACKSTAGE_JSON, type Paths, type ResolveFunc, findPaths, isChildPath };
50
+ /**
51
+ * This function can be called to setup undici and node-fetch Proxy agents.
52
+ *
53
+ * You can set GLOBAL_AGENT_HTTP(S)_PROXY to configure a proxy to be used in the
54
+ * CLIs.
55
+ *
56
+ * You can also configure a custom namespace by setting
57
+ * GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE which will replace the default
58
+ * "GLOBAL_AGENT_" env-var prefix.
59
+ *
60
+ * Make sure to call this function before any other imports.
61
+ *
62
+ * @public
63
+ */
64
+ declare function bootstrapEnvProxyAgents(): void;
65
+
66
+ /**
67
+ * Callback function that can be used to receive stdout or stderr data from a child process.
68
+ *
69
+ * @public
70
+ */
71
+ type RunOnOutput = (data: Buffer) => void;
72
+ /**
73
+ * Options for running a child process with {@link run} or related functions.
74
+ *
75
+ * @public
76
+ */
77
+ type RunOptions = Omit<SpawnOptions, 'env'> & {
78
+ env?: Partial<NodeJS.ProcessEnv>;
79
+ onStdout?: RunOnOutput;
80
+ onStderr?: RunOnOutput;
81
+ stdio?: SpawnOptions['stdio'];
82
+ };
83
+ /**
84
+ * Child process handle returned by {@link run}.
85
+ *
86
+ * @public
87
+ */
88
+ interface RunChildProcess extends ChildProcess {
89
+ /**
90
+ * Waits for the child process to exit.
91
+ *
92
+ * @remarks
93
+ *
94
+ * Resolves when the process exits successfully (exit code 0) or is terminated by a signal.
95
+ * If the process exits with a non-zero exit code, the promise is rejected with an {@link ExitCodeError}.
96
+ *
97
+ * @returns A promise that resolves when the process exits successfully or is terminated by a signal, or rejects on error.
98
+ */
99
+ waitForExit(): Promise<void>;
100
+ }
101
+ /**
102
+ * Runs a command and returns a child process handle.
103
+ *
104
+ * @public
105
+ */
106
+ declare function run(args: string[], options?: RunOptions): RunChildProcess;
107
+ /**
108
+ * Runs a command and returns the stdout.
109
+ *
110
+ * @remarks
111
+ *
112
+ * On error, both stdout and stderr are attached to the error object as properties.
113
+ *
114
+ * @public
115
+ */
116
+ declare function runOutput(args: string[], options?: RunOptions): Promise<string>;
117
+ /**
118
+ * Runs a command and returns true if it exits with code 0, false otherwise.
119
+ *
120
+ * @public
121
+ */
122
+ declare function runCheck(args: string[]): Promise<boolean>;
123
+
124
+ /**
125
+ * Error thrown when a child process exits with a non-zero code.
126
+ * @public
127
+ */
128
+ declare class ExitCodeError extends CustomErrorBase {
129
+ readonly code: number;
130
+ constructor(code: number, command?: string);
131
+ }
132
+
133
+ export { BACKSTAGE_JSON, ExitCodeError, type Paths, type ResolveFunc, type RunChildProcess, type RunOnOutput, type RunOptions, bootstrapEnvProxyAgents, findPaths, isChildPath, run, runCheck, runOutput };
@@ -1 +1 @@
1
- {"version":3,"file":"isChildPath.cjs.js","sources":["../src/isChildPath.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { relative, isAbsolute } from 'path';\n\n/**\n * Checks if path is the same as or a child path of base.\n *\n * @public\n */\nexport function isChildPath(base: string, path: string): boolean {\n const relativePath = relative(base, path);\n if (relativePath === '') {\n // The same directory\n return true;\n }\n\n const outsideBase = relativePath.startsWith('..'); // not outside base\n const differentDrive = isAbsolute(relativePath); // on Windows, this means dir is on a different drive from base.\n\n return !outsideBase && !differentDrive;\n}\n"],"names":["path","relative","isAbsolute"],"mappings":";;;;AAuBgB,SAAA,WAAA,CAAY,MAAcA,MAAuB,EAAA;AAC/D,EAAM,MAAA,YAAA,GAAeC,aAAS,CAAA,IAAA,EAAMD,MAAI,CAAA;AACxC,EAAA,IAAI,iBAAiB,EAAI,EAAA;AAEvB,IAAO,OAAA,IAAA;AAAA;AAGT,EAAM,MAAA,WAAA,GAAc,YAAa,CAAA,UAAA,CAAW,IAAI,CAAA;AAChD,EAAM,MAAA,cAAA,GAAiBE,gBAAW,YAAY,CAAA;AAE9C,EAAO,OAAA,CAAC,eAAe,CAAC,cAAA;AAC1B;;;;"}
1
+ {"version":3,"file":"isChildPath.cjs.js","sources":["../src/isChildPath.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { relative, isAbsolute } from 'path';\n\n/**\n * Checks if path is the same as or a child path of base.\n *\n * @public\n */\nexport function isChildPath(base: string, path: string): boolean {\n const relativePath = relative(base, path);\n if (relativePath === '') {\n // The same directory\n return true;\n }\n\n const outsideBase = relativePath.startsWith('..'); // not outside base\n const differentDrive = isAbsolute(relativePath); // on Windows, this means dir is on a different drive from base.\n\n return !outsideBase && !differentDrive;\n}\n"],"names":["path","relative","isAbsolute"],"mappings":";;;;AAuBO,SAAS,WAAA,CAAY,MAAcA,MAAA,EAAuB;AAC/D,EAAA,MAAM,YAAA,GAAeC,aAAA,CAAS,IAAA,EAAMD,MAAI,CAAA;AACxC,EAAA,IAAI,iBAAiB,EAAA,EAAI;AAEvB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAA,GAAc,YAAA,CAAa,UAAA,CAAW,IAAI,CAAA;AAChD,EAAA,MAAM,cAAA,GAAiBE,gBAAW,YAAY,CAAA;AAE9C,EAAA,OAAO,CAAC,eAAe,CAAC,cAAA;AAC1B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"paths.cjs.js","sources":["../src/paths.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from 'fs';\nimport { dirname, resolve as resolvePath } from 'path';\n\n/**\n * A function that takes a set of path fragments and resolves them into a\n * single complete path, relative to some root.\n *\n * @public\n */\nexport type ResolveFunc = (...paths: string[]) => string;\n\n/**\n * Common paths and resolve functions used by the cli.\n * Currently assumes it is being executed within a monorepo.\n *\n * @public\n */\nexport type Paths = {\n // Root dir of the cli itself, containing package.json\n ownDir: string;\n\n // Monorepo root dir of the cli itself. Only accessible when running inside Backstage repo.\n ownRoot: string;\n\n // The location of the app that the cli is being executed in\n targetDir: string;\n\n // The monorepo root package of the app that the cli is being executed in.\n targetRoot: string;\n\n // Resolve a path relative to own repo\n resolveOwn: ResolveFunc;\n\n // Resolve a path relative to own monorepo root. Only accessible when running inside Backstage repo.\n resolveOwnRoot: ResolveFunc;\n\n // Resolve a path relative to the app\n resolveTarget: ResolveFunc;\n\n // Resolve a path relative to the app repo root\n resolveTargetRoot: ResolveFunc;\n};\n\n// Looks for a package.json with a workspace config to identify the root of the monorepo\nexport function findRootPath(\n searchDir: string,\n filterFunc: (pkgJsonPath: string) => boolean,\n): string | undefined {\n let path = searchDir;\n\n // Some confidence check to avoid infinite loop\n for (let i = 0; i < 1000; i++) {\n const packagePath = resolvePath(path, 'package.json');\n const exists = fs.existsSync(packagePath);\n if (exists && filterFunc(packagePath)) {\n return path;\n }\n\n const newPath = dirname(path);\n if (newPath === path) {\n return undefined;\n }\n path = newPath;\n }\n\n throw new Error(\n `Iteration limit reached when searching for root package.json at ${searchDir}`,\n );\n}\n\n// Finds the root of a given package\nexport function findOwnDir(searchDir: string) {\n const path = findRootPath(searchDir, () => true);\n if (!path) {\n throw new Error(\n `No package.json found while searching for package root of ${searchDir}`,\n );\n }\n return path;\n}\n\n// Finds the root of the monorepo that the package exists in. Only accessible when running inside Backstage repo.\nexport function findOwnRootDir(ownDir: string) {\n const isLocal = fs.existsSync(resolvePath(ownDir, 'src'));\n if (!isLocal) {\n throw new Error(\n 'Tried to access monorepo package root dir outside of Backstage repository',\n );\n }\n\n return resolvePath(ownDir, '../..');\n}\n\n/**\n * Find paths related to a package and its execution context.\n *\n * @public\n * @example\n *\n * const paths = findPaths(__dirname)\n */\nexport function findPaths(searchDir: string): Paths {\n const ownDir = findOwnDir(searchDir);\n // Drive letter can end up being lowercased here on Windows, bring back to uppercase for consistency\n const targetDir = fs\n .realpathSync(process.cwd())\n .replace(/^[a-z]:/, str => str.toLocaleUpperCase('en-US'));\n\n // Lazy load this as it will throw an error if we're not inside the Backstage repo.\n let ownRoot = '';\n const getOwnRoot = () => {\n if (!ownRoot) {\n ownRoot = findOwnRootDir(ownDir);\n }\n return ownRoot;\n };\n\n // We're not always running in a monorepo, so we lazy init this to only crash commands\n // that require a monorepo when we're not in one.\n let targetRoot = '';\n const getTargetRoot = () => {\n if (!targetRoot) {\n targetRoot =\n findRootPath(targetDir, path => {\n try {\n const content = fs.readFileSync(path, 'utf8');\n const data = JSON.parse(content);\n return Boolean(data.workspaces);\n } catch (error) {\n throw new Error(\n `Failed to parse package.json file while searching for root, ${error}`,\n );\n }\n }) ?? targetDir; // We didn't find any root package.json, assume we're not in a monorepo\n }\n return targetRoot;\n };\n\n return {\n ownDir,\n get ownRoot() {\n return getOwnRoot();\n },\n targetDir,\n get targetRoot() {\n return getTargetRoot();\n },\n resolveOwn: (...paths) => resolvePath(ownDir, ...paths),\n resolveOwnRoot: (...paths) => resolvePath(getOwnRoot(), ...paths),\n resolveTarget: (...paths) => resolvePath(targetDir, ...paths),\n resolveTargetRoot: (...paths) => resolvePath(getTargetRoot(), ...paths),\n };\n}\n\n/**\n * The name of the backstage's config file\n *\n * @public\n */\nexport const BACKSTAGE_JSON = 'backstage.json';\n"],"names":["path","resolvePath","fs","dirname"],"mappings":";;;;;;;;;AA4DgB,SAAA,YAAA,CACd,WACA,UACoB,EAAA;AACpB,EAAA,IAAIA,MAAO,GAAA,SAAA;AAGX,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,GAAA,EAAM,CAAK,EAAA,EAAA;AAC7B,IAAM,MAAA,WAAA,GAAcC,YAAY,CAAAD,MAAA,EAAM,cAAc,CAAA;AACpD,IAAM,MAAA,MAAA,GAASE,mBAAG,CAAA,UAAA,CAAW,WAAW,CAAA;AACxC,IAAI,IAAA,MAAA,IAAU,UAAW,CAAA,WAAW,CAAG,EAAA;AACrC,MAAO,OAAAF,MAAA;AAAA;AAGT,IAAM,MAAA,OAAA,GAAUG,aAAQH,MAAI,CAAA;AAC5B,IAAA,IAAI,YAAYA,MAAM,EAAA;AACpB,MAAO,OAAA,KAAA,CAAA;AAAA;AAET,IAAOA,MAAA,GAAA,OAAA;AAAA;AAGT,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,mEAAmE,SAAS,CAAA;AAAA,GAC9E;AACF;AAGO,SAAS,WAAW,SAAmB,EAAA;AAC5C,EAAA,MAAM,IAAO,GAAA,YAAA,CAAa,SAAW,EAAA,MAAM,IAAI,CAAA;AAC/C,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,6DAA6D,SAAS,CAAA;AAAA,KACxE;AAAA;AAEF,EAAO,OAAA,IAAA;AACT;AAGO,SAAS,eAAe,MAAgB,EAAA;AAC7C,EAAA,MAAM,UAAUE,mBAAG,CAAA,UAAA,CAAWD,YAAY,CAAA,MAAA,EAAQ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AA;AACZ,MAAA,OAAO,UAAW,EAAA;AAAA,KACpB;AAAA,IACA,SAAA;AAAA,IACA,IAAI,UAAa,GAAA;AACf,MAAA,OAAO,aAAc,EAAA;AAAA,KACvB;AAAA,IACA,YAAY,CAAI,GAAA,KAAA,KAAUD,YAAY,CAAA,MAAA,EAAQ,GAAG,KAAK,CAAA;AAAA,IACtD,gBAAgB,CAAI,GAAA,KAAA,KAAUA,aAAY,UAAW,EAAA,EAAG,GAAG,KAAK,CAAA;AAAA,IAChE,eAAe,CAAI,GAAA,KAAA,KAAUA,YAAY,CAAA,SAAA,EAAW,GAAG,KAAK,CAAA;AAAA,IAC5D,mBAAmB,CAAI,GAAA,KAAA,KAAUA,aAAY,aAAc,EAAA,EAAG,GAAG,KAAK;AAAA,GACxE;AACF;AAOO,MAAM,cAAiB,GAAA;;;;;;;;"}
1
+ {"version":3,"file":"paths.cjs.js","sources":["../src/paths.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from 'fs';\nimport { dirname, resolve as resolvePath } from 'path';\n\n/**\n * A function that takes a set of path fragments and resolves them into a\n * single complete path, relative to some root.\n *\n * @public\n */\nexport type ResolveFunc = (...paths: string[]) => string;\n\n/**\n * Common paths and resolve functions used by the cli.\n * Currently assumes it is being executed within a monorepo.\n *\n * @public\n */\nexport type Paths = {\n // Root dir of the cli itself, containing package.json\n ownDir: string;\n\n // Monorepo root dir of the cli itself. Only accessible when running inside Backstage repo.\n ownRoot: string;\n\n // The location of the app that the cli is being executed in\n targetDir: string;\n\n // The monorepo root package of the app that the cli is being executed in.\n targetRoot: string;\n\n // Resolve a path relative to own repo\n resolveOwn: ResolveFunc;\n\n // Resolve a path relative to own monorepo root. Only accessible when running inside Backstage repo.\n resolveOwnRoot: ResolveFunc;\n\n // Resolve a path relative to the app\n resolveTarget: ResolveFunc;\n\n // Resolve a path relative to the app repo root\n resolveTargetRoot: ResolveFunc;\n};\n\n// Looks for a package.json with a workspace config to identify the root of the monorepo\nexport function findRootPath(\n searchDir: string,\n filterFunc: (pkgJsonPath: string) => boolean,\n): string | undefined {\n let path = searchDir;\n\n // Some confidence check to avoid infinite loop\n for (let i = 0; i < 1000; i++) {\n const packagePath = resolvePath(path, 'package.json');\n const exists = fs.existsSync(packagePath);\n if (exists && filterFunc(packagePath)) {\n return path;\n }\n\n const newPath = dirname(path);\n if (newPath === path) {\n return undefined;\n }\n path = newPath;\n }\n\n throw new Error(\n `Iteration limit reached when searching for root package.json at ${searchDir}`,\n );\n}\n\n// Finds the root of a given package\nexport function findOwnDir(searchDir: string) {\n const path = findRootPath(searchDir, () => true);\n if (!path) {\n throw new Error(\n `No package.json found while searching for package root of ${searchDir}`,\n );\n }\n return path;\n}\n\n// Finds the root of the monorepo that the package exists in. Only accessible when running inside Backstage repo.\nexport function findOwnRootDir(ownDir: string) {\n const isLocal = fs.existsSync(resolvePath(ownDir, 'src'));\n if (!isLocal) {\n throw new Error(\n 'Tried to access monorepo package root dir outside of Backstage repository',\n );\n }\n\n return resolvePath(ownDir, '../..');\n}\n\n/**\n * Find paths related to a package and its execution context.\n *\n * @public\n * @example\n *\n * const paths = findPaths(__dirname)\n */\nexport function findPaths(searchDir: string): Paths {\n const ownDir = findOwnDir(searchDir);\n // Drive letter can end up being lowercased here on Windows, bring back to uppercase for consistency\n const targetDir = fs\n .realpathSync(process.cwd())\n .replace(/^[a-z]:/, str => str.toLocaleUpperCase('en-US'));\n\n // Lazy load this as it will throw an error if we're not inside the Backstage repo.\n let ownRoot = '';\n const getOwnRoot = () => {\n if (!ownRoot) {\n ownRoot = findOwnRootDir(ownDir);\n }\n return ownRoot;\n };\n\n // We're not always running in a monorepo, so we lazy init this to only crash commands\n // that require a monorepo when we're not in one.\n let targetRoot = '';\n const getTargetRoot = () => {\n if (!targetRoot) {\n targetRoot =\n findRootPath(targetDir, path => {\n try {\n const content = fs.readFileSync(path, 'utf8');\n const data = JSON.parse(content);\n return Boolean(data.workspaces);\n } catch (error) {\n throw new Error(\n `Failed to parse package.json file while searching for root, ${error}`,\n );\n }\n }) ?? targetDir; // We didn't find any root package.json, assume we're not in a monorepo\n }\n return targetRoot;\n };\n\n return {\n ownDir,\n get ownRoot() {\n return getOwnRoot();\n },\n targetDir,\n get targetRoot() {\n return getTargetRoot();\n },\n resolveOwn: (...paths) => resolvePath(ownDir, ...paths),\n resolveOwnRoot: (...paths) => resolvePath(getOwnRoot(), ...paths),\n resolveTarget: (...paths) => resolvePath(targetDir, ...paths),\n resolveTargetRoot: (...paths) => resolvePath(getTargetRoot(), ...paths),\n };\n}\n\n/**\n * The name of the backstage's config file\n *\n * @public\n */\nexport const BACKSTAGE_JSON = 'backstage.json';\n"],"names":["path","resolvePath","fs","dirname"],"mappings":";;;;;;;;;AA4DO,SAAS,YAAA,CACd,WACA,UAAA,EACoB;AACpB,EAAA,IAAIA,MAAA,GAAO,SAAA;AAGX,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,EAAM,CAAA,EAAA,EAAK;AAC7B,IAAA,MAAM,WAAA,GAAcC,YAAA,CAAYD,MAAA,EAAM,cAAc,CAAA;AACpD,IAAA,MAAM,MAAA,GAASE,mBAAA,CAAG,UAAA,CAAW,WAAW,CAAA;AACxC,IAAA,IAAI,MAAA,IAAU,UAAA,CAAW,WAAW,CAAA,EAAG;AACrC,MAAA,OAAOF,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,OAAA,GAAUG,aAAQH,MAAI,CAAA;AAC5B,IAAA,IAAI,YAAYA,MAAA,EAAM;AACpB,MAAA,OAAO,MAA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if (process.env[`${globalAgentNamespace}HTTP_PROXY`] || process.env[`${globalAgentNamespace}HTTPS_PROXY`]) {
6
+ const globalAgent = require("global-agent");
7
+ globalAgent.bootstrap();
8
+ }
9
+ if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
10
+ const { setGlobalDispatcher, EnvHttpProxyAgent } = require("undici");
11
+ setGlobalDispatcher(new EnvHttpProxyAgent());
12
+ }
13
+ }
14
+
15
+ exports.bootstrapEnvProxyAgents = bootstrapEnvProxyAgents;
16
+ //# sourceMappingURL=proxyBootstrap.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxyBootstrap.cjs.js","sources":["../src/proxyBootstrap.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * This function can be called to setup undici and node-fetch Proxy agents.\n *\n * You can set GLOBAL_AGENT_HTTP(S)_PROXY to configure a proxy to be used in the\n * CLIs.\n *\n * You can also configure a custom namespace by setting\n * GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE which will replace the default\n * \"GLOBAL_AGENT_\" env-var prefix.\n *\n * Make sure to call this function before any other imports.\n *\n * @public\n */\nexport function bootstrapEnvProxyAgents() {\n // see https://www.npmjs.com/package/global-agent\n const globalAgentNamespace =\n process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? 'GLOBAL_AGENT_';\n if (\n process.env[`${globalAgentNamespace}HTTP_PROXY`] ||\n process.env[`${globalAgentNamespace}HTTPS_PROXY`]\n ) {\n const globalAgent =\n require('global-agent') as typeof import('global-agent');\n globalAgent.bootstrap();\n }\n\n if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {\n const { setGlobalDispatcher, EnvHttpProxyAgent } =\n require('undici') as typeof import('undici');\n setGlobalDispatcher(new EnvHttpProxyAgent());\n }\n}\n"],"names":[],"mappings":";;AA8BO,SAAS,uBAAA,GAA0B;AAExC,EAAA,MAAM,oBAAA,GACJ,OAAA,CAAQ,GAAA,CAAI,2CAAA,IAA+C,eAAA;AAC7D,EAAA,IACE,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,oBAAoB,CAAA,UAAA,CAAY,CAAA,IAC/C,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,oBAAoB,CAAA,WAAA,CAAa,CAAA,EAChD;AACA,IAAA,MAAM,WAAA,GACJ,QAAQ,cAAc,CAAA;AACxB,IAAA,WAAA,CAAY,SAAA,EAAU;AAAA,EACxB;AAEA,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,UAAA,IAAc,OAAA,CAAQ,IAAI,WAAA,EAAa;AACrD,IAAA,MAAM,EAAE,mBAAA,EAAqB,iBAAA,EAAkB,GAC7C,QAAQ,QAAQ,CAAA;AAClB,IAAA,mBAAA,CAAoB,IAAI,mBAAmB,CAAA;AAAA,EAC7C;AACF;;;;"}
@@ -0,0 +1,125 @@
1
+ 'use strict';
2
+
3
+ var spawn = require('cross-spawn');
4
+ var errors = require('./errors.cjs.js');
5
+ var errors$1 = require('@backstage/errors');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var spawn__default = /*#__PURE__*/_interopDefaultCompat(spawn);
10
+
11
+ function run(args, options = {}) {
12
+ if (args.length === 0) {
13
+ throw new Error("run requires at least one argument");
14
+ }
15
+ const [name, ...cmdArgs] = args;
16
+ const { onStdout, onStderr, stdio: customStdio, ...spawnOptions } = options;
17
+ const env = {
18
+ ...process.env,
19
+ FORCE_COLOR: "true",
20
+ ...options.env ?? {}
21
+ };
22
+ const stdio = customStdio ?? [
23
+ "inherit",
24
+ onStdout ? "pipe" : "inherit",
25
+ onStderr ? "pipe" : "inherit"
26
+ ];
27
+ const child = spawn__default.default(name, cmdArgs, {
28
+ ...spawnOptions,
29
+ stdio,
30
+ env
31
+ });
32
+ if (onStdout && child.stdout) {
33
+ child.stdout.on("data", onStdout);
34
+ }
35
+ if (onStderr && child.stderr) {
36
+ child.stderr.on("data", onStderr);
37
+ }
38
+ const commandName = args.join(" ");
39
+ let waitPromise;
40
+ child.waitForExit = async () => {
41
+ if (waitPromise) {
42
+ return waitPromise;
43
+ }
44
+ waitPromise = new Promise((resolve, reject) => {
45
+ if (typeof child.exitCode === "number") {
46
+ if (child.exitCode) {
47
+ reject(new errors.ExitCodeError(child.exitCode, commandName));
48
+ } else {
49
+ resolve();
50
+ }
51
+ return;
52
+ }
53
+ function onError(error) {
54
+ cleanup();
55
+ reject(error);
56
+ }
57
+ function onExit(code) {
58
+ cleanup();
59
+ if (code) {
60
+ reject(new errors.ExitCodeError(code, commandName));
61
+ } else {
62
+ resolve();
63
+ }
64
+ }
65
+ function onSignal() {
66
+ if (!child.killed && child.exitCode === null) {
67
+ child.kill();
68
+ }
69
+ }
70
+ function cleanup() {
71
+ for (const signal of ["SIGINT", "SIGTERM"]) {
72
+ process.removeListener(signal, onSignal);
73
+ }
74
+ child.removeListener("error", onError);
75
+ child.removeListener("exit", onExit);
76
+ }
77
+ child.once("error", onError);
78
+ child.once("exit", onExit);
79
+ for (const signal of ["SIGINT", "SIGTERM"]) {
80
+ process.addListener(signal, onSignal);
81
+ }
82
+ });
83
+ return waitPromise;
84
+ };
85
+ return child;
86
+ }
87
+ async function runOutput(args, options) {
88
+ const stdoutChunks = [];
89
+ const stderrChunks = [];
90
+ if (args.length === 0) {
91
+ throw new Error("runOutput requires at least one argument");
92
+ }
93
+ try {
94
+ await run(args, {
95
+ ...options,
96
+ onStdout: (data) => {
97
+ stdoutChunks.push(data);
98
+ options?.onStdout?.(data);
99
+ },
100
+ onStderr: (data) => {
101
+ stderrChunks.push(data);
102
+ options?.onStderr?.(data);
103
+ }
104
+ }).waitForExit();
105
+ return Buffer.concat(stdoutChunks).toString().trim();
106
+ } catch (error) {
107
+ errors$1.assertError(error);
108
+ error.stdout = Buffer.concat(stdoutChunks).toString();
109
+ error.stderr = Buffer.concat(stderrChunks).toString();
110
+ throw error;
111
+ }
112
+ }
113
+ async function runCheck(args) {
114
+ try {
115
+ await run(args).waitForExit();
116
+ return true;
117
+ } catch {
118
+ return false;
119
+ }
120
+ }
121
+
122
+ exports.run = run;
123
+ exports.runCheck = runCheck;
124
+ exports.runOutput = runOutput;
125
+ //# sourceMappingURL=run.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.cjs.js","sources":["../src/run.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ChildProcess, SpawnOptions } from 'child_process';\nimport spawn from 'cross-spawn';\nimport { ExitCodeError } from './errors';\nimport { assertError } from '@backstage/errors';\n\n/**\n * Callback function that can be used to receive stdout or stderr data from a child process.\n *\n * @public\n */\nexport type RunOnOutput = (data: Buffer) => void;\n\n/**\n * Options for running a child process with {@link run} or related functions.\n *\n * @public\n */\nexport type RunOptions = Omit<SpawnOptions, 'env'> & {\n env?: Partial<NodeJS.ProcessEnv>;\n onStdout?: RunOnOutput;\n onStderr?: RunOnOutput;\n stdio?: SpawnOptions['stdio'];\n};\n\n/**\n * Child process handle returned by {@link run}.\n *\n * @public\n */\nexport interface RunChildProcess extends ChildProcess {\n /**\n * Waits for the child process to exit.\n *\n * @remarks\n *\n * Resolves when the process exits successfully (exit code 0) or is terminated by a signal.\n * If the process exits with a non-zero exit code, the promise is rejected with an {@link ExitCodeError}.\n *\n * @returns A promise that resolves when the process exits successfully or is terminated by a signal, or rejects on error.\n */\n waitForExit(): Promise<void>;\n}\n\n/**\n * Runs a command and returns a child process handle.\n *\n * @public\n */\nexport function run(args: string[], options: RunOptions = {}): RunChildProcess {\n if (args.length === 0) {\n throw new Error('run requires at least one argument');\n }\n\n const [name, ...cmdArgs] = args;\n\n const { onStdout, onStderr, stdio: customStdio, ...spawnOptions } = options;\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n FORCE_COLOR: 'true',\n ...(options.env ?? {}),\n };\n\n const stdio =\n customStdio ??\n ([\n 'inherit',\n onStdout ? 'pipe' : 'inherit',\n onStderr ? 'pipe' : 'inherit',\n ] as ('inherit' | 'pipe')[]);\n\n const child = spawn(name, cmdArgs, {\n ...spawnOptions,\n stdio,\n env,\n }) as RunChildProcess;\n\n if (onStdout && child.stdout) {\n child.stdout.on('data', onStdout);\n }\n if (onStderr && child.stderr) {\n child.stderr.on('data', onStderr);\n }\n\n const commandName = args.join(' ');\n\n let waitPromise: Promise<void> | undefined;\n\n child.waitForExit = async (): Promise<void> => {\n if (waitPromise) {\n return waitPromise;\n }\n\n waitPromise = new Promise<void>((resolve, reject) => {\n if (typeof child.exitCode === 'number') {\n if (child.exitCode) {\n reject(new ExitCodeError(child.exitCode, commandName));\n } else {\n resolve();\n }\n return;\n }\n\n function onError(error: Error) {\n cleanup();\n reject(error);\n }\n\n function onExit(code: number | null) {\n cleanup();\n if (code) {\n reject(new ExitCodeError(code, commandName));\n } else {\n resolve();\n }\n }\n\n function onSignal() {\n if (!child.killed && child.exitCode === null) {\n child.kill();\n }\n }\n\n function cleanup() {\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.removeListener(signal, onSignal);\n }\n child.removeListener('error', onError);\n child.removeListener('exit', onExit);\n }\n\n child.once('error', onError);\n child.once('exit', onExit);\n\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.addListener(signal, onSignal);\n }\n });\n\n return waitPromise;\n };\n\n return child;\n}\n\n/**\n * Runs a command and returns the stdout.\n *\n * @remarks\n *\n * On error, both stdout and stderr are attached to the error object as properties.\n *\n * @public\n */\nexport async function runOutput(\n args: string[],\n options?: RunOptions,\n): Promise<string> {\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n\n if (args.length === 0) {\n throw new Error('runOutput requires at least one argument');\n }\n\n try {\n await run(args, {\n ...options,\n onStdout: data => {\n stdoutChunks.push(data);\n options?.onStdout?.(data);\n },\n onStderr: data => {\n stderrChunks.push(data);\n options?.onStderr?.(data);\n },\n }).waitForExit();\n\n return Buffer.concat(stdoutChunks).toString().trim();\n } catch (error) {\n assertError(error);\n\n (error as Error & { stdout?: string }).stdout =\n Buffer.concat(stdoutChunks).toString();\n (error as Error & { stderr?: string }).stderr =\n Buffer.concat(stderrChunks).toString();\n\n throw error;\n }\n}\n\n/**\n * Runs a command and returns true if it exits with code 0, false otherwise.\n *\n * @public\n */\nexport async function runCheck(args: string[]): Promise<boolean> {\n try {\n await run(args).waitForExit();\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["spawn","ExitCodeError","assertError"],"mappings":";;;;;;;;;;AAgEO,SAAS,GAAA,CAAI,IAAA,EAAgB,OAAA,GAAsB,EAAC,EAAoB;AAC7E,EAAA,IAAI,IAAA,CAAK,WAAW,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,MAAM,oCAAoC,CAAA;AAAA,EACtD;AAEA,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,OAAO,CAAA,GAAI,IAAA;AAE3B,EAAA,MAAM,EAAE,QAAA,EAAU,QAAA,EAAU,OAAO,WAAA,EAAa,GAAG,cAAa,GAAI,OAAA;AACpE,EAAA,MAAM,GAAA,GAAyB;AAAA,IAC7B,GAAG,OAAA,CAAQ,GAAA;AAAA,IACX,WAAA,EAAa,MAA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0C,CAAA;AAAA,EAC5D;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,IAAI,IAAA,EAAM;AAAA,MACd,GAAG,OAAA;AAAA,MACH,UAAU,CAAA,IAAA,KAAQ;AAChB,QAAA,YAAA,CAAa,KAAK,IAAI,CAAA;AACtB,QAAA,OAAA,EAAS,WAAW,IAAI,CAAA;AAAA,MAC1B,CAAA;AAAA,MACA,UAAU,CAAA,IAAA,KAAQ;AAChB,QAAA,YAAA,CAAa,KAAK,IAAI,CAAA;AACtB,QAAA,OAAA,EAAS,WAAW,IAAI,CAAA;AAAA,MAC1B;AAAA,KACD,EAAE,WAAA,EAAY;AAEf,IAAA,OAAO,OAAO,MAAA,CAAO,YAAY,CAAA,CAAE,QAAA,GAAW,IAAA,EAAK;AAAA,EACrD,SAAS,KAAA,EAAO;AACd,IAAAC,oBAAA,CAAY,KAAK,CAAA;AAEjB,IAAC,MAAsC,MAAA,GACrC,MAAA,CAAO,MAAA,CAAO,YAAY,EAAE,QAAA,EAAS;AACvC,IAAC,MAAsC,MAAA,GACrC,MAAA,CAAO,MAAA,CAAO,YAAY,EAAE,QAAA,EAAS;AAEvC,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAOA,eAAsB,SAAS,IAAA,EAAkC;AAC/D,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,CAAI,IAAI,CAAA,CAAE,WAAA,EAAY;AAC5B,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/cli-common",
3
- "version": "0.1.15",
3
+ "version": "0.1.16-next.1",
4
4
  "description": "Common functionality used by cli, backend, and create-app",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -34,14 +34,21 @@
34
34
  "start": "backstage-cli package start",
35
35
  "test": "backstage-cli package test"
36
36
  },
37
+ "dependencies": {
38
+ "@backstage/errors": "1.2.7",
39
+ "cross-spawn": "^7.0.3",
40
+ "global-agent": "^3.0.0",
41
+ "undici": "^7.2.3"
42
+ },
37
43
  "devDependencies": {
38
- "@backstage/cli": "^0.29.0",
44
+ "@backstage/cli": "0.34.6-next.1",
45
+ "@types/cross-spawn": "^6.0.2",
39
46
  "@types/node": "^20.16.0"
40
47
  },
41
48
  "typesVersions": {
42
49
  "*": {
43
- "index": [
44
- "dist/index.d.ts"
50
+ "package.json": [
51
+ "package.json"
45
52
  ]
46
53
  }
47
54
  }