#How to include a utility type in multiple projects

9 messages · Page 1 of 1 (latest)

warm mica
#

I have a mono-repo with three packages that all require a reference to a common type. What, if any, is the "correct" way to define and automatically include this type to each package so that it would also be included in the resulting NPM .tgz?

proper plume
#

IMO, the correct way to do this is to define that type in a package that is depended on by the other packages

warm mica
#

due to our project structure that's unfortunately not possible.

i need to "mirror" the type myself and include it in the packages

proper plume
#

ick... with that requirement, I guess I'd probably have a source file that is copied to each package with a prebuild step

warm mica
#

yeah, that's what i went with right now, as well

proper plume
#

Or potentially some postinstall setup that creates a symlink to the original file

#

Not sure how nicely that'd play on windows though

warm mica
#

sounds like a potential problem, true. the copy is safer in that sense. not ideal, but i guess it is what it is.

thanks for taking the time 🙂

proper plume
#

👍 can always use rsync/robocopy so that it's skipped if the file is up to date at least