nrel-spa/.github/wiki/Contributing.md
Aric Camarata aa850f806c feat(e6): portfolio polish — docs, CI, TypeScript standard, wiki
- 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
2026-05-28 13:59:43 -04:00

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

  1. Keep lib/spa.js in git. It is the core algorithm and must stay tracked.
  2. All new exports go through src/index.ts and src/types.ts.
  3. Add tests in test.mjs for any new behavior. The test suite uses Node's built-in node:test runner.
  4. Run pnpm test before 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.md under [Unreleased]
  • Do not bump the version number