Replace backend build script in package.json with a Node.js script for improved compatibility and maintainability. Added new build-backend.js script to handle the backend build process using Python.
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "npm run build-frontend -- --watch",
|
"watch": "npm run build-frontend -- --watch",
|
||||||
"build-frontend": "vite build",
|
"build-frontend": "vite build",
|
||||||
"build-backend": "venv/bin/python setup.py build",
|
"build-backend": "node scripts/build-backend.js",
|
||||||
"build": "npm run build-frontend && npm run build-backend",
|
"build": "npm run build-frontend && npm run build-backend",
|
||||||
"electron-postinstall": "electron-builder install-app-deps",
|
"electron-postinstall": "electron-builder install-app-deps",
|
||||||
"electron": "npm run electron-postinstall && npm run build && electron .",
|
"electron": "npm run electron-postinstall && npm run build && electron .",
|
||||||
|
|||||||
18
scripts/build-backend.js
Executable file
18
scripts/build-backend.js
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const { execSync } = require('child_process');
|
||||||
|
const path = require('path');
|
||||||
|
const os = require('os');
|
||||||
|
|
||||||
|
const platform = os.platform();
|
||||||
|
const venvPython = platform === 'win32'
|
||||||
|
? path.join('venv', 'Scripts', 'python.exe')
|
||||||
|
: path.join('venv', 'bin', 'python');
|
||||||
|
|
||||||
|
try {
|
||||||
|
execSync(`${venvPython} setup.py build`, { stdio: 'inherit' });
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Build failed:', error.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user