This guide covers the CI/CD setup, development workflow, and available commands for the chaindexing TypeScript implementation.
# Install dependencies
make install
# Run linting and formatting
make lint
make format
# Run tests
make tests.unit # Unit tests (no database required)
make tests.integration # Integration tests (requires PostgreSQL)
# Build all packages
make build
# Run full CI pipeline locally
make ci.allmake db.start # Start PostgreSQL database
make db.stop # Stop PostgreSQL database
make db.drop # Drop database data
make db.reset # Reset database (stop, drop, start)
make db.logs # Show database logsmake tests.setup # Setup test database
make tests.unit # Run unit tests (26 tests, ~2s)
make tests.integration # Run integration tests (8 tests, ~3s)
make tests # Run all tests
make tests.with.coverage # Run tests with coverage
make tests.watch # Run tests in watch mode
make tests.ci # Run CI test suitemake dev # Start development mode
make build # Build all packages
make build.clean # Clean and rebuildmake lint # Run ESLint
make lint.fix # Fix ESLint issues automatically
make format # Format code with Prettier
make format.check # Check code formatting
make type.check # Run TypeScript type checkingmake install # Install dependencies
make install.clean # Clean install dependencies
make outdated # Check for outdated packagesmake ci.lint # Run linting checks
make ci.type # Run type checking
make ci.test # Run CI test suite
make ci.build # Run build
make ci.all # Run full CI pipelinemake clean # Clean all build artifacts
make help # Show help messageThe project includes a comprehensive GitHub Actions workflow (.github/workflows/ci.yml) that runs
on:
- Push to
main/masterbranches - Pull requests to
main/masterbranches - Manual dispatch (workflow_dispatch)
- Scheduled runs (weekly on Saturdays)
- Runs ESLint with zero warnings policy
- Checks Prettier formatting
- Performs TypeScript type checking
- Duration: ~15 minutes
- Dependencies: None
- Runs all unit tests (no database required)
- Tests core functionality, filters, updates, config validation
- Duration: ~15 minutes
- Dependencies: None
- Runs integration tests with PostgreSQL database
- Tests end-to-end flows, database operations
- Duration: ~30 minutes
- Dependencies: PostgreSQL service
- Runs full test suite with coverage reporting
- Uploads coverage to Codecov (optional)
- Duration: ~30 minutes
- Dependencies: PostgreSQL service
- Builds all TypeScript packages
- Uploads build artifacts
- Duration: ~15 minutes
- Dependencies: None
- Checks for outdated npm packages
- Continue on error: Yes (won't fail CI)
- Duration: ~10 minutes
- Tests across multiple Node.js versions (18, 20, 21, 22)
- Node.js 22 is experimental (continue on error)
- Duration: ~30 minutes per version
- Summary job that ensures all required jobs passed
- Dependencies: lint, test-unit, test-integration, build
# Clone and setup
git clone <repository>
cd chaindexing-ts
make install
# Start database (for integration tests)
make db.start
# Run tests
make tests.unit # Quick feedback loop
make tests.integration # Full integration testing# Before committing
make lint.fix # Fix linting issues
make format # Format code
make type.check # Check types
make tests.unit # Run unit tests
# Full pre-commit check
make ci.all # Run complete CI pipeline locally- Unit Tests: Fast, isolated, no database (26 tests)
- Integration Tests: End-to-end, with database (8 tests)
- Repository Tests: Database operations (6 tests)
- Coverage Target: >80% for statements, branches, functions
make build # Build all packages
make build.clean # Clean build (removes dist/, rebuilds)The project is organized as a monorepo with multiple packages:
chaindexing-ts/
βββ chaindexing-core/ # Core functionality
βββ chaindexing-config/ # Configuration management
βββ chaindexing-postgres/ # PostgreSQL repository
βββ chaindexing-repos/ # Repository abstractions
βββ chaindexing-tests/ # Test utilities and suites
βββ chaindexing/ # Main package
βββ scripts/ # Build and utility scripts
Each package has its own:
package.jsonwith build scriptstsconfig.jsonfor TypeScript configuration- Individual build outputs in
dist/directories
- Parser:
@typescript-eslint/parser - Extends: ESLint recommended + TypeScript recommended + Prettier
- Rules:
- Zero warnings policy (
--max-warnings 0) - Unused variables must start with
_ - Console.log allowed for debugging
- Prefer const over let
- No prototype builtins
- Zero warnings policy (
- Print Width: 100 characters
- Tab Width: 2 spaces
- Semicolons: Required
- Quotes: Single quotes
- Trailing Commas: ES5 style
- Strict Mode: Enabled
- Target: ES2020
- Module: CommonJS
- Declaration: Generated for libraries
# Fix automatically
make lint.fix
# Check specific issues
npm run lint# Ensure PostgreSQL is running
make db.start
# Check database logs
make db.logs
# Reset database
make db.reset# Clean and rebuild
make build.clean
# Check TypeScript errors
make type.check# Run specific test suites
make tests.unit # No database required
make tests.integration # Requires database setup
# Setup test database
make tests.setupFor local development, ensure these are set:
# .env.test file
TEST_DATABASE_URL=postgres://postgres:postgres@localhost:5432/chaindexing_test
NODE_ENV=test
SETUP_TEST_DB=true# Run the same checks as CI
make ci.all
# Individual CI steps
make ci.lint
make ci.type
make ci.build
make ci.test- Check the Actions tab in GitHub repository
- Review job logs for specific failures
- Ensure secrets are configured (if using Codecov)
- Verify PostgreSQL service is healthy
- Unit Tests: ~2.4 seconds (26 tests)
- Integration Tests: ~2.7 seconds (8 tests)
- Repository Tests: ~2.7 seconds (6 tests)
- Total Test Suite: ~8-10 seconds
- Individual Package: ~2-3 seconds
- All Packages: ~2.4 seconds (parallel build)
- Clean Build: ~5-7 seconds
- Lint Job: ~2-3 minutes
- Unit Tests: ~2-3 minutes
- Integration Tests: ~4-5 minutes
- Build Job: ~2-3 minutes
- Total Pipeline: ~8-12 minutes
- All CI jobs must pass before merge
- Code review required
- Automatic formatting and linting checks
- Coverage reports for changes
mainbranch protected- Require CI status checks
- Require up-to-date branches
- Dismiss stale reviews on new commits
- Weekly outdated dependency checks
- Automated security updates (via Dependabot)
- Lock file consistency checks
# Future release workflow (not yet implemented)
make publish.dry # Dry run
make publish # Actual publish- Target: >80% coverage
- Reports: Generated in
coverage/directory - Upload: To Codecov (optional, requires token)
- Test execution times tracked
- Build performance metrics
- CI job duration monitoring
- ESLint error/warning counts
- TypeScript compilation errors
- Test pass/fail rates
- Publishing Pipeline: Automated npm package publishing
- Docker Integration: Containerized development environment
- E2E Testing: Browser-based end-to-end tests
- Performance Testing: Load and stress testing
- Security Scanning: Automated vulnerability scanning
- Semantic Releases: Automated versioning and changelogs
- Follow the established code quality standards
- Ensure all tests pass locally before pushing
- Add tests for new functionality
- Update documentation for API changes
- Use conventional commit messages
For more information, see the main README.md and TESTING.md files.