Skip to content
Draft
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
10 changes: 10 additions & 0 deletions .env.docs-cloud.example
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions DOCS_CLOUD_SETUP.md
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions apps/docs/docs.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createDocsCloudAnalytics, defineDocs } from "@farming-labs/docs";

export default defineDocs({
analytics: createDocsCloudAnalytics({
console: false,
includeInputs: false,
}),
});
25 changes: 25 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
Loading