Skip to content

Conversation

productdevbook
Copy link
Owner

Summary

  • Automatically generates ofetch.ts GraphQL client for Nuxt projects
  • Creates client only once with helpful customization comments
  • Improves developer experience with ready-to-use GraphQL client setup

Changes Made

  • Added automatic detection of Nuxt framework in type generation
  • Created generateNuxtOfetchClient function for clean code organization
  • Renamed server-type-generation.ts to type-generation.ts for better clarity
  • Enhanced client codegen configuration for improved type safety
  • Added informative comments in generated ofetch.ts file

Features

  • Framework Detection: Automatically detects Nuxt projects and generates appropriate client
  • One-time Generation: Creates ofetch.ts only if it doesn't exist, allowing customization
  • SSR Compatible: Uses Nuxt's $fetch and useRequestHeaders for proper SSR support
  • Developer Friendly: Includes helpful comments explaining the file's purpose

Test Plan

  • Verify ofetch.ts is generated automatically for Nuxt projects
  • Confirm file is not overwritten on subsequent generations
  • Test GraphQL client functionality with $fetch
  • Ensure proper TypeScript integration and auto-imports
  • Validate SSR compatibility with useRequestHeaders

The generated client provides a seamless GraphQL experience for Nuxt applications with minimal setup required.

- Add automatic generation of ofetch.ts for Nuxt projects
- Generate ofetch client only once with customization comments
- Rename server-type-generation.ts to type-generation.ts for clarity
- Improve client codegen configuration for better type safety
- Support framework-specific client generation patterns

The generated ofetch.ts provides a ready-to-use GraphQL client
using Nuxt's $fetch and useRequestHeaders for SSR compatibility.
@productdevbook productdevbook merged commit e82eda5 into main Jul 19, 2025
1 check passed
@productdevbook productdevbook deleted the feat/auto-generate-nuxt-ofetch-client branch July 19, 2025 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant