Files
cypress/graphql-codegen.yml
Tim Griesser 94541d4f18 feat: merging / delegating remote queries to cloud schema (#17875)
Changes:
- Pulls down & stitches in the "Cypress Cloud" schema from remote. Currently defaulted to "staging" so we can make quick fixes / iteration there
- Add dedicated type checking CircleCI job `check-ts`
- Adds [graphcache](https://formidable.com/open-source/urql/docs/graphcache/) to normalize the cache & provide better auto-reactivity when data changes
- Removes `LocalProject` / `DashboardProject` in favor of `Project` / `CloudProject`
- General cleanup of Vue components' GraphQL fragments
- Parallelizes launchpad tests & recording to new Cypress project: https://dashboard.cypress.io/projects/sehy69/runs
  - Did this b/c tests were frequently timing out, need to figure out the source of this
- Basic mocks for remote schema
2021-09-20 17:12:59 -04:00

95 lines
3.0 KiB
YAML

# https://www.graphql-code-generator.com/docs/getting-started/index
documentFilters: &documentFilters
immutableTypes: true
useTypeImports: true
preResolveTypes: true
onlyOperationTypes: true
avoidOptionals: true
strictScalars: true
scalars:
Date: string
DateTime: string
JSON: any
vueOperations: &vueOperations
schema: './packages/graphql/schemas/schema.graphql'
config:
<<: *documentFilters
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript'
- 'typescript-operations'
- 'typed-document-node':
# Intentionally specified under typed-document-node rather than top level config,
# becuase we don't want it flattening the types for the operations
flattenGeneratedTypes: true
vueTesting: &vueTesting
schema: './packages/graphql/schemas/schema.graphql'
config:
<<: *documentFilters
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript'
- 'typescript-operations'
- 'typed-document-node'
overwrite: true
config:
enumsAsTypes: true
declarationKind: 'interface'
generates:
###
# Generates types for us to infer the correct "source types" when we merge the
# remote schema cloud.graphql schema into Nexus. This ensures we have proper type checking
# when we're using cy.mountFragment in component tests
###
'./packages/graphql/src/gen/cloud-source-types.gen.ts':
schema: 'packages/graphql/schemas/cloud.graphql'
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript':
nonOptionalTypename: true
- 'packages/graphql/script/codegen-type-map.js'
###
# All of the GraphQL Query/Mutation documents we import for use in the .vue
# files for useQuery / useMutation, as well as types associated with the fragments
###
'./packages/launchpad/src/generated/graphql.ts':
documents: './packages/launchpad/src/**/*.vue'
<<: *vueOperations
'./packages/app/src/generated/graphql.ts':
documents: './packages/app/src/**/*.vue'
<<: *vueOperations
###
# All GraphQL documents imported into the .spec.tsx files for component testing.
# Similar to generated/graphql.ts, except it doesn't include the flattening for the document nodes,
# so we can actually use the document in cy.mountFragment
###
'./packages/launchpad/src/generated/graphql-test.ts':
documents: './packages/launchpad/src/**/*.vue'
<<: *vueTesting
'./packages/app/src/generated/graphql-test.ts':
documents: './packages/app/src/**/*.vue'
<<: *vueTesting
###
# A Custom GraphQL Code generator (codegen-mount.js), producing a GraphQL type which represents the "union"
# of all possible output types. This is exposed as `testFragmentMember` / `testFragmentMemberList`
# fields, and are used in testing components, so we can generate a type that fulfills a fragment
###
'./packages/graphql/src/testing/testUnionType.ts':
schema: './packages/graphql/schemas/schema.graphql'
plugins:
- add:
content: '/* eslint-disable */'
- 'packages/graphql/script/codegen-mount.js'