Replies: 1 comment
-
We definitely want to have good monorepo support and it's something we are thinking about but it will first be with bun install before the runtime |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My ideal package manager is one in which defining an npm package is simply a matter of indicating that a single file or folder should be published as a package.
For most monorepos, decisions have to be made about the boundary of what is a package with a
package.json
file. What should be split off into a helper libary, framework, etc.I think it would be better to control the package boundaries in a config setting. Allowing more flexible sharing of packages.
Usually you start with a monolithic structure like:
Now say you want to turn
baz
into a package:src
dirpackage.json
andtsconfig.json
filebaz
manually, that only
baz` needsThis is a lot of manual work, and makes decisions about package boundaries sticky, and hard to change. This can cause a lot of unnecessary complexity if things are split to early, and incorrectly, making it hard to undo stuff. Also because it's hard to split things, some packages will end up with a lot of coupling when they should actually be split.
To solve this:
package.json
files should be generated as needed. Nx uses aproject.json
file and has a task to generate them. Because Bun has control over the package resolver in its runtime, perhaps it wouldn't even need thispackage.json
file to ever exist except whenpublishing
.react
andreact-dom
. You could create "dependency sets" to solve this.E.g.
The point here is that you are setting exceptions, and the rest of the dependencies are implictly set to the default version ranges.
#monorepo/foo/bar/baz
->@org/foo.bar/baz/index.js
.Advantages
package.json
.Challenges
The challenges are mainly around package-specific import aliases (
package.json#imports
). Because boundaries are not rigid, every path would have to be relative to the monorepo root.#monorepo/bar/baz/index.js
instead of#baz/foo.js
(i.e. ifbar
was a package)@org/foo.bar.baz/index.js
. So same issue if you rename the package. And also reduces the chance that someone renames a package, but keeps an out-dated package name that no longer maps to the directory structure.Beta Was this translation helpful? Give feedback.
All reactions