fix: add Windows compatibility for zip extraction and file copy

- Use PowerShell Expand-Archive on Windows instead of unzip
- Use xcopy on Windows instead of cp -r in shell fallback
- Bump version to 1.0.3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Viet Tran 2025-12-03 10:18:18 +07:00
parent fc9956c648
commit 2e7acbf50f
3 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "uipro-cli", "name": "uipro-cli",
"version": "1.0.2", "version": "1.0.3",
"description": "CLI to install UI/UX Pro Max skill for AI coding assistants", "description": "CLI to install UI/UX Pro Max skill for AI coding assistants",
"type": "module", "type": "module",
"bin": { "bin": {

View File

@ -12,7 +12,7 @@ const program = new Command();
program program
.name('uipro') .name('uipro')
.description('CLI to install UI/UX Pro Max skill for AI coding assistants') .description('CLI to install UI/UX Pro Max skill for AI coding assistants')
.version('1.0.2'); .version('1.0.3');
program program
.command('init') .command('init')

View File

@ -9,7 +9,12 @@ const execAsync = promisify(exec);
export async function extractZip(zipPath: string, destDir: string): Promise<void> { export async function extractZip(zipPath: string, destDir: string): Promise<void> {
try { try {
await execAsync(`unzip -o "${zipPath}" -d "${destDir}"`); const isWindows = process.platform === 'win32';
if (isWindows) {
await execAsync(`powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`);
} else {
await execAsync(`unzip -o "${zipPath}" -d "${destDir}"`);
}
} catch (error) { } catch (error) {
throw new Error(`Failed to extract zip: ${error}`); throw new Error(`Failed to extract zip: ${error}`);
} }
@ -58,7 +63,11 @@ export async function copyFolders(
} catch { } catch {
// Try shell fallback for older Node versions // Try shell fallback for older Node versions
try { try {
await execAsync(`cp -r "${sourcePath}/." "${targetPath}"`); if (process.platform === 'win32') {
await execAsync(`xcopy "${sourcePath}" "${targetPath}" /E /I /Y`);
} else {
await execAsync(`cp -r "${sourcePath}/." "${targetPath}"`);
}
copiedFolders.push(folder); copiedFolders.push(folder);
} catch { } catch {
// Skip if copy fails // Skip if copy fails