🚀 Spent 5 hours automating a 5-minute task... and I regret nothing!
At work, I kept finding myself manually checking which GraphQL operations from our schema were actually implemented in our codebase. You know the drill - opening the schema file, scrolling through hundreds of queries/mutations, then grep-ing through the entire project to see what's actually being used.
5 minutes per check × multiple times per week = death by a thousand paper cuts 📈
So naturally, I did what any self-respecting developer would do: I spent an entire weekend building a tool to automate it! 🛠️
Introducing vite-plugin-graphql-usage - a Vite plugin and CLI tool that:
✅ Introspects your GraphQL schema (endpoint or SDL file)
✅ Scans your codebase for operation usage
✅ Generates beautiful markdown reports with checkboxes
✅ Shows exactly where each operation is used (file + line number)
✅ Integrates seamlessly into your build process
The best part? It's completely non-intrusive - it analyzes your code without modifying anything.
// Just add to your vite.config.ts
viteGraphQLUsages({
schemaSource: {
endpoint: 'https://api.example.com/graphql'
},
printTable: true,
saveReport: true
})
Now instead of manual detective work, I get automated reports like this:
📊 GraphQL Operations Report:
✅ Found: 47
❌ Not found: 23
📊 Total operations: 70
The classic developer paradox: "I'll spend 5 hours automating something that takes 5 minutes... because those 5 minutes happen 100 times!" 😅
But honestly? This has already saved our team hours of manual work, helped us identify unused operations to clean up, and made onboarding new developers way smoother.
Sometimes the best solutions come from being just annoyed enough at repetitive tasks to do something about it! 🎯
Check it out: npm install vite-plugin-graphql-usage
repository
What's the most "unnecessary" automation you've built that turned out to be incredibly useful? Drop it in the comments! 👇