Development Setup
Get started contributing to FitFileViewer.
Prerequisitesβ
Required Softwareβ
| Software | Version | Purpose |
|---|---|---|
| Node.js | >=22.12.0 | Runtime |
| npm | >=11.15.0 | 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 the repository root
cd FitFileViewer
# 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β
# Install root app tooling and docs workspace 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/ # Electron runtime source
β βββ main.ts # Main process
β βββ renderer.ts # Renderer process
β βββ preload.ts # Preload script
β βββ main-ui.ts # UI management
β βββ fitParser.ts # FIT parsing
β βββ utils/ # Runtime utility modules
βββ scripts/ # Root-owned build, lint, test, and release wrappers
βββ static/ # Root-owned static assets copied into runtime dist
βββ tests/ # Root-owned Vitest and Playwright tests
βββ docs/ # Documentation
βββ docusaurus/ # Documentation site
βββ fit-test-files/ # Sample FIT files
βββ electron-builder.config.cjs
βββ eslint.config.mjs
βββ prettier.config.mjs
βββ stylelint.config.mjs
βββ 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/utils/formatUtils.test.ts
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β
// prettier.config.mjs
export { default } from "prettier-config-nick2bad4u";
TypeScriptβ
// tsconfig.app.json
{
"compilerOptions": {
"noEmit": 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β
{
"configurations": [
{
"name": "Attach to Electron Main",
"port": 9229,
"request": "attach",
"type": "node"
}
],
"version": "0.2.0"
}
Run npm start from the repository root, then attach VS Code to the Electron
main process with this configuration.
Chrome DevToolsβ
- Start app:
npm start - Open DevTools:
Ctrl+Shift+I - Debug renderer process
Next: Code Standards β