Skip to content

Commit 281ac59

Browse files
committed
fix: fixed ansible-playbook to not use shelljs
1 parent 0bc7d16 commit 281ac59

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

template/ansible-playbook.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
const fs = require('fs');
22
const path = require('path');
3+
const { execSync } = require('child_process');
34

4-
const shell = require('shelljs');
55
const parse = require('parse-git-config');
66

77
const 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

Comments
 (0)