Closed BigForNothing closed 3 years ago
Hi Big, thank for reaching out. When I understood it correctly you want be able to specify a different tsconfig name or?
Instead of following which would target the tsconfig.json by default
"references": [
{ "path": "../src" }
]
you would like to have the possibility to specify the another config name like that here
"references": [
{ "path": "../src/tsconfig.build.json" }
]
Best Mirko
Correct, you are understanding it correctly.
Would you expect to have the value which is passed via the configName applied to the end of the path as well or did you would like to see a new param to control it independently?
I think a good practice would be "both".
linkedConfigName
in the examples below, but ive put no thought into a "good" name for the argument), it uses that.--configName
. configName
or linkedConfigName
does not exist in the directory it needs to reference, it uses either tsconfig.json
or the method currently implemented. npx update-ts-references --configName tsconfig.build.json
Uses the configName to both update (as it does today) and point to. So it would come out as
"references": [
{ "path": "../src/tsconfig.build.json" }
]
If tsconfig.build.json does not exist in the src directory, use ../src
(as it currently does) or ../src/tsconfig.json
.
npx update-ts-references --configName tsconfig.build.json --linkedConfigName tsconfig.different-build.json
Functions as previous examples, but references change to
"references": [
{ "path": "../src/tsconfig.different-build.json" }
]
Same fallback as above exists
Hi Big, sorry for letting you wait with an answer. In general I think I made a mistake when I introduced the configName param because it wasn't referencing the config by name probably. This should be addressed be #23 and adds also a fallback (to tsconfig.json) in the config file resolution.
Regarding the proposal of the --linkedConfigName
I need first to think about if I like it 😅 , but I hope the other change will enable you and other to work with our script.
Best Mirko
It's released now with v2.4.0. If you encounter any further issues please let us know.
I just realized I never followed up. Works as expected! Appreciate the work!
In my monorepo, I have
tsconfig.json
andtsconfig.build.json
. The project references are intsconfig.build.json
and using the--configName
arg, I can correctly use that. However the changes have the reference point to the directory. I would like it to be able to specify which filename it points. As all the the different packages have their owntsconfig.json
andtsconfig.build.json
It would be great if I can specify that filename as well. Maybe with the option of falling back to the current directory approach if that file happens to not exist for a package.