diff --git a/README.md b/README.md index 332dfea64..7997c2e65 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ AppKit's power comes from its plugin system. Each plugin adds a focused capabili ## Getting started -Follow the [Getting Started](https://databricks.github.io/appkit/docs/) guide to get started with AppKit. +Follow the [Getting Started](https://www.databricks.com/devhub/docs/appkit/v0/) guide to get started with AppKit. -🤖 For AI/code assistants, see the [AI-assisted development](https://databricks.github.io/appkit/docs/development/ai-assisted-development) guide. +🤖 For AI/code assistants, see the [AI-assisted development](https://www.databricks.com/devhub/docs/appkit/v0/development/ai-assisted-development) guide. ## Documentation -📖 For full AppKit documentation, visit the [AppKit Documentation](https://databricks.github.io/appkit/) website. +📖 For full AppKit documentation, visit the [AppKit Documentation](https://www.databricks.com/devhub/docs/appkit/v0/) website. ## Contributing diff --git a/docs/README.md b/docs/README.md index 848fa7cfa..9a11fe527 100644 --- a/docs/README.md +++ b/docs/README.md @@ -30,16 +30,10 @@ This command generates static content into the `build` directory and can be serv ## Deployment -Using SSH: +Documentation is published on [DevHub](https://www.databricks.com/devhub/docs/appkit/v0/). GitHub Pages (`databricks.github.io/appkit/`) automatically redirects all existing URLs to DevHub via `.github/workflows/docs-deploy.yml`. -```bash -USE_SSH=true pnpm deploy -``` - -Not using SSH: - -```bash -GIT_USER= pnpm deploy -``` +The `pnpm build` command: +1. Runs `docusaurus build` — generates HTML, `llms.txt`, and `.md` files +2. Runs `apply-redirects` — replaces HTML pages with redirect pages pointing to DevHub -If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. +Static files remain served from GitHub Pages: JSON schemas (`/schemas/`), `llms.txt`, and `.md` files (used by `npx @databricks/appkit docs` for npm-bundled documentation). diff --git a/docs/package.json b/docs/package.json index dfc52a896..4489849d4 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,7 +5,8 @@ "scripts": { "docusaurus": "docusaurus", "dev": "pnpm run gen && docusaurus start --no-open", - "build": "pnpm run gen && docusaurus build", + "build": "pnpm run gen && docusaurus build && pnpm run apply-redirects", + "apply-redirects": "tsx scripts/apply-redirects.ts", "gen": "pnpm run build-appkit-ui-styles && pnpm run generate-component-docs && pnpm run copy-schemas", "build-appkit-ui-styles": "tsx scripts/build-appkit-ui-styles.ts", "copy-schemas": "tsx scripts/copy-schemas.ts", diff --git a/docs/scripts/apply-redirects.ts b/docs/scripts/apply-redirects.ts new file mode 100644 index 000000000..4bf09cc3a --- /dev/null +++ b/docs/scripts/apply-redirects.ts @@ -0,0 +1,91 @@ +/** + * Replaces all generated HTML pages with redirect pages pointing to DevHub. + * Run AFTER `docusaurus build` so that llms.txt and .md files are generated + * from the original HTML content first. + * + * Static files (schemas, llms.txt, .md) are left untouched. + */ + +import { existsSync, readdirSync, statSync, writeFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const BUILD_DIR = join(__dirname, "../build"); +const DEVHUB_BASE = "https://www.databricks.com/devhub/docs/appkit/v0"; + +function generateRedirectHtml(targetUrl: string): string { + return ` + + + + Redirecting… + + + + +

This page has moved. Redirecting to ${targetUrl}

+ +`; +} + +function findHtmlFiles(dir: string): string[] { + const results: string[] = []; + for (const entry of readdirSync(dir)) { + const fullPath = join(dir, entry); + if (statSync(fullPath).isDirectory()) { + results.push(...findHtmlFiles(fullPath)); + } else if (entry === "index.html") { + results.push(fullPath); + } + } + return results; +} + +if (!existsSync(BUILD_DIR)) { + console.error(`Build directory not found: ${BUILD_DIR}`); + console.error("Run 'docusaurus build' first."); + process.exit(1); +} + +console.log("Applying DevHub redirects to HTML pages..."); + +const htmlFiles = findHtmlFiles(BUILD_DIR); +let count = 0; + +for (const htmlPath of htmlFiles) { + // Get path relative to build dir, e.g. "/docs/plugins/lakebase" + const relativePath = htmlPath + .slice(BUILD_DIR.length) + .replace(/\/index\.html$/, ""); + + // Map /docs/{path} → devhub /{path} (devhub flattens the /docs/ prefix) + const pathWithoutDocs = relativePath.replace(/^\/docs\/?/, "/"); + const devhubUrl = `${DEVHUB_BASE}${pathWithoutDocs || "/"}`; + + writeFileSync(htmlPath, generateRedirectHtml(devhubUrl)); + count++; +} + +// Catch-all 404.html for paths not matching a generated route +const notFoundHtml = ` + + + + Redirecting… + + + +

Redirecting to AppKit Documentation

+ +`; +writeFileSync(join(BUILD_DIR, "404.html"), notFoundHtml); + +console.log(`Done! Replaced ${count} HTML page(s) with redirects.`); diff --git a/packages/appkit/src/registry/index.ts b/packages/appkit/src/registry/index.ts index 1944d609e..10c7b246e 100644 --- a/packages/appkit/src/registry/index.ts +++ b/packages/appkit/src/registry/index.ts @@ -17,7 +17,7 @@ export { ResourceRegistry } from "./resource-registry"; export * from "./types"; /** - * URL to the plugin manifest JSON Schema hosted on GitHub Pages. + * URL to the plugin manifest JSON Schema. * Can be used for validation or referenced in manifest files. * * @example @@ -28,6 +28,8 @@ export * from "./types"; * ... * } * ``` + * + * @see {@link https://www.databricks.com/devhub/docs/appkit/v0/ | AppKit Documentation} */ // TODO: We may want to open a PR to https://github.com/SchemaStore/schemastore // export const MANIFEST_SCHEMA_ID = diff --git a/template/README.md b/template/README.md index ad71787f4..10c238ff4 100644 --- a/template/README.md +++ b/template/README.md @@ -1,6 +1,6 @@ # {{.projectName}} -A Databricks App powered by [AppKit](https://databricks.github.io/appkit/), featuring React, TypeScript, and Tailwind CSS. +A Databricks App powered by [AppKit](https://www.databricks.com/devhub/docs/appkit/v0/), featuring React, TypeScript, and Tailwind CSS. **Enabled plugins:** {{- if .plugins.analytics}} @@ -41,7 +41,7 @@ DATABRICKS_APP_PORT=8000 #### Lakebase Configuration -The Lakebase plugin requires additional environment variables for PostgreSQL connectivity. To learn how to configure the Lakebase plugin, see the [Lakebase plugin documentation](https://databricks.github.io/appkit/docs/plugins/lakebase). +The Lakebase plugin requires additional environment variables for PostgreSQL connectivity. To learn how to configure the Lakebase plugin, see the [Lakebase plugin documentation](https://www.databricks.com/devhub/docs/appkit/v0/plugins/lakebase). {{- end}} ### CLI Authentication diff --git a/template/client/src/App.tsx b/template/client/src/App.tsx index 5510bb805..a171dfaaa 100644 --- a/template/client/src/App.tsx +++ b/template/client/src/App.tsx @@ -153,7 +153,7 @@ function HomePage() {
  • {