diff --git a/code/utils/deploy-pokedex.js b/code/utils/deploy-pokedex.js index 63e0de7..7738517 100644 --- a/code/utils/deploy-pokedex.js +++ b/code/utils/deploy-pokedex.js @@ -217,30 +217,30 @@ async function deploy() { console.log('\nšŸ”Ø Building Vue 3 application...'); console.log(` Source: ${SOURCE_DIR}`); console.log(` Output: ${DIST_DIR}`); - + const { execSync } = await import('child_process'); try { // Check if node_modules exists if (!fs.existsSync(path.join(SOURCE_DIR, 'node_modules'))) { console.log(' šŸ“¦ Installing dependencies...'); - execSync('npm install', { - cwd: SOURCE_DIR, - stdio: 'inherit' + execSync('npm install', { + cwd: SOURCE_DIR, + stdio: 'inherit' }); } - + // Build the application console.log(' āš™ļø Running build...'); - execSync('npm run build', { - cwd: SOURCE_DIR, - stdio: 'inherit' + execSync('npm run build', { + cwd: SOURCE_DIR, + stdio: 'inherit' }); - + // Verify dist directory exists if (!fs.existsSync(DIST_DIR)) { throw new Error('Build failed - dist directory not found'); } - + console.log(' āœ… Build completed successfully'); } catch (error) { throw new Error(`Build failed: ${error.message}`); @@ -292,11 +292,11 @@ async function deploy() { // Transfer files console.log('\nšŸ“¤ Transferring files...'); - + // First transfer the dist directory console.log(' šŸ“¦ Transferring dist directory...'); const distFiles = []; - + function getDistFiles(dir, baseDir = DIST_DIR) { const files = fs.readdirSync(dir, { withFileTypes: true }); for (const file of files) { @@ -312,13 +312,13 @@ async function deploy() { } } } - + getDistFiles(DIST_DIR); console.log(` Found ${distFiles.length} files in dist/`); - + // Create dist directory on remote await ssh.execCommand(`mkdir -p ${REMOTE_PATH}/dist`); - + // Transfer dist files let transferred = 0; for (const file of distFiles) { @@ -329,14 +329,18 @@ async function deploy() { await ssh.putFile(file.local, file.remote); transferred++; if (transferred % 10 === 0) { - console.log(` šŸ“ Transferred ${transferred}/${distFiles.length} files...`); + console.log( + ` šŸ“ Transferred ${transferred}/${distFiles.length} files...` + ); } } catch (error) { - console.log(` āš ļø Failed to transfer ${path.relative(DIST_DIR, file.local)}: ${error.message}`); + console.log( + ` āš ļø Failed to transfer ${path.relative(DIST_DIR, file.local)}: ${error.message}` + ); } } console.log(` āœ… Transferred ${transferred} files from dist/`); - + // Now transfer config files const filesToTransfer = [ {