nupm icon indicating copy to clipboard operation
nupm copied to clipboard

some ideas for `nupm update`

Open amtoine opened this issue 2 years ago • 1 comments
trafficstars

i just wanted to throw this script in there, in case it can give inspiration to someone to write nupm update :pray:

# install a Nushell package without installing `nupm`
def nupm-install [
    package: path,  # the path to the local package to install
    --log-level: string = "DEBUG"  # the log level for the install
    --nupm: path,  # the path to the `nupm`'s directory
]: nothing -> nothing {
    nu --commands $"
        use ($nupm)
        NU_LOG_LEVEL=($log_level) nupm install --path ($package)
    "
}

alias "nupm install" = nupm-install --nupm (
    $env.GIT_REPOS_HOME | path join "github.com" "nushell" "nupm" "nupm"
)

def "nupm update" [repos: list<string>]: nothing -> nothing {
    for repo in $repos {
        let package = $env.GIT_REPOS_HOME | path join $repo

        git -C $package pull origin main
        nupm install $package
    }
}
nupm update [
    "github.com/goatfiles/scripts/nu_scripts"
    "github.com/amtoine/nu-git-manager"
    "github.com/amtoine/zellij-layouts/nu-zellij"
    "github.com/nushell/nu_scripts"
]

amtoine avatar Sep 04 '23 17:09 amtoine

I'm assuming this would need to work from Git tags on the module repo and those that are recognised as version numbers? So, updating everything to "latest" would infer what is latest based on semver comparisons presumably.

Once we have a dependencies file, it would need to be two operations I guess, one to update based on dependencies changed in the file by the user and another to discover what the latest versions are and apply them to the file ... But that's a tomorrow problem.

vyadh avatar Jan 23 '25 23:01 vyadh