Merge pull request #29320 from backstage/cli-allow-multiple-require
CLI: start command allow multiple require options
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Resolved a problem where the `start` command did not correctly handle multiple `--require` flags, ensuring all specified modules are now properly loaded.
|
||||
@@ -272,7 +272,7 @@ Options:
|
||||
--check
|
||||
--inspect [host]
|
||||
--inspect-brk [host]
|
||||
--require <path>
|
||||
--require <path...>
|
||||
--link <path>
|
||||
-h, --help
|
||||
```
|
||||
|
||||
@@ -86,7 +86,10 @@ export function registerScriptCommand(program: Command) {
|
||||
'--inspect-brk [host]',
|
||||
'Enable debugger in Node.js environments, breaking before code starts',
|
||||
)
|
||||
.option('--require <path>', 'Add a --require argument to the node process')
|
||||
.option(
|
||||
'--require <path...>',
|
||||
'Add a --require argument to the node process',
|
||||
)
|
||||
.option('--link <path>', 'Link an external workspace for module resolution')
|
||||
.action(lazy(() => import('./start'), 'command'));
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export type RunBackendOptions = {
|
||||
/** Whether to forward the --inspect-brk flag to the node process */
|
||||
inspectBrkEnabled: boolean;
|
||||
/** Additional module to require via the --require flag to the node process */
|
||||
require?: string;
|
||||
require?: string | string[];
|
||||
/** An external linked workspace to override module resolution towards */
|
||||
linkedWorkspace?: string;
|
||||
};
|
||||
@@ -107,7 +107,10 @@ export async function runBackend(options: RunBackendOptions) {
|
||||
optionArgs.push(inspect);
|
||||
}
|
||||
if (options.require) {
|
||||
optionArgs.push(`--require=${options.require}`);
|
||||
const requires = [options.require].flat();
|
||||
for (const r of requires) {
|
||||
optionArgs.push(`--require=${r}`);
|
||||
}
|
||||
}
|
||||
|
||||
const userArgs = process.argv
|
||||
|
||||
Reference in New Issue
Block a user