@farming-labs/docs 0.1.66 → 0.1.67

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.
@@ -80,7 +80,7 @@ async function main() {
80
80
  const { init } = await import("../init-BFhnsS7P.mjs");
81
81
  await init(initOptions);
82
82
  } else if (parsedCommand.command === "dev") {
83
- const { dev } = await import("../dev-Cj7kSQsB.mjs");
83
+ const { dev } = await import("../dev-DkMu-1UW.mjs");
84
84
  await dev(devOptions);
85
85
  } else if (parsedCommand.command === "mcp") {
86
86
  const { runMcp } = await import("../mcp-BANLcwQ0.mjs");
@@ -201,7 +201,18 @@ const managedConfigSchema = z.object({
201
201
  description: z.string().optional()
202
202
  }).passthrough().optional(),
203
203
  theme: z.object({ preset: z.string().optional() }).passthrough().optional(),
204
- cloud: z.object({ enabled: z.boolean().optional() }).passthrough().optional()
204
+ cloud: z.object({
205
+ enabled: z.boolean().optional(),
206
+ analytics: z.union([z.boolean(), z.object({
207
+ enabled: z.boolean().optional(),
208
+ console: z.union([z.boolean(), z.enum([
209
+ "log",
210
+ "info",
211
+ "debug"
212
+ ])]).optional(),
213
+ includeInputs: z.boolean().optional()
214
+ }).passthrough()]).optional()
215
+ }).passthrough().optional()
205
216
  }).passthrough();
206
217
  function toPosixPath(value) {
207
218
  return value.replace(/\\/g, "/");
@@ -481,7 +492,8 @@ function readManagedDocsProject(projectRoot) {
481
492
  siteName,
482
493
  titleTemplate: parsed.data.site?.titleTemplate ?? `%s | ${siteName}`,
483
494
  description: parsed.data.site?.description ?? `Documentation for ${siteName}.`,
484
- theme
495
+ theme,
496
+ analytics: parsed.data.cloud?.analytics
485
497
  };
486
498
  }
487
499
  function resolveLocalPackageSpec(projectRoot, runtimeDir) {
@@ -581,6 +593,7 @@ function renderDocsConfigFile(options) {
581
593
  specUrl: ${JSON.stringify(options.apiReference.specUrl)},
582
594
  },
583
595
  ` : "";
596
+ const analyticsBlock = renderManagedAnalyticsBlock(options.analytics);
584
597
  return `import { defineDocs } from "@farming-labs/docs";
585
598
  import { ${options.theme.factory} } from "${options.theme.importPath}";
586
599
 
@@ -598,9 +611,19 @@ export default defineDocs({
598
611
  titleTemplate: ${JSON.stringify(options.titleTemplate)},
599
612
  description: ${JSON.stringify(options.description)},
600
613
  },
601
- ${apiReferenceBlock}});
614
+ ${analyticsBlock}${apiReferenceBlock}});
602
615
  `;
603
616
  }
617
+ function renderManagedAnalyticsBlock(analytics) {
618
+ if (typeof analytics === "undefined") return "";
619
+ if (typeof analytics === "boolean") return ` analytics: ${analytics},\n`;
620
+ const properties = [];
621
+ if (typeof analytics.enabled === "boolean") properties.push(` enabled: ${analytics.enabled},`);
622
+ if (typeof analytics.console !== "undefined") properties.push(` console: ${JSON.stringify(analytics.console)},`);
623
+ if (typeof analytics.includeInputs === "boolean") properties.push(` includeInputs: ${analytics.includeInputs},`);
624
+ if (properties.length === 0) return " analytics: {},\n";
625
+ return ` analytics: {\n${properties.join("\n")}\n },\n`;
626
+ }
604
627
  function renderManagedApiReferenceLayout() {
605
628
  return `import docsConfig from "@/docs.config";
606
629
  import { createNextApiReferenceLayout } from "@farming-labs/next/api-reference";
@@ -951,6 +974,7 @@ function materializeManagedRuntime(projectRoot) {
951
974
  titleTemplate: project.titleTemplate,
952
975
  description: project.description,
953
976
  theme: project.theme,
977
+ analytics: project.analytics,
954
978
  apiReference: project.apiReferenceSpec ? {
955
979
  path: apiReferenceRoute,
956
980
  specUrl: project.apiReferenceSpec.specUrl
@@ -963,7 +987,8 @@ function materializeManagedRuntime(projectRoot) {
963
987
  siteName: project.siteName,
964
988
  titleTemplate: project.titleTemplate,
965
989
  description: project.description,
966
- theme: project.theme
990
+ theme: project.theme,
991
+ analytics: project.analytics
967
992
  }));
968
993
  else fs.rmSync(path.join(project.runtimeDir, "api-reference.config.ts"), { force: true });
969
994
  writeFileIfChanged(path.join(appDir, "layout.tsx"), rootLayoutTemplate(templateConfig, "app/global.css"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",