62 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
/**
* Check if AWS CLI is available on the system
* This script is run during postinstall to ensure AWS CLI is available
*/
const { spawn } = require('child_process');
const fs = require('fs');
const path = require('path');
console.log('🔍 Checking AWS CLI availability...');
// Check if AWS CLI is available
function checkAwsCli() {
return new Promise((resolve) => {
const process = spawn('aws', ['--version'], { stdio: 'pipe' });
process.on('close', (code) => {
resolve(code === 0);
});
process.on('error', () => {
resolve(false);
});
});
}
async function main() {
const isAvailable = await checkAwsCli();
if (isAvailable) {
console.log('✅ AWS CLI is available');
// Get version
const versionProcess = spawn('aws', ['--version'], { stdio: 'pipe' });
versionProcess.stdout.on('data', (data) => {
console.log(`📋 Version: ${data.toString().trim()}`);
});
console.log('🎉 You can now use the desktop sync tool with AWS S3!');
} else {
console.log('❌ AWS CLI is not available');
console.log('');
console.log('📋 To install AWS CLI v2:');
console.log('');
console.log(' Option 1: Run the installer script:');
console.log(' npm run install-aws-cli');
console.log('');
console.log(' Option 2: Install manually:');
console.log(' https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html');
console.log('');
console.log(' Option 3: Use Homebrew (macOS):');
console.log(' brew install awscli');
console.log('');
console.log('⚠️ The desktop sync tool requires AWS CLI to function properly.');
console.log(' Please install AWS CLI before using the sync functionality.');
}
}
main().catch(console.error);