From 1236c1cc0bf7655365a1b0f83b13205315d03bf4 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Tue, 24 Jul 2018 10:27:07 -0700 Subject: [PATCH] feat: add a command-line-interface for launching (#378) * feat: add a command-line-interface for launching * lint --- cli.js | 11 +++++++++++ package.json | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 cli.js diff --git a/cli.js b/cli.js new file mode 100755 index 00000000..504f8f97 --- /dev/null +++ b/cli.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +const {spawn} = require('child_process') +const electron = require('electron') +const path = require('path') + +const appPath = path.join(__dirname, 'main.js') +const args = [appPath].concat(process.argv.slice(2)) +const proc = spawn(electron, args, {stdio: 'inherit'}) + +proc.on('close', (code) => process.exit(code)) diff --git a/package.json b/package.json index de47d8d5..c15f5346 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "ElectronAPIDemos", + "name": "electron-api-demos", "productName": "Electron API Demos", "version": "1.3.0", "description": "Electron interactive API demos", - "private": true, "main": "main.js", + "bin": "cli.js", "scripts": { "start": "electron .", "dev": "electron . --debug",