create-boltdocs 0.1.0 → 0.2.0

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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
2
+ //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,66 +7,66 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
16
18
  };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
-
26
- // src/index.ts
27
- var import_node_fs5 = __toESM(require("fs"), 1);
28
- var import_node_path5 = __toESM(require("path"), 1);
29
- var import_node_child_process = require("child_process");
30
- var import_prompts = __toESM(require("prompts"), 1);
31
- var import_picocolors = __toESM(require("picocolors"), 1);
32
-
33
- // src/templates/shared.ts
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let node_fs = require("node:fs");
25
+ node_fs = __toESM(node_fs);
26
+ let node_path = require("node:path");
27
+ node_path = __toESM(node_path);
28
+ let node_child_process = require("node:child_process");
29
+ let prompts = require("prompts");
30
+ prompts = __toESM(prompts);
31
+ let picocolors = require("picocolors");
32
+ picocolors = __toESM(picocolors);
33
+ //#region src/templates/shared.ts
34
34
  function getPackageJson(projectName) {
35
- return {
36
- name: projectName,
37
- version: "1.0.0",
38
- private: true,
39
- type: "module",
40
- scripts: {
41
- dev: "boltdocs",
42
- build: "boltdocs build",
43
- preview: "boltdocs preview",
44
- doctor: "boltdocs doctor",
45
- "lint:md": 'markdownlint-cli2 "**/*.{md,mdx}"',
46
- "lint:md:fix": 'markdownlint-cli2 --fix "**/*.{md,mdx}"'
47
- },
48
- dependencies: {
49
- react: "^19.0.0",
50
- "react-dom": "^19.0.0",
51
- boltdocs: "latest"
52
- },
53
- devDependencies: {
54
- typescript: "^5.7.0",
55
- "@types/react": "^19.0.0",
56
- "@types/react-dom": "^19.0.0",
57
- "markdownlint-cli2": "^0.22.0",
58
- vite: "^7.0.0",
59
- tailwindcss: "^4.0.0",
60
- "@tailwindcss/vite": "^4.2.2"
61
- }
62
- };
35
+ return {
36
+ name: projectName,
37
+ version: "1.0.0",
38
+ private: true,
39
+ type: "module",
40
+ scripts: {
41
+ dev: "boltdocs",
42
+ build: "boltdocs build",
43
+ preview: "boltdocs preview",
44
+ doctor: "boltdocs doctor",
45
+ "lint:md": "markdownlint-cli2 \"docs/**/*.{md,mdx}\"",
46
+ "lint:md:fix": "markdownlint-cli2 --fix \"docs/**/*.{md,mdx}\""
47
+ },
48
+ dependencies: {
49
+ react: "19.2.5",
50
+ "react-dom": "19.2.5",
51
+ boltdocs: "latest"
52
+ },
53
+ devDependencies: {
54
+ typescript: "^5.7.0",
55
+ "@types/react": "^19.2.14",
56
+ "@types/react-dom": "^19.2.3",
57
+ "markdownlint-cli2": "^0.22.0",
58
+ vite: "^7.0.0",
59
+ tailwindcss: "^4.0.0",
60
+ "@tailwindcss/vite": "^4.2.2"
61
+ }
62
+ };
63
63
  }
64
- var gitignoreContent = `node_modules
64
+ const gitignoreContent = `node_modules
65
65
  dist
66
66
  .DS_Store
67
67
  .boltdocs
68
68
  `;
69
- var markdownlintContent = `# Default state for all rules
69
+ const markdownlintContent = `# Default state for all rules
70
70
  default: true
71
71
 
72
72
  # MD013/line-length - Line length
@@ -88,41 +88,40 @@ MD025: false
88
88
  # MD051/link-fragments
89
89
  MD051: false # Sometimes fragments aren't fully resolved locally by the linter
90
90
  `;
91
- var markdownlintignoreContent = `.git
91
+ const markdownlintignoreContent = `.git
92
92
  **/node_modules
93
93
  node_modules
94
94
  dist
95
95
  `;
96
96
  function getLogoLight() {
97
- return `<svg width="60" height="51" viewBox="0 0 60 51" fill="none" xmlns="http://www.w3.org/2000/svg">
97
+ return `<svg width="60" height="51" viewBox="0 0 60 51" fill="none" xmlns="http://www.w3.org/2000/svg">
98
98
  <path d="M29.4449 0H19.4449V16.5L29.4449 6.5V0Z" fill="white"/>
99
99
  <path d="M26.9449 22.7265C26.9449 22.5077 21.2201 27.0658 16.9449 28.5C13.7491 29.5721 12.3156 29.5038 8.94486 29.5C5.59532 29.4963 0 28.5 0 28.5C0 28.5 5.57953 28.5146 8.94486 27.5C12.5409 26.4158 14.8203 25.5843 17.9449 23.5C23.3445 19.898 29.4449 11.5 29.4449 11.5L29.9449 18C29.9449 18 33.5825 15.8308 36.4449 15C39.4452 14.1291 44.4449 14 44.4449 14C44.4449 14 36.9449 19 34.4449 21.5C31.5322 24.4126 29.8582 26.9017 29.4449 31C29.1217 34.2041 29.4771 36.4508 31.4449 39C33.5792 41.765 35.952 43.0183 39.4449 43C42.677 42.9831 45.3003 42.4182 47.4449 40C49.7406 37.4113 50.2495 34.4466 49.9449 31C49.6603 27.7804 48.4876 25.4953 45.9449 23.5C43.2931 21.4191 36.4449 24 36.4449 24L47.9449 15C47.9449 15 51.5761 16.771 53.4449 18.5C55.711 20.5967 56.7467 22.1546 57.9449 25C59.1784 27.9295 59.4832 29.8216 59.4449 33C59.4089 35.9867 59.179 37.78 57.9449 40.5C56.8475 42.9185 55.8511 44.6507 53.9449 46.5C51.9236 48.4609 50.5803 49.0076 47.9449 50C45.5414 50.9051 44.0131 51 41.4449 51C38.8766 51 37.3235 50.9685 34.9449 50C32.4851 48.9985 29.4449 46 29.4449 46V51H19.4449V37.9904L22.9449 31.4226L26.9449 22.7265Z" fill="white"/>
100
100
  </svg>`;
