0.1.3 • Published 2 years ago

@barelyhuman/gqlfragments v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.1-beta.1

2 years ago