@litodocs/cli 1.0.0 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litodocs/cli",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Beautiful documentation sites from Markdown. Fast, simple, and open-source.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -60,6 +60,18 @@ const DEFAULT_FRAMEWORK_CONFIGS = {
60
60
  // HMR trigger file that will be updated when content changes
61
61
  hmrTriggerFile: 'src/.lito-hmr-trigger.js',
62
62
  },
63
+ nuxt: {
64
+ name: 'nuxt',
65
+ commands: {
66
+ dev: ['nuxt', ['dev']],
67
+ build: ['nuxt', ['build']],
68
+ },
69
+ contentDir: 'content',
70
+ publicDir: 'public',
71
+ configFile: 'nuxt.config.ts',
72
+ layoutInjection: false,
73
+ useMDX: true,
74
+ },
63
75
  };
64
76
 
65
77
  /**
@@ -99,6 +111,11 @@ export async function detectFramework(projectDir) {
99
111
  return DEFAULT_FRAMEWORK_CONFIGS.astro;
100
112
  }
101
113
 
114
+ if (await pathExists(join(projectDir, 'nuxt.config.ts')) ||
115
+ await pathExists(join(projectDir, 'nuxt.config.js'))) {
116
+ return DEFAULT_FRAMEWORK_CONFIGS.nuxt;
117
+ }
118
+
102
119
  if (await pathExists(join(projectDir, 'next.config.js')) ||
103
120
  await pathExists(join(projectDir, 'next.config.mjs')) ||
104
121
  await pathExists(join(projectDir, 'next.config.ts'))) {
@@ -113,6 +130,7 @@ export async function detectFramework(projectDir) {
113
130
  const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
114
131
 
115
132
  if (deps['next']) return DEFAULT_FRAMEWORK_CONFIGS.next;
133
+ if (deps['nuxt']) return DEFAULT_FRAMEWORK_CONFIGS.nuxt;
116
134
  if (deps['astro']) return DEFAULT_FRAMEWORK_CONFIGS.astro;
117
135
  if (deps['vue'] && deps['vite']) return DEFAULT_FRAMEWORK_CONFIGS.vue;
118
136
  if (deps['react'] && deps['vite']) return DEFAULT_FRAMEWORK_CONFIGS.react;
@@ -162,6 +180,8 @@ export async function runFrameworkDev(projectDir, frameworkConfig, port = '4321'
162
180
  devArgs.push('--port', port);
163
181
  } else if (frameworkConfig.name === 'next') {
164
182
  devArgs.push('-p', port);
183
+ } else if (frameworkConfig.name === 'nuxt') {
184
+ devArgs.push('--port', port);
165
185
  } else {
166
186
  // Vite-based frameworks
167
187
  devArgs.push('--port', port);
@@ -189,6 +209,8 @@ export function getOutputDir(frameworkConfig) {
189
209
  return 'dist';
190
210
  case 'next':
191
211
  return '.next';
212
+ case 'nuxt':
213
+ return '.output/public';
192
214
  case 'react':
193
215
  case 'vue':
194
216
  return 'dist';
@@ -202,7 +224,7 @@ export function getOutputDir(frameworkConfig) {
202
224
  */
203
225
  export function needsSearchIndex(frameworkConfig) {
204
226
  // Only static-output frameworks need pagefind
205
- return ['astro', 'react', 'vue'].includes(frameworkConfig.name);
227
+ return ['astro', 'react', 'vue', 'nuxt'].includes(frameworkConfig.name);
206
228
  }
207
229
 
208
230
  export { DEFAULT_FRAMEWORK_CONFIGS };
@@ -1,6 +1,6 @@
1
1
  import pkg from 'fs-extra';
2
2
  const { ensureDir, emptyDir, copy, remove } = pkg;
3
- import { tmpdir } from 'os';
3
+ import { homedir } from 'os';
4
4
  import { join, basename } from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import { dirname } from 'path';
@@ -8,8 +8,9 @@ import { dirname } from 'path';
8
8
  const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = dirname(__filename);
10
10
 
11
- // Use a consistent directory path instead of random temp directories
12
- const LITO_DIR = join(tmpdir(), '.lito');
11
+ // Use a directory under the user's home to avoid resolution issues
12
+ // with bundlers (e.g. Turbopack) that fail to resolve node_modules from /tmp
13
+ const LITO_DIR = join(homedir(), '.lito', 'dev-project');
13
14
 
14
15
  export async function scaffoldProject(customTemplatePath = null) {
15
16
  // Ensure the directory exists (creates if it doesn't)