MCPcopy
hub / github.com/youzan/zan-proxy / update

Method update

src/core/services/plugin.ts:171–195  ·  view source on GitHub ↗
(pluginName: string)

Source from the content-addressed store, hash-verified

169 }
170
171 public update(pluginName: string) {
172 if (!this.has(pluginName)) {
173 throw new NotFoundError('该插件不存在');
174 }
175 return new Promise((resolve, reject) => {
176 const update = () => {
177 npm.commands.update([pluginName, this.pluginInstallDir], async err => {
178 if (err) {
179 return reject(err);
180 }
181 const plugins = this.getPlugins();
182 const plugin = plugins.find(p => p.name === pluginName);
183 if (plugin) {
184 plugin.version = await this.getPluginVersion(pluginName);
185 }
186 this.setPlugins(plugins);
187 return resolve(plugins);
188 });
189 };
190
191 const pluginConfig = this.plugins[pluginName];
192 const npmConfig = { loglevel: 'silent', prefix: this.pluginInstallDir, registry: pluginConfig.registry };
193 this.loadNpmConfig(npmConfig, update);
194 });
195 }
196
197 /**
198 * 删除插件库

Callers

nothing calls this directly

Calls 5

hasMethod · 0.95
getPluginsMethod · 0.95
getPluginVersionMethod · 0.95
setPluginsMethod · 0.95
loadNpmConfigMethod · 0.95

Tested by

no test coverage detected