Skip to content

update the index of packages#49

Merged
kubouch merged 2 commits intonushell:mainfrom
amtoine:update-nupm-index
Dec 13, 2023
Merged

update the index of packages#49
kubouch merged 2 commits intonushell:mainfrom
amtoine:update-nupm-index

Conversation

@amtoine
Copy link
Copy Markdown
Member

@amtoine amtoine commented Dec 11, 2023

cc/ @kubouch @stormasm

Description

this PR

  • updates the index of packages with all the repos containing package.nuon i know of
  • renames the file to index.nuon

details on the format

index.nuon is a table which contains a required $.package: string and an optional $.dir? :string:

  • $.package has format {host}:{repo}, e.g. github.com:amtoine/nu-git-manager
  • $.dir is an optional subdirectory in the repo when the package is not at the root of the repo, e.g. nu-logout for nu-logout inside amtoine/scripts

this allows to run a script such as the following to get the list of all the packages and their metadata 👌

let index = open index.nuon | each {|it|
    let pkg = $it.package | parse "{host}:{name}" | into record

    let host = match $pkg.host {
        "github.com" => "raw.githubusercontent.com",
        _ => { error make --unspanned { msg: $"invalid host '($pkg.host)'" } },
    }

    let url = {
        scheme: "https",
        host: $host,
        path: ($pkg.name | append ["main", $it.dir?, "package.nuon"] | compact | str join '/'),
    }
    print $"fetching '($pkg.name)'"
    http get ($url | url join)
}

$index | select name? version? type?
#─┬─────────────name──────────────┬version┬─type─
0 │nu_plugin_audio_hook           │0.1.9  │custom
1 │nu_plugin_clipboard            │0.3.1  │custom
2 │nu_plugin_desktop_notifications│1.0.6  │custom
3 │nu_plugin_image                │0.2.0  │custom
4 │nu_plugin_port_list            │1.2.7  │custom
5 │nu_plugin_port_scan            │1.0.7  │custom
6 │nu_plugin_qr_maker             │1.0.0  │custom
7 │nu-git-manager                 │0.3.0  │module
8 │nu-pomodoro                    │0.1.0  │      
9 │nu-right-prompt                │0.1.0  │      
10│nu_plugin_explore              │0.1.1  │custom
11│nu-clippy                      │0.1.0  │script
12│nu-logout                      │0.1.0  │script
13│nu-monitor-manager             │0.1.0  │script
14│nu-scripts                     │0.1.0  │module
15│nu-sound-manager               │0.1.0  │script
16│nu-zellij                      │0.1.0  │module
17│nu-scripts                     │0.1.0  │module
──┴───────────────────────────────┴───────┴──────

@stormasm
Copy link
Copy Markdown

@amtoine this works great !

I downloaded your repo and ran the script and it works nicely

good job 😄

@kubouch
Copy link
Copy Markdown
Contributor

kubouch commented Dec 13, 2023

I came up with something similar when working on online installation on packages. We can merge and use this in the meanwhile, I still didn't manage to finish it.

@kubouch kubouch merged commit 88eb95b into nushell:main Dec 13, 2023
@amtoine amtoine deleted the update-nupm-index branch December 13, 2023 21:02
@amtoine amtoine mentioned this pull request Dec 15, 2023
amtoine added a commit that referenced this pull request Dec 15, 2023
i just forgot to add Nupm itself to the index of packages in
#49 👀
@amtoine amtoine mentioned this pull request Dec 15, 2023
kubouch pushed a commit that referenced this pull request Dec 17, 2023
related to
- #50
- amtoine/nu-git-manager#140
- nushell/nu_scripts#700

## Description
#50 forces some packages with multiple modules to be split into multiple
packages.
this is the case of `amtoine/nu-git-manager` and `nushell/nu_scripts`
and this PR reflects this new set of packages.

> **Note**
> the script given as an example in
#49 might not work for now with the
ongoing transition from `package.nuon` to `nupm.nuon` in
#49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants