alloc / cush

WIP module bundler 🎁
MIT License
0 stars 0 forks source link

Upgrade auto-installed packages #28

Open aleclarson opened 5 years ago

aleclarson commented 5 years ago

Anything auto-installed into ~/.cush/packages using cush/utils/lazyRequire is currently never upgraded when a new version is available. Here's the plan to fix that.

Maintain ~/.cush/packages.json that maps dependencies to their installed versions.

{
  "cush-plugin-jsx": {
    "*": "1.0.0",
    "^1.0.0": "1.0.0"
  }
}

In the example above, we know that cush-plugin-jsx-1.0.0 is installed in ~/.cush/packages. When lazyRequire('cush-plugin-jsx') is called, we'll fetch the list of available versions from NPM. If the latest version is greater than 1.0.0, we will install it, but we'll still need to keep 1.0.0 installed because lazyRequire('cush-plugin-jsx', '^1.0.0') was once called. If that call was never made, we would uninstall 1.0.0 since it's no longer needed.

In the future, we could track package versions on a per-bundle basis, which would allow us to prune unused packages more efficiently. This will require bundle sessions.

aleclarson commented 5 years ago

Mentioned in "Using a plugin" (in the docs)

aleclarson commented 5 years ago

💡 Idea

cush plugins upgrade

Prompt with confirmation for each plugin upgrade.