This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ./localSchema.js | |
| const { loadFilesSync } = require("@graphql-tools/load-files"); | |
| const { mergeTypeDefs } = require("@graphql-tools/merge"); | |
| const loadedFiles = loadFilesSync(`${__dirname}/src/**/schema.js`); | |
| module.exports.schema = mergeTypeDefs(loadedFiles); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ./codegen.yml | |
| overwrite: true | |
| schema: | |
| - localSchema.js | |
| - ${SCHEMA_PATH}/graphql: # <-- this is for our remote schema, you'll probably have something similar | |
| headers: | |
| Authorization: ${AUTH0_ACCESS_TOKEN} | |
| generates: | |
| src/types/graphql.tsx: | |
| documents: # <-- your app structure may be different, but this will pick up the queries.ts and mutations.ts files created earlier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ./package.json | |
| { | |
| ... | |
| "scripts": { | |
| ... | |
| "generate:schema": "graphql-codegen -r dotenv/config" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ./src/AnotherThing/index.tsx | |
| import React from "react"; | |
| import { BalloonPickerThatHasAllOfTheNeededLogicInItButForSomeReasonRequiresMeToPassAMutation } from "../Balloon/Picker"; | |
| import { | |
| useGetSelectedBalloonLocalQuery, | |
| useGetBalloonsQuery, | |
| useSetSelectedBalloonLocalMutation, | |
| } from "../types/graphql"; |
OlderNewer