-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feature/optional config file #21
Conversation
I think an |
@IMax153 awesome work! 🎉 Learned a lot view reviewing (more like skimming) your PR. I've been working on a fork of this project (https://github.com/gillchristian/docs-ts-extra) with similar goals as your PR. Went for the for mainly because I assumed @gcanti wouldn't want to add fundamental changes such as support for configuration. My implementation was much simpler, just added the minimum changes to for strict mode (ie. enforce since tag behavior on/off), src and out dirs, and React support (ie. Will you publish as a fork if @gcanti prefers not to include these changes? Either way I'm willing to contribute. |
Awesome, thanks @IMax153 |
Still getting the same |
As always, thank you for your review. Apologies for the continued issues with the type signatures. I just ran docs generation on another personal project I have been developing and can see the Probably still an issue with |
No worries. Happy to help |
@IMax153 is there anything I could help with? We have a hackathon at work Thursday and Friday and I plan to work on docs-ts related stuff so I could contribute to this PR as well. |
Hey @gillchristian! Apologies for going MIA - I have been extremely busy with work lately and haven't gotten the chance to work on the fixes that are needed. Long story short - the reason that we are getting However, when using an I think the fix is to revert The solution is probably to provide the The interface for what would need to be added to the program's environment would be something like the following: import type { Reader } from 'fp-ts'
import * as ast from 'ts-morph'
import * as FS from './FileSystem'
export interface Project {
readonly project: ast.Project
readonly addFileToProject: (file: FS.File) => Reader<ast.Project, void>
} I am curious as to your thoughts! I should have some time next week to start working on this again, but if you want to take a crack at it please feel free! I welcome the help! |
@gillchristian - finally found some time to implement what I had been thinking about regarding the |
No worries at all.
😅 I ended up working on something different on the hackathon, although related to docs-ts https://github.com/gillchristian/docs-ts-mkdocs I like the implementation you went for, being able to use real file system and yet supporting the in memory one for tests is the best of both worlds. I tested it on the project I shared before and now all the types are generated as expected. One thing I found while testing is that Example.run fails with 'Type checking error' when
And looks like that didn't make Maybe the call to Besides that, what do you think is missing in the PR? I can spend some time this week doing a code review. |
No worries at all! I checked out the project and its pretty cool stuff!
Very strange - I wonder if this is an issue with the way that you are installing this fork in your repository? Regardless I completely agree that we are not handling the spawning and closing of the child process in the safest of manners.
What do you think of the re-implementation of export const run = (command: string, executablePath: string): TE.TaskEither<string, void> =>
pipe(
TE.fromEither(E.tryCatch(() => spawnSync(command, [executablePath], { stdio: 'pipe', encoding: 'utf8' }), String)),
TE.chain(({ status, stderr }) => (status === 0 ? TE.right(undefined) : TE.left(stderr)))
)
I don't really think anything else is missing at this point. We have added the features that we set out to, and we improved the test suite to give us more confidence when we make future changes. I would say you can go ahead and proceed with a code review! 🚀 |
Looks good 👌
Will do that then 🚀 |
Hey @gillchristian! Just wanted to see if there was anything else I could do to help get this PR over the finish line. I have a few projects in the pipeline with Let me know! |
Sorry for the delay 😬 I've tried it on some projects I use and all seems fine. And code wise it looks good. 🚀 I'll summon @gcanti for the approval |
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!
Thanks @gillchristian! @gcanti - let us know if you would like us to address anything else before merging |
Thanks @IMax153 @gillchristian LGTM, awesome work. I'm eager to try it out on fp-ts. |
@IMax153 There's a test which is failing locally, I temporary disabled code coverage for |
Hmm - sorry about that @gcanti. We did have quite a difficult time getting the tests to work properly due to problems with ‘ts-morph’, so I anticipate the issues are originating from there. I will take a look later today and let you know! |
@IMax153 no problem, if it helps I get the following error if I don't skip the test
|
@gcanti - I see the problem. Not an issue with ‘ts-morph’, just an issue with my brain 🤣. I hard coded the file path using my system file path when I should have used If I’ll push an update to the branch once I am back at a computer. |
Done, I confirm, the test now passes, thank you! |
@IMax153 running v0.6 against from RTE.bind('content', () => RTE.right(printModule(module, order))) to RTE.bind('content', () => RTE.right(printModule(module, order + 1))) in order to get the same output, what do you think? |
@gcanti - LGTM! I would rather keep the output as consistent as possible with what is currently being output in v0.5, so this change looks great! |
This pull request is quite large in its scope and aims to provide a flexible and extensible system for configuring
docs-ts
, while still allowing the tool to be zero-configuration by default.The most notable additions to the codebase with this pull request is the ability to optionally specify a
docs-ts.json
configuration file in the root directory of a project. The available configuration settings and their defaults can be viewed in the updated README for the repository.@gcanti - I completely understand if you would like to forego the changes made in this pull request as I know that this tool was primarily built for your own use. If you are open to the pull request, I completely open to suggestions for changes. In any case, it was a lot of fun to work on these updates and I learned a lot along the way!
Finally, I am leaving this as a draft for now because I still need to rework all of the tests and add new test files for those modules that are not currently included in the test suite.
Let me know what you think!
Closes #18.