Skip to main content

Development Setup

Get started contributing to FitFileViewer.

Prerequisites​

Required Software​

SoftwareVersionPurpose
Node.js>=22.12.0Runtime
npm>=11.15.0Package manager
GitLatestVersion control
  • 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​

VariablePurpose
NODE_ENVdevelopment/production
ELECTRON_IS_DEVEnable 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​

  1. Start app: npm start
  2. Open DevTools: Ctrl+Shift+I
  3. Debug renderer process

Next: Code Standards β†’