Developing Nerdamer
This is the practical path from cloning the repository to making and validating a change. The Nerdamer repository and its main development line are the source for current commands, file locations, and contributor guidance.
Set up the repository
git clone https://github.com/jiggzson/nerdamer.git
cd nerdamer
npm install
The source is TypeScript. Nerdamer now builds its public API modules separately from its browser bundles. The full bundle and parser-only bundle are separate targets, while build:modules produces the package subpath modules and declarations.
The normal contributor loop
src/Make the smallest change in the subsystem that owns the behavior.
npm run typechecknpm testCatch type and behavioral regressions while the change is still small.
npm run buildnpm run build:parserVerify both the complete package and parser-only browser targets.
Development commands
Use the repository scripts for type checking, testing, builds, documentation, and local experiments.
| Command | Use it for | What it checks or produces |
|---|---|---|
| npm run typecheck | Fast correctness check while editing | Runs TypeScript without emitting files. |
| npx tsc | Direct TypeScript compiler workflow | Runs the TypeScript compiler directly. |
| npm test | Behavior and regression coverage | Runs the Jest suite. |
| npm run build:modules | Refresh package API modules | Builds the generated JavaScript and declarations used by public package subpath imports. |
| npm run build:bundle | Build the complete browser bundle | Produces dist/bundle.js from the full package entry point. |
| npm run build:bundle:all-languages | Build the browser bundle with every language | Produces dist/bundle.js with all translated error-message catalogs included. |
| npm run build:parser | Build the parser-only browser target | Produces dist/parser.js from src/api/parser.ts and runs its smoke check. |
| npm run build:full | Build the complete package | Runs the module build, complete browser bundle, and full-bundle smoke check. |
| npm run build | Release-facing complete build | Runs build:full. The parser-only target remains a separate build:parser step. |
| npm run build:all-languages | Build the complete package with every browser language | Builds the package modules, the full browser bundle with every language catalog, and runs the full-bundle smoke check. |
| npm run dev | Scratch-driven development | Runs tools/dev.ts through the development watcher. |
| npm run lint | Static code checks | Runs ESLint over the TypeScript source. |
Full package and parser-only composition
The browser builds no longer assume that every parser entry point should pull in the complete CAS. src/index.ts assembles the complete package and calls registerNerdamerFunctions(), which registers parser-visible functions from core, math, algebra, calculus, and solving. The parser façade at src/api/parser.ts calls loadParserFunctions() instead, registering parser/core and math functionality without importing the higher-level algebra, calculus, and solver domains.
npm run build # complete package: modules + dist/bundle.js
npm run build:parser # parser-only browser target: dist/parser.js
This separation keeps nerdamer/parser and the parser browser target useful without recreating the old dependency from the parser back into the complete package. Domain dispatch modules register their own functions when the complete package is assembled.
Language-targeted browser builds
Browser bundles include English by default. The full and parser-only targets can include one or more translated error-message catalogs without carrying every translation. Supported language codes are spa, fra, deu, por, ita, and nld.
# Full browser bundle with Spanish
npx webpack --mode=production --env target=full --env language=spa
# Full browser bundle with Spanish and French
npx webpack --mode=production --env target=full --env language=spa,fra
# Parser-only browser bundle with Spanish and French
npx webpack --mode=production --env target=parser --env language=spa,fra
English is always included. For a targeted list, the first requested non-English language is selected initially and the other included catalogs are available for runtime switching. For example, language=spa,fra includes English, Spanish, and French, starts in Spanish, and allows the runtime LANGUAGE setting to switch to French or back to English.
When the complete package needs every translated catalog, use the named all-languages build:
npm run build:all-languages
This builds the package modules, produces the full dist/bundle.js with every language catalog, and runs the full-bundle smoke test. If only the all-languages browser bundle needs to be rebuilt, use:
npm run build:bundle:all-languages
The parser-only target can still be built with every catalog through its webpack target:
npx webpack --mode=production --env target=parser --env language=all
all cannot be combined with individual language codes. Unknown language codes fail the build. Repeated codes in a targeted list are ignored.
The normal npm run build:bundle and npm run build:parser commands omit the language option, so they produce English-only browser builds. Language targeting affects browser bundle composition; it does not replace the package module build.
nerdamer.set('LANGUAGE', ...) and Parser.set('LANGUAGE', ...) can select only catalogs that were included when the browser bundle was built. Use a comma-separated subset such as language=spa,fra when only those languages are needed, or npm run build:all-languages when the application must switch among every supported catalog.Use the development scratch file
tools/dev.ts is available for experiments, debugging, and quick local checks.
import nerdamer from '../src';
console.log(nerdamer('factor(x^4-1)').text());
If tools/dev.ts imports through one of the public API package paths, such as nerdamer/core, nerdamer/calculus, or nerdamer/structures, refresh the generated module output after changing the source:
npm run build:modules
Those package paths resolve through the generated module output, so without rebuilding them the scratch file can execute stale code.
Run the development watcher with:
npm run dev
Where should the change go?
src/core
Parser behavior, symbolic representation, shared operations, converters, settings, rationals, matrices, vectors, and common infrastructure.
src/algebra
Factoring, simplification, polynomial work, GCD/LCM, partial fractions, and related algebra algorithms.
src/calculus
Differentiation, integration, limits, sums/products, and transforms.
src/solve
Single-equation, polynomial, function, and multivariate/system solving.
src/math
Mathematical functions and lower-level numerical/symbolic helpers used by the higher layers.
spec
Targeted behavior specs and regression coverage. Add a reproducer here when a bug fix needs permanent protection.
Read the code conventions
Implementation patterns for reuse, types, parser entities, return flow, constants, access modifiers, files, and regression tests.
Code conventionsBefore you finish
A change that works in one scratch example is not enough. Check the surrounding subsystem, add a targeted regression when fixing a bug, and run the full validation commands before handing the change off.
npm run typecheck
npm test
npm run build
npm run build:parser
The repository is the source for current code, commands, package entry points, and contributor documentation.
github.com/jiggzson/nerdamerThe Codebase Map shows how the major source areas relate before you decide where to edit.
Codebase map