fix(techdocs-cli): config file for development build

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2021-11-11 19:09:30 +01:00
parent 7a3c2f9301
commit 0456b73da8
6 changed files with 18 additions and 7 deletions
+2 -1
View File
@@ -30,7 +30,8 @@
"lerna": "lerna",
"storybook": "yarn workspace storybook start",
"build-storybook": "yarn workspace storybook build-storybook",
"techdocs-cli:dev": "TECHDOCS_CLI_DEV_MODE=true packages/techdocs-cli/bin/techdocs-cli",
"techdocs-cli": "yarn workspace @techdocs/cli build && packages/techdocs-cli/bin/techdocs-cli",
"techdocs-cli:dev": "yarn workspace @techdocs/cli build:dev && TECHDOCS_CLI_DEV_MODE=true packages/techdocs-cli/bin/techdocs-cli",
"prepare": "husky install",
"lock:check": "yarn-lock-check"
},
@@ -1,7 +1,12 @@
# NOTE: This file is used for testing techdocs-cli locally
app:
title: Techdocs Preview App
baseUrl: http://localhost:3000
backend:
baseUrl: http://localhost:7000
techdocs:
builder: 'external'
requestUrl: http://localhost:7000/api
@@ -40,6 +40,7 @@
"scripts": {
"start": "backstage-cli app:serve --config ./app-config.yaml --config ./app-config.dev.yaml",
"build": "backstage-cli app:build --config ./app-config.yaml",
"build:dev": "backstage-cli app:build --config ./app-config.dev.yaml",
"clean": "backstage-cli clean",
"test": "backstage-cli test",
"lint": "backstage-cli lint",
+1
View File
@@ -22,6 +22,7 @@
"scripts": {
"start": "nodemon --",
"build": "./scripts/build.sh",
"build:dev": "TECHDOCS_CLI_DEV_MODE=true yarn build",
"clean": "backstage-cli clean",
"lint": "backstage-cli lint",
"test": "backstage-cli test --testPathIgnorePatterns src/e2e.test.ts",
+5 -1
View File
@@ -27,7 +27,11 @@ TECHDOCS_PREVIEW_DEST=dist/techdocs-preview-bundle
# Build the embedded-techdocs-app
pushd $EMBEDDED_TECHDOCS_APP_PATH >/dev/null
yarn build
if [[ $TECHDOCS_CLI_DEV_MODE == "true" ]]; then
yarn build:dev
else
yarn build
fi
popd >/dev/null
cp -r $TECHDOCS_PREVIEW_SOURCE $TECHDOCS_PREVIEW_DEST
@@ -98,9 +98,10 @@ export default async function serve(cmd: Command) {
'techdocs-preview-bundle',
);
const port = isDevMode ? backstageBackendPort : backstagePort;
const httpServer = new HTTPServer(
techdocsPreviewBundlePath,
isDevMode ? backstageBackendPort : backstagePort,
port,
cmd.mkdocsPort,
cmd.verbose,
);
@@ -114,11 +115,9 @@ export default async function serve(cmd: Command) {
})
.then(() => {
// The last three things default/component/local/ don't matter. They can be anything.
openBrowser(
`http://localhost:${backstagePort}/docs/default/component/local/`,
);
openBrowser(`http://localhost:${port}/docs/default/component/local/`);
logger.info(
`Serving docs in Backstage at http://localhost:${backstagePort}/docs/default/component/local/\nOpening browser.`,
`Serving docs in Backstage at http://localhost:${port}/docs/default/component/local/\nOpening browser.`,
);
});