Add cli option --preview-app-bundle-path
Signed-off-by: Morgan Bentell <mbentell@spotify.com>
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
## build app
|
||||
cd ~/kod/backstage-frontend/packages/techdocs-cli-embedded-app-4-spotify/
|
||||
yarn build
|
||||
|
||||
## run cli
|
||||
REPO_ROOT=~/kod/backstage
|
||||
|
||||
cd $REPO_ROOT/packages/techdocs-cli/src/
|
||||
rm -rf dist
|
||||
cp -r ~/kod/backstage-frontend/packages/techdocs-cli-embedded-app-4-spotify/dist .
|
||||
|
||||
cd $REPO_ROOT
|
||||
yarn workspace @techdocs/cli build
|
||||
cd ~/kod/docs/
|
||||
~/kod/backstage/packages/techdocs-cli/bin/techdocs-cli serve --preview-app-bundle-path ~/kod/backstage/packages/techdocs-cli/src/dist
|
||||
@@ -251,6 +251,10 @@ export function registerCommands(program: Command) {
|
||||
)
|
||||
.option('--mkdocs-port <PORT>', 'Port for MkDocs server to use', '8000')
|
||||
.option('-v --verbose', 'Enable verbose output.', false)
|
||||
.option(
|
||||
'--preview-app-bundle-path <PATH>',
|
||||
'Preview documentation using another web app',
|
||||
)
|
||||
.action(lazy(() => import('./serve/serve').then(m => m.default)));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,9 +42,15 @@ function findPreviewBundlePath(): string {
|
||||
}
|
||||
}
|
||||
|
||||
function getPreviewAppPath(opts: OptionValues): string {
|
||||
return opts.previewAppBundlePath ?? findPreviewBundlePath();
|
||||
}
|
||||
|
||||
export default async function serve(opts: OptionValues) {
|
||||
const logger = createLogger({ verbose: opts.verbose });
|
||||
|
||||
console.log(opts.previewAppBundlePath);
|
||||
|
||||
// Determine if we want to run in local dev mode or not
|
||||
// This will run the backstage http server on a different port and only used
|
||||
// for proxying mkdocs to the backstage app running locally (e.g. with webpack-dev-server)
|
||||
@@ -117,7 +123,7 @@ export default async function serve(opts: OptionValues) {
|
||||
|
||||
const port = isDevMode ? backstageBackendPort : backstagePort;
|
||||
const httpServer = new HTTPServer(
|
||||
findPreviewBundlePath(),
|
||||
getPreviewAppPath(opts),
|
||||
port,
|
||||
opts.mkdocsPort,
|
||||
opts.verbose,
|
||||
|
||||
Reference in New Issue
Block a user