File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -68,3 +68,42 @@ gulp.task('outdated', () => {
6868${ formatPackageUpgrades ( validUpgrades ) } `) ;
6969 } ) ;
7070} ) ;
71+
72+ gulp . task ( 'upgrade-patch' , ( ) => {
73+ const allUpgradesPromises = libraries . map ( library =>
74+ getUpgradeVersions ( library ) . then ( upgrades =>
75+ Object . assign ( library , { upgrades } )
76+ )
77+ ) ;
78+
79+ return Promise . all ( allUpgradesPromises ) . then ( allUpgrades => {
80+ const validUpgrades = allUpgrades . filter ( ( { upgrades } ) =>
81+ upgrades . get ( 'patch' )
82+ ) ;
83+
84+ if ( validUpgrades . length === 0 ) {
85+ log . warn ( `No patch upgrades to process` ) ;
86+
87+ return ;
88+ }
89+
90+ validUpgrades . forEach ( ( { name, version, upgrades } ) => {
91+ const patchVersion = upgrades . get ( 'patch' ) ;
92+ log ( `Upgrading ${ name } from ${ version } to ${ patchVersion } ` ) ;
93+
94+ const eos = require ( 'end-of-stream' ) ;
95+ const { spawn } = require ( 'child_process' ) ;
96+ eos (
97+ spawn ( 'yarn' , [ 'upgrade' , `${ name } @${ patchVersion } ` ] ) ,
98+ err =>
99+ err
100+ ? log . error ( err )
101+ : spawn ( 'git' , [
102+ 'commit' ,
103+ '-am' ,
104+ `Upgraded ${ name } from ${ version } to ${ patchVersion } ` ,
105+ ] )
106+ ) ;
107+ } ) ;
108+ } ) ;
109+ } ) ;
You can’t perform that action at this time.
0 commit comments