fix db init issue + add CI workflow

This commit is contained in:
samtiz 2025-07-08 01:36:15 +09:00
parent 96062e9b8d
commit 00db563fd3
2 changed files with 59 additions and 19 deletions

34
.github/workflows/build.yml vendored Normal file
View 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

View File

@ -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();