Skip to content

Commit

Permalink
Merge pull request #155 from jamesgeorge007/feat/validate-installation
Browse files Browse the repository at this point in the history
chore: validate git installation upfront
  • Loading branch information
sendilkumarn authored Aug 28, 2019
2 parents ccfc136 + e0bcd14 commit 6511028
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .bin/create-rust-webpack.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/usr/bin/env node

const { spawnSync } = require("child_process");
const { execSync, spawnSync } = require("child_process");
const fs = require("fs");
const path = require("path");
const cpr = require("cpr");
const rimraf = require("rimraf");

function isPresent(dep) {
try {
execSync(dep, {stdio: 'ignore'});
return true;
} catch (err) {
return false;
}
}

function run(cmd, args, opts) {
const output = spawnSync(cmd, args, opts);

Expand All @@ -18,6 +27,11 @@ function run(cmd, args, opts) {
}
}

if (!isPresent("git --version")) {
console.log('\n git is required');
process.exit(1);
}

let folderName = '.';

if (process.argv.length >= 3) {
Expand Down

0 comments on commit 6511028

Please sign in to comment.