equinor / equinor/fusion-framework
Remove @remix-run/router dependency after migration to @equinor/fusion-framework-react-router
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 10
- Avg merge
- 19h 40m
- Merged PRs (30d)
- 150
Description
## Goal
Eliminate the `@remix-run/router` dependency from the Fusion Framework repository by completing the migration to our unified router solution (`@equinor/fusion-framework-react-router`). This will reduce external dependencies, simplify the codebase, and ensure all applications use a consistent, framework-integrated routing approach.
## Why
**Reduced Dependency Surface Area**: Removing `@remix-run/router` eliminates an external dependency that is no longer needed once all apps migrate. This reduces maintenance burden, security exposure, and potential version conflicts.
**Unified Router Strategy**: `@equinor/fusion-framework-react-router` provides a purpose-built solution that integrates seamlessly with Fusion Framework's navigation module, context system, and module architecture. It offers route schema support for documentation and manifests, type-safe route definitions, and automatic Fusion context injection—features that are essential for our framework but not available in the generic `@remix-run/router` package.
**Code Simplification**: The current dual-router approach creates confusion and maintenance overhead. By removing `@remix-run/router`, we eliminate deprecated code paths (like `NavigationProvider.createRouter()`) and reduce the cognitive load for developers choosing routing solutions.
**Framework Consistency**: All Fusion applications should use the same routing solution to ensure consistent behavior, shared patterns, and easier cross-team collaboration. Removing the old dependency enforces this consistency.
## How
This goal will be achieved through a phased approach:
### Phase 1: Migration Monitoring & Outreach (Prerequisite)
- **Monitor telemetry**: Track usage of `NavigationProvider.createRouter()` via telemetry events (`Navigation::createRouter`) to identify applications still using legacy routing
- **Contact app teams**: Reach out to teams identified through telemetry monitoring to:
- Understand their migration timeline and blockers
- Provide migration support and documentation
- Coordinate migration efforts to ensure smooth transition
- **Verify migration status**: Ensure all applications and cookbooks have migrated to `@equinor/fusion-framework-react-router`
- **Confirm DSL adoption**: Verify all route definitions use the new router's DSL (`layout`, `index`, `route`, `prefix`)
### Phase 2: Code Removal
1. **Remove deprecated API**: Delete the `createRouter()` method from `NavigationProvider.ts` (currently marked as `@deprecated`)
2. **Remove type dependencies**: Remove `AgnosticRouteObject` and `Router` type imports from `NavigationProvider.interface.ts`
3. **Remove implementation dependencies**: Remove `createRouter` import and usage from `NavigationProvider.ts`
4. **Update package configuration**: Remove `@remix-run/router` from both `dependencies` and `peerDependencies` in `packages/modules/navigation/package.json`
### Phase 3: Cleanup
1. **Remove from cookbooks**: Remove any remaining `@remix-run/router` references from cookbook examples
2. **Update lockfile**: Run `pnpm install` to clean up `pnpm-lock.yaml`
3. **Remove TODO comments**: Clean up migration-related TODO comments in the codebase
### Phase 4: Verification
- Run full test suite to ensure no regressions
- Verify no TypeScript errors related to missing `@remix-run/router` types
- Confirm build and CI pipelines pass successfully
## Current State
The `@remix-run/router` package is currently used in:
- `@equinor/fusion-framework-module-navigation` - Used for router creation and type definitions
- `NavigationProvider.createRouter()` is marked as `@deprecated` with telemetry tracking
- Some cookbooks/apps may still reference it (to be verified during migration phase)
## Success Criteria
- [ ] Telemetry shows zero usage of `NavigationProvider.createRouter()` across all applications
- [ ] All app teams confirmed migration to `@equinor/fusion-framework-react-router`
- [ ] Zero references to `@remix-run/router` in the codebase
- [ ] `@remix-run/router` removed from all `package.json` files
- [ ] All tests passing
- [ ] No TypeScript compilation errors
- [ ] Documentation updated to reflect router migration completion
## Related
- **Related Implementation**: [#3716](https://github.com/equinor/fusion-framework/issues/3716) - React 19 - React Router Module (delivered the new router solution)
- `@equinor/fusion-framework-react-router` package
- Migration guide: `packages/react/router/README.md`
Contributor guide
Assessment
This issue has not been assessed yet.