11const fs = require ( 'fs' ) ;
22const path = require ( 'path' ) ;
3+ const { execSync } = require ( 'child_process' ) ;
34
4- const shell = require ( 'shelljs' ) ;
55const parse = require ( 'parse-git-config' ) ;
66
77const env = path . join ( __dirname , '.env.production' ) ;
88
9- if ( ! fs . existsSync ( env ) ) {
10- shell . echo ( `.env.production file missing: ${ env } ` ) ;
11- shell . exit ( 1 ) ;
12- }
9+ if ( ! fs . existsSync ( env ) )
10+ throw new Error ( `.env.production file missing: ${ env } ` ) ;
1311
14- if ( ! fs . statSync ( env ) . isFile ( ) ) {
15- shell . echo ( `.env.production file missing: ${ env } ` ) ;
16- shell . exit ( 1 ) ;
17- }
12+ if ( ! fs . statSync ( env ) . isFile ( ) )
13+ throw new Error ( `.env.production file missing: ${ env } ` ) ;
1814
1915// this will populate process.env with
2016// environment variables from dot env file
@@ -29,9 +25,7 @@ process.env.GITHUB_REPO = parse.sync({
2925 path : path . join ( __dirname , '.git' , 'config' )
3026} ) [ 'remote "origin"' ] . url ;
3127
32- if ( ! shell . which ( 'ansible-playbook' ) ) {
33- shell . echo ( 'ansible-playbook is required to be installed on this os' ) ;
34- shell . exit ( 1 ) ;
35- }
28+ if ( ! execSync ( 'which ansible-playbook' ) )
29+ throw new Error ( 'ansible-playbook is required to be installed on this os' ) ;
3630
37- shell . exec ( `ansible-playbook ${ process . argv . slice ( 2 ) . join ( ' ' ) } ` ) ;
31+ execSync ( `ansible-playbook ${ process . argv . slice ( 2 ) . join ( ' ' ) } ` ) ;
0 commit comments