Merge pull request #13 from JamesKyburz/issue-9

replaced run.bat with cli.js closes #9
This commit is contained in:
Mathias Buus 2015-04-30 11:33:36 +02:00
commit 3aa660c4cc
4 changed files with 8 additions and 16 deletions

7
npm/cli.js Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env node
var electron = require('./')
var proc = require('child_process')
proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'});

View file

@ -22,24 +22,11 @@ var paths = {
win32: path.join(__dirname, './dist/electron.exe')
}
var shebang = {
darwin: '#!/bin/bash\n',
linux: '#!/bin/bash\n',
win32: ''
}
var argv = {
darwin: '"$@"',
linux: '"$@"',
win32: '%*' // does this work with " " in the args?
}
if (!paths[platform]) throw new Error('Unknown platform: ' + platform)
nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) {
if (err) return onerror(err)
fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform])
fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform] + '"' + paths[platform] + '" ' + argv[platform])
extract(path.join(__dirname, filename), {dir: path.join(__dirname, 'dist')}, function (err) {
if (err) return onerror(err)
})

View file

@ -11,7 +11,7 @@
"test": "tape test/*.js"
},
"bin": {
"electron": "run.bat"
"electron": "cli.js"
},
"main": "index.js",
"dependencies": {

View file

@ -1,2 +0,0 @@
#!/bin/bash
"/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron" "$@"