create-ardo 2.1.1 → 2.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.js CHANGED
@@ -31,7 +31,14 @@ function createProjectStructure(root, template, options) {
31
31
  PROJECT_NAME: options.projectName,
32
32
  ARDO_VERSION: getCliVersion(),
33
33
  TYPEDOC_CONFIG: options.typedoc ? "typedoc: true," : "// typedoc: true, // Uncomment to enable API docs",
34
- GITHUB_PAGES_CONFIG: options.githubPages ? "// GitHub Pages: base path auto-detected from git remote" : "githubPages: false, // Disabled for non-GitHub Pages deployment"
34
+ GITHUB_PAGES_CONFIG: options.githubPages ? "// GitHub Pages: base path auto-detected from git remote" : "githubPages: false, // Disabled for non-GitHub Pages deployment",
35
+ GITHUB_PAGES_BASENAME_IMPORT: options.githubPages ? 'import { detectGitHubBasename } from "ardo/vite"' : "",
36
+ GITHUB_PAGES_BASENAME: options.githubPages ? "basename: detectGitHubBasename()," : "// basename: detectGitHubBasename(), // Uncomment for GitHub Pages",
37
+ DESCRIPTION: options.description,
38
+ TYPEDOC_NAV: options.typedoc ? "{ text: 'API', link: '/api-reference' }," : "",
39
+ TYPEDOC_SIDEBAR: options.typedoc ? "{ text: 'API Reference', link: '/api-reference' }," : "",
40
+ TYPEDOC_NAVLINK: options.typedoc ? '<NavLink to="/api-reference">API</NavLink>' : "",
41
+ TYPEDOC_SIDEBARLINK: options.typedoc ? '<SidebarLink to="/api-reference">API Reference</SidebarLink>' : ""
35
42
  };
36
43
  copyDir(templateDir, root, vars);
37
44
  }
@@ -73,6 +80,19 @@ function emptyDir(dir) {
73
80
  function isValidTemplate(template) {
74
81
  return templates.some((t) => t.name === template);
75
82
  }
83
+ function detectProjectDescription(targetDir) {
84
+ for (const dir of [path.dirname(targetDir), targetDir]) {
85
+ const pkgPath = path.join(dir, "package.json");
86
+ try {
87
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
88
+ if (pkg.description) {
89
+ return pkg.description;
90
+ }
91
+ } catch {
92
+ }
93
+ }
94
+ return void 0;
95
+ }
76
96
 
77
97
  // src/index.ts
78
98
  var defaultTargetDir = "my-docs";
@@ -185,11 +205,13 @@ async function main() {
185
205
  console.log();
186
206
  console.log(` ${cyan("Scaffolding project in")} ${root}...`);
187
207
  console.log();
208
+ const description = detectProjectDescription(root) || "Built with Ardo";
188
209
  createProjectStructure(root, template, {
189
210
  siteTitle,
190
211
  projectName: targetDir,
191
212
  typedoc: docType === "library",
192
- githubPages: githubPages ?? true
213
+ githubPages: githubPages ?? true,
214
+ description
193
215
  });
194
216
  console.log(` ${green("Done!")} Now run:`);
195
217
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ardo",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Scaffolding tool for Ardo documentation projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,3 +5,7 @@ build
5
5
 
6
6
  # React Router generated files
7
7
  .react-router
8
+
9
+ # Ardo generated files
10
+ app/routes.ts
11
+ app/routes/api-reference/
@@ -46,6 +46,7 @@ export default function Root() {
46
46
  nav={
47
47
  <Nav>
48
48
  <NavLink to="/guide/getting-started">Guide</NavLink>
49
+ {{TYPEDOC_NAVLINK}}
49
50
  </Nav>
50
51
  }
51
52
  />
@@ -56,6 +57,7 @@ export default function Root() {
56
57
  <SidebarGroup title="Guide">
57
58
  <SidebarLink to="/guide/getting-started">Getting Started</SidebarLink>
58
59
  </SidebarGroup>
60
+ {{TYPEDOC_SIDEBARLINK}}
59
61
  </Sidebar>
60
62
  )
61
63
  }
@@ -1,6 +1,8 @@
1
1
  import type { Config } from "@react-router/dev/config"
2
+ {{GITHUB_PAGES_BASENAME_IMPORT}}
2
3
 
3
4
  export default {
4
5
  ssr: false,
5
6
  prerender: true,
7
+ {{GITHUB_PAGES_BASENAME}}
6
8
  } satisfies Config
@@ -5,7 +5,7 @@ export default defineConfig({
5
5
  plugins: [
6
6
  ardo({
7
7
  title: '{{SITE_TITLE}}',
8
- description: 'Built with Ardo',
8
+ description: '{{DESCRIPTION}}',
9
9
 
10
10
  {{TYPEDOC_CONFIG}}
11
11
 
@@ -14,13 +14,17 @@ export default defineConfig({
14
14
  themeConfig: {
15
15
  siteTitle: '{{SITE_TITLE}}',
16
16
 
17
- nav: [{ text: 'Guide', link: '/guide/getting-started' }],
17
+ nav: [
18
+ { text: 'Guide', link: '/guide/getting-started' },
19
+ {{TYPEDOC_NAV}}
20
+ ],
18
21
 
19
22
  sidebar: [
20
23
  {
21
24
  text: 'Guide',
22
25
  items: [{ text: 'Getting Started', link: '/guide/getting-started' }],
23
26
  },
27
+ {{TYPEDOC_SIDEBAR}}
24
28
  ],
25
29
 
26
30
  footer: {