Skip to content

add support to install modules from non standard locations#28

Closed
amtoine wants to merge 4 commits intonushell:mainfrom
amtoine:install-non-standard-modules
Closed

add support to install modules from non standard locations#28
amtoine wants to merge 4 commits intonushell:mainfrom
amtoine:install-non-standard-modules

Conversation

@amtoine
Copy link
Copy Markdown
Member

@amtoine amtoine commented Oct 11, 2023

Description

  • refactors a bit the tests to make them easier to work with in the long run
  • adds two tests to
    1. install from src/: spam_module_src_root module and install-module-with-src-root test
    2. install from the root of the repo: spam_module_repo_root module and install-module-with-repo-root test
  • allows to change the path to the package module files with $.root in the package.nuon file

the general idea is that

  • if $.root is not defined, nupm install will try to install the module files from the subdirectory inside the root whose called the same as the package, e.g. nu-git-manager would install from ./nu-git-manager/
  • if $.root is defined, nupm install will copy the files from $.root and put that in the same place in the Nupm store

@amtoine
Copy link
Copy Markdown
Member Author

amtoine commented Oct 11, 2023

expected failure in https://github.com/nushell/nupm/actions/runs/6487491436/job/17617914677?pr=28, isn't it nice? 😏 🙏

@amtoine
Copy link
Copy Markdown
Member Author

amtoine commented Oct 11, 2023

@kubouch
you told me we could use $.modules: list<string> instead of $.root: string but i'm still not sure how this would work 🤔
all the files from all the paths in $.modules would be installed in the same directory in the Nupm store?
because we have a single package.nuon file 😮

or maybe each one of the $.modules should have a package.nuon file? 🤔

@amtoine amtoine marked this pull request as ready for review October 11, 2023 20:36
@amtoine amtoine requested a review from kubouch October 11, 2023 20:36
@kubouch
Copy link
Copy Markdown
Contributor

kubouch commented Oct 15, 2023

The modules field would give a list of files / directories to be installed to $env.NUPM_HOME | path join modules. You could use it to change your root by setting modules = ["your-desired-root-path/module-path"] and not having the default module present at all. We need to be able to install multiple submodules of a package to support repos like nu_scripts and having both root and modules is redundant.

amtoine pushed a commit that referenced this pull request Oct 19, 2023
related to 
- #28
 
this will supersede #28

## Description
Adds support for `$.modules` field to package.nuon. Similar to
`$.scripts`, this allows installing modules (both files and directories)
from custom locations.

> **Note**
> for Nupm, a package can be a collection of modules and scripts, this
PR comes closer to that goal

Another change is that the default package module (`package-name/` dir)
and script (`package-name.nu` file) are not required. You can have a
package that has _only_ the `$.modules:` and `$.scripts:` fields in
package.nuon.
@amtoine
Copy link
Copy Markdown
Member Author

amtoine commented Oct 19, 2023

superseded by #33

@amtoine amtoine closed this Oct 19, 2023
@amtoine amtoine deleted the install-non-standard-modules branch October 19, 2023 16:21
@amtoine amtoine mentioned this pull request Oct 19, 2023
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.

2 participants