eBayClassifiedsGroup / update-ts-references

Helper for multi-package repository with TypeScript
MIT License
46 stars 6 forks source link

filename reference #22

Closed BigForNothing closed 3 years ago

BigForNothing commented 3 years ago

In my monorepo, I have tsconfig.json and tsconfig.build.json. The project references are in tsconfig.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 own tsconfig.json and tsconfig.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.

MKruschke commented 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

BigForNothing commented 3 years ago

Correct, you are understanding it correctly.

MKruschke commented 3 years ago

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?

BigForNothing commented 3 years ago

I think a good practice would be "both".

Without additional argument

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.

With additional argument

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

MKruschke commented 3 years ago

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

MKruschke commented 3 years ago

It's released now with v2.4.0. If you encounter any further issues please let us know.

BigForNothing commented 3 years ago

I just realized I never followed up. Works as expected! Appreciate the work!