Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions unified-doc/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# --zlan-branch=BRANCH Branch for netfoundry/zlan (default: main)
# --platform-branch=BRANCH Branch for netfoundry/platform-doc (default: main)
# --data-connector-branch=BRANCH Branch for netfoundry/nf-data-connector (default: main)
# --customer-connect-branch=BRANCH Branch for netfoundry/customer-connect-docs (default: main)
# --clean Wipe _remotes and .docusaurus cache before building
# --lint-only Run lint checks only; skip build
# --qualifier=VALUE Append VALUE to output dir (e.g. --qualifier=-preview -> build-preview)
Expand All @@ -31,10 +32,12 @@
# BB_REPO_TOKEN_ONPREM Bitbucket token for k8s-on-prem-installations (falls back to SSH)
# BB_REPO_TOKEN_PLATFORM_DOC Bitbucket token for platform-doc (falls back to SSH)
# BB_REPO_TOKEN_DATA_CONNECTOR Bitbucket token for nf-data-connector (falls back to SSH)
# BB_REPO_TOKEN_CUSTOMER_CONNECT Bitbucket token for customer-connect-docs (falls back to SSH)
# BB_USERNAME Bitbucket username (default: x-token-auth)
# DOCUSAURUS_BUILD_MASK Hex bitmask: 0x1=openziti 0x2=frontdoor 0x4=selfhosted
# 0x8=zrok 0x10=zlan 0x20=platform
# 0x40=data-connector 0xFF=all (default: 0xFF)
# 0x40=data-connector 0x80=llm-gateway 0x100=mcp-gateway
# 0x200=customer-connect 0x3FF=all (default: 0x3FF)
# DOCUSAURUS_PUBLISH_ENV Set to 'prod' to use production Algolia index
# NO_MINIFY Set to any value to pass --no-minify to Docusaurus
# IS_VERCEL Set to 'true' on Vercel preview deployments
Expand Down Expand Up @@ -62,6 +65,7 @@ BRANCH_SELFHOSTED="main"
BRANCH_ZLAN="main"
BRANCH_PLATFORM="main"
BRANCH_DATA_CONNECTOR="main"
BRANCH_CUSTOMER_CONNECT="add-docs"

usage() {
sed -n '/^# USAGE/,/^# =====/{ /^# =====/d; s/^# \{0,1\}//; p }' "$0"
Expand All @@ -76,13 +80,15 @@ while [[ $# -gt 0 ]]; do
--zlan-branch=*) BRANCH_ZLAN="${1#*=}"; shift ;;
--platform-branch=*) BRANCH_PLATFORM="${1#*=}"; shift ;;
--data-connector-branch=*) BRANCH_DATA_CONNECTOR="${1#*=}"; shift ;;
--customer-connect-branch=*) BRANCH_CUSTOMER_CONNECT="${1#*=}"; shift ;;
--ziti-doc-branch) BRANCH_ZITI_DOC="${2:?--ziti-doc-branch requires a value}"; shift 2 ;;
--zrok-branch) BRANCH_ZROK="${2:?--zrok-branch requires a value}"; shift 2 ;;
--frontdoor-branch) BRANCH_FRONTDOOR="${2:?--frontdoor-branch requires a value}"; shift 2 ;;
--selfhosted-branch) BRANCH_SELFHOSTED="${2:?--selfhosted-branch requires a value}"; shift 2 ;;
--zlan-branch) BRANCH_ZLAN="${2:?--zlan-branch requires a value}"; shift 2 ;;
--platform-branch) BRANCH_PLATFORM="${2:?--platform-branch requires a value}"; shift 2 ;;
--data-connector-branch) BRANCH_DATA_CONNECTOR="${2:?--data-connector-branch requires a value}"; shift 2 ;;
--customer-connect-branch) BRANCH_CUSTOMER_CONNECT="${2:?--customer-connect-branch requires a value}"; shift 2 ;;
--clean) CLEAN=1; shift ;;
--lint-only) LINT_ONLY=1; shift ;;
-h|--help) usage; exit 0 ;;
Expand All @@ -109,6 +115,7 @@ echo " BRANCH_SELFHOSTED='$BRANCH_SELFHOSTED'"
echo " BRANCH_ZLAN='$BRANCH_ZLAN'"
echo " BRANCH_PLATFORM='$BRANCH_PLATFORM'"
echo " BRANCH_DATA_CONNECTOR='$BRANCH_DATA_CONNECTOR'"
echo " BRANCH_CUSTOMER_CONNECT='$BRANCH_CUSTOMER_CONNECT'"
echo " CLEAN=$CLEAN"
echo " IS_VERCEL='${IS_VERCEL:-}'"
echo " node: $(node --version 2>/dev/null || echo 'not found')"
Expand Down Expand Up @@ -186,6 +193,16 @@ clone_or_update() {
echo "🔑 Using SSH for nf-data-connector" >&2
fi
;;
*customer-connect-docs*)
if [ -n "${BB_REPO_TOKEN_CUSTOMER_CONNECT:-}" ]; then
local bb_user="${BB_USERNAME:-x-token-auth}"
url="https://${bb_user}:${BB_REPO_TOKEN_CUSTOMER_CONNECT}@bitbucket.org/netfoundry/customer-connect-docs.git"
echo "🔑 Using BB_REPO_TOKEN_CUSTOMER_CONNECT token" >&2
else
url="git@bitbucket.org:netfoundry/customer-connect-docs.git"
echo "🔑 Using SSH for customer-connect-docs" >&2
fi
;;
esac

