Thank you for contributing to Condense! Please review this document before submitting issues or pull requests.
- Clone the repository:
git clone https://github.com/studioframes/Condense.git cd Condense - Install dependencies:
npm install
- Test your standalone CLI locally:
npm start
- Run the test suite:
npm test
Because Condense is distributed as an npm package, you must maintain compatibility across all three distribution paths:
- No Local Disk Access First: Do not write temporary files to the disk (
/tmp,multer.diskStorage, etc.) by default. Use pure in-memory Buffers and Node Streams to maintain statelessness. (Exception: Very specific structural overrides like MP4 faststart which strictly require file buffering). - Keep Core Helpers Modular: Ensure helper files inside
src/services/are decoupled from Express HTTP objects (req,res) so they can still be safely imported programmatically. - Respect Bypass Directives: If adding new language processors, ensure they respect bypass parameters or check for
data-condense-ignorepatterns. - Support Three Quality Tiers: When implementing new optimizers, always handle
quality,balanced, andextrememethods appropriately. - Update Tests: When modifying service functions, add or update corresponding tests in the
tests/folder. Runnpm testto verify all tests pass.
Condense uses Node's built-in test framework. Tests live in the tests/ directory and cover:
- imageService.test.js — Image optimization (PNG, JPEG, quality/balanced/extreme modes)
- textService.test.js — Code/markup minification (JS, CSS, HTML, XML, YAML, ignore directives)
- mediaService.test.js — Media streaming (audio/video processing, error handling)
- esbuildService.test.js — TypeScript and React minification tests
- wasmService.test.js — WebAssembly stripping tests
- cacheService.test.js — LRU caching tests
- helpers.js — Shared test utilities
Tests are development-only and excluded from published npm packages via .npmignore.
Condense uses Prettier for automatic code formatting. Before committing, run:
npm run formatThis ensures consistent code style across the project (2-space indentation, single quotes, semicolons).
Condense uses ESLint to catch bugs and code quality issues:
npm run lintCommon issues caught: unused variables, unreachable code, inconsistent spacing, and more.
Before submitting a PR, ensure:
npm run lint # No linting errors
npm run format # Code is formatted
npm test # All tests pass- Fork the repo and create your branch from
main. - Commit your changes and ensure they don't break existing package exports.
- Run
npm run lintto check for code quality issues. - Run
npm run formatto auto-format code. - Run
npm testto verify all tests pass before submitting a PR. - Submit a Pull Request targeting
main.