0.0.2 • Published 3 years ago
@julr/gql-generator-full-blown-preset v0.0.2
gql-generator-full-blown-preset
🛩 A cool and opinionated base configuration for Graphql Code Generator.
Features
- Generates a base
schema.graphqlfile using@graphql-codegen/schema-ast - Generates a base
schema.generated.tswith typings for the base schema using@graphql-codegen/typescript - Generates typings files for each of your operations files using
@graphql-codegen/typescript - Generate
TypedDocumentNodeinstead of hooks/composables using@graphql-codegen/typed-document-node - Use PascalCase as default naming convention.
- Remove
__typenamesfrom types.
Installation
pnpm add -D @julr/gql-generator-full-blown-preset
pnpm add @graphql-typed-document-node/coreIf you are using pnpm you must hoist the @graphql-codegen dependencies to the root modules directory. This could be done by adding the following content to your project .npmrc file :
public-hoist-pattern[]=@graphql-codegen/*Usage
Create a graphql.config.js file in the root of your project.
require("dotenv").config();
const defineConfig = require("@julr/gql-generator-full-blown-preset");
module.exports = defineConfig({
// The path to your GraphQL schema file. Can be a local file or a remote URL.
schema: {
url: process.env.HASURA_URL,
secret: process.env.HASURA_SECRET,
},
// Since we're using graphql-config, you may need to define
// additional extensions configurations
additionalExtensions: {
myExtension: {
config: 'foo'
}
}
});License
MIT License © 2022 Julien Ripouteau
0.0.2
3 years ago