electron-osx-flat.js 750 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env node
  2. var fs = require('fs')
  3. var path = require('path')
  4. var args = require('minimist')(process.argv.slice(2), {
  5. 'boolean': [
  6. 'help'
  7. ]
  8. })
  9. var usage = fs.readFileSync(path.join(__dirname, 'electron-osx-flat-usage.txt')).toString()
  10. var flat = require('../').flat
  11. args.app = args._.shift()
  12. if (!args.app || args.help) {
  13. console.log(usage)
  14. process.exit(0)
  15. }
  16. // Remove excess arguments
  17. delete args._
  18. delete args.help
  19. flat(args, function done (err) {
  20. if (err) {
  21. console.error('Flat failed:')
  22. if (err.message) console.error(err.message)
  23. else if (err.stack) console.error(err.stack)
  24. else console.log(err)
  25. process.exit(1)
  26. }
  27. console.log('Application flattened, saved to:', args.pkg)
  28. process.exit(0)
  29. })