refactor: compile backend with tsc, Electron runs dist/index.js
This commit is contained in:
1 parent
a31c047091
commit
302472d881
2 files changed
+4
-3
No files matched your search
+2
-2
@@ -4,7 +4,7 @@ const http = require('http')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const PROJECT_DIR = path.resolve(__dirname, '../../project')
|
const PROJECT_DIR = path.resolve(__dirname, '../../project')
|
||||||
const TSX = path.join(PROJECT_DIR, 'node_modules', 'tsx', 'dist', 'cli.mjs')
|
const ENTRY = path.join(PROJECT_DIR, 'dist', 'index.js')
|
||||||
let backend = null
|
let backend = null
|
||||||
let tray = null
|
let tray = null
|
||||||
let isRunning = false
|
let isRunning = false
|
||||||
@@ -27,7 +27,7 @@ function updateMenu() {
|
|||||||
|
|
||||||
function startBackend() {
|
function startBackend() {
|
||||||
if (backend) return
|
if (backend) return
|
||||||
backend = spawn('node', [TSX, 'src/index.ts'], {
|
backend = spawn('node', [ENTRY], {
|
||||||
cwd: PROJECT_DIR,
|
cwd: PROJECT_DIR,
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
env: { ...process.env, PORT: process.env.PORT || '3000' },
|
env: { ...process.env, PORT: process.env.PORT || '3000' },
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsx watch src/index.ts",
|
"dev": "tsx src/index.ts",
|
||||||
|
"watch": "tsx watch src/index.ts",
|
||||||
"start": "tsx src/index.ts",
|
"start": "tsx src/index.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:web": "cd web && npm run build",
|
"build:web": "cd web && npm run build",
|
||||||
|
|||||||
Reference in new issue
Block a user