@litodocs/cli 1.4.1 → 1.4.2

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.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Beautiful documentation sites from Markdown. Fast, simple, and open-source.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
2
2
  import { resolve, join, extname } from 'path';
3
+ import { homedir } from 'os';
3
4
  import { intro, outro, log, spinner } from '@clack/prompts';
4
5
  import pc from 'picocolors';
5
6
  import { validateConfig } from '../core/config-validator.js';
@@ -257,7 +258,7 @@ async function checkCommonIssues(inputPath) {
257
258
  }
258
259
 
259
260
  async function checkTemplateCache() {
260
- const cacheDir = join(process.env.HOME || '~', '.lito', 'templates');
261
+ const cacheDir = join(homedir(), '.lito', 'templates');
261
262
 
262
263
  if (!existsSync(cacheDir)) {
263
264
  return {
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
2
2
  import { resolve, join, extname } from 'path';
3
+ import { homedir } from 'os';
3
4
  import { intro, outro, log } from '@clack/prompts';
4
5
  import pc from 'picocolors';
5
6
  import { TEMPLATE_REGISTRY } from '../core/template-registry.js';
@@ -137,7 +138,7 @@ export async function infoCommand(options) {
137
138
  log.message(` ${pc.cyan('Node.js:')} ${process.version}`);
138
139
  log.message(` ${pc.cyan('Platform:')} ${process.platform}`);
139
140
 
140
- const cacheDir = join(process.env.HOME || '~', '.lito', 'templates');
141
+ const cacheDir = join(homedir(), '.lito', 'templates');
141
142
  if (existsSync(cacheDir)) {
142
143
  const cached = readdirSync(cacheDir).length;
143
144
  log.message(` ${pc.cyan('Cached templates:')} ${cached}`);
@@ -71,7 +71,8 @@ export async function previewCommand(options) {
71
71
  } catch (serveError) {
72
72
  // Fallback to Python's http.server if serve isn't available
73
73
  try {
74
- await execa('python3', ['-m', 'http.server', port, '-d', outputPath], {
74
+ const pythonCmd = process.platform === 'win32' ? 'python' : 'python3';
75
+ await execa(pythonCmd, ['-m', 'http.server', port, '-d', outputPath], {
75
76
  stdio: 'inherit',
76
77
  cwd: process.cwd(),
77
78
  });
@@ -123,13 +123,13 @@ export async function fetchGitHubTemplate(owner, repo, ref) {
123
123
 
124
124
  // Use tar to extract (available on all Unix systems and modern Windows)
125
125
  const { execa } = await import('execa');
126
- const isWin = process.platform === 'win32';
126
+ // Use forward slashes on Windows to avoid bsdtar issues with drive letters (C:)
127
+ const tarPath = tempTarPath.replace(/\\/g, '/');
128
+ const extractPath = cachePath.replace(/\\/g, '/');
127
129
  const tarArgs = [
128
- '-xzf', isWin ? tempTarPath.replace(/\\/g, '/') : tempTarPath,
129
- '-C', isWin ? cachePath.replace(/\\/g, '/') : cachePath,
130
- '--strip-components=1',
131
- // On Windows, GNU tar misinterprets drive letters (C:) as remote hosts
132
- ...(isWin ? ['--force-local'] : [])
130
+ '-xzf', tarPath,
131
+ '-C', extractPath,
132
+ '--strip-components=1'
133
133
  ];
134
134
  await execa('tar', tarArgs);
135
135