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
package/dist/bin.js
CHANGED
|
@@ -5184,6 +5184,11 @@ async function selectTemplate(args) {
|
|
|
5184
5184
|
title: "Telegram Bot - Bot de Telegram con Telegraf y TypeScript",
|
|
5185
5185
|
value: "telegram-bot",
|
|
5186
5186
|
description: "Production-ready Telegram bot with polling/webhook support"
|
|
5187
|
+
},
|
|
5188
|
+
{
|
|
5189
|
+
title: "Fumadocs - Documentaci\xF3n con Next.js + MDX + Fumadocs",
|
|
5190
|
+
value: "fumadocs",
|
|
5191
|
+
description: "Bilingual documentation site with GitHub Pages deployment"
|
|
5187
5192
|
}
|
|
5188
5193
|
]
|
|
5189
5194
|
}, {
|
|
@@ -5350,10 +5355,102 @@ Operation cancelled`));
|
|
|
5350
5355
|
runInstall: args.noInstall ? false : response.runInstall ?? true
|
|
5351
5356
|
};
|
|
5352
5357
|
}
|
|
5358
|
+
async function promptFumadocs(args) {
|
|
5359
|
+
const gitUser = await getGitUser();
|
|
5360
|
+
const parsed = parseProjectArg(args.projectName);
|
|
5361
|
+
const response = await import_prompts.default([
|
|
5362
|
+
{
|
|
5363
|
+
type: args.projectName ? null : "text",
|
|
5364
|
+
name: "name",
|
|
5365
|
+
message: "Project name",
|
|
5366
|
+
initial: parsed.name,
|
|
5367
|
+
validate: (value) => {
|
|
5368
|
+
if (!value)
|
|
5369
|
+
return "Project name is required";
|
|
5370
|
+
if (!isValidProjectName(value)) {
|
|
5371
|
+
return "Invalid name. Use lowercase letters, numbers, and hyphens only";
|
|
5372
|
+
}
|
|
5373
|
+
return true;
|
|
5374
|
+
},
|
|
5375
|
+
format: (value) => value.toLowerCase().trim()
|
|
5376
|
+
},
|
|
5377
|
+
{
|
|
5378
|
+
type: args.description ? null : "text",
|
|
5379
|
+
name: "description",
|
|
5380
|
+
message: "Description",
|
|
5381
|
+
initial: "Documentation site built with Fumadocs"
|
|
5382
|
+
},
|
|
5383
|
+
{
|
|
5384
|
+
type: args.author ? null : "text",
|
|
5385
|
+
name: "author",
|
|
5386
|
+
message: "Author",
|
|
5387
|
+
initial: gitUser || "Anonymous"
|
|
5388
|
+
},
|
|
5389
|
+
{
|
|
5390
|
+
type: "text",
|
|
5391
|
+
name: "githubRepo",
|
|
5392
|
+
message: "GitHub repo (e.g., username/repo)",
|
|
5393
|
+
initial: (prev) => `${gitUser || "username"}/${prev}`
|
|
5394
|
+
},
|
|
5395
|
+
{
|
|
5396
|
+
type: "text",
|
|
5397
|
+
name: "basePath",
|
|
5398
|
+
message: "Base path (e.g., /my-docs or / for root)",
|
|
5399
|
+
initial: (prev) => `/${prev}`
|
|
5400
|
+
},
|
|
5401
|
+
{
|
|
5402
|
+
type: "select",
|
|
5403
|
+
name: "defaultLocale",
|
|
5404
|
+
message: "Default locale",
|
|
5405
|
+
choices: [
|
|
5406
|
+
{ title: "Spanish (Espa\xF1ol)", value: "es" },
|
|
5407
|
+
{ title: "English", value: "en" }
|
|
5408
|
+
],
|
|
5409
|
+
initial: 0
|
|
5410
|
+
},
|
|
5411
|
+
{
|
|
5412
|
+
type: args.noGit ? null : "confirm",
|
|
5413
|
+
name: "initGit",
|
|
5414
|
+
message: "Initialize git repository?",
|
|
5415
|
+
initial: true
|
|
5416
|
+
},
|
|
5417
|
+
{
|
|
5418
|
+
type: args.noInstall ? null : "confirm",
|
|
5419
|
+
name: "runInstall",
|
|
5420
|
+
message: "Run bun install?",
|
|
5421
|
+
initial: true
|
|
5422
|
+
}
|
|
5423
|
+
], {
|
|
5424
|
+
onCancel: () => {
|
|
5425
|
+
console.log(kleur_default.red(`
|
|
5426
|
+
Operation cancelled`));
|
|
5427
|
+
process.exit(0);
|
|
5428
|
+
}
|
|
5429
|
+
});
|
|
5430
|
+
const name = args.projectName ? parsed.name : response.name;
|
|
5431
|
+
const targetDir = args.dir || `./${name}`;
|
|
5432
|
+
return {
|
|
5433
|
+
template: "fumadocs",
|
|
5434
|
+
name,
|
|
5435
|
+
scope: "",
|
|
5436
|
+
description: args.description || response.description || "",
|
|
5437
|
+
author: args.author || response.author || gitUser || "Anonymous",
|
|
5438
|
+
githubRepo: response.githubRepo || `${gitUser || "username"}/${name}`,
|
|
5439
|
+
basePath: response.basePath || `/${name}`,
|
|
5440
|
+
defaultLocale: response.defaultLocale || "es",
|
|
5441
|
+
supportedLocales: "es,en",
|
|
5442
|
+
targetDir,
|
|
5443
|
+
initGit: args.noGit ? false : response.initGit ?? true,
|
|
5444
|
+
runInstall: args.noInstall ? false : response.runInstall ?? true
|
|
5445
|
+
};
|
|
5446
|
+
}
|
|
5353
5447
|
async function promptUser(args, templateType) {
|
|
5354
5448
|
if (templateType === "telegram-bot") {
|
|
5355
5449
|
return promptTelegramBot(args);
|
|
5356
5450
|
}
|
|
5451
|
+
if (templateType === "fumadocs") {
|
|
5452
|
+
return promptFumadocs(args);
|
|
5453
|
+
}
|
|
5357
5454
|
return promptMonorepo(args);
|
|
5358
5455
|
}
|
|
5359
5456
|
async function getDefaultsMonorepo(args) {
|
|
@@ -5389,10 +5486,32 @@ async function getDefaultsTelegramBot(args) {
|
|
|
5389
5486
|
runInstall: !args.noInstall
|
|
5390
5487
|
};
|
|
5391
5488
|
}
|
|
5489
|
+
async function getDefaultsFumadocs(args) {
|
|
5490
|
+
const gitUser = await getGitUser();
|
|
5491
|
+
const parsed = parseProjectArg(args.projectName);
|
|
5492
|
+
const targetDir = args.dir || parsed.targetDir;
|
|
5493
|
+
return {
|
|
5494
|
+
template: "fumadocs",
|
|
5495
|
+
name: parsed.name,
|
|
5496
|
+
scope: "",
|
|
5497
|
+
description: args.description || "Documentation site built with Fumadocs",
|
|
5498
|
+
author: args.author || gitUser || "Anonymous",
|
|
5499
|
+
githubRepo: `${gitUser || "username"}/${parsed.name}`,
|
|
5500
|
+
basePath: `/${parsed.name}`,
|
|
5501
|
+
defaultLocale: "es",
|
|
5502
|
+
supportedLocales: "es,en",
|
|
5503
|
+
targetDir,
|
|
5504
|
+
initGit: !args.noGit,
|
|
5505
|
+
runInstall: !args.noInstall
|
|
5506
|
+
};
|
|
5507
|
+
}
|
|
5392
5508
|
async function getDefaults(args, templateType) {
|
|
5393
5509
|
if (templateType === "telegram-bot") {
|
|
5394
5510
|
return getDefaultsTelegramBot(args);
|
|
5395
5511
|
}
|
|
5512
|
+
if (templateType === "fumadocs") {
|
|
5513
|
+
return getDefaultsFumadocs(args);
|
|
5514
|
+
}
|
|
5396
5515
|
return getDefaultsMonorepo(args);
|
|
5397
5516
|
}
|
|
5398
5517
|
|
|
@@ -5407,6 +5526,7 @@ var TEXT_EXTENSIONS = new Set([
|
|
|
5407
5526
|
".jsx",
|
|
5408
5527
|
".json",
|
|
5409
5528
|
".md",
|
|
5529
|
+
".mdx",
|
|
5410
5530
|
".txt",
|
|
5411
5531
|
".yml",
|
|
5412
5532
|
".yaml",
|
|
@@ -5493,6 +5613,17 @@ function generatePlaceholders(config, templateType) {
|
|
|
5493
5613
|
TG_BOT_TOKEN: config.botToken || "YOUR_BOT_TOKEN_HERE"
|
|
5494
5614
|
};
|
|
5495
5615
|
}
|
|
5616
|
+
if (templateType === "fumadocs") {
|
|
5617
|
+
return {
|
|
5618
|
+
...base,
|
|
5619
|
+
PROJECT_NAME: config.name,
|
|
5620
|
+
DESCRIPTION: config.description,
|
|
5621
|
+
GITHUB_REPO: config.githubRepo || `${config.author}/${config.name}`,
|
|
5622
|
+
BASE_PATH: config.basePath || `/${config.name}`,
|
|
5623
|
+
DEFAULT_LOCALE: config.defaultLocale || "es",
|
|
5624
|
+
SUPPORTED_LOCALES: config.supportedLocales || "es,en"
|
|
5625
|
+
};
|
|
5626
|
+
}
|
|
5496
5627
|
throw new Error(`Unknown template: ${templateType}`);
|
|
5497
5628
|
}
|
|
5498
5629
|
async function copyTemplateDir(src, dest, placeholders) {
|
|
@@ -5564,7 +5695,7 @@ async function listTemplates() {
|
|
|
5564
5695
|
console.log(`
|
|
5565
5696
|
\uD83D\uDCE6 Templates Status:
|
|
5566
5697
|
`);
|
|
5567
|
-
const templates = ["monorepo", "telegram-bot"];
|
|
5698
|
+
const templates = ["monorepo", "telegram-bot", "fumadocs"];
|
|
5568
5699
|
for (const name of templates) {
|
|
5569
5700
|
const templatePath = join2(TEMPLATES_DIR, name);
|
|
5570
5701
|
if (!existsSync2(templatePath)) {
|
|
@@ -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.
|