-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 support for loading tsconfig.json #2089
Conversation
Cool! I’m looking at the failure on appveyor and don’t understand why expect != actual tests/config.test ... FAILED |
@ry I think the handling of wildcard is not the same in Linux/Windows. Maybe we have to do a workaround for those environment as it's due to |
+ actual_out = actual_out.replace(os.path.sep, '/') above or before here, should fix, but might be overkill... |
it will be more complex than that look at |
Yeah, I caught the appveyor as well. I am changing a couple things in the PR today and updating and fixing the appveyor failure as well. I think the CheckJS should be another PR after this lands as it would require a lot of infrastructure. Also, I am going to load the configuration differently, in order to facilitate both CheckJS but also the cache invalidation, but that could be a subsequent PR as well. |
Sorry it is taking so long, I am travelling with family and don't have as much time as I would expect. I have moved the loading of the config directly into the thread safe state, which should make it easier to be able to add the config to the hash and detecting if CheckJS is enabled. |
Sorry, still travelling, but I should get some time over the next couple days to finish this off. |
Testing the state changes in isolation is really challenging, because I am not sure of the easiest way to "stub" reading of the file. I haven't added a test for that yet. I still want to do the cache invalidation as part of this PR, which I should be able to address in the next 24 hours. |
What about generating a temporary file to be read by the test? |
Can you point me to any examples of something like that in Rust? |
You can use TempirDir: https://docs.rs/tempdir/0.3.7/tempdir/ Or do the same behaviour by writing your own func in the test. |
Ok, the cache invalidation is added... This is now ready for a proper review @ry. |
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.
Looking good! A few comments...
.long("config") | ||
.value_name("FILE") | ||
.help("Load compiler configuration file") | ||
.takes_value(true), |
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.
Just feed for thought here: If we ever find a need to introduce deno specific config, we'll have trouble with appropriate flag name, how about --ts-config
for TS compiler configuration?
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.
Personal opinion, if we ever need a custom config file for Deno, we are probably doing it wrong. Even if we allowed setting of flags via a configuration file, I would hope we would expand the syntax of the TypeScript format, where "compilerOptions"
would still be provided to the compiler and the rest parsed by Deno. In my opinion, Deno and TypeScript should always be synergistic instead of some sort of "adjunct".
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.
Deno and TypeScript should always be synergistic instead of some sort of "adjunct".
Fits the Philosphy. Thumb up.
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.
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. | ||
|
||
// TODO(kitsonk) Replace with `deno_std/colors/mod.ts` when we can load modules | ||
// which end in `.ts`. |
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.
Thanks
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 @kitsonk - this is a long time coming : )
Resolves #51
This PR supports the command line option
-c
/--config
and atsconfig.json
file to be passed which will then be used by the compiler.I need to do a couple things, plus any feedback on the PR:
detect"checkjs": true
in a configuration and send JS files to the compiler to re-enable the support of CheckJS for Deno.