@@ -20,7 +20,8 @@ runMain(async () => {
2020 command `yarn lerna run pack` . run ( )
2121
2222 buildApp ( 'test/apps/vanilla' )
23- buildApp ( 'test/apps/react' )
23+ buildApp ( 'test/apps/react-router-v6-app' )
24+ await buildReactRouterv7App ( )
2425 await buildExtensions ( )
2526
2627 printLog ( 'Test apps and extensions built successfully.' )
@@ -32,6 +33,34 @@ function buildApp(appPath: string) {
3233 command `yarn build` . withCurrentWorkingDirectory ( appPath ) . run ( )
3334}
3435
36+ async function buildReactRouterv7App ( ) {
37+ const baseAppPath = 'test/apps/react-router-v6-app'
38+ const appPath = 'test/apps/react-router-v7-app'
39+
40+ fs . rmSync ( appPath , { recursive : true , force : true } )
41+ fs . cpSync ( baseAppPath , appPath , { recursive : true } )
42+
43+ await modifyFile ( path . join ( appPath , 'package.json' ) , ( content : string ) =>
44+ content
45+ . replace ( / " n a m e " : " r e a c t - r o u t e r - v 6 - a p p " / , '"name": "react-router-v7-app"' )
46+ . replace ( / " r e a c t - r o u t e r - d o m " : " [ ^ " ] * " / , '"react-router": "7.0.2"' )
47+ )
48+
49+ await modifyFile ( path . join ( appPath , 'app.tsx' ) , ( content : string ) =>
50+ content
51+ . replace ( '@datadog/browser-rum-react/react-router-v6' , '@datadog/browser-rum-react/react-router-v7' )
52+ . replace ( "from 'react-router-dom'" , "from 'react-router'" )
53+ )
54+
55+ await modifyFile ( path . join ( appPath , 'webpack.config.js' ) , ( content : string ) =>
56+ content
57+ . replace ( 'react-router-v6-app.js' , 'react-router-v7-app.js' )
58+ . replace ( 'react-router-v6-app.js' , 'react-router-v7-app.js' )
59+ )
60+
61+ buildApp ( appPath )
62+ }
63+
3564async function buildExtensions ( ) : Promise < void > {
3665 const baseExtDir = 'test/apps/base-extension'
3766
0 commit comments