@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
package/src/commands/doctor.js
CHANGED
|
@@ -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(
|
|
261
|
+
const cacheDir = join(homedir(), '.lito', 'templates');
|
|
261
262
|
|
|
262
263
|
if (!existsSync(cacheDir)) {
|
|
263
264
|
return {
|
package/src/commands/info.js
CHANGED
|
@@ -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(
|
|
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}`);
|
package/src/commands/preview.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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',
|
|
129
|
-
'-C',
|
|
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
|
|