@@ -359,7 +359,7 @@ async function initPrompts (id, context) {
359
359
await prompts . start ( )
360
360
}
361
361
362
- function update ( id , context ) {
362
+ function update ( id , context , notify = true ) {
363
363
return progress . wrap ( 'plugin-update' , context , async setProgress => {
364
364
setProgress ( {
365
365
status : 'plugin-update' ,
@@ -370,15 +370,44 @@ function update (id, context) {
370
370
const { current, wanted } = await getVersion ( plugin , context )
371
371
await updatePackage ( cwd . get ( ) , getCommand ( ) , null , id )
372
372
resetPluginApi ( context )
373
+
373
374
logs . add ( {
374
375
message : `Plugin ${ id } updated from ${ current } to ${ wanted } ` ,
375
376
type : 'info'
376
377
} , context )
378
+
379
+ if ( notify ) {
380
+ notifier . notify ( {
381
+ title : `Plugin updated` ,
382
+ message : `Plugin ${ id } was successfully updated` ,
383
+ icon : path . resolve ( __dirname , '../../assets/done.png' )
384
+ } )
385
+ }
386
+
377
387
currentPluginId = null
378
388
return findOne ( id )
379
389
} )
380
390
}
381
391
392
+ async function updateAll ( context ) {
393
+ const plugins = await list ( cwd . get ( ) , context )
394
+ let updatedPlugins = [ ]
395
+ for ( const plugin of plugins ) {
396
+ const version = await getVersion ( plugin , context )
397
+ if ( version . current !== version . wanted ) {
398
+ updatedPlugins . push ( await update ( plugin . id , context , false ) )
399
+ }
400
+ }
401
+
402
+ notifier . notify ( {
403
+ title : `Plugins updated` ,
404
+ message : `${ updatedPlugins . length } plugin(s) were successfully updated` ,
405
+ icon : path . resolve ( __dirname , '../../assets/done.png' )
406
+ } )
407
+
408
+ return updatedPlugins
409
+ }
410
+
382
411
function getApi ( ) {
383
412
return pluginApi
384
413
}
@@ -433,6 +462,7 @@ module.exports = {
433
462
install,
434
463
uninstall,
435
464
update,
465
+ updateAll,
436
466
runInvoke,
437
467
resetPluginApi,
438
468
getApi,
0 commit comments