doccupine 0.0.70 → 0.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/lib/structures.js +2 -0
- package/dist/templates/components/PostHogProvider.d.ts +1 -1
- package/dist/templates/components/PostHogProvider.js +1 -1
- package/dist/templates/mdx/platform/analytics.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/analytics.mdx.js +51 -0
- package/dist/templates/package.js +8 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -135,6 +135,7 @@ Place these JSON files in your project root (where you run `doccupine`). They ar
|
|
|
135
135
|
| `links.json` | Static header/footer links |
|
|
136
136
|
| `fonts.json` | Font configuration (Google Fonts or local) |
|
|
137
137
|
| `sections.json` | Section definitions for tabbed doc groups (see [Sections](#sections)) |
|
|
138
|
+
| `analytics.json` | Analytics provider configuration (PostHog supported) |
|
|
138
139
|
|
|
139
140
|
## Public Directory
|
|
140
141
|
|
package/dist/lib/structures.js
CHANGED
|
@@ -96,6 +96,7 @@ import { platformThemeSettingsMdxTemplate } from "../templates/mdx/platform/them
|
|
|
96
96
|
import { platformNavigationSettingsMdxTemplate } from "../templates/mdx/platform/navigation-settings.mdx.js";
|
|
97
97
|
import { platformFontsSettingsMdxTemplate } from "../templates/mdx/platform/fonts-settings.mdx.js";
|
|
98
98
|
import { platformExternalLinksMdxTemplate } from "../templates/mdx/platform/external-links.mdx.js";
|
|
99
|
+
import { platformAnalyticsMdxTemplate } from "../templates/mdx/platform/analytics.mdx.js";
|
|
99
100
|
import { platformAiAssistantMdxTemplate } from "../templates/mdx/platform/ai-assistant.mdx.js";
|
|
100
101
|
import { platformCustomDomainsMdxTemplate } from "../templates/mdx/platform/custom-domains.mdx.js";
|
|
101
102
|
import { platformBuildAndDeployMdxTemplate } from "../templates/mdx/platform/build-and-deploy.mdx.js";
|
|
@@ -203,6 +204,7 @@ export const startingDocsStructure = {
|
|
|
203
204
|
"platform/navigation-settings.mdx": platformNavigationSettingsMdxTemplate,
|
|
204
205
|
"platform/fonts-settings.mdx": platformFontsSettingsMdxTemplate,
|
|
205
206
|
"platform/external-links.mdx": platformExternalLinksMdxTemplate,
|
|
207
|
+
"platform/analytics.mdx": platformAnalyticsMdxTemplate,
|
|
206
208
|
"platform/ai-assistant.mdx": platformAiAssistantMdxTemplate,
|
|
207
209
|
"platform/custom-domains.mdx": platformCustomDomainsMdxTemplate,
|
|
208
210
|
"platform/build-and-deploy.mdx": platformBuildAndDeployMdxTemplate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const postHogProviderTemplate = "\"use client\";\n\nimport posthog from \"posthog-js\";\nimport { PostHogProvider as PHProvider } from \"posthog
|
|
1
|
+
export declare const postHogProviderTemplate = "\"use client\";\n\nimport posthog from \"posthog-js\";\nimport { PostHogProvider as PHProvider } from \"@posthog/react\";\nimport { Suspense, useEffect, useRef, useState } from \"react\";\nimport { usePathname, useSearchParams } from \"next/navigation\";\nimport rawAnalyticsConfig from \"@/analytics.json\";\n\ninterface AnalyticsConfig {\n provider?: string;\n posthog?: {\n key?: string;\n host?: string;\n };\n}\n\nconst analyticsConfig = rawAnalyticsConfig as AnalyticsConfig;\n\nconst posthogKey =\n analyticsConfig?.provider === \"posthog\" ? analyticsConfig.posthog?.key : null;\n\nfunction PostHogInit({ onReady }: { onReady: () => void }) {\n const initRef = useRef(false);\n\n useEffect(() => {\n if (initRef.current || !posthogKey) return;\n initRef.current = true;\n\n posthog.init(posthogKey, {\n api_host: \"/ingest\",\n ui_host: analyticsConfig.posthog?.host || \"https://us.posthog.com\",\n capture_pageview: false,\n capture_pageleave: true,\n loaded: onReady,\n });\n }, [onReady]);\n\n return null;\n}\n\nfunction PostHogPageviewTracker() {\n const pathname = usePathname();\n const searchParams = useSearchParams();\n\n useEffect(() => {\n if (pathname) {\n const url = searchParams?.size\n ? `${pathname}?${searchParams.toString()}`\n : pathname;\n posthog.capture(\"$pageview\", { $current_url: url });\n }\n }, [pathname, searchParams]);\n\n return null;\n}\n\nexport function PostHogProvider({ children }: { children: React.ReactNode }) {\n const [ready, setReady] = useState(false);\n\n if (!posthogKey) {\n return <>{children}</>;\n }\n\n return (\n <PHProvider client={posthog}>\n <PostHogInit onReady={() => setReady(true)} />\n <Suspense fallback={null}>{ready && <PostHogPageviewTracker />}</Suspense>\n {children}\n </PHProvider>\n );\n}\n";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const postHogProviderTemplate = `"use client";
|
|
2
2
|
|
|
3
3
|
import posthog from "posthog-js";
|
|
4
|
-
import { PostHogProvider as PHProvider } from "posthog
|
|
4
|
+
import { PostHogProvider as PHProvider } from "@posthog/react";
|
|
5
5
|
import { Suspense, useEffect, useRef, useState } from "react";
|
|
6
6
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
7
7
|
import rawAnalyticsConfig from "@/analytics.json";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const platformAnalyticsMdxTemplate = "---\ntitle: \"Analytics\"\ndescription: \"Enable PostHog analytics to track page views on your documentation site.\"\ndate: \"2026-02-24\"\ncategory: \"Configuration\"\ncategoryOrder: 2\norder: 3\nsection: \"Platform\"\n---\n# Analytics\nThe Analytics settings page lets you add PostHog analytics to your documentation site. Page views are tracked client-side and proxied through your own domain for privacy - no data is sent directly to PostHog.\n\n## Enabling analytics\nUse the **Enable Analytics** toggle to turn tracking on or off. When disabled, no tracking code is added to your site.\n\n## Configuration\n\n### PostHog Project API Key\nYour project API key from PostHog (starts with `phc_`). This is a public identifier and is safe to commit to your repository.\n\nTo find your key:\n1. Log in to [PostHog](https://posthog.com).\n2. Open your project settings.\n3. Copy the **Project API Key**.\n\n### Region\nSelect the PostHog cloud region that matches your project:\n\n- **US Cloud** - `us.i.posthog.com`\n- **EU Cloud** - `eu.i.posthog.com`\n\n## How it works\nAnalytics settings are stored in `analytics.json` at the root of your repository. Here's an example:\n\n```json\n{\n \"provider\": \"posthog\",\n \"posthog\": {\n \"key\": \"phc_your_project_api_key\",\n \"host\": \"https://us.i.posthog.com\"\n }\n}\n```\n\nWhen enabled, Doccupine routes all analytics traffic through your documentation domain using Next.js rewrites. Instead of sending data directly to PostHog (which ad blockers may intercept), requests go through `/ingest` on your own domain and are proxied to PostHog.\n\n<Callout type=\"note\">\n Changes to analytics settings are staged as pending changes. Click **Publish** to commit them to your repository and trigger a deploy.\n</Callout>\n\nSee the [Analytics](/analytics) page for the full configuration reference and additional details on the privacy proxy.";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const platformAnalyticsMdxTemplate = `---
|
|
2
|
+
title: "Analytics"
|
|
3
|
+
description: "Enable PostHog analytics to track page views on your documentation site."
|
|
4
|
+
date: "2026-02-24"
|
|
5
|
+
category: "Configuration"
|
|
6
|
+
categoryOrder: 2
|
|
7
|
+
order: 3
|
|
8
|
+
section: "Platform"
|
|
9
|
+
---
|
|
10
|
+
# Analytics
|
|
11
|
+
The Analytics settings page lets you add PostHog analytics to your documentation site. Page views are tracked client-side and proxied through your own domain for privacy - no data is sent directly to PostHog.
|
|
12
|
+
|
|
13
|
+
## Enabling analytics
|
|
14
|
+
Use the **Enable Analytics** toggle to turn tracking on or off. When disabled, no tracking code is added to your site.
|
|
15
|
+
|
|
16
|
+
## Configuration
|
|
17
|
+
|
|
18
|
+
### PostHog Project API Key
|
|
19
|
+
Your project API key from PostHog (starts with \`phc_\`). This is a public identifier and is safe to commit to your repository.
|
|
20
|
+
|
|
21
|
+
To find your key:
|
|
22
|
+
1. Log in to [PostHog](https://posthog.com).
|
|
23
|
+
2. Open your project settings.
|
|
24
|
+
3. Copy the **Project API Key**.
|
|
25
|
+
|
|
26
|
+
### Region
|
|
27
|
+
Select the PostHog cloud region that matches your project:
|
|
28
|
+
|
|
29
|
+
- **US Cloud** - \`us.i.posthog.com\`
|
|
30
|
+
- **EU Cloud** - \`eu.i.posthog.com\`
|
|
31
|
+
|
|
32
|
+
## How it works
|
|
33
|
+
Analytics settings are stored in \`analytics.json\` at the root of your repository. Here's an example:
|
|
34
|
+
|
|
35
|
+
\`\`\`json
|
|
36
|
+
{
|
|
37
|
+
"provider": "posthog",
|
|
38
|
+
"posthog": {
|
|
39
|
+
"key": "phc_your_project_api_key",
|
|
40
|
+
"host": "https://us.i.posthog.com"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
When enabled, Doccupine routes all analytics traffic through your documentation domain using Next.js rewrites. Instead of sending data directly to PostHog (which ad blockers may intercept), requests go through \`/ingest\` on your own domain and are proxied to PostHog.
|
|
46
|
+
|
|
47
|
+
<Callout type="note">
|
|
48
|
+
Changes to analytics settings are staged as pending changes. Click **Publish** to commit them to your repository and trigger a deploy.
|
|
49
|
+
</Callout>
|
|
50
|
+
|
|
51
|
+
See the [Analytics](/analytics) page for the full configuration reference and additional details on the privacy proxy.`;
|
|
@@ -10,20 +10,21 @@ export const packageJsonTemplate = JSON.stringify({
|
|
|
10
10
|
format: "prettier --write .",
|
|
11
11
|
},
|
|
12
12
|
dependencies: {
|
|
13
|
-
"@langchain/anthropic": "^1.3.
|
|
14
|
-
"@langchain/core": "^1.1.
|
|
13
|
+
"@langchain/anthropic": "^1.3.20",
|
|
14
|
+
"@langchain/core": "^1.1.28",
|
|
15
15
|
"@langchain/google-genai": "^2.1.20",
|
|
16
|
-
"@langchain/openai": "^1.2.
|
|
16
|
+
"@langchain/openai": "^1.2.10",
|
|
17
17
|
"@mdx-js/react": "^3.1.1",
|
|
18
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
19
|
+
"@posthog/react": "^1.8.1",
|
|
19
20
|
"cherry-styled-components": "^0.1.13",
|
|
20
|
-
langchain: "^1.2.
|
|
21
|
+
langchain: "^1.2.27",
|
|
21
22
|
"lucide-react": "^0.575.0",
|
|
22
23
|
next: "16.1.6",
|
|
23
24
|
"next-mdx-remote": "^6.0.0",
|
|
24
25
|
polished: "^4.3.1",
|
|
25
|
-
"posthog-js": "^1.
|
|
26
|
-
"posthog-node": "^5.
|
|
26
|
+
"posthog-js": "^1.354.0",
|
|
27
|
+
"posthog-node": "^5.26.0",
|
|
27
28
|
react: "19.2.4",
|
|
28
29
|
"react-dom": "19.2.4",
|
|
29
30
|
"rehype-highlight": "^7.0.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doccupine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"description": "Free and open-source documentation platform. Write MDX, get a production-ready site with AI chat, built-in components, and an MCP server - in one command.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|