From 2e7acbf50f8ea257e1d4e0629baf87bf5e6c71b3 Mon Sep 17 00:00:00 2001 From: Viet Tran Date: Wed, 3 Dec 2025 10:18:18 +0700 Subject: [PATCH] fix: add Windows compatibility for zip extraction and file copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- cli/package.json | 2 +- cli/src/index.ts | 2 +- cli/src/utils/extract.ts | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cli/package.json b/cli/package.json index e46b953..a215540 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "uipro-cli", - "version": "1.0.2", + "version": "1.0.3", "description": "CLI to install UI/UX Pro Max skill for AI coding assistants", "type": "module", "bin": { diff --git a/cli/src/index.ts b/cli/src/index.ts index fd51499..b5c225d 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -12,7 +12,7 @@ const program = new Command(); program .name('uipro') .description('CLI to install UI/UX Pro Max skill for AI coding assistants') - .version('1.0.2'); + .version('1.0.3'); program .command('init') diff --git a/cli/src/utils/extract.ts b/cli/src/utils/extract.ts index 8554ce6..038a73c 100644 --- a/cli/src/utils/extract.ts +++ b/cli/src/utils/extract.ts @@ -9,7 +9,12 @@ const execAsync = promisify(exec); export async function extractZip(zipPath: string, destDir: string): Promise { 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) { throw new Error(`Failed to extract zip: ${error}`); } @@ -58,7 +63,11 @@ export async function copyFolders( } catch { // Try shell fallback for older Node versions 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); } catch { // Skip if copy fails