Merge pull request #13 from JamesKyburz/issue-9
replaced run.bat with cli.js closes #9
This commit is contained in:
commit
3aa660c4cc
4 changed files with 8 additions and 16 deletions
7
npm/cli.js
Executable file
7
npm/cli.js
Executable 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'});
|
|
@ -22,24 +22,11 @@ var paths = {
|
||||||
win32: path.join(__dirname, './dist/electron.exe')
|
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)
|
if (!paths[platform]) throw new Error('Unknown platform: ' + platform)
|
||||||
|
|
||||||
nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) {
|
nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) {
|
||||||
if (err) return onerror(err)
|
if (err) return onerror(err)
|
||||||
fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform])
|
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) {
|
extract(path.join(__dirname, filename), {dir: path.join(__dirname, 'dist')}, function (err) {
|
||||||
if (err) return onerror(err)
|
if (err) return onerror(err)
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"test": "tape test/*.js"
|
"test": "tape test/*.js"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"electron": "run.bat"
|
"electron": "cli.js"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
"/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron" "$@"
|
|
Loading…
Reference in a new issue