UNPKG

backsplash-app

Version:
85 lines (70 loc) • 2.97 kB
#!/usr/bin/env node /** * Test script to verify Sentry configuration * Run with: node scripts/test-sentry.js */ const fs = require("fs"); const path = require("path"); require("dotenv").config({ path: ".env.production" }); console.log("šŸ” Testing Sentry Configuration...\n"); // Check if required environment variables are present const requiredEnvVars = { SENTRY_DSN: process.env.SENTRY_DSN, SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN, }; let allGood = true; console.log("šŸ“‹ Environment Variables:"); for (const [key, value] of Object.entries(requiredEnvVars)) { const status = value ? "āœ…" : "āŒ"; const displayValue = value ? (key === "SENTRY_AUTH_TOKEN" ? "*".repeat(20) : value) : "NOT SET"; console.log(` ${status} ${key}: ${displayValue}`); if (!value) allGood = false; } console.log("\nšŸ“ Configuration Files:"); // Check if .sentryclirc exists and has content const sentryRcPath = path.join(__dirname, "..", ".sentryclirc"); if (fs.existsSync(sentryRcPath)) { console.log(" āœ… .sentryclirc: EXISTS"); const content = fs.readFileSync(sentryRcPath, "utf-8"); if (content.includes("token=") && !content.includes("token=\n")) { console.log(" āœ… .sentryclirc: Has token configured"); } else { console.log(" āš ļø .sentryclirc: Token not configured"); } } else { console.log(" āš ļø .sentryclirc: NOT FOUND (optional)"); } // Check if Vite configs have Sentry plugin const rendererConfigPath = path.join(__dirname, "..", "config", "vite.renderer.config.ts"); const mainConfigPath = path.join(__dirname, "..", "config", "vite.main.config.ts"); if (fs.existsSync(rendererConfigPath)) { const rendererContent = fs.readFileSync(rendererConfigPath, "utf-8"); if (rendererContent.includes("sentryVitePlugin")) { console.log(" āœ… Renderer config: Sentry plugin configured"); } else { console.log(" āŒ Renderer config: Sentry plugin NOT configured"); allGood = false; } } if (fs.existsSync(mainConfigPath)) { const mainContent = fs.readFileSync(mainConfigPath, "utf-8"); if (mainContent.includes("sentryVitePlugin")) { console.log(" āœ… Main config: Sentry plugin configured"); } else { console.log(" āŒ Main config: Sentry plugin NOT configured"); allGood = false; } } console.log("\nšŸ—ļø Build Configuration:"); console.log(" • Sourcemaps will be generated during production builds"); console.log(" • Sentry plugin runs only in production mode"); console.log(" • Requires SENTRY_AUTH_TOKEN to upload sourcemaps"); console.log("\nšŸ“ Next Steps:"); if (!allGood) { console.log(" 1. Set missing environment variables in .env.production"); console.log(" 2. Get your Sentry auth token from: https://sentry.io/settings/auth-tokens/"); console.log(" 3. Run a production build: yarn make"); } else { console.log(" šŸŽ‰ Configuration looks good! Run: yarn make"); } console.log("\nšŸ“š For more information, see: SENTRY_SETUP.md");