Add Powershell script to start developement server (#63)
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "beatconnect_client",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+5
-3
@@ -9,6 +9,7 @@
|
||||
"homepage": "./",
|
||||
"scripts": {
|
||||
"start": "node scripts/start.js",
|
||||
"dev:win": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./scripts/start.ps1",
|
||||
"build": "node scripts/build.js",
|
||||
"test": "node scripts/test.js",
|
||||
"lint": "npm run lint:prettier && npm run lint:es",
|
||||
@@ -19,9 +20,9 @@
|
||||
"lint:fix:es": "eslint --fix '**/*.{js,jsx,mjs,ts,tsx}'",
|
||||
"go": "electron .",
|
||||
"dist": "npm run build && npx npx electron-builder --win --linux --x64",
|
||||
"dist-win": "npm run build && npx electron-builder build --win --x64",
|
||||
"dist-linux": "npm run build && npx electron-builder build --linux --x64",
|
||||
"dist-mac": "npm run build && npx electron-builder build --mac --x64",
|
||||
"dist:win": "npm run build && npx electron-builder build --win --x64",
|
||||
"dist:linux": "npm run build && npx electron-builder build --linux --x64",
|
||||
"dist:mac": "npm run build && npx electron-builder build --mac --x64",
|
||||
"dist:gh-publish": "npm run build && npx electron-builder build --win --linux --mac --ia32 --x64 -p always",
|
||||
"electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3000 electron ."
|
||||
},
|
||||
@@ -116,6 +117,7 @@
|
||||
"postcss-normalize": "7.0.1",
|
||||
"postcss-preset-env": "6.6.0",
|
||||
"postcss-safe-parser": "4.0.1",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.8.6",
|
||||
"react-app-polyfill": "^1.0.1",
|
||||
"react-desktop": "^0.3.9",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
const { app, webContents } = require('electron');
|
||||
const log = require('electron-log');
|
||||
const isDev = require('electron-is-dev');
|
||||
@@ -29,7 +30,10 @@ DownloadManager.register({
|
||||
|
||||
const main = () => {
|
||||
let mainWindow = null;
|
||||
console.log('readee');
|
||||
if (isDev) {
|
||||
console.log('Main process ready');
|
||||
console.log('Waiting for dev server to show up');
|
||||
}
|
||||
|
||||
mainWindow = new Window({
|
||||
backgroundColor: '#121212',
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
cls
|
||||
|
||||
"$PSScriptRoot|npm start", "$PSScriptRoot|npm run electron-dev" | % {
|
||||
|
||||
$ScriptBlock = {
|
||||
# accept the loop variable across the job-context barrier
|
||||
param($pathWithCmd)
|
||||
# Get working directory and command
|
||||
$dir, $cmd = $pathWithCmd.split('|')
|
||||
# Set job dir
|
||||
Set-Location "$dir"
|
||||
# Execute a command
|
||||
Invoke-Expression $cmd
|
||||
# Just wait for a bit...
|
||||
Start-Sleep 5
|
||||
}
|
||||
|
||||
$dir, $cmd = $_.split('|')
|
||||
# pass the loop variable across the job-context barrier
|
||||
Start-Job -name "$cmd" -ScriptBlock $ScriptBlock -ArgumentList $_
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
While (Get-Job -State "Running") {
|
||||
|
||||
Get-Job | Receive-Job
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
Write-Error "Something went wrong"
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
Write-Warning "CTRL-C was used - Shutting down any running jobs before exiting the script. It can take some time."
|
||||
Get-Job | Where-Object { $_.Name -like "npm *" } | Remove-Job -Force -Confirm:$False
|
||||
[Console]::TreatControlCAsInput = $False
|
||||
_Exit-Script -HardExit $True
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user