deprecate support for react-router beta

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-11-23 16:43:19 +01:00
parent 9a0bb13e29
commit 3e358b0dff
3 changed files with 31 additions and 1 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/core-app-api': patch
'@backstage/cli': patch
---
Added deprecation warning for React Router v6 beta, please make sure you have migrated your apps to use React Router v6 stable as support for the beta version will be removed. See the [migration tutorial](https://backstage.io/docs/tutorials/react-router-stable-migration) for more information.
+14
View File
@@ -72,6 +72,20 @@ export async function serveBundle(options: ServeOptions) {
),
);
}
if (
targetPkg.dependencies?.['react-router']?.includes('beta') ||
targetPkg.dependencies?.['react-router-dom']?.includes('beta')
) {
// eslint-disable-next-line no-console
console.warn(
chalk.yellow(`
DEPRECATION WARNING: React Router Beta is deprecated and support for it will be removed in a future release.
Please migrate to use React Router v6 stable.
See https://backstage.io/docs/tutorials/react-router-stable-migration
`),
);
}
}
checkReactVersion();
+11 -1
View File
@@ -240,11 +240,21 @@ export class AppManager implements BackstageApp {
);
const { routing, featureFlags, routeBindings } = useMemo(() => {
const usesReactRouterBeta = isReactRouterBeta();
if (usesReactRouterBeta) {
// eslint-disable-next-line no-console
console.warn(`
DEPRECATION WARNING: React Router Beta is deprecated and support for it will be removed in a future release.
Please migrate to use React Router v6 stable.
See https://backstage.io/docs/tutorials/react-router-stable-migration
`);
}
const result = traverseElementTree({
root: children,
discoverers: [childDiscoverer, routeElementDiscoverer],
collectors: {
routing: isReactRouterBeta()
routing: usesReactRouterBeta
? routingV1Collector
: routingV2Collector,
collectedPlugins: pluginCollector,