build-package.js 700 B

123456789101112131415161718192021
  1. var spawn = require('child_process').spawn;
  2. var os = require('os');
  3. var process = require('process');
  4. var args = process.argv.slice(2);
  5. function abortOnError(code) {
  6. if (code !== 0) {
  7. process.exit(code);
  8. }
  9. }
  10. if (os.type() === 'Linux') {
  11. spawn('bash', ['dist/package.sh'].concat(args), {stdio: 'inherit'}).on('exit', abortOnError);
  12. } else if (os.type() === 'Darwin') {
  13. spawn('bash', ['dist/package.sh'].concat(args), {stdio: 'inherit'}).on('exit', abortOnError);
  14. } else if (os.type() === 'Windows_NT') {
  15. spawn('powershell', ['dist/package.sh'].concat(args), {stdio: 'inherit'}).on('exit', abortOnError);
  16. } else {
  17. throw new Error("Unsupported OS found: " + os.type());
  18. }