- Properly disable service workers in electron builds - Add CSP headers for electron security - Fix path resolution in electron context - Improve preload script error handling and IPC setup - Update build scripts for better electron/capacitor compatibility - Fix router path handling in electron context - Remove electron-builder dependency - Streamline build process and output structure This change improves the stability and security of electron builds while maintaining PWA functionality in web builds. Service workers are now properly disabled in electron context, and path resolution issues are fixed.
2.5 KiB
Building TimeSafari
This guide explains how to build TimeSafari for different platforms.
Prerequisites
- Node.js (LTS version recommended)
- npm (comes with Node.js)
- Git
- For iOS builds: macOS with Xcode installed
- For Android builds: Android Studio with SDK installed
- For desktop builds: Additional build tools based on your OS
Initial Setup
-
Clone the repository:
git clone [repository-url] cd TimeSafari -
Install dependencies:
npm install
Web Build
To build for web deployment:
-
Run the production build:
npm run build -
The built files will be in the
distdirectory. -
To test the production build locally:
npm run serve
Desktop Build (Electron)
To build the desktop application:
-
Run the Electron build:
npm run build:electron -
The built files will be in
dist-electron. -
To run the desktop app:
electron dist-electron
Mobile Builds (Capacitor)
iOS Build
Prerequisites: macOS with Xcode installed
-
Build the web assets:
npm run build -- --mode capacitor -
Add iOS platform if not already added:
npx cap add ios -
Update iOS project with latest build:
npx cap sync ios -
Open the project in Xcode:
npx cap open ios -
Use Xcode to build and run on simulator or device.
Android Build
Prerequisites: Android Studio with SDK installed
-
Build the web assets:
npm run build -- --mode capacitor -
Add Android platform if not already added:
npx cap add android -
Update Android project with latest build:
npx cap sync android -
Open the project in Android Studio:
npx cap open android -
Use Android Studio to build and run on emulator or device.
Development
To run the application in development mode:
- Start the development server:
npm run dev
Testing
Run local tests:
npm run test-local
Run all tests (includes building):
npm run test-all
Linting
Check code style:
npm run lint
Fix code style issues:
npm run lint-fix
Notes
- The application uses PWA (Progressive Web App) features for web builds
- Electron builds disable PWA features automatically
- Build output directories:
- Web:
dist/ - Electron:
dist-electron/ - Capacitor:
dist-capacitor/
- Web: