-
Notifications
You must be signed in to change notification settings - Fork 13
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
towards Nupm workspaces #48
Comments
This comment was marked as resolved.
This comment was marked as resolved.
Sounds good. I'm also fine renaming |
nice, i'll start working on all this then 😌
yeah, |
progress on point 2i'm trying to use a keyword, i've defined the following simple module
with # mod.nu
use pkg/lib/lib.nu # tries to use an internal _library_ command
# ___
# `-> the example is a bit contrived, because one could just `use lib/lib.nu` here.
# but, because `use lib/lib.nu` would mean `use ./lib/lib.nu` and we want to
# abstract away from the exact location of the root of the module => imagine
# a submodule deep inside, you'd have to write `use ../../../lib/lib.nu` but
# here we want the same `use pkg/lib/lib.nu` everywhere!
export def main [] {
print "this is foo"
lib # here
} # lib/lib.nu # defines a _library_ command
export def main [] {
print "this is lib"
}
which is expected now, when i try to make
let pkg = open package.nuon | get name
# NOTE: just to wait for 0.88 and `std null-device`
def null-device []: nothing -> path {
"/dev/null"
}
let head = ^mktemp -t -d nupm_install_XXXXXXX
^git worktree add --detach $head HEAD out+err> (null-device)
rm --recursive ($head | path join ".git")
^git worktree prune out+err> (null-device)
let target = "target" | path join $pkg (^git rev-parse HEAD)
if ($target | path exists) {
rm --recursive $target
}
mkdir $target
cp --recursive ($head | path join $pkg) ($target | path join "pkg")
$env.NU_LIB_DIRS = [
("target" | path join (open package.nuon | get name) (^git rev-parse HEAD))
]
|
I think I misunderstood your point 2, we don't have anything like Rust's |
@kubouch i've created a draft PR to try things out 😋 |
i was once again working on NGM and was thinking about a few things related to Nupm 😏
in allow installing multiple modules from a single package #33, we made it possible to install multiple distinct modules from a single package, e.g.
nu-git-manager
andnu-git-manager-sugar
in NGM. However, after using this feature, it sounds a bit strange... it's a bit like having two separatesrc/
directories in a single Rust crate 🤔i think we should revert that feature and keep it simpler, i.e. a single module per module package, and move towards a "workspace" or "bundle" model
in NGM, i always have to write things like
use ../../foo/bar.nu
in the modules themselves oruse ../src/nu-git-manager/
in the tests, which is not that great 🤔i think it would be great to have a
nupm run
that would resolve the dependencies and do that for the user, e.g.use module/foo/bar.nu
anduse nu-git-manager
respectively: this would only be a trick withNU_LIB_DIRS
to expose modules and activate overlayspkg
keyword #52would be cool to have multiple module packages in a repo and a central top-level
package.nuon
that would define a "workspace" and allow maybe to install everything at once?, e.g.nupm install --workspace
package.nuon
tonupm.nuon
nupm.nuon
#51The text was updated successfully, but these errors were encountered: