-
Notifications
You must be signed in to change notification settings - Fork 463
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
Pinned packages support #4361
Comments
Another issue that makes the monorepo experience challenging is #4084. An example use case that we've seen is the generation of |
I have forked the monorepo @BlueHotDog posted and rewritten it to show the style of monorepo I would like to use. I've written up all the things this is designed to achieve, and why it doesn't currently work, in the readme: This structure holds a lot of potential, I very nearly used it for my production project, but the watch-rebuild process is just slow enough to be annoying and the lack of compiler warnings really killed it for us. |
@TheSpyder that's awesome! thank you(hopefully BS gods will hear this) The way i'm doing it now, e.g by having a single top level bs-config makes this impossible(you have to run a single build, so when working on the flow i've to:
|
@BlueHotDog you can still run each project separately if you want, even in my example 😁 Little-known fact about npm module resolution, it also supports searching for a parent
In fact, my setup might work for you today if you never use a top-level |
I actually work on a monorepo that uses Lerna + Yarn workspaces - Pupilfirst. It's not a traditional workspaces-based monorepo, in that there is a top-level application, with other packages inside it; they're not all side-by-side like in the example @TheSpyder created. And it works... most of the time. Occasionally, the bsb compilation will start failing, complaining about the presence of duplicate It's a bit annoying, but it happens rarely enough that it doesn't get in the way of work, and it was the only way I could set this up as a monorepo. I haven't a clue why this happens - I haven't been able to replicate it reliably, but it probably has something to do with all packages (including root) having their own |
@harigopal your top-level My guess about your |
Seems that on BS 8 the situation is better and now i can work with Yarn Workspaces.(was this fixed? couldnt see anything in any communications nor was it on the roadmap.. but.. yeah) |
I'm not sure what changed, but I don't believe it has been fixed. I'm still struggling along without access to If you don't want to keep this open, I'll open a new one 🤔 |
Yup, my mistake, wasn't fixed. |
@bobzhang any update on this? is this planning to be getting some attention? unfortunately if this is a no-go i can't use Reasonml and need to move code back to typescript i would just love to know before i make any drastic changes. |
Hi, sorry for your bad experience.
It’s on our roadmap for this half so we will have a look . But I am not
sure if we can deliver it in a timely manner to match your expectation.
Danni Friedland <notifications@github.com>于2020年8月10日 周一下午9:55写道:
@bobzhang <https://github.com/bobzhang> any update on this? is this
planning to be getting some attention? unfortunately if this is a no-go i
can't use Reasonml and need to move code back to typescript i would just
love to know before i make any drastic changes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFWMK5MDLJJJQ2FO35UJRLR7735XANCNFSM4M4ORL5A>
.
--
Regards
-- Hongbo Zhang
|
Hopefully, if i could get some visibility into what's planned to ship(and a ballpark of when) i can make an educated decision with the team. |
I will think about it and get back to u later this week
Danni Friedland <notifications@github.com>于2020年8月10日 周一下午10:53写道:
Hopefully, if i could get some visibility into what's planned to ship(and
a ballpark of when) i can make an educated decision with the team.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFWMKYXVEBK5PFXOODG5J3SAACWFANCNFSM4M4ORL5A>
.
--
Regards
-- Hongbo Zhang
|
Hi Danni, sorry for being late, I checked my calendar that we'll start the
improvement over build system in general in mid September, this is an issue
we will prioritize.
…On Mon, Aug 10, 2020 at 10:53 PM Danni Friedland ***@***.***> wrote:
Hopefully, if i could get some visibility into what's planned to ship(and
a ballpark of when) i can make an educated decision with the team.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFWMKYXVEBK5PFXOODG5J3SAACWFANCNFSM4M4ORL5A>
.
--
Regards
-- Hongbo Zhang
|
Hey Bob, Thanks! |
I'm also happy to help with thoughts on how changes will impact my attempts to develop in a monorepo |
Hey guys, any news on this issue? |
Hi, we are working on the improvement of build system currently, will get
back to you if we need more feedback
…On Mon, Sep 14, 2020 at 4:05 AM Itay Adler ***@***.***> wrote:
Hey guys, any news on this issue?
I've been working heavily these past few weeks on a ReScript monorepo, and
I experience pains with setting up a consistent watch flow, between 2
packages (app, common), it keeps breaking whenever I change something in
the common package, and then I need to run a clean build on both packages
in order to get it working
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFWMKZU2OMQTI23OLF2KSLSFUQZHANCNFSM4M4ORL5A>
.
--
Regards
-- Hongbo Zhang
|
sweet, ty 🙇 would love to help anyway I can |
Hey, i see there's a lot of progress on 8.3, and i was eager to try and see if we get good Monorepo support. |
Hi, it is not in this release. As you can see, we are working on build
system stuff in this release, we will keep working on build system related
stuff in next release
…On Wed, Sep 23, 2020 at 11:25 PM Danni Friedland ***@***.***> wrote:
Hey, i see there's a lot of progress on 8.3, and i was eager to try and
see if we get good Monorepo support.
Not sure if this release is intended to fix these issue, but it seems like
the problems are still there - Is 8.3 intends to address better support for
monorepo?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFWMK7YSPSGSMURLYQ57ODSHIHPHANCNFSM4M4ORL5A>
.
--
Regards
-- Hongbo Zhang
|
@bobzhang exciting stuff about 8.3! myself and the company I work for really love ReScript and this issue is affecting us on a daily basis, as we need to workaround it each time it occurs. |
As far as I understand they're all facebook employees, I don't think they need patreon support 😂 |
Really eager to see this happening! We have a pretty big monorepo here and we suffer in a daily basis with the problems pointed above. If there is any way we can help testing you can count with us @bobzhang. Thanks for your effort |
I'm transitioning to a monorepo too, to share code between the react-native and the react-native-web apps essentially. For now I launch bsb watch in each packages I needed, with the same package-specs (module: es6, in-source: true), It work while working on implementation detail (example : doing styles in packages/design-system while working on the package/react-native-app), but doesn't if I change parameters of a componentd for example. |
yes, sorry, I've been busy but I'll give it a go tonight or tomorrow |
I couldn't make my example reason monorepo reproduce the issue so I'll try making it more complex. In the meantime I switched back to my main repo and I was wrong about something:
I must have put my repository into a weird state to make that compile. The problem is that it's still a circular dependency:
So unless the dev sources can be compiled in a separate pass I'll need to unwind those dependency links. On a clean repo it's giving me a module not found error compiling the tests of library 1, which is a bit misleading but oh well. |
Looks like the weird state I was seeing where no changes caused a full rebuild were related to the cycle that wasn't really a cycle. With a clean checkout and no fake cycles it's fine. Sorry about that. It's still unusable for large monorepo projects due to this thing you said earlier
But I'm going to log a new issue for that as it is a separate discussion. Pinned packages seem to be working as designed. |
Hi, I made a release 8.4.0 under dev tag, it should work on
Linux/Windows/Mac
…On Tue, Dec 1, 2020 at 1:15 AM Danni Friedland ***@***.***> wrote:
@Hongbo-bb <https://github.com/Hongbo-bb> could you please ping when i
can test again?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRMSRWXV5TKZFHAVDJMRDSSPHMNANCNFSM4M4ORL5A>
.
--
-- Regards, Hongbo
|
@Hongbo-bb amazing! it seems to pass, i've noticed that linux dist seems to be incorrectly packed? https://github.com/Coobaha/bsb-smallest-monorepo-example/runs/1505808007?check_suite_focus=true Build passes on mac and uses correct bsb :) |
Doesnt work :(
|
Indeed, it seems I made a mistake for publishing on linux.
Should be good now -- 8.4.1
…On Sun, Dec 6, 2020 at 5:44 PM Alexander Ryzhikov ***@***.***> wrote:
@Hongbo-bb <https://github.com/Hongbo-bb> amazing! it seems to pass, i've
noticed that linux dist seems to be incorrectly packed?
https://github.com/Coobaha/bsb-smallest-monorepo-example/runs/1505808007?check_suite_focus=true
Build passes on mac and uses correct bsb :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRMSTIAYKWTL2E23YXVTLSTNHAXANCNFSM4M4ORL5A>
.
--
-- Regards, Hongbo
|
Just tried again :(
|
can you double check that if your bs-platform is indeed 8.4.1?
…On Mon, Dec 7, 2020 at 1:55 AM Danni Friedland ***@***.***> wrote:
Just tried again :(
I'm a bit lost between all the versions, but seems to not work still:
Still getting this weird error.
19:51:04.978 | [4/4] Building fresh packages...
-- | --
19:51:16.633 | Done in 112.46s.
19:51:17.028 | yarn run v1.22.4
19:51:17.058 | $ NODE_ENV=production yarn re:cleanbuild && NODE_ENV=production yarn js:build
19:51:17.264 | $ bsb -clean-world -make-world
19:51:17.336 | bsb: error: loading 'build.ninja': No such file or directory
19:51:17.336 | Failed
19:51:17.341 | bs-platform version mismatch Running bsb 8.4.0-dev.1 (/vercel/workpath0/node_modules/bs-platform) vs vendored 8.4.0 (/vercel/workpath0/node_modules/bs-platform)
19:51:17.352 | error Command failed with exit code 2.
19:51:17.352 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
19:51:17.369 | error Command failed with exit code 2.
19:51:17.369 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
19:51:17.377 | Error: Command "yarn build " exited with 2
19:51:19.526 | Done with "package.json"
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRMSWKJDS4VK6N66J27ITSTPASLANCNFSM4M4ORL5A>
.
--
-- Regards, Hongbo
|
i did, also made sure yarn.lock has 8.4.1. |
The log is weird, what's the output of `npx bsb -v`? it should say `8.4.1`
on your platform
…On Mon, Dec 7, 2020 at 3:27 PM Danni Friedland ***@***.***> wrote:
i did, also made sure yarn.lock has 8.4.1.
it fails the same way on chromatic/vercel
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRMSSNDE3IVXYBSWNT64TSTR7UZANCNFSM4M4ORL5A>
.
--
-- Regards, Hongbo
|
Yeah, super weird. and it works locally on my OSX. the problem is, i dont have shell access to any of these platforms. pinging you on Discord to maybe give you some other way to look. |
It seems to be passing on Linux, before it was failing with the same error as you have @BlueHotDog Can you reproduce this error with my repo and vercel build? |
Just tried, and seems to work. well. no idea what is happening.. and no idea what this error means :( |
I won't have time to log the issue until tomorrow, probably, but I have added pinned packages support to my example monorepo (it's probably a good way to show how pinned packages work, actually) and there's a blurb in the readme about why it isn't quite good enough for large projects. |
Changing ExampleStyles.re in b causes package c to rebuild even though c does
not use it.
Changing ATest.re - which is a development source file and therefore
cannot have any impact on the exported code - triggers a complete rebuild
of packages b and c.
This could be fixed but I think it still won't match with the expectation
of true monorepo -- when you do change the interface type, it would trigger
the whole project rebuild.
In that case, the benefit of such minor improvement is not that high?
…On Tue, Dec 8, 2020 at 4:56 AM Andrew Herron ***@***.***> wrote:
But I'm going to log a new issue for that as it is a separate discussion
I won't have time to log the issue until tomorrow, probably, but I have
added pinned packages support to my example monorepo
<https://github.com/TheSpyder/reason_monorepo> (it's probably a good way
to show how pinned packages work, actually) and there's a blurb in the
readme about why it isn't *quite* good enough for large projects.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRMSRWWQEVTNDSBNGZHPLSTU6PZANCNFSM4M4ORL5A>
.
--
-- Regards, Hongbo
|
@andrew Herron <andrew.herron@gmail.com> I made an experimental PR in #4863
to support more fine-grained dependency tracking. This is the best that we
can achieve given we treat the package as a black box.
It works best when you write interface file for your packages
…On Tue, Dec 8, 2020 at 11:53 AM Hongbo Zhang ***@***.***> wrote:
> Changing ExampleStyles.re in b causes package c to rebuild even though c does
not use it.
> Changing ATest.re - which is a development source file and therefore
cannot have any impact on the exported code - triggers a complete rebuild
of packages b and c.
This could be fixed but I think it still won't match with the expectation
of true monorepo -- when you do change the interface type, it would trigger
the whole project rebuild.
In that case, the benefit of such minor improvement is not that high?
On Tue, Dec 8, 2020 at 4:56 AM Andrew Herron ***@***.***>
wrote:
> But I'm going to log a new issue for that as it is a separate discussion
>
> I won't have time to log the issue until tomorrow, probably, but I have
> added pinned packages support to my example monorepo
> <https://github.com/TheSpyder/reason_monorepo> (it's probably a good way
> to show how pinned packages work, actually) and there's a blurb in the
> readme about why it isn't *quite* good enough for large projects.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#4361 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ADLRMSRWWQEVTNDSBNGZHPLSTU6PZANCNFSM4M4ORL5A>
> .
>
--
-- Regards, Hongbo
--
-- Regards, Hongbo
|
Thanks! I look forward to testing it, I do usually have more interfaces it was just an example |
Hi @andrew Herron <andrew.herron@gmail.com> I published a version
8.4.2-dev.1 for Mac, let me know if it works for you
…On Tue, Dec 8, 2020 at 3:13 PM Andrew Herron ***@***.***> wrote:
Thanks! I look forward to testing it, I do usually have more interfaces it
was just an example
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRMSVEVMTNIABWORTXDULSTXGZBANCNFSM4M4ORL5A>
.
--
-- Regards, Hongbo
|
That's beautiful, thank you! 😁 So the change means that saving an implementation will no longer trigger dependent rebuilds, but saving an interface still does? I tested by swapping back and forth between pinned packages and a single flat The single namespace is able to avoid dependent modules rebuilding in this scenario when the interface contents remains the same. As a pinned package, that same change causes all dependent modules to rebuild; presumably because the build system is operating in new contexts for dependencies and only checks the file timestamp not whether the interface actually changed. This means it's still slower to develop on than the single namespace but it's vastly improved from 8.4.1 and I think that tips the balance such that team will overlook the speed difference to get the improved monorepo experience. |
I have updated my example monorepo with 8.4.2-dev.1 and added interface files to every pinned dependency. The readme now lists just one example that triggers a forest of rebuilds. |
Thanks for checking the new release. When the package's interface changes,
it will trigger a rebuild, the current situation is the best we can get in
theory when we treat the package as a black box.
…On Thu, Dec 10, 2020 at 3:42 AM Andrew Herron ***@***.***> wrote:
I published a version 8.4.2-dev.1 for Mac, let me know if it works for you
That's beautiful, thank you! 😁
So the change means that saving an implementation will no longer trigger
dependent rebuilds, but saving an interface still does? I tested by
swapping back and forth between pinned packages and a single flat
bsconfig.json, then saving one of my .rei files (no changes but it causes
the file to be built).
The single namespace is able to avoid dependent modules rebuilding in this
scenario when the interface contents remains the same. As a pinned package,
that same change causes all dependent modules to rebuild; presumably
because the build system is operating in new contexts for dependencies and
only checks build date not whether the interface actually changed.
This means it's still slower to develop on than the single namespace but
it's vastly improved from 8.4.1 and I think that tips the balance such that
team will overlook the speed difference to get the improved monorepo
experience.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4361 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRMSUEYFVLDL2TNLNOT3TST7HI7ANCNFSM4M4ORL5A>
.
--
-- Regards, Hongbo
|
Yeah I can understand that’s the current design. It would be nice if pinned packages weren’t a black box but that would be hard with features like namespace: true (and it can be improved later if you find a way to do it). |
Hi! I read the blogpost but I don't understand how it work. I put one of my workspace I read that watcher is an other topic that isn't yet ready I think. How can I benefit of the advantages of a monorepo with yarn workspace? Working on files in different packages without switching script run, clean and relaunch every time, just like if we work on separate repositories… I should miss something I don't understand, or maybe it's not yet ready? (because of watcher) |
@Freddy03h The test monorepo I used to provide feedback is a good example of how to run with pinned packages. I'll update it to the 8.4 release soon. |
@TheSpyder Thank's for the answer, I finally got time to test it.
|
Watching is the easiest part, I had actually stopped using
This does lose the timing printout for each compile but I'm planning to add a little shell script to do that later (and then I'll post the whole thing on the forum). |
@TheSpyder we wanted to create a dedicated doc page just for monorepo support (see related issue)... might be worth adding your findings on a reliable watch setup in userland there as well. |
Will do, sorry I thought I would have it done by now but life has been a bit busy. |
https://github.com/BlueHotDog/reason_monorepo
Monorepo support via common tooling(specifically in the above repo Lerna) is broken.
Monorepo support for JS projects is usually being done by using symlinks to support cross-project dependencies - That's the most basic and common workflow.
Another possible monorepo approach is by using Yarn workspaces, which utilizes symlinking even more by hoisting all dependencies to the "root".
Currently, bucklescript is unable to handle any kind of monorepo setup, which, after trying to bang my head, is impossible to solve and leads to a very weird workflow for any ambitious, project(e.g a modern SPA + Nodejs server in Reason).
The example project above illustrates all the problems, but just to summarize what i've encountered:
Links to previous discussions that died out and might be related:
#3521
#4047
As there's no roadmap for reasonml. any type of communication regarding stale issue would really help.
The text was updated successfully, but these errors were encountered: