-
Notifications
You must be signed in to change notification settings - Fork 284
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
Add JSDocs to generated projects #1334
Conversation
This comment has been minimized.
This comment has been minimized.
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.
LGTM! 🚀🦐
packages/cli/package.json
Outdated
@@ -42,7 +42,7 @@ | |||
"gunzip-maybe": "^1.4.2", | |||
"prettier": "^2.8.4", | |||
"tar-fs": "^2.1.1", | |||
"typescript": "^5.2.2", | |||
"ts-morph": "19.0.0", |
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.
FWIW ts-morph
adds about 13mb to the install: https://pkg-size.dev/ts-morph
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.
Yeah, but it replaces typescript
, which is 41mb. Creating a new Hydrogen project (i.e. installing the CLI globally) should now download 28mb less than before 😄
} | ||
|
||
/** | ||
* @license MIT (https://github.com/futurGH/ts-to-jsdoc/blob/67b5e548a30b9cb5bf74f200168ffddab9d8600e/LICENSE) |
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.
@blittle just to double check, do you think it's OK to include this license here in this file?
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.
Hmmm, looks like it should be okay, as long as we keep the copyright notice: https://memgraph.com/blog/what-is-mit-license#:~:text=2.%20Does%20the%20MIT%20License%20allow%20commercial%20use%3F
WHY are these changes introduced?
We already have GraphQL Codegen for TypeScript but JS projects are not getting any benefits from it. This adds JSDocs to the generated JS projects.
WHAT is this pull request doing?
This uses
ts-morph
to transpile TS => JS and also generate JSDocs at the same time from the TS types.First, it adds typedefs for each type at the bottom:
Then, it annotates each function using the types defined:
HOW to test your changes?
In the
templates
folder, run:Check that the generated project has JSDocs and works with Codegen. You might need to
>TypeScript: Restart TS Server
in VSCode at times.Post-merge steps
Checklist