# Development Guide ## Project Structure ``` solarlunar/ ├── src/ # Source files │ └── solarLunar.js # Main implementation ├── const/ # Constant data ├── test/ # Test files ├── dist/ # Build output ├── rollup.config.js # Build configuration ├── vitest.config.js # Test configuration ├── .eslintrc.js # ESLint configuration ├── .prettierrc # Prettier configuration └── package.json # Project configuration ``` ## Modern Features ### ES6+ Syntax - Arrow functions - Template literals - Destructuring - Modules (ESM) - Let/const declarations ### Build System - Rollup for module bundling - Supports UMD, CJS, and ESM formats - Tree-shaking enabled - Minification for production builds ### Testing - Vitest for unit testing - Modern assertion library - Mock support - Code coverage ### Code Quality - ESLint with modern rules - Prettier for code formatting - Type checking via TypeScript definitions ### Package Management - Modern NPM features - Dependency management - Security checks ## Migration Notes ### From Old Version - Babel 6 → Babel 7 - Karma/Mocha → Vitest - Webpack 3 → Rollup 4 - Custom build → Modern build pipeline ### Breaking Changes None. The API remains compatible with the original library. ### Performance Improvements - Optimized algorithms - Better variable declarations - Improved error handling ## Commands ### Development ```bash npm run dev # Watch mode for development npm test # Run tests once npm run test:watch # Watch mode for tests npm run lint # Check code quality npm run format # Format code npm run typecheck # Type checking ``` ### Production ```bash npm run build # Build all formats npm run prepublishOnly # Runs build before publish ``` ## Testing Strategy ### Unit Tests - Complete API coverage (57 tests with 100% pass rate) - Edge case validation - Performance benchmarks - Regression tests ### Modern Testing Features - Parallel test execution - Mock/stub support - Snapshot testing capability - UI test runner ### Performance - All 57 tests passing - Average operation time: <0.01ms - 10,000 conversions in ~80ms - Performance test available via: `npm run perf` ## Code Standards ### JavaScript - ES2020+ features allowed - Strict mode required - Consistent naming conventions - JSDoc documentation ### Style Guide - 2 space indentation - Single quotes for strings - Semicolons required - 100 character line limit ## Release Process 1. Update version in `package.json` 2. Run all tests 3. Build and verify output 4. Update documentation 5. Create git tag 6. Publish to npm ```bash npm version [patch|minor|major] npm run build npm publish ``` ## Compatibility ### Browsers - Modern browsers (ES2020+) - Node.js 14+ ### Modules - ES modules - CommonJS - UMD (for browser) ## Performance Considerations ### Optimizations - Efficient algorithm implementations - Minimal dependencies - Tree-shaking friendly exports - Lazy loading where appropriate ### Benchmarks The library maintains the same performance characteristics as the original while fixing potential issues with variable declarations and scoping. ## Troubleshooting ### Common Issues 1. **Variable redeclaration errors**: Fixed with proper let/const usage 2. **Build failures**: Check dependency versions and Node.js version 3. **Test failures**: Verify algorithm implementations match original behavior ### Migration Issues - Original algorithms preserved to maintain behavior - Variable scoping issues resolved - Module system updated for modern usage