mirror of
https://github.com/acamarata/nrel-spa.git
synced 2026-06-30 19:04:25 +00:00
- Trim README to ≤80 lines with wiki link for full docs - Add CHANGELOG.md with initial entry - Fix CI: replace pinned pnpm/action-setup with corepack enable - Add "type": "module" and flat exports map (ADR-015) - Add ./package.json exports entry - Add coverage script - Rename lib/spa.js → lib/spa.cjs to fix CJS/ESM conflict under "type": "module" - Update src/index.ts and tsup.config.ts to reference spa.cjs - Add .github/wiki pages: _Sidebar, _Footer, Contributing, SECURITY, CODE_OF_CONDUCT
1.6 KiB
1.6 KiB
Contributing
Prerequisites
- Node.js 20 or later
- pnpm (enabled via corepack:
corepack enable)
Setup
git clone https://github.com/acamarata/nrel-spa.git
cd nrel-spa
pnpm install
Development
Build and test:
pnpm build # compile TypeScript
pnpm test # run full test suite (ESM + CJS)
pnpm run typecheck # type-check without emitting
pnpm run lint # ESLint
pnpm run format # Prettier format
The build output goes to dist/. It is gitignored; do not commit it.
Project Structure
src/
index.ts exports and public API wrappers
types.ts all TypeScript types and constants
lib/
spa.js core SPA algorithm (JS port of NREL C source, tracked in git)
dist/ tsup build output (gitignored)
test.mjs full ESM test suite
test-cjs.cjs CJS test subset
bin/ C reference testing infrastructure
Making Changes
- Keep
lib/spa.jsin git. It is the core algorithm and must stay tracked. - All new exports go through
src/index.tsandsrc/types.ts. - Add tests in
test.mjsfor any new behavior. The test suite uses Node's built-innode:testrunner. - Run
pnpm testbefore submitting. All tests must pass on Node 20, 22, and 24.
Validation Against C Reference
The bin/ directory contains infrastructure for comparing output against the original NREL C implementation. See bin/README.md for setup instructions. Use this when changing anything in lib/spa.js.
Pull Requests
- One logical change per PR
- Include tests for new behavior
- Update
CHANGELOG.mdunder[Unreleased] - Do not bump the version number