-
-
Notifications
You must be signed in to change notification settings - Fork 114
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: warn user about missing required dependencies in generated client #110
feat: warn user about missing required dependencies in generated client #110
Conversation
@mrlubos I have updated the dependencies to match your issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you really want this, then if I have just angular installed, it should infer angular and show warning. This implementation would infer fetch and show no warnings (potentially). Again, the primary functionality here is to remove the need to specify client, not to do dependency checks
Addressed in latest commit |
@@ -18,6 +18,15 @@ type Dependencies = Record<string, unknown>; | |||
// TODO: add support for `openapi-ts.config.ts` | |||
const configFiles = ['openapi-ts.config.js', 'openapi-ts.config.cjs', 'openapi-ts.config.mjs']; | |||
|
|||
// Mapping of all dependencies required by each client. These should be installed in the generated client package | |||
const clientDependencies: Record<Config['client'], string[]> = { | |||
angular: ['@angular/common', '@angular/core', 'rxjs'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought CLI is used for Angular projects? https://angular.io/guide/setup-local
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, but the generated client for angular only imports code from these packages (so cli is not required). These are a map of dependencies that the client we generate needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. In that case, can you update the warning message to clarify those are the dependencies that need to be installed in order for the client to work? Right now it just says they're required, but not why
Infer client only if all dependencies are present. Log warning to user about missing dependencies that are required.