101
101
  }
102
102
  function getLogoDark() {
103
- return `<svg width="60" height="52" viewBox="0 0 60 52" fill="none" xmlns="http://www.w3.org/2000/svg">
103
+ return `<svg width="60" height="52" viewBox="0 0 60 52" fill="none" xmlns="http://www.w3.org/2000/svg">
104
104
  <path d="M29.4449 0H19.4449V16.5L29.4449 6.5V0Z" fill="black"/>
105
105
  <path d="M26.9449 22.7265C26.9449 22.5077 21.2201 27.0658 16.9449 28.5C13.7491 29.5721 12.3156 29.5038 8.94486 29.5C5.59532 29.4963 0 28.5 0 28.5C0 28.5 5.57953 28.5146 8.94486 27.5C12.5409 26.4158 14.8203 25.5843 17.9449 23.5C23.3445 19.898 29.4449 11.5 29.4449 11.5L29.9449 18.5C29.9449 18.5 33.5124 15.5332 36.4449 15C41.9449 14 45.4449 15 45.4449 15C45.4449 15 36.9449 19 34.4449 21.5C31.5322 24.4126 29.8582 26.9017 29.4449 31C29.1217 34.2041 29.4771 36.4508 31.4449 39C33.5792 41.765 35.952 43.0183 39.4449 43C42.677 42.9831 45.3003 42.4182 47.4449 40C49.7406 37.4113 50.2495 34.4466 49.9449 31C49.6603 27.7804 48.4876 25.4953 45.9449 23.5C43.2931 21.4191 36.4449 24 36.4449 24L47.4449 15.5C47.4449 15.5 50.4449 16 53.4449 19C56.4449 22 57.4449 23.5 57.9449 24.5C58.4449 25.5 59.9449 28.5 59.9449 33.5C59.9449 36.4869 59.9449 37.5 57.9449 41.5C55.9449 45.5 52.9449 47.5 52.9449 47.5C52.9449 47.5 51.9449 48.5 49.9449 49.5C47.9449 50.5 45.9289 50.8863 44.9449 51.1121C43.2783 51.4944 42.7023 51.5 41.4449 51.5C40.6256 51.5 39.3731 51.3693 37.9449 51.0624C36.9972 50.8587 35.9722 50.5774 34.9449 50.2051C33.7409 49.7688 32.5339 49.2076 31.4449 48.5C30.6262 47.9681 29.4449 47 29.4449 47V51H19.4449V37.9904L22.9449 31.4226L26.9449 22.7265Z" fill="black"/>
106
106
  </svg>`;
107
107
  }
108
108
  function getBoltdocsConfig(projectName, options = {}) {
109
- const i18nConfig = options.i18n ? `
109
+ const i18nConfig = options.i18n ? `
110
110
  i18n: {
111
111
  defaultLocale: 'en',
112
112
  locales: {
113
113
  en: 'English',
114
- es: 'Espa\xF1ol'
114
+ es: 'Español'
115
115
  },
116
116
  localeConfigs: {
117
117
  en: { label: 'English', direction: 'ltr' },
118
- es: { label: 'Espa\xF1ol', direction: 'ltr' }
118
+ es: { label: 'Español', direction: 'ltr' }
119
119
  }
120
120
  },` : "";
121
- const homePageConfig = options.homePage ? `
122
- homePage: '${options.homePage}',` : "";
123
- return `import { defineConfig } from 'boltdocs';
121
+ return `import { defineConfig } from 'boltdocs';
124
122
 
125
- export default defineConfig({${homePageConfig}${i18nConfig}
123
+ export default defineConfig({${options.homePage ? `
124
+ homePage: '${options.homePage}',` : ""}${i18nConfig}
126
125
  theme: {
127
126
  title: '${projectName}',
128
127
  logo: {
@@ -141,7 +140,7 @@ export default defineConfig({${homePageConfig}${i18nConfig}
141
140
  });`;
142
141
  }
143
142
  function getIndexCss() {
144
- return `@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
143
+ return `
145
144
  @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');
146
145
 
147
146
  @import "tailwindcss";
@@ -152,38 +151,10 @@ function getIndexCss() {
152
151
  inside node_modules for class usage and generate the necessary CSS.
153
152
  */
154
153
  @source "./node_modules/boltdocs/src/client";
155
-
156
- .hero-section {
157
- display: flex;
158
- flex-direction: column;
159
- align-items: center;
160
- justify-content: center;
161
- padding: 8rem 2rem;
162
- text-align: center;
163
- }
164
-
165
- .hero-title {
166
- font-size: 4.5rem;
167
- font-weight: 900;
168
- letter-spacing: -0.02em;
169
- line-height: 1.1;
170
- background: linear-gradient(135deg, var(--color-primary-600) 0%, var(--color-primary-400) 100%);
171
- -webkit-background-clip: text;
172
- -webkit-text-fill-color: transparent;
173
- margin-bottom: 1.5rem;
174
- }
175
-
176
- .hero-subtitle {
177
- font-size: 1.5rem;
178
- color: var(--color-muted);
179
- max-width: 48rem;
180
- margin-bottom: 3rem;
181
- line-height: 1.6;
182
- }
183
154
  `;
184
155
  }
185
156
  function getLayoutPage() {
186
- return `import {
157
+ return `import {
187
158
  DocsLayout,
188
159
  Navbar,
189
160
  Sidebar,
@@ -195,7 +166,6 @@ function getLayoutPage() {
195
166
  CopyMarkdown,
196
167
  useRoutes,
197
168
  useConfig,
198
- useMdxComponents,
199
169
  useLocation
200
170
  } from 'boltdocs/client'
201
171
 
@@ -203,46 +173,45 @@ export default function Layout({ children }: { children: React.ReactNode }) {
203
173
  const { routes: filteredRoutes, allRoutes, currentRoute } = useRoutes()
204
174
  const { pathname } = useLocation()
205
175
  const config = useConfig()
206
- const mdxComponents = useMdxComponents()
207
- const CopyMarkdownComp = (mdxComponents.CopyMarkdown as any) || CopyMarkdown
208
176
 
209
- const isHome = pathname === '/' || pathname === ''
177
+ const isDocs = pathname.startsWith('/docs')
210
178
 
211
179
  return (
212
180
  <DocsLayout>
213
- {/* Modern Spotlight Gradients */}
214
181
  <Head
215
- siteTitle={config.theme?.title || 'Boltdocs'}
216
- siteDescription={config.theme?.description || ''}
182
+ siteTitle={config.theme?.title}
183
+ siteDescription={config.theme?.description}
217
184
  routes={allRoutes}
218
185
  />
219
186
  <Navbar />
220
187
 
221
188
  <DocsLayout.Body>
222
- {!isHome && <Sidebar routes={filteredRoutes} config={config} />}
189
+ {isDocs && <Sidebar routes={filteredRoutes} config={config} />}
223
190
 
224
191
  <DocsLayout.Content>
225
- {!isHome && (
226
- <DocsLayout.ContentHeader>
227
- <Breadcrumbs />
228
- <CopyMarkdownComp
229
- mdxRaw={currentRoute?._rawContent}
230
- route={currentRoute}
231
- config={config.theme?.copyMarkdown}
232
- />
233
- </DocsLayout.ContentHeader>
234
- )}
235
-
236
- <ErrorBoundary>{children}</ErrorBoundary>
237
-
238
- {!isHome && (
239
- <DocsLayout.ContentFooter>
240
- <PageNav />
241
- </DocsLayout.ContentFooter>
242
- )}
192
+ <DocsLayout.ContentMdx>
193
+ {isDocs && (
194
+ <DocsLayout.ContentHeader>
195
+ <Breadcrumbs />
196
+ <CopyMarkdown
197
+ mdxRaw={currentRoute?._rawContent}
198
+ route={currentRoute}
199
+ config={config.theme?.copyMarkdown}
200
+ />
201
+ </DocsLayout.ContentHeader>
202
+ )}
203
+
204
+ <ErrorBoundary>{children}</ErrorBoundary>
205
+
206
+ {isDocs && (
207
+ <DocsLayout.ContentFooter>
208
+ <PageNav />
209
+ </DocsLayout.ContentFooter>
210
+ )}
211
+ </DocsLayout.ContentMdx>
243
212
  </DocsLayout.Content>
244
213
 
245
- {!isHome && (
214
+ {isDocs && (
246
215
  <OnThisPage
247
216
  headings={currentRoute?.headings}
248
217
  editLink={config.theme?.editLink}
@@ -254,40 +223,78 @@ export default function Layout({ children }: { children: React.ReactNode }) {
254
223
  </DocsLayout>
255
224
  )
256
225
  }
257
-
258
226
  `;
259
227
  }
260
-
261
- // src/templates/empty.ts
262
- var import_node_path = __toESM(require("path"), 1);
263
- var import_node_fs = __toESM(require("fs"), 1);
264
- function generateEmptyTemplate(projectDir, projectName) {
265
- const srcDir = import_node_path.default.join(projectDir, "src");
266
- import_node_fs.default.mkdirSync(srcDir, { recursive: true });
267
- const homePageContent = `import React from 'react';
228
+ function generateHomePage() {
229
+ return `
230
+ import { Button, Cards, Card } from 'boltdocs/client'
231
+ import { time } from 'node:console';
232
+
233
+ const features = [
234
+ {
235
+ title: 'Fast and Lightweight',
236
+ description: 'Boltdocs is built with performance in mind, ensuring your documentation loads quickly and efficiently.',
237
+ icon: '⚡',
238
+ href: "https://boltdocs.vercel.app/docs/guides/overview/introduction"
239
+ },
240
+ {
241
+ title: "I18n & Versioning Support",
242
+ description: "Easily manage multiple languages and versions of your documentation with built-in support.",
243
+ icon: '🌐',
244
+ href: 'https://boltdocs.vercel.app/docs/guides/core-concepts/i18n'
245
+ },
246
+ {
247
+ title: 'Customizable',
248
+ description: 'Tailor your documentation site to your needs with flexible customization options.',
249
+ icon: '🎨',
250
+ href: 'https://boltdocs.vercel.app/docs/guides/customization/theme'
251
+
252
+ },
253
+ {
254
+ title: "plugins",
255
+ description: "Extend Boltdocs' functionality with a growing ecosystem of plugins.",
256
+ icon: '🔌',
257
+ href: 'https://boltdocs.vercel.app/docs/plugins'
258
+ }
259
+ ]
268
260
 
269
261
  export default function HomePage() {
270
262
  return (
271
- <div className="hero-section">
272
- <h1 className="hero-title">${projectName}</h1>
273
- <p className="hero-subtitle">
274
- Your minimal documentation site is ready. Start building something amazing.
275
- </p>
276
- <div className="flex gap-4">
277
- <a href="/docs" className="bg-primary text-primary-foreground px-8 py-3 rounded-lg no-underline font-semibold text-lg hover:opacity-90 transition-opacity">
278
- Get Started
279
- </a>
280
- </div>
263
+ <div className="w-full h-screen flex flex-col items-center pt-10 gap-6">
264
+ <header className='flex flex-col items-center'>
265
+ <h1 className="text-4xl font-bold text-center">Powerful Documentation</h1>
266
+ <p className="text-center">
267
+ Your minimal documentation site is ready. Start building something amazing.
268
+ </p>
269
+ <div className="flex gap-4">
270
+ <Button href="/docs">
271
+ Get Started
272
+ </Button>
273
+ </div>
274
+ </header>
275
+ <Cards className='mx-auto w-[60%]' cols={2}>
276
+ {features.map((feature, index) => (
277
+ <Card href={feature.href} key={index} title={feature.title} icon={feature.icon}>
278
+ <p>{feature.description}</p>
279
+ </Card>
280
+ ))}
281
+ </Cards>
281
282
  </div>
282
283
  );
283
284
  }
284
285
  `;
285
- const docsDir = import_node_path.default.join(projectDir, "docs");
286
- import_node_fs.default.mkdirSync(docsDir, { recursive: true });
287
- import_node_fs.default.writeFileSync(import_node_path.default.join(srcDir, "HomePage.tsx"), homePageContent);
288
- import_node_fs.default.writeFileSync(import_node_path.default.join(projectDir, "index.css"), getIndexCss());
289
- import_node_fs.default.writeFileSync(import_node_path.default.join(docsDir, "layout.tsx"), getLayoutPage());
290
- const indexMdx = `---
286
+ }
287
+ //#endregion
288
+ //#region src/templates/empty.ts
289
+ function generateEmptyTemplate(projectDir, projectName) {
290
+ const srcDir = node_path.default.join(projectDir, "src");
291
+ node_fs.default.mkdirSync(srcDir, { recursive: true });
292
+ const docsDir = node_path.default.join(projectDir, "docs");
293
+ node_fs.default.mkdirSync(docsDir, { recursive: true });
294
+ node_fs.default.writeFileSync(node_path.default.join(srcDir, "home-page.tsx"), generateHomePage());
295
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, "index.css"), getIndexCss());
296
+ node_fs.default.writeFileSync(node_path.default.join(docsDir, "layout.tsx"), getLayoutPage());
297
+ const indexMdx = `---
291
298
  title: Welcome
292
299
  ---
293
300
 
@@ -295,18 +302,16 @@ title: Welcome
295
302
 
296
303
  This is a minimal documentation setup. You can start by editing \`docs/index.mdx\`.
297
304
  `;
298
- import_node_fs.default.writeFileSync(import_node_path.default.join(docsDir, "index.mdx"), indexMdx);
305
+ node_fs.default.writeFileSync(node_path.default.join(docsDir, "index.mdx"), indexMdx);
299
306
  }
300
-
301
- // src/templates/base.ts
302
- var import_node_path2 = __toESM(require("path"), 1);
303
- var import_node_fs2 = __toESM(require("fs"), 1);
304
- function generateBaseTemplate(projectDir) {
305
- const srcDir = import_node_path2.default.join(projectDir, "src");
306
- import_node_fs2.default.mkdirSync(srcDir, { recursive: true });
307
- const componentsDir = import_node_path2.default.join(srcDir, "components");
308
- import_node_fs2.default.mkdirSync(componentsDir, { recursive: true });
309
- const buttonContent = `import React from 'react';
307
+ //#endregion
308
+ //#region src/templates/base.ts
309
+ function generateBaseTemplate(projectDir, projectName) {
310
+ const srcDir = node_path.default.join(projectDir, "src");
311
+ node_fs.default.mkdirSync(srcDir, { recursive: true });
312
+ const componentsDir = node_path.default.join(srcDir, "components");
313
+ node_fs.default.mkdirSync(componentsDir, { recursive: true });
314
+ node_fs.default.writeFileSync(node_path.default.join(componentsDir, "Button.tsx"), `import React from 'react';
310
315
 
311
316
  export function Button({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) {
312
317
  return (
@@ -318,58 +323,13 @@ export function Button({ children, ...props }: React.ButtonHTMLAttributes<HTMLBu
318
323
  </button>
319
324
  );
320
325
  }
321
- `;
322
- import_node_fs2.default.writeFileSync(import_node_path2.default.join(componentsDir, "Button.tsx"), buttonContent);
323
- const homePageContent = `import { Button, Cards, Card } from 'boltdocs/client';
324
-
325
- export default function HomePage() {
326
- return (
327
- <div className="hero-section">
328
- <h1 className="hero-title">my-boltdocs-app</h1>
329
- <p className="hero-subtitle">
330
- The modern documentation framework. Fast, efficient, and beautiful by default.
331
- </p>
332
-
333
- <div className="flex gap-4 mb-16">
334
- <Button href="/docs">
335
- Get Started
336
- </Button>
337
- <Button href="https://github.com/jesusalcaladev/boltdocs" variant={'ghost'}>
338
- GitHub
339
- </Button>
340
- </div>
341
-
342
- <Cards>
343
- {[
344
- {
345
- title: "Performance First",
346
- desc: "Ultra-fast load times and instant HMR with Vite-powered development."
347
- },
348
- {
349
- title: "MDX Support",
350
- desc: "Write documentation with React components directly in your markdown files."
351
- },
352
- {
353
- title: "Fully Customizable",
354
- desc: "Custom layouts, components, and themes tailored to your project needs."
355
- }
356
- ].map((feat, i) => (
357
- <Card key={i} title={feat.title}>
358
- {feat.desc}
359
- </Card>
360
- ))}
361
- </Cards>
362
- </div>
363
- );
364
- }
365
-
366
- `;
367
- const docsDir = import_node_path2.default.join(projectDir, "docs");
368
- import_node_fs2.default.mkdirSync(docsDir, { recursive: true });
369
- import_node_fs2.default.writeFileSync(import_node_path2.default.join(srcDir, "home-page.tsx"), homePageContent);
370
- import_node_fs2.default.writeFileSync(import_node_path2.default.join(docsDir, "layout.tsx"), getLayoutPage());
371
- import_node_fs2.default.writeFileSync(import_node_path2.default.join(projectDir, "index.css"), getIndexCss());
372
- const indexMdx = `---
326
+ `);
327
+ const docsDir = node_path.default.join(projectDir, "docs");
328
+ node_fs.default.mkdirSync(docsDir, { recursive: true });
329
+ node_fs.default.writeFileSync(node_path.default.join(srcDir, "home-page.tsx"), generateHomePage());
330
+ node_fs.default.writeFileSync(node_path.default.join(docsDir, "layout.tsx"), getLayoutPage());
331
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, "index.css"), getIndexCss());
332
+ node_fs.default.writeFileSync(node_path.default.join(docsDir, "index.mdx"), `---
373
333
  title: Introduction
374
334
  ---
375
335
 
@@ -388,19 +348,16 @@ Welcome to your new documentation site!
388
348
  </Tip>
389
349
 
390
350
  <Button onClick={() => alert('Hello world!')}>Try me</Button>
391
- `;
392
- import_node_fs2.default.writeFileSync(import_node_path2.default.join(docsDir, "index.mdx"), indexMdx);
351
+ `);
393
352
  }
394
-
395
- // src/templates/i18n.ts
396
- var import_node_path3 = __toESM(require("path"), 1);
397
- var import_node_fs3 = __toESM(require("fs"), 1);
398
- function generateI18nTemplate(projectDir) {
399
- const srcDir = import_node_path3.default.join(projectDir, "src");
400
- import_node_fs3.default.mkdirSync(srcDir, { recursive: true });
401
- const componentsDir = import_node_path3.default.join(srcDir, "components");
402
- import_node_fs3.default.mkdirSync(componentsDir, { recursive: true });
403
- const buttonContent = `import React from 'react';
353
+ //#endregion
354
+ //#region src/templates/i18n.ts
355
+ function generateI18nTemplate(projectDir, projectName) {
356
+ const srcDir = node_path.default.join(projectDir, "src");
357
+ node_fs.default.mkdirSync(srcDir, { recursive: true });
358
+ const componentsDir = node_path.default.join(srcDir, "components");
359
+ node_fs.default.mkdirSync(componentsDir, { recursive: true });
360
+ node_fs.default.writeFileSync(node_path.default.join(componentsDir, "Button.tsx"), `import React from 'react';
404
361
 
405
362
  export function Button({ children, className = '', ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) {
406
363
  return (
@@ -412,54 +369,13 @@ export function Button({ children, className = '', ...props }: React.ButtonHTMLA
412
369
  </button>
413
370
  );
414
371
  }
415
- `;
416
- import_node_fs3.default.writeFileSync(import_node_path3.default.join(componentsDir, "Button.tsx"), buttonContent);
417
- const homePageContent = `import React from 'react';
418
- import { Button } from './components/Button';
419
- import { useI18n } from 'boltdocs/client';
420
-
421
- export default function HomePage() {
422
- const { currentLocale } = useI18n();
423
- const locale = currentLocale || 'en';
424
-
425
- const translations: any = {
426
- en: {
427
- title: "Global Documentation",
428
- subtitle: "Multi-language support built-in.",
429
- button: "Get Started"
430
- },
431
- es: {
432
- title: "Documentaci\xF3n Global",
433
- subtitle: "Soporte multi-idioma integrado.",
434
- button: "Comenzar"
435
- }
436
- };
437
-
438
- const content = translations[locale] || translations.en;
439
-
440
- return (
441
- <div className="hero-section">
442
- <h1 className="hero-title">{content.title}</h1>
443
- <p className="hero-subtitle">{content.subtitle}</p>
444
- <div className="flex gap-4">
445
- <a href="/docs" className="no-underline">
446
- <Button className="text-lg px-10 py-4">
447
- {content.button}
448
- </Button>
449
- </a>
450
- </div>
451
- </div>
452
- );
453
- }
454
- `;
455
- const docsDir = import_node_path3.default.join(projectDir, "docs");
456
- import_node_fs3.default.mkdirSync(docsDir, { recursive: true });
457
- import_node_fs3.default.writeFileSync(import_node_path3.default.join(srcDir, "home-page.tsx"), homePageContent);
458
- import_node_fs3.default.writeFileSync(import_node_path3.default.join(projectDir, "index.css"), getIndexCss());
459
- import_node_fs3.default.writeFileSync(import_node_path3.default.join(docsDir, "layout.tsx"), getLayoutPage());
460
- import_node_fs3.default.writeFileSync(
461
- import_node_path3.default.join(docsDir, "index.mdx"),
462
- `---
372
+ `);
373
+ const docsDir = node_path.default.join(projectDir, "docs");
374
+ node_fs.default.mkdirSync(docsDir, { recursive: true });
375
+ node_fs.default.writeFileSync(node_path.default.join(srcDir, "home-page.tsx"), generateHomePage());
376
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, "index.css"), getIndexCss());
377
+ node_fs.default.writeFileSync(node_path.default.join(docsDir, "layout.tsx"), getLayoutPage());
378
+ node_fs.default.writeFileSync(node_path.default.join(docsDir, "index.mdx"), `---
463
379
  title: Introduction
464
380
  ---
465
381
 
@@ -468,36 +384,30 @@ title: Introduction
468
384
  This project is configured with English and Spanish support.
469
385
 
470
386
  Check the \`es/\` folder for Spanish content.
471
- `
472
- );
473
- const esDocsDir = import_node_path3.default.join(docsDir, "es");
474
- import_node_fs3.default.mkdirSync(esDocsDir, { recursive: true });
475
- import_node_fs3.default.writeFileSync(
476
- import_node_path3.default.join(esDocsDir, "index.mdx"),
477
- `---
478
- title: Introducci\xF3n
387
+ `);
388
+ const esDocsDir = node_path.default.join(docsDir, "es");
389
+ node_fs.default.mkdirSync(esDocsDir, { recursive: true });
390
+ node_fs.default.writeFileSync(node_path.default.join(esDocsDir, "index.mdx"), `---
391
+ title: Introducción
479
392
  ---
480
393
 
481
- # Internacionalizaci\xF3n
394
+ # Internacionalización
482
395
 
483
- Este proyecto est\xE1 configurado con soporte para Ingl\xE9s y Espa\xF1ol.
396
+ Este proyecto está configurado con soporte para Inglés y Español.
484
397
 
485
- Boltdocs detecta autom\xE1ticamente las carpetas de idiomas.
486
- `
487
- );
398
+ Boltdocs detecta automáticamente las carpetas de idiomas.
399
+ `);
488
400
  }
489
-
490
- // src/templates/external.ts
491
- var import_node_path4 = __toESM(require("path"), 1);
492
- var import_node_fs4 = __toESM(require("fs"), 1);
493
- function generateExternalTemplate(projectDir) {
494
- const srcDir = import_node_path4.default.join(projectDir, "src");
495
- import_node_fs4.default.mkdirSync(srcDir, { recursive: true });
496
- const docsDir = import_node_path4.default.join(projectDir, "docs");
497
- import_node_fs4.default.mkdirSync(docsDir, { recursive: true });
498
- const externalPagesDir = import_node_path4.default.join(docsDir, "pages-external");
499
- import_node_fs4.default.mkdirSync(externalPagesDir, { recursive: true });
500
- const externalPagesContent = `import React from 'react'
401
+ //#endregion
402
+ //#region src/templates/external.ts
403
+ function generateExternalTemplate(projectDir, projectName) {
404
+ const srcDir = node_path.default.join(projectDir, "src");
405
+ node_fs.default.mkdirSync(srcDir, { recursive: true });
406
+ const docsDir = node_path.default.join(projectDir, "docs");
407
+ node_fs.default.mkdirSync(docsDir, { recursive: true });
408
+ const externalPagesDir = node_path.default.join(docsDir, "pages-external");
409
+ node_fs.default.mkdirSync(externalPagesDir, { recursive: true });
410
+ node_fs.default.writeFileSync(node_path.default.join(externalPagesDir, "index.tsx"), `import React from 'react'
501
411
  import { PrimitiveButton } from 'boltdocs/client'
502
412
  import HomePage from '../../src/home-page'
503
413
 
@@ -554,38 +464,10 @@ export const layout = ({ children }: { children: React.ReactNode }) => (
554
464
  </footer>
555
465
  </div>
556
466
  )
557
- `;
558
- import_node_fs4.default.writeFileSync(
559
- import_node_path4.default.join(externalPagesDir, "index.tsx"),
560
- externalPagesContent
561
- );
562
- const homePageContent = `import React from 'react'
563
- import { Button } from 'boltdocs/client'
564
-
565
- export default function HomePage() {
566
- return (
567
- <div className="hero-section">
568
- <h1 className="hero-title text-center">External Pages</h1>
569
- <p className="hero-subtitle text-center">
570
- Boltdocs now supports standalone React pages and custom layouts outside the standard docs structure.
571
- </p>
572
- <div className="flex gap-4">
573
- <a href="/docs" className="no-underline">
574
- <Button className="text-lg px-10 py-4">Read Docs</Button>
575
- </a>
576
- <a href="/contact" className="no-underline">
577
- <Button variant="ghost" className="text-lg px-10 py-4">External Page</Button>
578
- </a>
579
- </div>
580
- </div>
581
- )
582
- }
583
- `;
584
- import_node_fs4.default.writeFileSync(import_node_path4.default.join(srcDir, "home-page.tsx"), homePageContent);
585
- import_node_fs4.default.writeFileSync(import_node_path4.default.join(projectDir, "index.css"), getIndexCss());
586
- import_node_fs4.default.writeFileSync(
587
- import_node_path4.default.join(docsDir, "index.mdx"),
588
- `---
467
+ `);
468
+ node_fs.default.writeFileSync(node_path.default.join(srcDir, "home-page.tsx"), generateHomePage());
469
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, "index.css"), getIndexCss());
470
+ node_fs.default.writeFileSync(node_path.default.join(docsDir, "index.mdx"), `---
589
471
  title: Introduction
590
472
  ---
591
473
 
@@ -596,152 +478,117 @@ This project demonstrates the \`pages-external\` feature of Boltdocs.
596
478
  Check out [Contact Page](/contact) to see it in action.
597
479
 
598
480
  The source code for that page is located in \`docs/pages-external/index.tsx\`.
599
- `
600
- );
481
+ `);
601
482
  }
602
-
603
- // src/index.ts
604
- var { green, yellow, bold, cyan, magenta, blue, red, dim } = import_picocolors.default;
483
+ //#endregion
484
+ //#region src/index.ts
485
+ const { green, yellow, bold, cyan, magenta, blue, red, dim } = picocolors.default;
605
486
  function getPackageManager() {
606
- const userAgent = process.env.npm_config_user_agent;
607
- if (userAgent?.includes("pnpm")) return "pnpm";
608
- if (userAgent?.includes("yarn")) return "yarn";
609
- if (userAgent?.includes("bun")) return "bun";
610
- return "npm";
487
+ const userAgent = process.env.npm_config_user_agent;
488
+ if (userAgent?.includes("pnpm")) return "pnpm";
489
+ if (userAgent?.includes("yarn")) return "yarn";
490
+ if (userAgent?.includes("bun")) return "bun";
491
+ return "npm";
611
492
  }
612
493
  async function run() {
613
- const pkgManager = getPackageManager();
614
- console.log(
615
- blue(
616
- bold(`
494
+ const pkgManager = getPackageManager();
495
+ console.log(blue(bold(`
617
496
  ____ ___ _ _____ ____ ___ ____ ____
618
497
  | __ ) / _ \\| | |_ _| _ \\ / _ \\ / ___/ ___|
619
498
  | _ \\| | | | | | | | | | | | | | | \\___ \\
620
499
  | |_) | |_| | |___ | | | |_| | |_| | |___ ___) |
621
- |____/ \\___/|_____| |_| |____/ \\___/ \\____|____/`)
622
- )
623
- );
624
- console.log(dim(`
625
- v0.0.2 - The modern documentation framework
626
- `));
627
- const response = await (0, import_prompts.default)([
628
- {
629
- type: "text",
630
- name: "projectName",
631
- message: "Project name:",
632
- initial: "my-boltdocs-app"
633
- },
634
- {
635
- type: "select",
636
- name: "template",
637
- message: "Select a project preset:",
638
- choices: [
639
- {
640
- title: cyan("Empty"),
641
- description: "Minimal documentation setup.",
642
- value: "empty"
643
- },
644
- {
645
- title: magenta("Base"),
646
- description: "Hero and custom components.",
647
- value: "base"
648
- },
649
- {
650
- title: yellow("i18n"),
651
- description: "Multi-language support (EN/ES).",
652
- value: "i18n"
653
- },
654
- {
655
- title: blue("External"),
656
- description: "Custom routes and external layouts.",
657
- value: "external"
658
- }
659
- ],
660
- initial: 1
661
- },
662
- {
663
- type: "confirm",
664
- name: "install",
665
- message: `Install dependencies with ${bold(pkgManager)}?`,
666
- initial: true
667
- }
668
- ]);
669
- if (!response.projectName || !response.template) {
670
- console.log(yellow("\nOperation canceled."));
671
- return;
672
- }
673
- const projectDir = import_node_path5.default.join(process.cwd(), response.projectName);
674
- if (import_node_fs5.default.existsSync(projectDir)) {
675
- console.error(
676
- red(`
677
- Error: Directory "${response.projectName}" already exists.`)
678
- );
679
- process.exit(1);
680
- }
681
- console.log(dim(`
682
- Building your documentation site...
683
- `));
684
- import_node_fs5.default.mkdirSync(projectDir, { recursive: true });
685
- console.log(`${green("\u2714")} Created project directory`);
686
- const configOptions = {};
687
- if (response.template === "empty") {
688
- generateEmptyTemplate(projectDir, response.projectName);
689
- } else if (response.template === "i18n") {
690
- configOptions.i18n = true;
691
- configOptions.homePage = "./src/home-page.tsx";
692
- generateI18nTemplate(projectDir);
693
- } else if (response.template === "external") {
694
- generateExternalTemplate(projectDir);
695
- } else {
696
- configOptions.homePage = "./src/home-page.tsx";
697
- generateBaseTemplate(projectDir);
698
- }
699
- console.log(`${green("\u2714")} Applied "${response.template}" preset`);
700
- import_node_fs5.default.writeFileSync(
701
- import_node_path5.default.join(projectDir, "package.json"),
702
- JSON.stringify(getPackageJson(response.projectName), null, 2)
703
- );
704
- import_node_fs5.default.writeFileSync(import_node_path5.default.join(projectDir, ".gitignore"), gitignoreContent);
705
- import_node_fs5.default.writeFileSync(import_node_path5.default.join(projectDir, ".npmignore"), gitignoreContent);
706
- import_node_fs5.default.writeFileSync(
707
- import_node_path5.default.join(projectDir, ".markdownlint.yaml"),
708
- markdownlintContent
709
- );
710
- import_node_fs5.default.writeFileSync(
711
- import_node_path5.default.join(projectDir, ".markdownlintignore"),
712
- markdownlintignoreContent
713
- );
714
- import_node_fs5.default.writeFileSync(
715
- import_node_path5.default.join(projectDir, "boltdocs.config.ts"),
716
- getBoltdocsConfig(response.projectName, configOptions)
717
- );
718
- const publicDir = import_node_path5.default.join(projectDir, "public");
719
- import_node_fs5.default.mkdirSync(publicDir, { recursive: true });
720
- import_node_fs5.default.writeFileSync(import_node_path5.default.join(publicDir, "logo-light.svg"), getLogoLight());
721
- import_node_fs5.default.writeFileSync(import_node_path5.default.join(publicDir, "logo-dark.svg"), getLogoDark());
722
- console.log(`${green("\u2714")} Finalized configuration and assets`);
723
- if (response.install) {
724
- console.log(cyan(`
725
- Installing dependencies with ${pkgManager}...
726
- `));
727
- try {
728
- (0, import_node_child_process.execSync)(`${pkgManager} install`, { cwd: projectDir, stdio: "inherit" });
729
- console.log(`
730
- ${green("\u2714")} Dependencies installed successfully`);
731
- } catch (e) {
732
- console.log(
733
- yellow(
734
- `
735
- Could not install dependencies automatically. Please run "${pkgManager} install".`
736
- )
737
- );
738
- }
739
- }
740
- console.log(bold(green("\n\u2728 All set! Your documentation is ready. \u2728\n")));
741
- console.log(`To start developing:`);
742
- console.log(` cd ${response.projectName}`);
743
- if (!response.install) console.log(` ${pkgManager} install`);
744
- console.log(` ${pkgManager} run dev
745
- `);
500
+ |____/ \\___/|_____| |_| |____/ \\___/ \\____|____/`)));
501
+ console.log(dim(`\n v0.0.2 - The modern documentation framework\n`));
502
+ const response = await (0, prompts.default)([
503
+ {
504
+ type: "text",
505
+ name: "projectName",
506
+ message: "Project name:",
507
+ initial: "my-boltdocs-app"
508
+ },
509
+ {
510
+ type: "select",
511
+ name: "template",
512
+ message: "Select a project preset:",
513
+ choices: [
514
+ {
515
+ title: cyan("Empty"),
516
+ description: "Minimal documentation setup.",
517
+ value: "empty"
518
+ },
519
+ {
520
+ title: magenta("Base"),
521
+ description: "Hero and custom components.",
522
+ value: "base"
523
+ },
524
+ {
525
+ title: yellow("i18n"),
526
+ description: "Multi-language support (EN/ES).",
527
+ value: "i18n"
528
+ },
529
+ {
530
+ title: blue("External"),
531
+ description: "Custom routes and external layouts.",
532
+ value: "external"
533
+ }
534
+ ],
535
+ initial: 1
536
+ },
537
+ {
538
+ type: "confirm",
539
+ name: "install",
540
+ message: `Install dependencies with ${bold(pkgManager)}?`,
541
+ initial: true
542
+ }
543
+ ]);
544
+ if (!response.projectName || !response.template) {
545
+ console.log(yellow("\nOperation canceled."));
546
+ return;
547
+ }
548
+ const projectDir = node_path.default.join(process.cwd(), response.projectName);
549
+ if (node_fs.default.existsSync(projectDir)) {
550
+ console.error(red(`\nError: Directory "${response.projectName}" already exists.`));
551
+ process.exit(1);
552
+ }
553
+ console.log(dim(`\nBuilding your documentation site...\n`));
554
+ node_fs.default.mkdirSync(projectDir, { recursive: true });
555
+ console.log(`${green("✔")} Created project directory`);
556
+ const configOptions = { homePage: "./src/home-page.tsx" };
557
+ if (response.template === "empty") generateEmptyTemplate(projectDir, response.projectName);
558
+ else if (response.template === "i18n") {
559
+ configOptions.i18n = true;
560
+ generateI18nTemplate(projectDir, response.projectName);
561
+ } else if (response.template === "external") generateExternalTemplate(projectDir, response.projectName);
562
+ else generateBaseTemplate(projectDir, response.projectName);
563
+ console.log(`${green("✔")} Applied "${response.template}" preset`);
564
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, "package.json"), JSON.stringify(getPackageJson(response.projectName), null, 2));
565
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, ".gitignore"), gitignoreContent);
566
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, ".npmignore"), gitignoreContent);
567
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, ".markdownlint.yaml"), markdownlintContent);
568
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, ".markdownlintignore"), markdownlintignoreContent);
569
+ node_fs.default.writeFileSync(node_path.default.join(projectDir, "boltdocs.config.ts"), getBoltdocsConfig(response.projectName, configOptions));
570
+ const publicDir = node_path.default.join(projectDir, "public");
571
+ node_fs.default.mkdirSync(publicDir, { recursive: true });
572
+ node_fs.default.writeFileSync(node_path.default.join(publicDir, "logo-light.svg"), getLogoLight());
573
+ node_fs.default.writeFileSync(node_path.default.join(publicDir, "logo-dark.svg"), getLogoDark());
574
+ console.log(`${green("✔")} Finalized configuration and assets`);
575
+ if (response.install) {
576
+ console.log(cyan(`\nInstalling dependencies with ${pkgManager}...\n`));
577
+ try {
578
+ (0, node_child_process.execSync)(`${pkgManager} install`, {
579
+ cwd: projectDir,
580
+ stdio: "inherit"
581
+ });
582
+ console.log(`\n${green("✔")} Dependencies installed successfully`);
583
+ } catch (e) {
584
+ console.log(yellow(`\nCould not install dependencies automatically. Please run "${pkgManager} install".`));
585
+ }
586
+ }
587
+ console.log(bold(green("\n✨ All set! Your documentation is ready. ✨\n")));
588
+ console.log(`To start developing:`);
589
+ console.log(` cd ${response.projectName}`);
590
+ if (!response.install) console.log(` ${pkgManager} install`);
591
+ console.log(` ${pkgManager} run dev\n`);
746
592
  }
747
593
  run().catch(console.error);
594
+ //#endregion