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
|
44
src/index.js
44
src/index.js
@ -165,27 +165,33 @@ app.whenReady().then(async () => {
|
||||
// Initialize core services
|
||||
initializeFirebase();
|
||||
|
||||
databaseInitializer.initialize()
|
||||
.then(() => {
|
||||
console.log('>>> [index.js] Database initialized successfully');
|
||||
|
||||
// Clean up zombie sessions from previous runs first
|
||||
sessionRepository.endAllActiveSessions();
|
||||
try {
|
||||
await databaseInitializer.initialize();
|
||||
console.log('>>> [index.js] Database initialized successfully');
|
||||
|
||||
// Clean up zombie sessions from previous runs first
|
||||
sessionRepository.endAllActiveSessions();
|
||||
|
||||
authService.initialize();
|
||||
listenService.setupIpcHandlers();
|
||||
askService.initialize();
|
||||
settingsService.initialize();
|
||||
setupGeneralIpcHandlers();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('>>> [index.js] Database initialization failed - some features may not work', err);
|
||||
});
|
||||
authService.initialize();
|
||||
listenService.setupIpcHandlers();
|
||||
askService.initialize();
|
||||
settingsService.initialize();
|
||||
setupGeneralIpcHandlers();
|
||||
|
||||
WEB_PORT = await startWebStack();
|
||||
console.log('Web front-end listening on', WEB_PORT);
|
||||
|
||||
createWindows();
|
||||
// Start web server and create windows ONLY after all initializations are successful
|
||||
WEB_PORT = await startWebStack();
|
||||
console.log('Web front-end listening on', WEB_PORT);
|
||||
|
||||
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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user