@fumadocs/cli 0.0.6 → 0.0.7

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -22
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -256,6 +256,9 @@ prettier . --write`,
256
256
  if (text.type === "code") {
257
257
  note(text.code, text.title);
258
258
  }
259
+ if (text.type === "title") {
260
+ log.step(text.text);
261
+ }
259
262
  }
260
263
  }
261
264
 
@@ -421,7 +424,7 @@ function localResolver(dir) {
421
424
  import picocolors3 from "picocolors";
422
425
 
423
426
  // src/generated.js
424
- var generated = { "app/docs-og/[...slug]/route": "import { generateOGImage } from 'fumadocs-ui/og';\nimport { metadataImage } from '@/lib/metadata';\n\nexport const GET = metadataImage.createAPI((page) => {\n return generateOGImage({\n title: page.data.title,\n description: page.data.description,\n site: 'My App',\n });\n});\n\nexport function generateStaticParams() {\n return metadataImage.generateParams();\n}\n", "lib/i18n": "import type { I18nConfig } from 'fumadocs-core/i18n';\n\nexport const i18n: I18nConfig = {\n defaultLanguage: 'en',\n languages: ['en', 'cn'],\n};\n", "middleware": "import { createI18nMiddleware } from 'fumadocs-core/i18n';\nimport { i18n } from '@/lib/i18n';\n\nexport default createI18nMiddleware(i18n);\n\nexport const config = {\n // Matcher ignoring `/_next/` and `/api/`\n matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],\n};\n", "scripts/generate-docs": "import * as OpenAPI from 'fumadocs-openapi';\nimport { rimrafSync } from 'rimraf';\n\nconst out = './content/docs/(api)';\n\n// clean generated files\nrimrafSync(out, {\n filter(v) {\n return !v.endsWith('index.mdx') && !v.endsWith('meta.json');\n },\n});\n\nvoid OpenAPI.generateFiles({\n // input files\n input: ['./openapi.json'],\n output: out,\n groupBy: 'tag',\n});\n", "lib/metadata": "import { createMetadataImage } from 'fumadocs-core/server';\nimport { source } from '@/lib/source';\n\nexport const metadataImage = createMetadataImage({\n imageRoute: '/docs-og',\n source,\n});\n" };
427
+ var generated = { "lib/metadata": "import { createMetadataImage } from 'fumadocs-core/server';\nimport { source } from '@/lib/source';\n\nexport const metadataImage = createMetadataImage({\n imageRoute: '/docs-og',\n source,\n});\n", "app/docs-og/[...slug]/route": "import { generateOGImage } from 'fumadocs-ui/og';\nimport { metadataImage } from '@/lib/metadata';\n\nexport const GET = metadataImage.createAPI((page) => {\n return generateOGImage({\n title: page.data.title,\n description: page.data.description,\n site: 'My App',\n });\n});\n\nexport function generateStaticParams() {\n return metadataImage.generateParams();\n}\n", "lib/i18n": "import type { I18nConfig } from 'fumadocs-core/i18n';\n\nexport const i18n: I18nConfig = {\n defaultLanguage: 'en',\n languages: ['en', 'cn'],\n};\n", "middleware": "import { createI18nMiddleware } from 'fumadocs-core/i18n';\nimport { i18n } from '@/lib/i18n';\n\nexport default createI18nMiddleware(i18n);\n\nexport const config = {\n // Matcher ignoring `/_next/` and `/api/`\n matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],\n};\n", "scripts/generate-docs": "import * as OpenAPI from 'fumadocs-openapi';\nimport { rimrafSync } from 'rimraf';\n\nconst out = './content/docs/(api)';\n\n// clean generated files\nrimrafSync(out, {\n filter(v) {\n return !v.endsWith('index.mdx') && !v.endsWith('meta.json');\n },\n});\n\nvoid OpenAPI.generateFiles({\n // input files\n input: ['./openapi.json'],\n output: out,\n groupBy: 'tag',\n});\n" };
425
428
 
426
429
  // src/plugins/og-image.ts
427
430
  function isI18nEnabled(ctx) {
@@ -473,7 +476,6 @@ export function generateMetadata({ params }: { params: { slug?: string[] } }) {
473
476
 
474
477
  // src/plugins/i18n.ts
475
478
  import path7 from "node:path";
476
- import picocolors4 from "picocolors";
477
479
  import { log as log3 } from "@clack/prompts";
478
480
 
479
481
  // src/utils/i18n/transform-layout-config.ts
@@ -641,6 +643,7 @@ function runTransform(sourceFile) {
641
643
  }
642
644
 
643
645
  // src/plugins/i18n.ts
646
+ import picocolors4 from "picocolors";
644
647
  var i18nPlugin = {
645
648
  files: ({ src: src2 }) => ({
646
649
  "lib/i18n.ts": generated["lib/i18n"],
@@ -649,8 +652,19 @@ var i18nPlugin = {
649
652
  dependencies: [],
650
653
  instructions: () => [
651
654
  {
652
- type: "text",
653
- text: "Make sure to update the params of page.tsx and route.ts (if necessary):"
655
+ type: "title",
656
+ text: `1. Update the params of ${picocolors4.bold("page.tsx")} and ${picocolors4.bold("layout.tsx")}, and make them async if necessary.`
657
+ },
658
+ {
659
+ type: "code",
660
+ title: "layout.tsx",
661
+ code: `
662
+ export default async function Layout({
663
+ params,
664
+ }: {
665
+ ${picocolors4.underline(picocolors4.bold("params: Promise<{ lang: string }>"))}
666
+ })
667
+ `.trim()
654
668
  },
655
669
  {
656
670
  type: "code",
@@ -664,19 +678,12 @@ export default async function Page({
664
678
  `.trim()
665
679
  },
666
680
  {
667
- type: "text",
668
- text: "Update the usages to `source` with:"
669
- },
670
- {
671
- type: "code",
672
- title: "page.tsx",
673
- code: `const page = source.getPage(params.slug, params.lang);
674
- const pages = source.getPage(params.lang);`
681
+ type: "title",
682
+ text: "2. Update references to your `source` object"
675
683
  },
676
684
  {
677
- type: "code",
678
- title: "layout.tsx",
679
- code: `const tree = source.pageTree[params.lang];`
685
+ type: "text",
686
+ text: "You can follow the instructions in https://fumadocs.vercel.app/docs/ui/internationalization#source section."
680
687
  }
681
688
  ],
682
689
  async transform(ctx) {
@@ -895,7 +902,7 @@ async function runTree(args) {
895
902
  // package.json
896
903
  var package_default = {
897
904
  name: "@fumadocs/cli",
898
- version: "0.0.6",
905
+ version: "0.0.7",
899
906
  description: "The CLI tool for Fumadocs",
900
907
  keywords: [
901
908
  "NextJs",
@@ -929,19 +936,19 @@ var package_default = {
929
936
  "types:check": "tsc --noEmit"
930
937
  },
931
938
  dependencies: {
932
- "@clack/prompts": "^0.9.0",
933
- commander: "^12.1.0",
939
+ "@clack/prompts": "^0.9.1",
940
+ commander: "^13.0.0",
934
941
  execa: "^9.5.2",
935
942
  "package-manager-detector": "^0.2.8",
936
943
  picocolors: "^1.1.1",
937
- "ts-morph": "^24.0.0"
944
+ "ts-morph": "^25.0.0"
938
945
  },
939
946
  devDependencies: {
940
947
  "@types/cross-spawn": "^6.0.6",
941
- "@types/node": "22.10.2",
942
- "@types/react": "^19.0.2",
948
+ "@types/node": "22.10.6",
949
+ "@types/react": "^19.0.7",
943
950
  "eslint-config-custom": "workspace:*",
944
- "fast-glob": "^3.3.1",
951
+ "fast-glob": "^3.3.3",
945
952
  tsconfig: "workspace:*",
946
953
  tsx: "^4.19.2"
947
954
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fumadocs/cli",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "The CLI tool for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -26,18 +26,18 @@
26
26
  "dist/*"
27
27
  ],
28
28
  "dependencies": {
29
- "@clack/prompts": "^0.9.0",
30
- "commander": "^12.1.0",
29
+ "@clack/prompts": "^0.9.1",
30
+ "commander": "^13.0.0",
31
31
  "execa": "^9.5.2",
32
32
  "package-manager-detector": "^0.2.8",
33
33
  "picocolors": "^1.1.1",
34
- "ts-morph": "^24.0.0"
34
+ "ts-morph": "^25.0.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/cross-spawn": "^6.0.6",
38
- "@types/node": "22.10.2",
39
- "@types/react": "^19.0.2",
40
- "fast-glob": "^3.3.1",
38
+ "@types/node": "22.10.6",
39
+ "@types/react": "^19.0.7",
40
+ "fast-glob": "^3.3.3",
41
41
  "tsx": "^4.19.2",
42
42
  "eslint-config-custom": "0.0.0",
43
43
  "tsconfig": "0.0.0"