File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
packages/components/scripts Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,16 @@ const execa = require('execa');
22const git = require ( 'simple-git' ) ( ) ;
33
44const hasChanges = async ( ) => {
5- const result = await git . diffSummary ( [ 'master...HEAD' ] ) ;
6- if ( result . files . length ) return true ;
7- return false ;
5+ const { files } = await git . diffSummary ( [ 'master...HEAD' ] ) ;
6+
7+ return files . length > 0 ;
88} ;
99
1010const run = autoAccept => {
1111 const options = [ 'chromatic:base' ] ;
12- if ( autoAccept ) options . push ( '--auto-accept-changes' ) ;
12+ if ( autoAccept ) {
13+ options . push ( '--auto-accept-changes' ) ;
14+ }
1315
1416 execa ( 'yarn' , options ) . stdout . pipe ( process . stdout ) ;
1517} ;
@@ -18,12 +20,14 @@ const start = async () => {
1820 const { current : currentBranch } = await git . branch ( ) ;
1921
2022 if ( currentBranch === 'master' ) {
21- run ( true ) ;
22- } else {
23- const changes = await hasChanges ( ) ;
24- if ( changes ) run ( ) ;
25- else console . warn ( 'No changes found in branch, skipping visual tests' ) ;
23+ return run ( true ) ;
2624 }
25+
26+ if ( await hasChanges ( ) ) {
27+ return run ( ) ;
28+ }
29+
30+ console . warn ( 'No changes found in branch, skipping visual tests' ) ;
2731} ;
2832
2933start ( ) ;
You can’t perform that action at this time.
0 commit comments