apollographql / apollographql/apollo-tooling

The CLI --help command doesn't work

Open
#2,520 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Intended outcome:**

I was trying to figure out how to use the `client:codegen` subcommand. It directed me to use the `--help` option and no matter where I place it, I'm unable to get help output. I expected to see information about the command's flags, but instead received an error about a plugin.

**Actual outcome:**

```
> yarn apollo client:codegen
yarn run v1.22.17
$ /home/nirvdrum/dev/workspaces/taskerator/node_modules/.bin/apollo client:codegen
› Error: Missing required flag:
› --target TARGET Type of code generator to use (swift | typescript | flow | scala | json | json-modern (exposes raw json types))
› See more help with --help
error Command failed with exit code 2.
```

```
> yarn apollo client:codegen --help
yarn run v1.22.17
$ /home/nirvdrum/dev/workspaces/taskerator/node_modules/.bin/apollo client:codegen --help
TypeError: plugin_help_1.getHelpClass is not a function
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

> yarn apollo --help client:codegen
yarn run v1.22.17
$ /home/nirvdrum/dev/workspaces/taskerator/node_modules/.bin/apollo --help client:codegen
TypeError: plugin_help_1.getHelpClass is not a function
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

> yarn apollo --help
yarn run v1.22.17
$ /home/nirvdrum/dev/workspaces/taskerator/node_modules/.bin/apollo --help
TypeError: plugin_help_1.getHelpClass is not a function
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

**How to reproduce the issue:**

1. Create a new JS project.
2. Install _apollo_ as a dev dependency (e.g., `yarn add -D apollo`)
3. Run help command: `yarn apollo --help`

Please note that the issue can be reproduced using `npm` instead of `yarn`.

**Versions**

Apollo: 2.33.9

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `yarn apollo --help` and `yarn apollo client:codegen --help` in a new project using Apollo 2.33.9. Trace the CLI help entry point and the `plugin_help_1.getHelpClass` error; done means the general and subcommand help commands print their flag information without the plugin error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.