vite-plugin-graphql-usage
Dennis kinuthia

Dennis kinuthia @tigawanna

About: Helping you avoid the beginner growing pains that wasted so much of my Time

Location:
Nairobi, Kenya
Joined:
May 8, 2022

vite-plugin-graphql-usage

Publish Date: May 26
1 0

🚀 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.

repository

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
})
Enter fullscreen mode Exit fullscreen mode

Now instead of manual detective work, I get automated reports like this:

📊 GraphQL Operations Report:
✅ Found: 47
❌ Not found: 23  
📊 Total operations: 70
Enter fullscreen mode Exit fullscreen mode

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! 👇

Comments 0 total

    Add comment