fix db init issue + add CI workflow
This commit is contained in:
parent
96062e9b8d
commit
00db563fd3
34
.github/workflows/build.yml
vendored
Normal file
34
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
name: Build & Verify
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ] # Runs on every push to main branch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
# Currently runs on macOS only, can add windows-latest later
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 🚚 Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: ⚙️ Setup Node.js environment
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20.x' # Node.js version compatible with project
|
||||||
|
cache: 'npm' # npm dependency caching for speed improvement
|
||||||
|
|
||||||
|
- name: 📦 Install root dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: 🌐 Install and build web (Renderer) part
|
||||||
|
# Move to pickleglass_web directory and run commands
|
||||||
|
working-directory: ./pickleglass_web
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: 🖥️ Build Electron app
|
||||||
|
# Run Electron build script from root directory
|
||||||
|
run: npm run build
|
40
src/index.js
40
src/index.js
@ -165,27 +165,33 @@ app.whenReady().then(async () => {
|
|||||||
// Initialize core services
|
// Initialize core services
|
||||||
initializeFirebase();
|
initializeFirebase();
|
||||||
|
|
||||||
databaseInitializer.initialize()
|
try {
|
||||||
.then(() => {
|
await databaseInitializer.initialize();
|
||||||
console.log('>>> [index.js] Database initialized successfully');
|
console.log('>>> [index.js] Database initialized successfully');
|
||||||
|
|
||||||
// Clean up zombie sessions from previous runs first
|
// Clean up zombie sessions from previous runs first
|
||||||
sessionRepository.endAllActiveSessions();
|
sessionRepository.endAllActiveSessions();
|
||||||
|
|
||||||
authService.initialize();
|
authService.initialize();
|
||||||
listenService.setupIpcHandlers();
|
listenService.setupIpcHandlers();
|
||||||
askService.initialize();
|
askService.initialize();
|
||||||
settingsService.initialize();
|
settingsService.initialize();
|
||||||
setupGeneralIpcHandlers();
|
setupGeneralIpcHandlers();
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.error('>>> [index.js] Database initialization failed - some features may not work', err);
|
|
||||||
});
|
|
||||||
|
|
||||||
WEB_PORT = await startWebStack();
|
// Start web server and create windows ONLY after all initializations are successful
|
||||||
console.log('Web front-end listening on', WEB_PORT);
|
WEB_PORT = await startWebStack();
|
||||||
|
console.log('Web front-end listening on', WEB_PORT);
|
||||||
|
|
||||||
createWindows();
|
createWindows();
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('>>> [index.js] Database initialization failed - some features may not work', err);
|
||||||
|
// Optionally, show an error dialog to the user
|
||||||
|
dialog.showErrorBox(
|
||||||
|
'Application Error',
|
||||||
|
'A critical error occurred during startup. Some features might be disabled. Please restart the application.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
initAutoUpdater();
|
initAutoUpdater();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user