Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli-utils): Implement multi-schema support for CLI commands #261

Merged
merged 14 commits into from
Apr 26, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented Apr 25, 2024

Resolves #248
Related to #257

This implements multi-schema support, as per the RFC, in the CLI. This, together with 0no-co/GraphQLSP#303 fully resolves the RFC and implements true multi-schema support.

A given tsconfig.json with the plugin configuration can now set up multiple schemas:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "@0no-co/graphqlsp",
        "schemas": [
          {
            "name": "pokemon",
            "schema": "./schema.graphql",
            "tadaOutputLocation": "./src/graphql-env.d.ts",
            "tadaTurboLocation": "./src/graphql-cache.d.ts",
            "tadaPersistedLocation": "./src/persisted.json"
          },
          // ...
        ]
      }
    ]
  }
}

These can be used by instantiating them with initGraphQLTada via the output file (as specified by tadaOutputLocation).
The new configuration is fully validated (as can be seen when running gql.tada doctor.

Warning

Whenever a command accepts an --output argument, this is now unsupported by the CLI command in favour of clear configuration options (i.e. tadaOutputLocation, tadaTurboLocation, and tadaPersistedLocation)
This is except for the generate schema command, with which multiple schema requires the --output option now.

Copy link

changeset-bot bot commented Apr 25, 2024

🦋 Changeset detected

Latest commit: cb56be8

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten kitten enabled auto-merge (squash) April 26, 2024 10:11
@kitten kitten merged commit 2c82c63 into main Apr 26, 2024
1 check passed
@kitten kitten deleted the feat/multi-schema-cli branch April 26, 2024 10:11
@github-actions github-actions bot mentioned this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Provide built-in multi-schema support ("Multiple Schemas")
2 participants