#Nested Modules / Context Arguments
1 messages ยท Page 1 of 1 (latest)
My understanding was that if I have this in a Dagger module:
/**
* Run Bun install for the entire monorepo
*/
@func()
bunInstall(
@argument({
defaultPath: ".",
ignore: [
"*",
"!package.json",
"!bunfig.toml",
"!bun.lockb",
"!**/package.json",
"**/node_modules/**/package.json",
],
})
directory: Directory
): Container {
return dag.nodeJs().withBun(directory).withExec(["bun", "install"]);
}
Calling this module from anywhere in my nested monorepo without arguments would run with . being relative to the module itself
I even sure I've tried this and it worked
However, it doesn't seem to be working with 0.13?
this was changed in https://github.com/dagger/dagger/pull/8391
@bitter narwhal @bleak pilot can we get a release note next time ๐
sorry, that sounded snippy, that's not what i meant
That wasn't necessary because it's an adjustment to a PR that's in this release.
I don't think that's the problem I'm facing?
context directories were added in v0.12.6
Amazing!
Oh yeah, I forget sorry ๐ฆ
Oh, right! For some reason I thought it wasn't released yet so I didn't flag the missing change log.
THIS IS AMAZING
bunInstall(
@argument({
defaultPath: ".",
ignore: [
"*",
"!package.json",
"!bunfig.toml",
"!bun.lockb",
"!**/package.json",
"**/node_modules/**/package.json",
"**/dagger/**",
],
})

Don't you need ** instead of just *?
Nope, ** is for finding files or directories that are nested within
- is everything
I can now have a function in the root of my mono repo that only mounts project package.jsons, runs a bun recursive install and cache that node_modules for all future per project runs
and it's working nicely
not as fast as I'd like, but one step at a time ๐
What's the slowest part? Is it initialize?
Hmm, perhaps my internet today
I'll share some traces
2m is .sync ?
Which I assume is the actual bun install ?
Seems like the slowest part for you is bun install. 1m20s.
2177 packages installed [7.81s]
Locally
after running rm -rf ~/.bun
Hmm, maybe that's not my bun cache
In uv (Python), it uses hardlinks locally (between the cache and project), but in a container it's different file systems so it has to copy the files instead. Do you want to try in a docker container (with a cache volume for the bun cache)?
find . -name "node_modules" -exec rm -rf {} \; && bun install --no-cache
36s
@bitter narwhal I'll try that now, good idea
Fresh install is still 2 mins, but got subsequent installs down to 6s with using a cacheVolume for global cache
dumb question: where does that exec bun install even come from? i don't see a withExec() for it anywhere in the trace ๐ค
It's part of the Void.sync?
I tried putting the global bun cache inside the node_modules cacheVolume to see if that could force hardlinks
but no improvement
that's what forces it to run, but I don't see what actually installs the exec - normally there's a corresponding withExec(["bun", "install"]) somewhere
@func()
bunInstall(
@argument({
defaultPath: ".",
ignore: [
"*",
"!package.json",
"!bunfig.toml",
"!bun.lockb",
"!**/package.json",
"**/node_modules/**/package.json",
"**/dagger/**",
],
})
directory: Directory
): Container {
return dag.nodeJs().withBun(directory).withExec(["bun", "install"]);
}
hmm ok that's what I would have assumed, but it's missing from here for some reason
(sorry, this is a tangent, I'm just doing trace UI work, so paying extra attention to things like that)
I found it under .sync.
that's the exec, not the withExec that installed it ๐ - that one's nowhere to be found, mysteriously
Ah, I see what you mean now ๐
This one seems broken and I can't Ctrl-C