passmaster/scripts/setup.js

47 lines
1.6 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
console.log('🚀 PassMaster Setup Script');
console.log('==========================');
// Create .env.local if it doesn't exist
const envPath = path.join(process.cwd(), '.env.local');
if (!fs.existsSync(envPath)) {
const envContent = `# Site URL for metadata and PWA
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# For production, change to your actual domain
# NEXT_PUBLIC_SITE_URL=https://passmaster.app
`;
fs.writeFileSync(envPath, envContent);
console.log('✅ Created .env.local file');
} else {
console.log(' .env.local already exists');
}
// Check if node_modules exists
const nodeModulesPath = path.join(process.cwd(), 'node_modules');
if (!fs.existsSync(nodeModulesPath)) {
console.log('📦 Installing dependencies...');
const { execSync } = require('child_process');
try {
execSync('npm install', { stdio: 'inherit' });
console.log('✅ Dependencies installed');
} catch (error) {
console.error('❌ Failed to install dependencies:', error.message);
process.exit(1);
}
} else {
console.log(' Dependencies already installed');
}
console.log('\n🎉 Setup complete!');
console.log('\nNext steps:');
console.log('1. Run "npm run dev" to start the development server');
console.log('2. Open http://localhost:3000 in your browser');
console.log('3. Add icon files to public/icons/ directory');
console.log('4. Update .env.local with your production URL when deploying');
console.log('\nHappy coding! 🚀');