-
Notifications
You must be signed in to change notification settings - Fork 202
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: lookup project tsconfig #2068
Conversation
please create a test for when no tsconfig files can be found |
If no tsconfig.json file is found, the behavior is exactly the same as before this commit — you can see the only change is the assignment in the arguments. Since you have no real CLI tests suite, I'm not sure how this could be easily integrated. |
(Or do you mean just in the unit test, because of the missing code coverage for the "not found" case?) |
Please check if the new tests suffice. |
src/Utils/findTsConfig.ts
Outdated
* @param filename - The filename of the tsconfig.json file. Defaults to "tsconfig.json". | ||
* @returns The path to the tsconfig.json file or undefined if no such file was found. | ||
*/ | ||
export function findTsConfig(directory: string = process.cwd(), filename = "tsconfig.json"): string | undefined { |
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.
Is there any chance that we can import this logic from tsc rather than implementing it? If not, then this is good.
Maybe (to offload this logic from this codebase) https://www.npmjs.com/package/get-tsconfig?activeTab=readme could be a good idea. |
Oh look at the bottom of the read me. They show how to use tsc. |
Since you don't depend on The third-party package you linked to looks like another option (there's a package for everything in Node these days, huh), but it means having another depdendency (with its own dependencies) for something rather trivial, and you don't need its other parsing features. In essence, it does exactly the same as the function I committed. Feel free to merge or just replace the one function call with the third-party dependency — I am not passionate about this. |
We depend on typescript. And yes I agree, no to another dep. |
Where? ts-json-schema-generator/package.json Lines 58 to 95 in 46f638e
|
Oh, never mind, I was looking in the wrong place. Should I update the PR or could you make that two line change yourself? |
Go ahead! |
How tf i have never seen this 🤡 |
Can you refactor the last bit @slhck? |
This looks up the default tsconfig.json file for the current project when used from the CLI, to avoid possible compliation errors. Fixes vega#2062
Please see the new commit. |
I got burned on this last week, happy to see it getting improved. 👏 |
Thank you! |
🚀 PR was released in |
🚀 PR was released in |
This looks up the default tsconfig.json file for the current project when used from the CLI, to avoid possible compliation errors. Fixes #2062