aragon / aragon-cli

CLI for creating and publishing Aragon apps
GNU General Public License v3.0
91 stars 79 forks source link

version manager for apm packages #583

Open kernelwhisperer opened 5 years ago

kernelwhisperer commented 5 years ago

TL;DR

nvm, but for @aragon/cli, as well as other tools.

This will make pinning to a certain version as quick as few seconds and as easy as one command.

🚀 Feature

There is the use case where an app might be using a different version of the GUI client.

(currently this is hard coded in the CLI, but I think we need to move it to a configuration file, along with the gasPrice option and the others)

And there is also the use case where an app only works with a specific version of the CLI.

(currently people can install the CLI as a project depedency and pin it to a certain version)

Proposal

I wonder if it makes sense to centralize these versions under ~/.aragon, for example:

~/.aragon/cli/v5.9.3
~/.aragon/cli/v5.8.0
~/.aragon/cli/v5.6.2
~/.aragon/gui/v0.8
~/.aragon/gui/v0.7

And declare in the arapp.json/package.json or some other project-specific configuration file, which version it should use, e.g.: >= 5, <= 6.

This logic might also improve how the aragon-desktop handles GUI upgrades and downgrades. :thinking:

The other solution

The alternative would be include these projects (gui, cli, etc.) as project dependencies... :thinking:

  "@aragon/cli": "5.9.3",
  "@aragon/gui": "0.8.0"

Pros:

Cons:

I think the first solution makes more sense because these projects are not libraries like aragon.js or aragon-ui. They have more in common with tools like git, node, npm, which you have installed globally and you expect them to just work.

Possible interface

avm set-default @aragon/cli v5.9.3
avm set-default @aragon/gui v0.8

Now if I do aragon --version it will print v5.9.3, but if my cwd is a project and its package.json says:

  "aragon" : {
     "cliVersion": "v5.6.0",
     "guiVersion": "*"
   }

Doing aragon --version should actually print v5.6.0.

kernelwhisperer commented 4 years ago

Now if I do aragon --version it will print v5.9.3, but if my cwd is a project and its package.json says:

  "aragon" : {
     "cliVersion": "v5.6.0",
     "guiVersion": "*"
   }

Doing aragon --version should actually print v5.6.0.

On second thought, this might be too much magic and could cause problems. It would be better if the CLI would throw an error instead.

So if package.json says:

  "engines": {
     "aragonCLI": "> 5.0.0"
  }

And you are using v6.0.0, it should error saying: "This project is only compatible with v5 of the aragonCLI, please use avm set-default @aragon/cli v5.9.3 to switch"

This would also allow us to start using the CLI globally and remove it from repos before we have the "apm version manager" feature.

kernelwhisperer commented 4 years ago

solc-select has nice UX too, using an environment variable to switch between versions: https://github.com/crytic/solc-select#usage