techdocs-cli: unified dev and production build through config detection
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -31,11 +31,7 @@ compile_and_build_cli() {
|
||||
|
||||
build_and_embed_app() {
|
||||
echo "🚚 Embedding app..."
|
||||
if [ "$TECHDOCS_CLI_DEV_MODE" = "true" ] ; then
|
||||
yarn workspace techdocs-cli-embedded-app build:dev > /dev/null
|
||||
else
|
||||
yarn workspace techdocs-cli-embedded-app build > /dev/null
|
||||
fi
|
||||
yarn workspace techdocs-cli-embedded-app build > /dev/null
|
||||
cp -r "$TECHDOCS_CLI_EMBEDDED_APP_DIR"/dist "$TECHDOCS_CLI_DIR"/dist/techdocs-preview-bundle > /dev/null
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,18 @@ export default class HTTPServer {
|
||||
response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
||||
|
||||
request.url = forwardPath;
|
||||
return proxy.web(request, response);
|
||||
proxy.web(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
return serveHandler(request, response, {
|
||||
// This endpoint is used by the frontend to detect where the backend is running.
|
||||
if (request.url === '/.detect') {
|
||||
response.setHeader('Content-Type', 'text/plain');
|
||||
response.end('techdocs-cli-server');
|
||||
return;
|
||||
}
|
||||
|
||||
serveHandler(request, response, {
|
||||
public: this.backstageBundleDir,
|
||||
trailingSlash: true,
|
||||
rewrites: [{ source: '**', destination: 'index.html' }],
|
||||
|
||||
Reference in New Issue
Block a user