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

Support custom tsconfig paths #30

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

cmidgley
Copy link
Contributor

Custom tsconfig.json file are ignored by di-compiler, as it uses the get-tsconfig package to scan for the default tsconfig.json file. For example, if using tsconfig.test.json with "di": { "identifier": "myContainer" }, it will not work because di-compiler will load these settings from tsconfig.json (and not tsconfig.test.json).

To resolve this, the arguments passed to the compiler (in typescript.sys.args) are checked for the -p (or --project) options and the following parameter is used as the typescript filename, which is then provided to the get-tsconfig method getTsconfig. If the -p option is not found, it results in undefined, which falls back on the existing defaults to scan for a tsconfig.json file.

Ran test suite and all tests pass. Likely the github actions execution will fail again, as my last pull request failed due to a pnpm version compatibility issue with the actions (and #28 likely needs to be addressed as well).

Copy link
Owner

@wessberg wessberg left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for your contribution!

@wessberg wessberg merged commit a6a8e11 into wessberg:master Sep 25, 2024
0 of 15 checks passed
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.

2 participants