mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
+5
-5
@@ -9,9 +9,9 @@ const {
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { electron } = require('process');
|
const { electron } = require('process');
|
||||||
|
|
||||||
(async () => {
|
var env = process.env.NODE_ENV || 'prod';
|
||||||
const { nodeapp } = await import('./src/app.js');
|
|
||||||
})();
|
const { nodeapp } = import(path.join(__dirname, env=='prod' ? '../' : '', 'src/app.js'));
|
||||||
|
|
||||||
// Load Icons
|
// Load Icons
|
||||||
// TODO: Icons appear pixelated
|
// TODO: Icons appear pixelated
|
||||||
@@ -68,8 +68,8 @@ function createWindow() {
|
|||||||
try {
|
try {
|
||||||
// loaded = path.join(__dirname, '../client/build/index.html');
|
// loaded = path.join(__dirname, '../client/build/index.html');
|
||||||
// win.loadURL(`file://${loaded}`);
|
// win.loadURL(`file://${loaded}`);
|
||||||
// win.loadURL('http://localhost:4001/editor');
|
win.loadURL('http://localhost:4001/editor');
|
||||||
win.loadURL(`file://${__dirname}/dist/index.html`);
|
//win.loadURL(`file://${__dirname}/dist/index.html`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
loaded = error;
|
loaded = error;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -29,14 +29,15 @@
|
|||||||
"eslint-plugin-simple-import-sort": "^7.0.0"
|
"eslint-plugin-simple-import-sort": "^7.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"nodestart": "node app.js",
|
"nodestart": "NODE_ENV=development node app.js",
|
||||||
"start": "electron .",
|
"start": "NODE_ENV=development electron .",
|
||||||
"pack": "electron-builder --dir",
|
"pack": "electron-builder --dir",
|
||||||
"dist": "electron-builder",
|
"dist": "electron-builder",
|
||||||
"startall": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\""
|
"startall": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\""
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "your.id",
|
"appId": "your.id",
|
||||||
|
"asar": false,
|
||||||
"mac": {
|
"mac": {
|
||||||
"category": "your.app.category.type"
|
"category": "your.app.category.type"
|
||||||
},
|
},
|
||||||
@@ -50,6 +51,13 @@
|
|||||||
"filter": [
|
"filter": [
|
||||||
"**/*"
|
"**/*"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": "src",
|
||||||
|
"to": "resources/src",
|
||||||
|
"filter": [
|
||||||
|
"**/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
+5
-3
@@ -10,7 +10,9 @@ import { fileURLToPath } from 'url';
|
|||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
const file = join('data/', config.database.filename);
|
var env = process.env.NODE_ENV || 'prod';
|
||||||
|
|
||||||
|
const file = join(__dirname, 'data/', config.database.filename);
|
||||||
const adapter = new JSONFile(file);
|
const adapter = new JSONFile(file);
|
||||||
export const db = new Low(adapter);
|
export const db = new Low(adapter);
|
||||||
|
|
||||||
@@ -66,10 +68,10 @@ app.use('/event', eventRouter);
|
|||||||
app.use('/ontime', ontimeRouter);
|
app.use('/ontime', ontimeRouter);
|
||||||
|
|
||||||
// serve react
|
// serve react
|
||||||
app.use(express.static(path.join(__dirname, '../../client/build')));
|
app.use(express.static(path.join(__dirname, env == 'prod' ? '../' : '../../', 'client/build')));
|
||||||
|
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
res.sendFile(path.resolve(__dirname, '../../client', 'build', 'index.html'));
|
res.sendFile(path.resolve(__dirname, env == 'prod' ? '../' : '../../', 'client', 'build', 'index.html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Implement route for errors
|
// Implement route for errors
|
||||||
|
|||||||
Reference in New Issue
Block a user