Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit 1236c1c

Browse files
authored
feat: add a command-line-interface for launching (#378)
* feat: add a command-line-interface for launching * lint
1 parent f9987d2 commit 1236c1c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

cli.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env node
2+
3+
const {spawn} = require('child_process')
4+
const electron = require('electron')
5+
const path = require('path')
6+
7+
const appPath = path.join(__dirname, 'main.js')
8+
const args = [appPath].concat(process.argv.slice(2))
9+
const proc = spawn(electron, args, {stdio: 'inherit'})
10+
11+
proc.on('close', (code) => process.exit(code))

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "ElectronAPIDemos",
2+
"name": "electron-api-demos",
33
"productName": "Electron API Demos",
44
"version": "1.3.0",
55
"description": "Electron interactive API demos",
6-
"private": true,
76
"main": "main.js",
7+
"bin": "cli.js",
88
"scripts": {
99
"start": "electron .",
1010
"dev": "electron . --debug",

0 commit comments

Comments
 (0)