Development Setup
Get started contributing to FitFileViewer.
Prerequisitesβ
Required Softwareβ
| Software | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Runtime |
| npm | 9+ | Package manager |
| Git | Latest | Version control |
Recommendedβ
- VS Code with extensions:
- ESLint
- Prettier
- JavaScript/TypeScript
Quick Startβ
# Clone the repository
git clone https://github.com/Nick2bad4u/FitFileViewer.git
# Navigate to electron app
cd FitFileViewer/electron-app
# Install dependencies
npm install
# Start development
npm start
Detailed Setupβ
1. Clone Repositoryβ
# HTTPS
git clone https://github.com/Nick2bad4u/FitFileViewer.git
# SSH
git clone git@github.com:Nick2bad4u/FitFileViewer.git
# Navigate to project
cd FitFileViewer
2. Install Dependenciesβ
# Enter electron-app directory
cd electron-app
# Install all dependencies
npm install
3. Start Development Serverβ
# Start Electron in development mode
npm start
This will:
- Launch Electron with hot reload
- Enable DevTools
- Show console output
4. Open DevToolsβ
- Press
Ctrl+Shift+I(Windows/Linux) - Press
Cmd+Option+I(macOS)
Project Structureβ
FitFileViewer/
βββ electron-app/ # Main application
β βββ main.js # Main process
β βββ renderer.js # Renderer process
β βββ preload.js # Preload script
β βββ main-ui.js # UI management
β βββ fitParser.js # FIT parsing
β βββ utils/ # Utility modules
β βββ tests/ # Test files
β βββ package.json # Dependencies
βββ docs/ # Documentation
βββ fit-test-files/ # Sample FIT files
βββ README.md
Development Commandsβ
Run Applicationβ
# Development mode (with DevTools)
npm start
# Production mode (no DevTools)
npm run start-prod
Testingβ
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test -- tests/unit/formatDistance.test.js
Lintingβ
# Run ESLint
npm run lint
# Fix auto-fixable issues
npm run lint:fix
Buildingβ
# Build for current platform
npm run build
# Build for all platforms
npm run build-all
Configuration Filesβ
ESLintβ
// eslint.config.mjs
export default [
// Configuration
];
Prettierβ
// .prettierrc
{
"tabWidth": 4,
"useTabs": true,
"singleQuote": true
}
TypeScriptβ
// tsconfig.json
{
"compilerOptions": {
"checkJs": true,
"allowJs": true
}
}
Testing with FIT Filesβ
Sample FIT files are provided:
# Location
fit-test-files/
βββ _Fenton_Michigan_Afternoon_Ride_*.fit
βββ Virtual_Zwift_*.fit
βββ ...
Environment Variablesβ
| Variable | Purpose |
|---|---|
NODE_ENV | development/production |
ELECTRON_IS_DEV | Enable dev features |
Debuggingβ
VS Code Launch Configβ
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/electron-app",
"runtimeExecutable": "${workspaceFolder}/electron-app/node_modules/.bin/electron",
"args": ["."]
}
]
}
Chrome DevToolsβ
- Start app:
npm start - Open DevTools:
Ctrl+Shift+I - Debug renderer process
Next: Code Standards β