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 for project references #26

Closed
fubhy opened this issue Oct 30, 2023 · 7 comments
Closed

Support for project references #26

fubhy opened this issue Oct 30, 2023 · 7 comments

Comments

@fubhy
Copy link

fubhy commented Oct 30, 2023

Is it currently possible to set up tshy in a monorepo and leverage projects references (with composite and incremental builds)? If not, is that sth. you have planned?

@isaacs
Copy link
Owner

isaacs commented Nov 2, 2023

I use tshy in a monorepo, but not at the root level. I just have each of the packages in the monorepo do their own tshy builds (so I guess it's not "using tshy in a monorepo" but more like "have a monorepo containing a bunch of packages that use tshy").

I'm not sure if it's possible to make it compatible with composite/incremental builds. I haven't looked too much into that, since it seemed to impose a lot of complexity on the project structure. Since tshy works by doing two complete builds into a fresh temp outDir each time, I imagine that it'd be tricky to get it to work with incremental builds? I suppose we could use a separate outDir for each dialect, and keep them around between builds or something?

How would you like it to work?

@isaacs
Copy link
Owner

isaacs commented Nov 3, 2023

Ok, so, leaving aside project references, and just looking at incremental/composite.

"composite": true seems to pretty much Just Work (assuming that you comply with the caveats/restrictions that it imposes (all files being listed, declaration being true, etc), but tshy defaults that all to be the case anyway.

"incremental": true works, but... uselessly. Because tshy builds in a temp dir and then deletes it, it's always throwing away the *.tsbuildinfo file, which means it's starting from zero every time.

I think what it ought to do is detect incremental: true in the config, and if so, do not delete the .tshy-build-tmp folder. It can still delete it if it's not in incremental mode, since in that case, there's no benefit to keeping multiple copies of the built artifacts.

@fubhy
Copy link
Author

fubhy commented Nov 3, 2023

Hey. Sorry I'm neck deep in some major refactorings atm. and got zero head space right now to ponder this :-). I'll report back here in a few days when I'm done with this game of whack-a-mole! Sorry for not being responsive.

@isaacs
Copy link
Owner

isaacs commented Nov 3, 2023

Hm, the caveat here would be that if you set "incremental": true, then tshy won't delete an output file if it is removed from src. (I suppose it could just removed files explicitly, but that's kind of a pain.)

@isaacs
Copy link
Owner

isaacs commented Nov 3, 2023

@fubhy No worries! I just like to dump thoughts on issues stream of consciousness style while working on it, or else I lose my place and forget what I was doing when I come back to it. Feel free to ignore or weigh in asynchronously whenever you like, or never, as you see fit :)

@isaacs
Copy link
Owner

isaacs commented Nov 4, 2023

Incremental composite builds seem worthwhile even if you aren't using project references, and can speed up build times, so why not. Just need to keep the .tshy-build-tmp folder around. (Might want to rename it to .tshy-build, since it's not tmp if you use incremental building?)

I think maybe that'll make it just work with project references? But I'm not sure.

@fubhy I'll land #29 and leave this open, you can weigh in whenever you get dug out of your refactor hole, or someone else can come along and verify that it works for them, or maybe someday I'll actually use project references and verify it for myself :)

isaacs added a commit that referenced this issue Nov 4, 2023
@isaacs
Copy link
Owner

isaacs commented Dec 16, 2023

Closing to get this off my todo list, but happy to reopen of course if there's more to be done here :)

@isaacs isaacs closed this as completed Dec 16, 2023
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

No branches or pull requests

2 participants