if [ -d "$target/.git" ]; then
Expand Down Expand Up @@ -263,6 +280,7 @@ lint_docs() {
"${script_dir}/_remotes/openziti/docusaurus/docs"
"${script_dir}/_remotes/platform/docusaurus/docs"
"${script_dir}/_remotes/data-connector/docusaurus/docs"
"${script_dir}/_remotes/customer-connect/docusaurus/docs"
)

# 2. VERIFY FOLDERS
Expand Down Expand Up @@ -393,7 +411,8 @@ clone_or_update "https://github.com/openziti/ziti-doc.git"
clone_or_update "https://github.com/netfoundry/zlan.git" zlan "$BRANCH_ZLAN"
clone_or_update "https://github.com/openziti/zrok.git" zrok "$BRANCH_ZROK"
clone_or_update "https://bitbucket.org/netfoundry/platform-doc.git" platform "$BRANCH_PLATFORM"
clone_or_update "https://bitbucket.org/netfoundry/nf-data-connector.git" data-connector "$BRANCH_DATA_CONNECTOR"
clone_or_update "https://bitbucket.org/netfoundry/nf-data-connector.git" data-connector "$BRANCH_DATA_CONNECTOR"
clone_or_update "https://bitbucket.org/netfoundry/customer-connect-docs.git" customer-connect "$BRANCH_CUSTOMER_CONNECT"

echo "Cleaning stale build artifacts from remotes..."
find "$script_dir/_remotes" -type d \( -path "*/docusaurus/build" -o -path "*/docusaurus/.docusaurus" -o -path "*/website/build" -o -path "*/website/.docusaurus" \) -exec rm -rf {} + 2>/dev/null || true
Expand Down
25 changes: 22 additions & 3 deletions unified-doc/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {onpremRedirects} from "./_remotes/selfhosted/docusaurus/docusaurus-plugi
import {platformDocsPluginConfig} from "./_remotes/platform/docusaurus/docusaurus-plugin-platform-docs.ts";
import {openzitiDocsPluginConfig, openzitiRedirects} from "./_remotes/openziti/docusaurus/docusaurus-plugin-openziti-docs.ts";
import {dataconnectorDocsPluginConfig} from "./_remotes/data-connector/docusaurus/docusaurus-plugin-dataconnector-docs.ts";
import {customerConnectDocsPluginConfig} from "./_remotes/customer-connect/docusaurus/docusaurus-plugin-customer-connect-docs.ts";

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
const frontdoor = `./_remotes/frontdoor`;
Expand All @@ -35,6 +36,7 @@ const zrokRoot = `./_remotes/zrok/website`;
const zlan = `./_remotes/zlan`;
const platform = `./_remotes/platform`;
const dataConnector = `./_remotes/data-connector`;
const customerConnect = `./_remotes/customer-connect`;
const llmGateway = `./docs/llm-gateway`;
const mcpGateway = `./docs/mcp-gateway`;

Expand All @@ -48,7 +50,7 @@ function routeBase(name: string) {
return isVercel ? `docs/${name}` : name;
}

const buildMask = parseInt(process.env.DOCUSAURUS_BUILD_MASK ?? "0x1FF", 16);
const buildMask = parseInt(process.env.DOCUSAURUS_BUILD_MASK ?? "0x3FF", 16);

