我想在发布插件之后当检测到有新版本时自动更新到最新版。
这个过程可以是自动的也可以是通过指令手动触发,由用户选择。
我想在发布插件之后当检测到有新版本时自动更新到最新版。
这个过程可以是自动的也可以是通过指令手动触发,由用户选择。
是这样的,你可以发到求插件板块!我也想要这种
So there are 2 kinds of logics that you should implement:
It is easily to utilise the installer
service from the market
plugin for managing your other plugins:
ctx.installer.resolveName(name)
to resolve the name of the plugin to the actual name of the package name.ctx.installer.getDeps()
to get the dependencies map which you could resolve to the package metadata.gt(latest, resolved)
function from package semver
to compare the remote version and local version while these parameters are both coming from the value of the package metadata mentioned above.We will also utilise installer
service for upgrading our plugin by:
ctx.installer.install(['name'])
Note: the mechanism described above is just a demonstration, in the realm you should apply more than this such as exception catching, configuration maintenance, side-effect cleaning, misuse evidence, etc.
谢谢佬!