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.
- GitHub Pages: Prime Factorization Tool
- Alternative Tool: Integer Factorization to Prime Factors with API
- 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.
- Node.js 20, matching .nvmrc.
- npm 10 or newer.
git clone https://github.com/doctorlai/prime-factorization.git
cd prime-factorization
nvm use
npm ci
npm run devOpen http://localhost:5173/prime-factorization/ in your browser.
| 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 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.
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
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.
This project is licensed under the MIT License. See LICENSE for details.