This document describes all the tools and processes configured to improve the development experience in Legal Markdown JS.
- Development Guide
- Node.js >= 16.0.0
- npm >= 7.0.0
- Git
# Clone and setup
git clone <repository-url>
cd legal-md-wizard
npm install
# Verify setup
npm run validate# Start development with hot reload
npm run dev
# Run in watch mode during development
npm run build:watch # TypeScript compilation
npm run test:watch # Tests with file watching
# Quick validation before committing
npm run validate # Runs typecheck + lint + testsrc/
├── cli/ # CLI interface and service layer
├── core/ # Core LegalMarkdown functionality
├── extensions/ # Additional features
├── lib/ # Shared utilities
├── constants/ # Global constants
├── errors/ # Custom error classes
└── types.ts # Type definitions
examples/ # Example files and templates
docs/ # Project documentation
tests/ # Test files organized by type
-
Strict mode enabled for maximum type safety
-
Path aliases configured for clean imports:
import { LegalMarkdownError } from '@errors'; import { processHeaders } from '@core/processors/header-processor';
Configuration: .eslintrc.js
# Lint all files
npm run lint
# Auto-fix issues
npm run lint:fixRules configured:
- TypeScript-specific rules
- No unused variables (with underscore exception)
- Explicit function return types (warning)
- Max line length: 100 characters
- Single quotes, semicolons required
Configuration: .prettierrc
# Check formatting
npm run format:check
# Auto-format all files
npm run formatSettings:
- 100 character line width
- Single quotes
- Semicolons required
- 2-space indentation
- Different rules for different file types
File: .editorconfig
- Consistent formatting across all editors
- UTF-8 encoding
- LF line endings
- Trim trailing whitespace
tests/
├── unit/ # Unit tests for individual functions
├── integration/ # Integration tests for modules
├── e2e/ # End-to-end CLI tests
└── setup.ts # Test configuration
# Run all tests
npm test
# Run specific test types
npm run test:unit
npm run test:integration
npm run test:e2e
# Coverage report
npm run test:coverage
# Watch mode for development
npm run test:watch- Framework: Jest with ts-jest
- Coverage: LCOV reports in
coverage/ - Path aliases configured for imports
- Timeout: 10 seconds for long-running tests
We use Conventional Commits for consistent commit messages.
Format: type(scope): description
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code formattingrefactor: Code refactoringtest: Test additions/modificationschore: Maintenance tasks
# Interactive commit creation
npm run commitThis launches an interactive prompt that helps you create properly formatted commits.
Automatically runs on every commit:
- ESLint with auto-fix
- Prettier formatting
- Only on staged files (fast!)
Automatically runs on commit message:
- Validates conventional commit format
# Feature development
git checkout -b feat/new-feature
git checkout -b fix/bug-description
git checkout -b docs/update-readme
# Hotfixes
git checkout -b hotfix/critical-fixTriggers: Push to main/develop, Pull Requests
Jobs:
- Multi-Node Testing: Tests on Node 16, 18, 20
- Quality Gates: TypeScript, ESLint, Prettier, Build
- Test Coverage: Jest with coverage upload to Codecov
- Security Audit: npm audit + audit-ci
Triggers: Push to main branch
Process:
- Automated versioning with semantic-release
- Changelog generation
- NPM package publishing
- GitHub release creation
All PRs must pass:
- ✅ TypeScript compilation
- ✅ ESLint checks
- ✅ Prettier formatting
- ✅ All tests passing
- ✅ Build successful
- ✅ No high/critical security vulnerabilities
Releases are fully automated using semantic-release:
- Commit with conventional format
- Push to main branch
- CI validates everything
- Semantic-release analyzes commits:
fix:→ Patch version (0.1.1)feat:→ Minor version (0.2.0)BREAKING CHANGE:→ Major version (1.0.0)
- Changelog generated automatically
- NPM package published
- GitHub release created
# Test what the next release would be
npm run release:dry
# Pre-release validation
npm run prereleaseThe project includes VS Code configuration:
- Settings:
.vscode/settings.json - Extensions:
.vscode/extensions.json
Automatically suggested when opening the project:
- Prettier - Code formatter
- ESLint - Linting
- TypeScript - Language support
- Jest - Test runner
- YAML - YAML file support
- Code Spell Checker - Spelling
- Format on Save: Prettier runs automatically
- Auto Fix: ESLint fixes on save
- Import Management: Auto-import and organize
- Type Checking: Real-time TypeScript errors
- Test Integration: Run tests from editor
For other editors, ensure:
- TypeScript language server enabled
- ESLint and Prettier plugins installed
- EditorConfig support enabled
Configured in tsconfig.json and Vitest:
// Instead of relative imports
import { LegalMarkdownError } from '../../errors';
// Use clean aliases
import { LegalMarkdownError } from '@errors';
import { PATHS } from '@constants';
import { logger } from '@utils/logger';Available aliases:
@core/*→src/core/*@types→src/types.ts@extensions/*→src/extensions/*@cli/*→src/cli/*@constants→src/constants/index.ts@errors→src/errors/index.ts@utils/*→src/utils/*@plugins/*→src/plugins/*
Dependabot (.github/dependabot.yml):
- Weekly dependency updates
- Security vulnerability patches
- GitHub Actions updates
- Automatic PR creation
- Target: Maintain > 80% coverage
- Reports: Available in
coverage/after running tests - CI Integration: Coverage uploaded to Codecov
- npm audit: Runs in CI
- audit-ci: Fails CI on high/critical vulnerabilities
- Dependabot: Security updates
# If hooks fail, check:
npm run lint:fix # Fix linting issues
npm run format # Fix formatting issues
npm run typecheck # Check TypeScript errors# Run specific tests
npm run test:unit -- --verbose
npm run test:integration -- --verbose
# Update snapshots if needed
npm test -- --updateSnapshot# Clean build
npm run clean
npm run build
# Check TypeScript errors
npm run typecheck- Verify path aliases in
tsconfig.json - Check Jest moduleNameMapping in
jest.config.js - Restart TypeScript language server in IDE
- Check this documentation first
- Run diagnostics:
npm run validate - Check CI logs for detailed error information
- Review test output for specific failures
- Use
npm run devfor development with hot reload - Run
npm run validatebefore committing - Write tests for new features
- Use descriptive commit messages
- Follow TypeScript strict mode
- Use path aliases for imports
- Write self-documenting code
- Add JSDoc for public APIs
- Write unit tests for utilities
- Write integration tests for processors
- Write e2e tests for CLI functionality
- Maintain good test coverage
- Use conventional commit format
- Keep commits atomic and focused
- Use descriptive branch names
- Rebase feature branches before merging
- Conventional Commits
- Semantic Versioning
- TypeScript Handbook
- Jest Documentation
- ESLint Rules
- Prettier Configuration
This document should be updated when:
- New tools are added to the development stack
- Workflow processes change
- New scripts are added to package.json
- CI/CD pipeline is modified
Last updated: $(date)