( plugin: string, scope: PluginScope, )
| 293 | * @param scope Scope to update |
| 294 | */ |
| 295 | export async function updatePluginCli( |
| 296 | plugin: string, |
| 297 | scope: PluginScope, |
| 298 | ): Promise<void> { |
| 299 | try { |
| 300 | writeToStdout( |
| 301 | `Checking for updates for plugin "${plugin}" at ${scope} scope…\n`, |
| 302 | ) |
| 303 | |
| 304 | const result = await updatePluginOp(plugin, scope) |
| 305 | |
| 306 | if (!result.success) { |
| 307 | throw new Error(result.message) |
| 308 | } |
| 309 | |
| 310 | writeToStdout(`${figures.tick} ${result.message}\n`) |
| 311 | |
| 312 | if (!result.alreadyUpToDate) { |
| 313 | const { name, marketplace } = parsePluginIdentifier( |
| 314 | result.pluginId || plugin, |
| 315 | ) |
| 316 | logEvent('ncode_plugin_updated_cli', { |
| 317 | _PROTO_plugin_name: |
| 318 | name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 319 | ...(marketplace && { |
| 320 | _PROTO_marketplace_name: |
| 321 | marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED, |
| 322 | }), |
| 323 | old_version: (result.oldVersion || |
| 324 | 'unknown') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 325 | new_version: (result.newVersion || |
| 326 | 'unknown') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 327 | ...buildPluginTelemetryFields( |
| 328 | name, |
| 329 | marketplace, |
| 330 | getManagedPluginNames(), |
| 331 | ), |
| 332 | }) |
| 333 | } |
| 334 | |
| 335 | await gracefulShutdown(0) |
| 336 | } catch (error) { |
| 337 | handlePluginCommandError(error, 'update', plugin) |
| 338 | } |
| 339 | } |
no test coverage detected