@barelyhuman/gqlfragments

0.1.3 • Public • Published

gqlfragments

Generate fragments from your graphql schema's custom scalars

The base concept was forked from Hasan-git/gql-fragments-generator and was modified to match my use case.

Example

# Sample schema
type User {
	id: Int!
	username: String!
	email: String!
	createdAt: String!
	projects: [Project!]
}
# fragment generated
# - fields are sorted by their lengths
# - subsets are not added to fragments , eg `projects` is missing here
fragment UserFields on User {
	id
	email
	username
	createdAt
}

Usage

# Install
npm install @barelyhuman/gqlfragments -g

# see the usage
gqlfragments --help

# Generate fragments from schema file
gqlfragments --schema ./example/schema.gql --out ./example/output
Usage: gqlfragments [options]

Options:
  --schema [value]  path of your graphql schema
  --out [value]     folder to store the generated fragments in
  --ignore [value]  path to csv containing types to be ignored
  --clean           create a clean build
  -h, --help        display help for command

License

MIT 2022 Reaper
ISC Hasan-git

Package Sidebar

Install

npm i @barelyhuman/gqlfragments

Weekly Downloads

0

Version

0.1.3

License

ISC

Unpacked Size

9.2 kB

Total Files

11

Last publish

Collaborators

  • barelyreaper