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');
2
2
const git = require ( 'simple-git' ) ( ) ;
3
3
4
4
const 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 ;
8
8
} ;
9
9
10
10
const run = autoAccept => {
11
11
const options = [ 'chromatic:base' ] ;
12
- if ( autoAccept ) options . push ( '--auto-accept-changes' ) ;
12
+ if ( autoAccept ) {
13
+ options . push ( '--auto-accept-changes' ) ;
14
+ }
13
15
14
16
execa ( 'yarn' , options ) . stdout . pipe ( process . stdout ) ;
15
17
} ;
@@ -18,12 +20,14 @@ const start = async () => {
18
20
const { current : currentBranch } = await git . branch ( ) ;
19
21
20
22
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 ) ;
26
24
}
25
+
26
+ if ( await hasChanges ( ) ) {
27
+ return run ( ) ;
28
+ }
29
+
30
+ console . warn ( 'No changes found in branch, skipping visual tests' ) ;
27
31
} ;
28
32
29
33
start ( ) ;
You can’t perform that action at this time.
0 commit comments