-
-
Notifications
You must be signed in to change notification settings - Fork 769
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
#!/usr/bin/env node | ||
const { join } = require('path'); | ||
const { spawn } = require('child_process'); | ||
const electronPath = require('electron'); | ||
const { join } = require('path') | ||
const { spawn } = require('child_process') | ||
|
||
const appPath = join(__dirname, 'build', 'main-bundle.js'); | ||
const { execSync } = require('child_process') | ||
const fs = require('fs/promises') | ||
|
||
const electronProcess = spawn(electronPath, [appPath]); | ||
electronProcess.stdout.on('data', (data) => process.stdout.write(data)); | ||
electronProcess.stderr.on('data', (data) => process.stderr.write(data)); | ||
electronProcess.on('close', (code) => process.exit(code)); | ||
async function installElectron() { | ||
// Read package.json | ||
const packageJson = JSON.parse(fs.readFile('package.json', 'utf8')) | ||
// Get the Electron version from package.json | ||
const electronVersion = packageJson.devDependencies.electron | ||
// Install Electron | ||
console.log(`Installing Electron ${electronVersion}...`) | ||
execSync(`npm i electron@${electronVersion}`, { stdio: 'inherit' }) | ||
console.log('Electron installed successfully.') | ||
} | ||
|
||
const main = async () => { | ||
let electronPath | ||
try { | ||
electronPath = require('electron') | ||
} catch (e) { | ||
await installElectron() | ||
} | ||
electronPath = require('electron') | ||
const appPath = join(__dirname, 'build', 'main-bundle.js') | ||
const electronProcess = spawn(electronPath, [appPath]) | ||
electronProcess.stdout.on('data', (data) => process.stdout.write(data)) | ||
electronProcess.stderr.on('data', (data) => process.stderr.write(data)) | ||
electronProcess.on('close', (code) => process.exit(code)) | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "selenium-ide", | ||
"version": "4.0.1-alpha.65", | ||
"version": "4.0.1-alpha.66", | ||
"private": false, | ||
"description": "Selenium IDE electron app", | ||
"author": "Todd <[email protected]>", | ||
|