Skip to content

DoctorLai/prime-factorization

Repository files navigation

Prime Factorization App

CI Last Commit License GitHub Stars Code Style Commits Activity GitHub Commit Activity Watchers PRs Welcome JavaScript Repo Size Top Language GitHub Open PRs GitHub Open Issues GitHub Forks Node.js Version Ask DeepWiki

A small React web app that computes the prime factorization of a positive integer and displays all primes up to 2000 for quick reference. The app runs entirely in the browser, supports a persisted dark mode preference, and is tested with Vitest.

Live Demo

Prime Factorization app screenshot

Features

  • Prime factorization in exponent form, such as 24 => 2^3 * 3.
  • Browser-only computation with no application server request for entered numbers.
  • Prime reference list up to 2000.
  • Light and dark mode toggle persisted in localStorage.
  • CI checks for formatting, linting, coverage thresholds, build, and tests.
  • Pull request coverage comments generated from Vitest coverage output.

Requirements

  • Node.js 20, matching .nvmrc.
  • npm 10 or newer.

Quick Start

git clone https://github.com/doctorlai/prime-factorization.git
cd prime-factorization
nvm use
npm ci
npm run dev

Open http://localhost:5173/prime-factorization/ in your browser.

Commands

Command Purpose
npm run dev Start the Vite development server.
npm run format Check Prettier formatting.
npm run format:fix Format files with Prettier.
npm run lint Run ESLint.
npm run coverage Run tests with coverage thresholds.
npm run build Build the production app.
npm run test Run the Vitest suite once.
npm run check Run formatting, lint, coverage, and build.
npm run ci Alias for npm run check.
npm run clean Remove generated dist and coverage.
npm run badges:languages Refresh badges/languages.json.
npm run deploy Build and publish dist with gh-pages.

Coverage

Coverage is enforced by npm run coverage with 80% minimum thresholds for lines, statements, functions, and branches. Pull requests receive a GitHub bot coverage comment through davelosert/vitest-coverage-report-action, using Vitest's coverage/coverage-summary.json and coverage/coverage-final.json output.

Project Structure

src/                  React app and factorization functions
tests/                Vitest and Testing Library tests
.github/workflows/   CI and badge refresh automation
badges/               Shields endpoint JSON published to the badges branch
scripts/              Maintenance scripts

Documentation

Internationalization

This is not a browser extension and does not currently ship translated UI strings, so _locales and lang directories are intentionally not included. The roadmap leaves room for localization if the app grows beyond its current English-only interface.

License

This project is licensed under the MIT License. See LICENSE for details.

Acknowledgments

  • Built by @justyy.
  • If you found this tool useful, consider buying the maintainer a coffee.