backsplash-app
Version:
An AI powered wallpaper app.
85 lines (70 loc) ⢠2.97 kB
JavaScript
/**
* 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");