Skip to content
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 --tsconfig-path option for CLI & support extends property in tsconfig.json #914

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

nokazn
Copy link

@nokazn nokazn commented Apr 13, 2022

Overview

Hi, there!
I've made a PR to add a new CLI option and resolve potential problems. If there is something wrong or missing, feel free to point it out.
Thank you.

Changes

  • add --tsconfig-path to specify path to tsconfig.json file for CLI option
    • if path to tsconfig.json is passed by this option, ncc sees that path directly, or if not, ncc resolve path to tsconfig.json as before
  • support extends property in tsconfig.json
    • use officially provided API by TypeScript to resolve and parse compilerOptions & extends property
    • add param-case to convert values at jsx option to kebab-case
    • use tsconfck to parse tsconfig.json options.

Related

* @param {ts.ModuleResolutionKind} moduleResolution
* @returns {string | undefined}
*/
function normalizeModuleResolutionOption(moduleResolution) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem very future proof.

Is there a way to have TypeScript convert this for us?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@styfle
I see.
I cloudn't find a way to get complete config objects by TypeScript, but I found tsconfck from microsoft/TypeScript#44573.

Does this library look future proof, do you think? If you think it's OK, I will rewrite src/utils/load-tsconfig-options.js.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrited this & related parts by 5d85cd2, which uses tsconfck.
Would be glad to review it.

@nokazn nokazn force-pushed the feature/#457/specify-tsconfig branch 2 times, most recently from d2b6b92 to 129d3df Compare April 16, 2022 04:15
@nokazn nokazn force-pushed the feature/#457/specify-tsconfig branch from 129d3df to 5d85cd2 Compare April 16, 2022 04:23
@nokazn nokazn requested a review from styfle April 16, 2022 04:25
@TheRealBarenziah
Copy link

This is a great feature, thanks nokazn! 👏
I hope your work will be merged soon as ncc TS support is incomplete without it. Unfortunately, since ncc lacks preinstall script it's a hassle to use the fork in the meantime.

@mreis1
Copy link
Contributor

mreis1 commented Jan 20, 2023

Why is still on hold? Thanks for the PR

@YElyousfi
Copy link

Hello, when can we expect this to PR to be merged?

@steverhoades
Copy link

Very interested in this addition. Is there anything I can do to help get this across the finish line?

@vtgn
Copy link

vtgn commented Jun 15, 2023

Hello, what's new about this?
This is very embarrassing to not be able to set the tsconfig file to use. :/
For example, the NestJs framework standard is to name the tsconfig file tsconfig.build.json for the code only, extending the tsconfig.json file used for code and test.
Without this feature, we cannot respect the NestJs standard. :(
Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to specify path to tsconfig.json
7 participants