Suggestion: Pinned dependencies should be transitive
I'm not sure whether this is a bug. I'm wording this issue like a feature request instead of a bug report since transitivity isn't specified in the pinned-dependency docs.
Current Behavior
Right now, pinned dependencies are not transitive: if c is a pinned dependency of b and b is a pinned dependency of a, then c is not necessarily a pinned dependency of a. This means that if c is not explicitly marked as a pinned dependency of a, then when a is rebuilt, all dev files in c are deleted.
Suggested Behavior
When a is built, dev files in c should also be build since c is a transitive pinned dependency of a through b.
Motivation
- Non-transitivity is unintuitive. Dependencies, including the dependencies and dev-dependencies in bsconfig and package.json, are almost always transitive.
- Non-transitivity makes building and testing code more complicated. When testing packages in a mono-repo, its common to build and test all packages in the repo using commands like
yarn workspaces foreach run build && yarn workspaces foreach --parallel run test. For those not familiar with yarn, the commandyarn workspaces foreach run [script]runs the given script on each project in a workspace in arbitrary order. To build and test a monorepo that uses rescript, you have two options:- Build projects in topological order (
yarn workspaces foreach --topological-dev run build-test). Sincerescript buildisn't thread-safe, the command above can't be run with the--paralleloption. - Create a phony project that depends on all other projects and build it before testing (
cd phony-project && yarn build && cd top && yarn workspaces foreach --parallel run test). This approach becomes more complicated when non-ReScript packages are in the same monorepo as ReScript packages.
- Build projects in topological order (
You can take a look at the logic around here
https://github.com/rescript-lang/rescript-compiler/blob/master/jscomp/bsb/bsb_config_parse.ml#L305
did you find any solution here ? i am facing the same.
Did you try https://github.com/teamwalnut/rewatch?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I believe Rewatch, the new build system, solves this. Feel free to reopen if not.