create-bunspace 0.1.1 → 0.2.1
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/dist/bin.js +132 -1
- package/dist/templates/fumadocs/.env.example +49 -0
- package/dist/templates/fumadocs/.github/workflows/deploy.yml +89 -0
- package/dist/templates/fumadocs/CLAUDE.md +164 -0
- package/dist/templates/fumadocs/LICENSE +21 -0
- package/dist/templates/fumadocs/MUST-FOLLOW-GUIDELINES.md +269 -0
- package/dist/templates/fumadocs/README.md +319 -0
- package/dist/templates/fumadocs/biome.json +41 -0
- package/dist/templates/fumadocs/bun.lock +883 -0
- package/dist/templates/fumadocs/content-template/docs/getting-started/index.mdx +92 -0
- package/dist/templates/fumadocs/content-template/docs/getting-started/installation.mdx +168 -0
- package/dist/templates/fumadocs/content-template/docs/getting-started/quick-start.mdx +168 -0
- package/dist/templates/fumadocs/content-template/docs/index.mdx +70 -0
- package/dist/templates/fumadocs/content-template/en/docs/getting-started/index.mdx +92 -0
- package/dist/templates/fumadocs/content-template/en/docs/getting-started/installation.mdx +168 -0
- package/dist/templates/fumadocs/content-template/en/docs/getting-started/quick-start.mdx +168 -0
- package/dist/templates/fumadocs/content-template/en/docs/index.mdx +69 -0
- package/dist/templates/fumadocs/messages/en.json +14 -0
- package/dist/templates/fumadocs/messages/es.json +14 -0
- package/dist/templates/fumadocs/next.config.mjs +35 -0
- package/dist/templates/fumadocs/oxlint.json +14 -0
- package/dist/templates/fumadocs/package.json +35 -0
- package/dist/templates/fumadocs/postcss.config.mjs +5 -0
- package/dist/templates/fumadocs/source.config.ts +31 -0
- package/dist/templates/fumadocs/src/app/(home)/layout.tsx +6 -0
- package/dist/templates/fumadocs/src/app/(home)/page.tsx +132 -0
- package/dist/templates/fumadocs/src/app/api/search/route.ts +9 -0
- package/dist/templates/fumadocs/src/app/docs/[[...slug]]/page.tsx +62 -0
- package/dist/templates/fumadocs/src/app/docs/layout.tsx +11 -0
- package/dist/templates/fumadocs/src/app/en/docs/[[...slug]]/page.tsx +61 -0
- package/dist/templates/fumadocs/src/app/en/docs/layout.tsx +11 -0
- package/dist/templates/fumadocs/src/app/global.css +3 -0
- package/dist/templates/fumadocs/src/app/layout.tsx +47 -0
- package/dist/templates/fumadocs/src/app/llms-full.txt/route.ts +10 -0
- package/dist/templates/fumadocs/src/app/og/docs/[...slug]/route.tsx +27 -0
- package/dist/templates/fumadocs/src/components/language-selector.tsx +56 -0
- package/dist/templates/fumadocs/src/components/markdown-actions.tsx +61 -0
- package/dist/templates/fumadocs/src/config/site.config.ts +115 -0
- package/dist/templates/fumadocs/src/lib/layout.shared.tsx +23 -0
- package/dist/templates/fumadocs/src/lib/source.ts +91 -0
- package/dist/templates/fumadocs/src/mdx-components.tsx +14 -0
- package/dist/templates/fumadocs/tsconfig.json +46 -0
- package/package.json +1 -1
- package/templates/fumadocs/.env.example +49 -0
- package/templates/fumadocs/.github/workflows/deploy.yml +89 -0
- package/templates/fumadocs/CLAUDE.md +164 -0
- package/templates/fumadocs/LICENSE +21 -0
- package/templates/fumadocs/MUST-FOLLOW-GUIDELINES.md +269 -0
- package/templates/fumadocs/README.md +319 -0
- package/templates/fumadocs/biome.json +41 -0
- package/templates/fumadocs/bun.lock +883 -0
- package/templates/fumadocs/content-template/docs/getting-started/index.mdx +92 -0
- package/templates/fumadocs/content-template/docs/getting-started/installation.mdx +168 -0
- package/templates/fumadocs/content-template/docs/getting-started/quick-start.mdx +168 -0
- package/templates/fumadocs/content-template/docs/index.mdx +70 -0
- package/templates/fumadocs/content-template/en/docs/getting-started/index.mdx +92 -0
- package/templates/fumadocs/content-template/en/docs/getting-started/installation.mdx +168 -0
- package/templates/fumadocs/content-template/en/docs/getting-started/quick-start.mdx +168 -0
- package/templates/fumadocs/content-template/en/docs/index.mdx +69 -0
- package/templates/fumadocs/messages/en.json +14 -0
- package/templates/fumadocs/messages/es.json +14 -0
- package/templates/fumadocs/next.config.mjs +35 -0
- package/templates/fumadocs/oxlint.json +14 -0
- package/templates/fumadocs/package.json +35 -0
- package/templates/fumadocs/postcss.config.mjs +5 -0
- package/templates/fumadocs/source.config.ts +31 -0
- package/templates/fumadocs/src/app/(home)/layout.tsx +6 -0
- package/templates/fumadocs/src/app/(home)/page.tsx +132 -0
- package/templates/fumadocs/src/app/api/search/route.ts +9 -0
- package/templates/fumadocs/src/app/docs/[[...slug]]/page.tsx +62 -0
- package/templates/fumadocs/src/app/docs/layout.tsx +11 -0
- package/templates/fumadocs/src/app/en/docs/[[...slug]]/page.tsx +61 -0
- package/templates/fumadocs/src/app/en/docs/layout.tsx +11 -0
- package/templates/fumadocs/src/app/global.css +3 -0
- package/templates/fumadocs/src/app/layout.tsx +47 -0
- package/templates/fumadocs/src/app/llms-full.txt/route.ts +10 -0
- package/templates/fumadocs/src/app/og/docs/[...slug]/route.tsx +27 -0
- package/templates/fumadocs/src/components/language-selector.tsx +56 -0
- package/templates/fumadocs/src/components/markdown-actions.tsx +61 -0
- package/templates/fumadocs/src/config/site.config.ts +115 -0
- package/templates/fumadocs/src/lib/layout.shared.tsx +23 -0
- package/templates/fumadocs/src/lib/source.ts +91 -0
- package/templates/fumadocs/src/mdx-components.tsx +14 -0
- package/templates/fumadocs/tsconfig.json +46 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { docs, docsEn } from 'fumadocs-mdx:collections/server';
|
|
2
|
+
import { type InferPageType, loader } from 'fumadocs-core/source';
|
|
3
|
+
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
|
|
4
|
+
import { siteConfig } from '@/config/site.config';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Base URL prefix computed from basePath.
|
|
8
|
+
* Combines the basePath (e.g., '/telegram-bot-manager') with the docs path.
|
|
9
|
+
*/
|
|
10
|
+
const basePrefix = siteConfig.basePath;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Source loader for Spanish documentation (default locale).
|
|
14
|
+
*
|
|
15
|
+
* @see {@link https://fumadocs.vercel.app/docs/headless/source Fumadocs Source}
|
|
16
|
+
*/
|
|
17
|
+
export const source = loader({
|
|
18
|
+
baseUrl: `${basePrefix}/docs`,
|
|
19
|
+
source: docs.toFumadocsSource(),
|
|
20
|
+
plugins: [lucideIconsPlugin()],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Source loader for English documentation.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://fumadocs.vercel.app/docs/headless/source Fumadocs Source}
|
|
27
|
+
*/
|
|
28
|
+
export const sourceEn = loader({
|
|
29
|
+
baseUrl: `${basePrefix}/en/docs`,
|
|
30
|
+
source: docsEn.toFumadocsSource(),
|
|
31
|
+
plugins: [lucideIconsPlugin()],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generates OpenGraph image metadata for a page.
|
|
36
|
+
*
|
|
37
|
+
* @param page - Page instance from source loader
|
|
38
|
+
* @returns Object with segments and URL for OG image
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const image = getPageImage(page);
|
|
42
|
+
* // { segments: ['introduction', 'image.png'], url: '/og/docs/introduction/image.png' }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export function getPageImage(page: InferPageType<typeof source>) {
|
|
46
|
+
const segments = [...page.slugs, 'image.png'];
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
segments,
|
|
50
|
+
url: `${basePrefix}/og/docs/${segments.join('/')}`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves the raw markdown content for LLM consumption.
|
|
56
|
+
*
|
|
57
|
+
* @param page - Page instance from source loader
|
|
58
|
+
* @returns Markdown string with title and processed content
|
|
59
|
+
* @deprecated Use {@link getRawMarkdownContent} instead
|
|
60
|
+
*/
|
|
61
|
+
export async function getLLMText(page: InferPageType<typeof source>) {
|
|
62
|
+
const processed = await page.data.getText('processed');
|
|
63
|
+
|
|
64
|
+
return `# ${page.data.title}
|
|
65
|
+
|
|
66
|
+
${processed}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves the raw markdown content for copying/viewing.
|
|
71
|
+
*
|
|
72
|
+
* Formats the page content as raw markdown with the title as a heading.
|
|
73
|
+
* Used by the MarkdownActions component for "Copy as Markdown" functionality.
|
|
74
|
+
*
|
|
75
|
+
* @param page - Page instance from either source loader
|
|
76
|
+
* @returns Complete markdown string with title and content
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const markdown = await getRawMarkdownContent(page);
|
|
80
|
+
* // "# My Page\n\nContent here..."
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export async function getRawMarkdownContent(
|
|
84
|
+
page: InferPageType<typeof source> | InferPageType<typeof sourceEn>
|
|
85
|
+
) {
|
|
86
|
+
const processed = await page.data.getText('processed');
|
|
87
|
+
|
|
88
|
+
return `# ${page.data.title}
|
|
89
|
+
|
|
90
|
+
${processed}`;
|
|
91
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import defaultMdxComponents from 'fumadocs-ui/mdx';
|
|
2
|
+
import { Steps } from 'fumadocs-ui/components/steps';
|
|
3
|
+
import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
|
|
4
|
+
import type { MDXComponents } from 'mdx/types';
|
|
5
|
+
|
|
6
|
+
export function getMDXComponents(components?: MDXComponents): MDXComponents {
|
|
7
|
+
return {
|
|
8
|
+
Steps,
|
|
9
|
+
Tabs,
|
|
10
|
+
Tab,
|
|
11
|
+
...defaultMdxComponents,
|
|
12
|
+
...components,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"lib": [
|
|
6
|
+
"dom",
|
|
7
|
+
"dom.iterable",
|
|
8
|
+
"esnext"
|
|
9
|
+
],
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"module": "esnext",
|
|
17
|
+
"moduleResolution": "bundler",
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"jsx": "react-jsx",
|
|
21
|
+
"incremental": true,
|
|
22
|
+
"paths": {
|
|
23
|
+
"@/*": [
|
|
24
|
+
"./src/*"
|
|
25
|
+
],
|
|
26
|
+
"fumadocs-mdx:collections/*": [
|
|
27
|
+
".source/*"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"plugins": [
|
|
31
|
+
{
|
|
32
|
+
"name": "next"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"include": [
|
|
37
|
+
"next-env.d.ts",
|
|
38
|
+
"**/*.ts",
|
|
39
|
+
"**/*.tsx",
|
|
40
|
+
".next/types/**/*.ts",
|
|
41
|
+
".next/dev/types/**/*.ts"
|
|
42
|
+
],
|
|
43
|
+
"exclude": [
|
|
44
|
+
"node_modules"
|
|
45
|
+
]
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# ============================================
|
|
2
|
+
# Fumadocs Template Configuration
|
|
3
|
+
# ============================================
|
|
4
|
+
# Copy this file to .env.local and set your values
|
|
5
|
+
# Variables marked with {{PLACEHOLDER}} will be replaced by mks-scaffolder
|
|
6
|
+
|
|
7
|
+
# --------------------------------------------
|
|
8
|
+
# Project Information
|
|
9
|
+
# --------------------------------------------
|
|
10
|
+
PROJECT_NAME={{PROJECT_NAME}}
|
|
11
|
+
DESCRIPTION={{DESCRIPTION}}
|
|
12
|
+
AUTHOR={{AUTHOR}}
|
|
13
|
+
KEYWORDS=docs,documentation,nextjs,fumadocs
|
|
14
|
+
|
|
15
|
+
# --------------------------------------------
|
|
16
|
+
# Deployment
|
|
17
|
+
# --------------------------------------------
|
|
18
|
+
# Base path for GitHub Pages or subdirectory deployment
|
|
19
|
+
# Example: /my-project or leave empty for root domain
|
|
20
|
+
BASE_PATH={{BASE_PATH}}
|
|
21
|
+
|
|
22
|
+
# Full site URL (for production)
|
|
23
|
+
NEXT_PUBLIC_SITE_URL=https://{{GITHUB_REPO}}
|
|
24
|
+
|
|
25
|
+
# OpenGraph image (optional)
|
|
26
|
+
OG_IMAGE_URL=/og.png
|
|
27
|
+
|
|
28
|
+
# --------------------------------------------
|
|
29
|
+
# i18n (Internationalization)
|
|
30
|
+
# --------------------------------------------
|
|
31
|
+
DEFAULT_LOCALE={{DEFAULT_LOCALE}}
|
|
32
|
+
NEXT_PUBLIC_SUPPORTED_LOCALES={{SUPPORTED_LOCALES}}
|
|
33
|
+
|
|
34
|
+
# --------------------------------------------
|
|
35
|
+
# Theme & Branding
|
|
36
|
+
# --------------------------------------------
|
|
37
|
+
# Primary color in CSS variable format (optional)
|
|
38
|
+
# PRIMARY_COLOR=var(--color-primary)
|
|
39
|
+
|
|
40
|
+
# Logo configuration (optional)
|
|
41
|
+
# Use SVG markup or plain text
|
|
42
|
+
# LOGO_SVG=<svg viewBox="0 0 24 24">...</svg>
|
|
43
|
+
# LOGO_TEXT=My Docs
|
|
44
|
+
|
|
45
|
+
# --------------------------------------------
|
|
46
|
+
# URL Configuration
|
|
47
|
+
# --------------------------------------------
|
|
48
|
+
# Enable trailing slash for all URLs (recommended for GitHub Pages)
|
|
49
|
+
TRAILING_SLASH=true
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Workflow para construir y desplegar la documentación a GitHub Pages
|
|
2
|
+
name: Deploy Docs to Pages
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: ["main", "master"]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: "pages"
|
|
16
|
+
cancel-in-progress: false
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Setup Bun
|
|
27
|
+
uses: oven-sh/setup-bun@v2
|
|
28
|
+
with:
|
|
29
|
+
bun-version: latest
|
|
30
|
+
|
|
31
|
+
- name: Setup Pages
|
|
32
|
+
uses: actions/configure-pages@v5
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: bun install --frozen-lockfile
|
|
36
|
+
|
|
37
|
+
- name: Configure environment
|
|
38
|
+
run: |
|
|
39
|
+
# Set BASE_PATH from repository variables or use empty string
|
|
40
|
+
BASE_PATH="${{ vars.BASE_PATH }}"
|
|
41
|
+
echo "BASE_PATH=${BASE_PATH}" >> $GITHUB_ENV
|
|
42
|
+
|
|
43
|
+
# Set project name from repository name
|
|
44
|
+
REPO_NAME="${{ github.event.repository.name }}"
|
|
45
|
+
echo "REPO_NAME=${REPO_NAME}" >> $GITHUB_ENV
|
|
46
|
+
|
|
47
|
+
- name: Build with Next.js
|
|
48
|
+
run: bun run build
|
|
49
|
+
env:
|
|
50
|
+
NODE_ENV: production
|
|
51
|
+
BASE_PATH: ${{ vars.BASE_PATH }}
|
|
52
|
+
|
|
53
|
+
- name: Move files for basePath
|
|
54
|
+
run: |
|
|
55
|
+
cd out
|
|
56
|
+
# Only create subdirectory if BASE_PATH is set
|
|
57
|
+
if [ -n "$BASE_PATH" ]; then
|
|
58
|
+
# Extract the directory name from BASE_PATH (remove leading /)
|
|
59
|
+
DIR_NAME="${BASE_PATH#/}"
|
|
60
|
+
mkdir -p "$DIR_NAME"
|
|
61
|
+
# Move all files and directories except the created directory itself
|
|
62
|
+
for item in *; do
|
|
63
|
+
if [ "$item" != "$DIR_NAME" ]; then
|
|
64
|
+
mv "$item" "$DIR_NAME/"
|
|
65
|
+
fi
|
|
66
|
+
done
|
|
67
|
+
# Also move hidden files if any
|
|
68
|
+
for item in .[^.]*; do
|
|
69
|
+
if [ -e "$item" ] && [ "$item" != "." ] && [ "$item" != ".." ] && [ "$item" != ".git" ]; then
|
|
70
|
+
mv "$item" "$DIR_NAME/"
|
|
71
|
+
fi
|
|
72
|
+
done
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
- name: Upload artifact
|
|
76
|
+
uses: actions/upload-pages-artifact@v3
|
|
77
|
+
with:
|
|
78
|
+
path: ./out
|
|
79
|
+
|
|
80
|
+
deploy:
|
|
81
|
+
environment:
|
|
82
|
+
name: github-pages
|
|
83
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
needs: build
|
|
86
|
+
steps:
|
|
87
|
+
- name: Deploy to GitHub Pages
|
|
88
|
+
id: deployment
|
|
89
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## CRITICAL: Development Guidelines
|
|
6
|
+
|
|
7
|
+
**ALL development MUST follow the rules in `MUST-FOLLOW-GUIDELINES.md`**
|
|
8
|
+
|
|
9
|
+
Before making ANY code changes, read and understand:
|
|
10
|
+
- `/MUST-FOLLOW-GUIDELINES.md` - Source of truth for coding standards
|
|
11
|
+
|
|
12
|
+
**Key Rules Overview:**
|
|
13
|
+
- JSDoc completo profesional obligatorio
|
|
14
|
+
- Result pattern siempre (mks-fumadocs-template/utils/result)
|
|
15
|
+
- Logging via mks-fumadocs-template/utils/logger (NUNCA console.log)
|
|
16
|
+
- Validacion con Arktype
|
|
17
|
+
- Nomenclatura: prefijo I para interfaces
|
|
18
|
+
- Estructura: src/types/ y src/utils/ con barrel exports
|
|
19
|
+
- Async/await preferido sobre Promise chaining
|
|
20
|
+
|
|
21
|
+
## Monorepo Stack
|
|
22
|
+
|
|
23
|
+
This is a Bun-based monorepo for npm packages.
|
|
24
|
+
|
|
25
|
+
**Core Stack:**
|
|
26
|
+
- **Runtime**: Bun (package manager & runtime)
|
|
27
|
+
- **Workspaces**: Bun workspaces (`workspace:*` protocol)
|
|
28
|
+
- **Bundling**: Rolldown (`rolldown` v1.0.0-beta.58)
|
|
29
|
+
- **Linting**: Oxlint (OxC-based linter)
|
|
30
|
+
- **Formatting**: Prettier with `prettier-plugin-organize-imports`
|
|
31
|
+
- **Type Checking**: TSGO (@typescript/native-preview v7.0.0-dev)
|
|
32
|
+
- **Validation**: Arktype (schema validation)
|
|
33
|
+
- **Versioning**: Changesets
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Development - all workspaces
|
|
39
|
+
bun run dev # Start dev mode for all packages
|
|
40
|
+
|
|
41
|
+
# Build - all workspaces
|
|
42
|
+
bun run build # Build all packages
|
|
43
|
+
|
|
44
|
+
# Type checking
|
|
45
|
+
bun run typecheck # Type check all packages
|
|
46
|
+
|
|
47
|
+
# Linting (Oxlint only - no ESLint)
|
|
48
|
+
bun run lint # Run oxlint
|
|
49
|
+
bun run lint:fix # Auto-fix oxlint issues
|
|
50
|
+
|
|
51
|
+
# Formatting (Prettier)
|
|
52
|
+
bun run format # Format all files
|
|
53
|
+
bun run format:check # Check formatting
|
|
54
|
+
|
|
55
|
+
# Clean everything
|
|
56
|
+
bun run clean # Remove node_modules, dist, .turbo
|
|
57
|
+
|
|
58
|
+
# Changesets (versioning)
|
|
59
|
+
bun run changeset # Create a changeset
|
|
60
|
+
bun run changeset:version # Apply changesets and bump versions
|
|
61
|
+
bun run changeset:publish # Publish packages to npm
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Monorepo Structure
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
├── core/
|
|
68
|
+
│ └── packages/
|
|
69
|
+
│ ├── utils/ # Shared utilities package
|
|
70
|
+
│ │ ├── src/
|
|
71
|
+
│ │ │ ├── logger.ts # Logging wrapper (@mks2508/better-logger)
|
|
72
|
+
│ │ │ ├── result.ts # Result wrapper (@mks2508/no-throw)
|
|
73
|
+
│ │ │ └── index.ts # Barrel export
|
|
74
|
+
│ │ ├── rolldown.config.ts
|
|
75
|
+
│ │ └── package.json
|
|
76
|
+
│ └── main/ # Main library package
|
|
77
|
+
│ ├── src/
|
|
78
|
+
│ └── package.json # Depends on utils via workspace:*
|
|
79
|
+
└── apps/
|
|
80
|
+
└── example/ # Example app
|
|
81
|
+
└── package.json # Depends on utils via workspace:*
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Workspace Pattern:**
|
|
85
|
+
- Packages in `core/packages/*` and `apps/*` are auto-discovered
|
|
86
|
+
- Internal dependencies use `"mks-fumadocs-template/package": "workspace:*"`
|
|
87
|
+
- Root `package.json` defines shared devDependencies
|
|
88
|
+
|
|
89
|
+
## Shared Utilities Pattern
|
|
90
|
+
|
|
91
|
+
The `mks-fumadocs-template/utils` package provides shared wrappers:
|
|
92
|
+
|
|
93
|
+
### Logger (`mks-fumadocs-template/utils/logger`)
|
|
94
|
+
|
|
95
|
+
Wrapper around `@mks2508/better-logger` with preset configured:
|
|
96
|
+
```typescript
|
|
97
|
+
import { createLogger } from 'mks-fumadocs-template/utils/logger';
|
|
98
|
+
|
|
99
|
+
const log = createLogger('ComponentName');
|
|
100
|
+
log.info('Message');
|
|
101
|
+
log.success('Success!');
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Result (`mks-fumadocs-template/utils/result`)
|
|
105
|
+
|
|
106
|
+
Wrapper around `@mks2508/no-throw` with domain-specific error codes:
|
|
107
|
+
```typescript
|
|
108
|
+
import { ok, tryCatch, createAppError, type Result } from 'mks-fumadocs-template/utils/result';
|
|
109
|
+
|
|
110
|
+
const result: Result<string> = ok('success');
|
|
111
|
+
const error = createAppError('NetworkError', 'Failed to fetch');
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Tool Configuration Files
|
|
115
|
+
|
|
116
|
+
### Root TypeScript/TSGO (`tsconfig.json`)
|
|
117
|
+
- Target: ES2022, Module: ESNext
|
|
118
|
+
- Strict mode enabled
|
|
119
|
+
- `moduleResolution: "bundler"`
|
|
120
|
+
- Key options: `verbatimModuleSyntax: true`, `declaration: true`
|
|
121
|
+
- Compiler: TSGO (@typescript/native-preview) for faster type checking
|
|
122
|
+
|
|
123
|
+
### Validation (Arktype)
|
|
124
|
+
Schema validation using Arktype for performance:
|
|
125
|
+
```typescript
|
|
126
|
+
import { type } from 'arktype';
|
|
127
|
+
|
|
128
|
+
export const OptionsSchema = type({
|
|
129
|
+
url: 'string',
|
|
130
|
+
timeout: 'number.optional',
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const result = OptionsSchema(options);
|
|
134
|
+
if (result instanceof type.errors) {
|
|
135
|
+
return err(result.summary());
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Oxlint (`oxlint.json`)
|
|
140
|
+
- Categories: `correctness`, `suspicious`, `perf`, `style` -> "warn"
|
|
141
|
+
- `restriction` -> "off"
|
|
142
|
+
- Env: `node`, `es2021`
|
|
143
|
+
|
|
144
|
+
### Prettier (`.prettierrc`)
|
|
145
|
+
- 100 char width, 2 spaces, single quotes
|
|
146
|
+
- Plugin: `prettier-plugin-organize-imports`
|
|
147
|
+
- Trailing commas: es5
|
|
148
|
+
|
|
149
|
+
## Workspace Dependencies
|
|
150
|
+
|
|
151
|
+
When adding a new package dependency:
|
|
152
|
+
|
|
153
|
+
1. **For shared packages**: Add to appropriate `core/packages/*/package.json`
|
|
154
|
+
2. **For workspace deps**: Use `"mks-fumadocs-template/name": "workspace:*"`
|
|
155
|
+
3. **For external deps**: Add to root `package.json` devDependencies if used across multiple packages
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
bun install # Install/resolves workspace dependencies
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Build Output Patterns
|
|
162
|
+
|
|
163
|
+
- **Rolldown**: Generates JS + sourcemaps, separate `tsc --emitDeclarationOnly` for types
|
|
164
|
+
- Always ESM-first, CJS as optional compatibility layer
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MKS2508
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|