-
Notifications
You must be signed in to change notification settings - Fork 6
Description
@jaredly gave some good feedback about how many moving parts there are even with pesy. In some cases, there's some ways to make those much less noisy or require less explanation.
In other cases, there's not much we can do:
Why do packages need to be named
package-nameand then the namespaces/files be namedPackageName?
The reason is that packages end up in file paths, and not all file systems are case sensitive. If publishing to npm they even mandate that everything be lowercase.
With some changes to esy, we could maybe fix that. But it would be weird and different than npm. Not necessarily bad.
How about making the public library name the same as the module name so they're both
LikeThis?
I think that has the same problem. The library name ends up in file paths so it has to be like-this when the module name is LikeThis
Okay, what can we do to simplify?
One great simplification is to use pesy to hide public library names and make people basically think they're just supplying require paths! We do that by making the public library names correspond directly to their paths inside their packages.
{
"name": "my-package",
"build": "dune build -p #{self.name}",
"buildDirs": {
"lib/here": {
"namespace": "Foo",
"require": ["my-package/lib/there"]
},
"lib/there": { },
"bin/my-binary.exe": {
"require": ["my-package/lib/here", "@reason-native/console"]
}
}
}You wouldn't even have to specify a namespace most of the time. You could even infer it from the library path (so "lib/this-path" could automatically have namespace ThisPath).
So what's going on is that packages at "lib/there" are actually getting a dune public_nameofmy-package.lib.there`.
This is really nice because it makes it feel a lot like npm - they're just require paths like they've always been using. The only difference is that they have to specify them in the package.json per directory instead of per file which is actually kind of nice because it gives you a bird's eye view of your project.