@@ -881,97 +881,96 @@ export default class Package {
881881 . end ( ) ;
882882
883883 logger . log ( table . content . trim ( ) ) ;
884-
885884 logger . log ( "Update dependencies ... " + res ) ;
885+ }
886886
887- // commit and push
888- COMMIT: if ( commit ) {
889- try {
887+ // commit and push
888+ COMMIT: if ( commit ) {
889+ try {
890890
891- // get working tree status
892- res = await this . git . getWorkingTreeStatus ( ) ;
893- if ( ! res . ok ) throw res ;
891+ // get working tree status
892+ res = await this . git . getWorkingTreeStatus ( ) ;
893+ if ( ! res . ok ) throw res ;
894894
895- const commitFiles = [ ] ;
895+ const commitFiles = [ ] ;
896896
897- // working tree is dirty
898- if ( res . data . isDirty ) {
899- for ( const lockFile of [ "package-lock.json" , "npm-shrinkwrap.json" ] ) {
900- const lockFilePath = this . rootSlug
901- ? this . rootSlug + "/" + lockFile
902- : lockFile ;
897+ // working tree is dirty
898+ if ( res . data . isDirty ) {
899+ for ( const lockFile of [ "package-lock.json" , "npm-shrinkwrap.json" ] ) {
900+ const lockFilePath = this . rootSlug
901+ ? this . rootSlug + "/" + lockFile
902+ : lockFile ;
903903
904- if ( res . data . files [ lockFilePath ] ) commitFiles . push ( lockFile ) ;
905- }
904+ if ( res . data . files [ lockFilePath ] ) commitFiles . push ( lockFile ) ;
906905 }
906+ }
907907
908- // dependencies locks was not updated
909- if ( ! commitFiles . length ) break COMMIT;
908+ // dependencies locks was not updated
909+ if ( ! commitFiles . length ) break COMMIT;
910910
911- // add changes
912- res = await repeatAction (
913- async ( ) => {
914- const res = await this . git . exec ( [ "add" , ...commitFiles ] ) ;
911+ // add changes
912+ res = await repeatAction (
913+ async ( ) => {
914+ const res = await this . git . exec ( [ "add" , ...commitFiles ] ) ;
915915
916- if ( res . ok ) {
917- return res ;
918- }
919- else {
916+ if ( res . ok ) {
917+ return res ;
918+ }
919+ else {
920920
921- // console.log( ansi.error( res + "" ) );
921+ // console.log( ansi.error( res + "" ) );
922922
923- throw res ;
924- }
925- } ,
926- { repeatOnError }
927- ) ;
928- if ( ! res . ok ) throw res ;
923+ throw res ;
924+ }
925+ } ,
926+ { repeatOnError }
927+ ) ;
928+ if ( ! res . ok ) throw res ;
929929
930- // commit changes
931- res = await repeatAction (
932- async ( ) => {
933- const res = await this . git . exec ( [ "commit" , "-m" , "chore(deps): update locked dependencies" , ...commitFiles ] ) ;
930+ // commit changes
931+ res = await repeatAction (
932+ async ( ) => {
933+ const res = await this . git . exec ( [ "commit" , "-m" , "chore(deps): update locked dependencies" , ...commitFiles ] ) ;
934934
935- if ( res . ok ) {
936- return res ;
937- }
938- else {
935+ if ( res . ok ) {
936+ return res ;
937+ }
938+ else {
939939
940- // console.log( ansi.error( res + "" ) );
940+ // console.log( ansi.error( res + "" ) );
941941
942- throw res ;
943- }
944- } ,
945- { repeatOnError }
946- ) ;
947- if ( ! res . ok ) throw res ;
942+ throw res ;
943+ }
944+ } ,
945+ { repeatOnError }
946+ ) ;
947+ if ( ! res . ok ) throw res ;
948948
949- // push changes
950- res = await repeatAction (
951- async ( ) => {
952- const res = await this . git . exec ( [ "push" ] ) ;
949+ // push changes
950+ res = await repeatAction (
951+ async ( ) => {
952+ const res = await this . git . exec ( [ "push" ] ) ;
953953
954- if ( res . ok ) {
955- return res ;
956- }
957- else {
954+ if ( res . ok ) {
955+ return res ;
956+ }
957+ else {
958958
959- // console.log( ansi.error( res + "" ) );
959+ // console.log( ansi.error( res + "" ) );
960960
961- return res ;
962- }
963- } ,
964- { repeatOnError }
965- ) ;
966- if ( ! res . ok ) throw res ;
961+ return res ;
962+ }
963+ } ,
964+ { repeatOnError }
965+ ) ;
966+ if ( ! res . ok ) throw res ;
967967
968- logger . log ( "Commit and push ... " + result ( 200 ) ) ;
969- }
970- catch ( e ) {
971- res = result . catch ( e ) ;
968+ logger . log ( "Commit and push ... " + result ( 200 ) ) ;
969+ }
970+ catch ( e ) {
971+ res = result . catch ( e ) ;
972972
973- logger . log ( "Commit and push ... " + ansi . error ( " ERROR " ) + ", " + res ) ;
974- }
973+ logger . log ( "Commit and push ... " + ansi . error ( " ERROR " ) + ", " + res ) ;
975974 }
976975 }
977976 }
0 commit comments