apollographql / apollographql/apollo-tooling
Allow passing custom generator package to CLI
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
There are a lot of cases where it's nice to generate either new custom code, or type definitions that are slightly different from the standard definitions generated by the CLI. Currently to generate some new custom artifact, I'd have to make a custom version of the actual CLI package.
It looks like most of the logic to select the output generation happens here: https://github.com/apollographql/apollo-cli/blob/a0912739fcabb040232f3ddf6cde0d609a7581b8/packages/apollo/src/generate.ts
It would be really nice if in addition to the standard list of languages it were possible to pass in a package that exports a `generateFiles` function or similar. As a nice side effect that might even make it possible to move the legacy generators out of the repo.
Another option would be to create a new `--json` option that outputs the new IR, but that wouldn't be as great cause that wouldn't let us as easily take advantage of file watching, etc.
Contributor guide
Research direction
Start by reading packages/apollo/src/generate.ts, where the issue says output generation is selected, and trace how the CLI chooses its standard language generators and handles file watching. The issue is done when the CLI can accept an external package exposing a generateFiles-like function alongside the standard generators, without requiring a custom CLI package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100