-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: Migrate to Biome and TypeScript, Modernize Project Structure #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add tsconfig.json with ES modules and edge worker settings - Add TypeScript dependencies - Update all dependencies to latest versions
- Fix mismatched quotes in Cloudflare adapter - Fix mismatched quotes in Akamai adapter - Fix mismatched quotes in CloudFront adapter
- Remove npm-specific files and prettier - Add pnpm as package manager - Add Biome for formatting and linting - Update scripts in package.json
- Update schema to latest version 1.9.4 - Disable VCS integration - Set tab indentation - Configure JavaScript quote style and trailing comma - Remove dist ignore as it's handled by .gitignore
- Add ignore patterns for generated and IDE directories - Apply Biome formatting across the codebase - Format biome.json configuration
- Set Biome as default formatter for all relevant file types - Add support for React file extensions (jsx/tsx) - Enable format on save - Add recommended extensions: - biomejs.biome for formatting and linting - eamodio.gitlens for Git integration - vitest.explorer for test running - jeanp413.open-remote-wsl for WSL support
- Add CDN adapter interfaces for request/response handling - Add KVStore interface for key-value operations - Add Optimizely configuration and user context interfaces - Create types barrel file for clean imports
- Add CDNAdapterFactory with singleton pattern - Create BaseAdapter with common cookie handling - Add type-safe adapter registration and creation - Implement cookie serialization and parsing utilities
- Create CloudflareAdapter class extending BaseAdapter - Add Cloudflare-specific types for env and context - Implement cookie handling methods - Add basic request handling structure - Export adapter through index files
- Add CDN settings and event batch settings types - Implement KV-based caching with TTL support - Add event queuing and batched event dispatch - Handle caching requests with origin fallback - Add cache key generation and response serialization
- Add core type definitions for requests, decisions, and settings - Create CoreLogic class with TypeScript types - Implement initial set of methods with proper typing - Add dependency injection pattern for better testability
- Add main request processing pipeline - Implement visitor ID handling with multiple sources - Add datafile retrieval with KV storage caching - Add Optimizely initialization with error handling - Improve type safety for all methods
- Add response preparation for both origin and local responses - Add header management for visitor ID and decisions - Add cookie management with proper security settings - Add error handling for origin forwarding - Improve type safety for response handling
- Add flag decision handling with validation - Add cookie parsing and security measures - Add error handling utilities - Add type guards and validation - Add comprehensive logging
- Add proper type definitions for Optimizely SDK - Add interfaces for events and decisions - Add type safety for user profiles and attributes - Add error handling and logging
- Add UserProfile and CacheData interfaces - Add type safety for KV store operations - Add proper return types for all methods - Add readonly modifiers for immutable properties - Improve error handling and logging
- Add EventType union type for event names - Add EventListener type for listener functions - Add EventListenersMap for type-safe event mapping - Add new utility methods for event management - Add improved error handling and type safety
- Add interfaces for event parameters - Add type safety for all event handlers - Add proper typing for request and response objects - Add type definitions for all event listeners - Add improved error handling and logging
- Add interfaces for CdnProvider, FetchOptions, CookieOptions, and Decision - Add type safety for all helper functions - Add proper return types and parameter types - Add improved error handling with type checking - Add type guards for JSON parsing and validation
- Add interfaces for CDN providers and headers - Add type safety for response handling - Add proper typing for environment variables - Add type definitions for KV store operations - Add improved error handling with type checking
- Upgrade @biomejs/biome to 1.9.4 - Upgrade @vercel/edge to 1.2.0 - Upgrade vite to 6.0.7 - Set Node.js version to v22 in .nvmrc
Renamed to better reflect its role as a concrete implementation of IKVStore rather than an interface definition. Updated related imports and documentation.
* Add KVStore exports to all adapter index files * Implement missing cookie methods in FastlyAdapter * Add constructor and KVStore initialization to all adapters * Update adapter class documentation * Replace forEach with for...of loop in BaseAdapter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This PR introduces several significant improvements to the codebase:
1. Development Environment
.nvmrc
to standardize Node.js version (v22)2. TypeScript Migration
CookieOptions
andCDNSettings
type
prefix from imports where unnecessary3. Project Structure
build/cloudflare.ts
andbuild/vercel.ts
for targeted builds4. Code Quality
5. Legacy Code Management
src/legacy/
directoryTesting
The changes have been tested locally with Biome's formatting and linting tools. Build configurations have been verified to produce correct output for each CDN target.
Migration Notes
biome check --apply
to format code according to new standards.nvmrc