TypeScript Migration and Modern Build System Upgrade#156
TypeScript Migration and Modern Build System Upgrade#156chrisscudder merged 53 commits intoaws-solutions-library-samples:mainfrom
Conversation
… Build status: Success
…Build status: Success
…t Build status: Success
…pt Build status: Success
…ild status: Success
Fixed /admin/events
|
@davidfsmith issues resolved, ready for retest |
re-tested, am now able to create events and also add users via registration |
|
Timing is all now displaying correctly in manage race and also the commentator view, warning around insecure websocket connection remains in developer tools Leaderboard and Overlays all working as expected |
|
All basic functionality checked, including leaderboard and overlays. Outstanding / Not tested:
|
|
Legacy car activation page worked perfectly 👍 For reference the user agent of a car flashed with 20.04 is |
|
All of the core functionality is there as well as a nice fix for car activation. It looks good to merge to me (IMHO) |
dc9477c
into
aws-solutions-library-samples:main









TypeScript Migration, Modern Build System, and Legacy Browser Support
Summary
This PR modernizes the DREM frontend codebase with a migration from JavaScript to TypeScript and Create React App to Vite, and adds compatibility support for Firefox 84.0 (the browser on DeepRacer cars' Ubuntu GUI).
Key Changes
🔧 Build System Modernization
website/)website-leaderboard/)website-stream-overlays/)📝 TypeScript Migration
types/api-responses.ts)types/domain.ts)types/graphql.ts)types/enums.ts)🏎️ Legacy Browser Support for Car Activation
The TypeScript/Vite/React 18 stack targets ES2020, which is incompatible with Firefox 84.0 - the browser shipped on DeepRacer cars running Ubuntu 20.04. This caused the car activation page to crash when accessed directly from a DeepRacer car.
Solution: automatic browser detection with fallback page
carActivationWrapper.tsx- detects legacy browsers via feature detection and user agent checks, automatically redirects to the legacy page. Supports?legacy=trueURL param for testingcarActivationOriginal.tsx- the original React/Cloudscape component, unchangedcarActivation.tsx- re-exports from the wrapper, preserving all existing imports and routingcar-activation-legacy.html- standalone vanilla JS/HTML page served frompublic/. Compatible with Firefox 84.0. Loads the AppSync endpoint fromsessionStorage(set byApp.tsxon load), finds the Cognito idToken from Amplify's localStorage entries, and calls AppSync directly. Provides full car activation functionality including fleet selection, hostname/password, WiFi config, and custom console optionAuth flow: the operator logs into DREM normally via the Amplify login page (compatible with Firefox 84.0), which stores the Cognito idToken in localStorage. When redirected to the legacy page, the token is already available and used directly as the AppSync
Authorizationheader.🏗️ Architecture Improvements
mutations.ts,queries.ts,subscriptions.ts)useAuthhook centralising authentication logic, replacing scattered auth calls across componentsuseGroupsApi.ts- consolidated into other hooks🐍 Backend Updates
lib/base-stack.ts)🐛 Bug Fixes
/admin/eventsand/admin/events/createpages broken during TypeScript migration - corrected domain types and GraphQL mutations🧪 Testing
vitest.config.ts) and test runner support via MakefilemetricCalculations.ts📚 Documentation
TYPESCRIPT_MIGRATION_CHECKLIST.md- Step-by-step migration guideTYPESCRIPT_MIGRATION_STATUS.md- Current migration statusTYPESCRIPT_QUICK_REFERENCE.md- TypeScript best practicesAPI_TYPES_USAGE.md- API types usage guide🔄 Dependency Updates
Testing
Breaking Changes
Benefits