ericclemmons / if-env

Simplify npm scripts with `if-env ... && npm run this || npm run that`
MIT License
97 stars 14 forks source link

Initial release #1

Closed ericclemmons closed 8 years ago

ericclemmons commented 8 years ago
#!/usr/bin/env node

var parse = require("querystring").parse;
var conditions = process.argv.slice(2);
var query = conditions.join("&");
var expected = parse(query);

for (var env in expected) {
  if (process.env[env] !== expected[env]) {
    process.exit(1);
  }
}

process.exit(0);