const BUILD_FLAGS = {
NONE: 0x0,
Expand All @@ -59,8 +61,9 @@ const BUILD_FLAGS = {
ZLAN: 0x10,
PLATFORM: 0x20,
DATA_CONNECTOR: 0x40,
LLM_GATEWAY: 0x80,
MCP_GATEWAY: 0x100,
LLM_GATEWAY: 0x80,
MCP_GATEWAY: 0x100,
CUSTOMER_CONNECT: 0x200,
};

function build(flag: number) {
Expand Down Expand Up @@ -121,6 +124,7 @@ const REMARK_MAPPINGS = [
{ from: '@dataconnectordocs', to: `${docsBase}dataconnector`},
{ from: '@llmgatewaydocs', to: `${docsBase}llm-gateway`},
{ from: '@mcpgatewaydocs', to: `${docsBase}mcp-gateway`},
{ from: '@customerconnectdocs', to: `${docsBase}customer-connect`},
{ from: '@static', to: docsBase},
{ from: '/openziti', to: `${docsBase}${routeBase('openziti')}` },
{ from: '/frontdoor', to: `${docsBase}${routeBase('frontdoor')}` },
Expand Down Expand Up @@ -295,6 +299,7 @@ const config: Config = {
'_remotes/openziti/docusaurus/static/',
'_remotes/zlan/docusaurus/static/',
'_remotes/platform/docusaurus/static/',
'_remotes/customer-connect/docusaurus/static/',
`${zrokRoot}/static/`,
`${zrokRoot}/docs/images`
],
Expand Down Expand Up @@ -353,6 +358,7 @@ const config: Config = {
'@staticdir': path.resolve(__dirname, `docusaurus/static`),
'@platform': path.resolve(__dirname, `${platform}/docusaurus`),
'@dataconnector': path.resolve(__dirname, `${dataConnector}/docusaurus`),
'@customerconnectdocs': path.resolve(__dirname, `${customerConnect}/docusaurus`),
},
},
module: {
Expand All @@ -376,6 +382,7 @@ const config: Config = {
build(BUILD_FLAGS.ZROK) && ['@docusaurus/plugin-content-pages',{id: `zrok-pages`, path: `${zrokRoot}/src/pages`, routeBasePath: `/${routeBase('zrok')}`}],
build(BUILD_FLAGS.PLATFORM) && ['@docusaurus/plugin-content-pages',{id: `platform-pages`, path: `${platform}/docusaurus/src/pages`, routeBasePath: `/${routeBase('platform')}`}],
build(BUILD_FLAGS.DATA_CONNECTOR) && ['@docusaurus/plugin-content-pages',{id: `dataconnector-pages`, path: `${dataConnector}/docusaurus/src/pages`, routeBasePath: `/${routeBase('dataconnector')}`}],
build(BUILD_FLAGS.CUSTOMER_CONNECT) && ['@docusaurus/plugin-content-pages',{id: `customer-connect-pages`, path: `${customerConnect}/docusaurus/src/pages`, routeBasePath: `/${routeBase('customer-connect')}`}],
build(BUILD_FLAGS.ZROK) && extendDocsPlugins(zrokDocsPluginConfig(zrokRoot, REMARK_MAPPINGS, routeBase('zrok'))),
build(BUILD_FLAGS.SELFHOSTED) && [
'@docusaurus/plugin-content-docs',
Expand Down Expand Up @@ -441,6 +448,11 @@ const config: Config = {
routeBase('dataconnector'),
),
),
build(BUILD_FLAGS.CUSTOMER_CONNECT) && customerConnectDocsPluginConfig(
`${customerConnect}/docusaurus`,
REMARK_MAPPINGS,
routeBase('customer-connect'),
),
build(BUILD_FLAGS.LLM_GATEWAY) && [
'@docusaurus/plugin-content-docs',
{
Expand Down Expand Up @@ -501,6 +513,13 @@ const config: Config = {
showNavLink: false,
configuration: {url: `${docsBase}console-api-spec.yaml`, hideClientButton: true, hideTestRequestButton: true, searchHotKey: 'i'},
} as ScalarOptions],
build(BUILD_FLAGS.CUSTOMER_CONNECT) && ['@scalar/docusaurus', {
id: 'customer-connect-api',
label: 'API reference',
route: `/${routeBase('customer-connect')}/api-guides/openapi-reference`,
showNavLink: false,
configuration: {url: `${docsBase}customer-connect-api-spec.yaml`, hideClientButton: true, hideTestRequestButton: true, searchHotKey: 'i'},
} as ScalarOptions],
build(BUILD_FLAGS.FRONTDOOR) && ['@scalar/docusaurus', {
id: 'frontdoor-api',
label: 'API reference',
Expand Down
Loading