- AddTransactionButton.tsx: useEffect import 제거 - BudgetProgressCard.tsx: localBudgetData를 _localBudgetData로 변경 - Header.tsx: isMobile을 _isMobile로 변경 - RecentTransactionsSection.tsx: isDeleting을 _isDeleting로 변경 - TransactionCard.tsx: cn import 제거 - ExpenseForm.tsx: useState import 제거 - cacheStrategies.ts: QueryClient, Transaction import 제거 - Analytics.tsx: Separator import 제거, 미사용 변수들에 underscore prefix 추가 - Index.tsx: useMemo import 제거 - Login.tsx: setLoginError를 _setLoginError로 변경 - Register.tsx: useEffect dependency 수정 및 useCallback 추가 - Settings.tsx: toast, handleClick에 underscore prefix 추가 - authStore.ts: setError, setAppwriteInitialized에 underscore prefix 추가 - budgetStore.ts: ranges를 _ranges로 변경 - BudgetProgressCard.test.tsx: waitFor import 제거 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
90 lines
2.7 KiB
JavaScript
Executable File
90 lines
2.7 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Vercel 환경 변수 자동 설정 스크립트
|
|
* 이 스크립트는 .env.example 파일을 기반으로 Vercel 환경 변수를 설정합니다.
|
|
*/
|
|
|
|
const { execSync } = require('child_process');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const ENV_EXAMPLE_PATH = path.join(__dirname, '..', '.env.example');
|
|
|
|
function parseEnvFile(filePath) {
|
|
if (!fs.existsSync(filePath)) {
|
|
console.error(`❌ 파일을 찾을 수 없습니다: ${filePath}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const content = fs.readFileSync(filePath, 'utf-8');
|
|
const envVars = {};
|
|
|
|
content.split('\n').forEach(line => {
|
|
line = line.trim();
|
|
if (line && !line.startsWith('#') && line.includes('=')) {
|
|
const [key, ...values] = line.split('=');
|
|
if (key.startsWith('VITE_')) {
|
|
envVars[key.trim()] = values.join('=').trim();
|
|
}
|
|
}
|
|
});
|
|
|
|
return envVars;
|
|
}
|
|
|
|
function setupVercelEnv() {
|
|
console.log('🚀 Vercel 환경 변수 설정을 시작합니다...');
|
|
|
|
// Vercel CLI 설치 확인
|
|
try {
|
|
execSync('vercel --version', { stdio: 'ignore' });
|
|
} catch (error) {
|
|
console.error('❌ Vercel CLI가 설치되지 않았습니다.');
|
|
console.error('다음 명령어로 설치해주세요: npm i -g vercel');
|
|
process.exit(1);
|
|
}
|
|
|
|
// .env.example에서 환경 변수 파싱
|
|
console.log('📋 .env.example에서 환경 변수를 읽고 있습니다...');
|
|
const envVars = parseEnvFile(ENV_EXAMPLE_PATH);
|
|
|
|
if (Object.keys(envVars).length === 0) {
|
|
console.log('⚠️ VITE_ 접두사를 가진 환경 변수가 없습니다.');
|
|
return;
|
|
}
|
|
|
|
console.log('🔧 다음 환경 변수들을 Vercel에 설정해야 합니다:');
|
|
Object.keys(envVars).forEach(key => {
|
|
console.log(` - ${key}`);
|
|
});
|
|
|
|
console.log('\\n📝 Vercel 대시보드에서 수동으로 설정하거나,');
|
|
console.log('다음 Vercel CLI 명령어들을 사용하세요:\\n');
|
|
|
|
// 환경별 설정 명령어 생성
|
|
const environments = [
|
|
{ name: 'production', flag: '--prod' },
|
|
{ name: 'preview', flag: '--preview' },
|
|
{ name: 'development', flag: '--dev' }
|
|
];
|
|
|
|
environments.forEach(env => {
|
|
console.log(`# ${env.name.toUpperCase()} 환경:`);
|
|
Object.keys(envVars).forEach(key => {
|
|
const placeholder = `your-${env.name}-${key.toLowerCase().replace('vite_', '').replace(/_/g, '-')}`;
|
|
console.log(`vercel env add ${key} ${env.flag} # 값: ${placeholder}`);
|
|
});
|
|
console.log('');
|
|
});
|
|
|
|
console.log('💡 팁: Vercel 대시보드 (Settings > Environment Variables)에서');
|
|
console.log(' 더 쉽게 환경 변수를 관리할 수 있습니다.');
|
|
}
|
|
|
|
// 스크립트 실행
|
|
if (require.main === module) {
|
|
setupVercelEnv();
|
|
}
|
|
|
|
module.exports = { parseEnvFile, setupVercelEnv }; |