Commit cef5b3e
Migrate from JavaScript to TypeScript with Vite + Vitest (#160)
* Migrate from JavaScript to TypeScript with Vite + Vitest
- Convert all JavaScript source files to TypeScript with proper typing
- Replace Rollup build system with Vite for faster development
- Replace tape test runner with Vitest for modern testing
- Bundle TypeScript declarations into single file
- Update demo to work with new build system
- Maintain backward compatibility with existing API
New build outputs:
- dist/martinez.js (ES module)
- dist/martinez.cjs (CommonJS)
- dist/index.d.ts (bundled TypeScript declarations)
Scripts:
- npm run build: Build library
- npm run test: Run tests with Vitest
- npm run dev: Start dev server with demo
- npm run typecheck: Type checking
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Replace ESLint with oxlint for faster linting
- Remove ESLint, TypeScript ESLint plugins, and related dependencies
- Add oxlint (Rust-based linter) for significantly faster performance
- Configure oxlint with TypeScript support and reasonable rule set
- Maintain code quality standards while improving build speed
Performance improvement:
- ESLint: ~2-3 seconds on 18 files
- oxlint: 9ms on 18 files with 96 rules using 8 threads
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix TypeScript build errors in core library files
TypeScript fixes:
- Fix BBox type from interface to tuple [number, number, number, number]
- Fix connectEdges function call signature (remove unused operation parameter)
- Fix variable type conflicts in connect_edges.ts (separate tmpEvent and tmpPos)
- Add proper null assertion operators for guaranteed non-null properties
Build verification:
- ✅ Build completes successfully: dist/martinez.js, dist/martinez.cjs, dist/index.d.ts
- ✅ All 22 tests pass with Vitest
- ✅ Library functions correctly
- ✅ Main TypeScript errors resolved
Remaining errors are only in debug utilities and test files, not in core library.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Convert all remaining tests from tape to Vitest
✅ Successfully converted 7 additional test files:
- compute_fields.test.js → compute_fields.test.ts (1 test)
- featureTypes.test.js → featureTypes.test.ts (16 tests)
- genericTestCases.test.js → genericTestCases.test.ts (27 tests)
- index.test.js → index.test.ts (14 tests)
- segment_intersection.test.js → segment_intersection.test.ts (11 tests)
- sweep_event.test.js → sweep_event.test.ts (6 tests)
- sweep_line.test.js → sweep_line.test.ts (1 test)
🎯 Test migration results:
- **Before**: 22 tests passing (4 converted files)
- **After**: 98 tests passing (11 converted files)
- **Improvement**: 76 additional tests (+345% increase)
🔧 Key changes:
- Converted complex nested tape test structures to proper Vitest describe/it blocks
- Updated all assertions from tape to Vitest expect syntax
- Added TypeScript support with proper type assertions
- Added glob dependency for file system test discovery
- Fixed import statements for modern package versions
- Maintained all original test logic and fixtures
All tests now run with Vitest and provide comprehensive coverage
of the martinez polygon clipping library functionality.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update vite.config.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update test/compare_segments.test.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update test/genericTestCases.test.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update test/genericTestCases.test.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Tests, benchmarks
* New demo
* Nojekyll
* Packages
* More tests from #156
* npmrc
* Stricter ts
* Fixed the queue
* Fixed the demo
* Bumped the version
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 3d55204 commit cef5b3e
File tree
80 files changed
+6404
-9232
lines changed- bench
- demo
- css
- js
- src
- test
- genericTestCases
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
80 files changed
+6404
-9232
lines changedThis file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments