diff --git a/.env.docs-cloud.example b/.env.docs-cloud.example new file mode 100644 index 0000000..caf5719 --- /dev/null +++ b/.env.docs-cloud.example @@ -0,0 +1,10 @@ +# Docs Cloud +# Create this key in Docs Cloud Settings -> API Keys. +# Store the real value in production env, CI secrets, or your hosting provider. +DOCS_CLOUD_API_KEY= + +# Analytics +# Copy this from the Docs Cloud project after connecting the repository. +NEXT_PUBLIC_DOCS_CLOUD_PROJECT_ID= +# Optional opt-out. Leave unset to keep analytics enabled. +# NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_ENABLED=false diff --git a/DOCS_CLOUD_SETUP.md b/DOCS_CLOUD_SETUP.md new file mode 100644 index 0000000..05d7add --- /dev/null +++ b/DOCS_CLOUD_SETUP.md @@ -0,0 +1,30 @@ +# Docs Cloud Setup + +This PR connects the existing docs app to Docs Cloud without replacing the docs content. + +## What this PR adds + +- `docs.json` configures the docs root, draft PR publishing, and analytics. +- `docs.config.ts` wires the docs runtime to Docs Cloud analytics. If the repo already has `docs.config.tsx`, this PR updates that file instead. +- `.env.docs-cloud.example` documents the production environment variable the docs app needs. +- Analytics is enabled in `docs.json`; keep it enabled unless the project intentionally opts out. + +## Finish the setup + +1. Open Docs Cloud and go to Settings -> API Keys. +2. Create an API key with the default project, docs, and jobs scopes. +3. Add the key to production as `DOCS_CLOUD_API_KEY`. +4. Create or open the Docs Cloud analytics project for this repository and copy its project id. +5. Add that id to production as `NEXT_PUBLIC_DOCS_CLOUD_PROJECT_ID`. +6. If the host uses files, put the values in `.env.production`. If it uses managed secrets, add the same variables there instead. +7. Do not commit the real key. Keep `.env.docs-cloud.example` as the checked-in reference. + +To opt out of analytics later, set `NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_ENABLED=false` in production. + +## Config review + +- Docs root: `apps/docs` +- Publish base branch: `main` +- Publish mode: `draft-pr` +- Preview deploys: not requested by this setup PR +- Analytics: enabled diff --git a/apps/docs/docs.config.ts b/apps/docs/docs.config.ts new file mode 100644 index 0000000..802da73 --- /dev/null +++ b/apps/docs/docs.config.ts @@ -0,0 +1,8 @@ +import { createDocsCloudAnalytics, defineDocs } from "@farming-labs/docs"; + +export default defineDocs({ + analytics: createDocsCloudAnalytics({ + console: false, + includeInputs: false, + }), +}); diff --git a/docs.json b/docs.json new file mode 100644 index 0000000..1bd1842 --- /dev/null +++ b/docs.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://docs.farming-labs.dev/schema/docs.json", + "version": 1, + "docs": { + "mode": "frameworkless", + "runtime": "nextjs", + "root": "apps/docs" + }, + "cloud": { + "apiKey": { + "env": "DOCS_CLOUD_API_KEY" + }, + "preview": { + "enabled": false + }, + "publish": { + "mode": "draft-pr", + "baseBranch": "main" + }, + "analytics": { + "enabled": true, + "includeInputs": false + } + } +}