Repository navigation
chore(testers): add Rozenite DevTools plugins to tester apps #1509
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
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| import { AppRegistry } from 'react-native'; | ||
| import { name as appName } from './app.json'; | ||
| import App from './src/App'; | ||
| import { startDevTools } from './src/rozenite'; | ||
|
|
||
| // ScriptManager setup | ||
| import './src/setup'; | ||
|
|
||
| startDevTools(); | ||
|
|
||
| AppRegistry.registerComponent(appName, () => App); |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| declare module '*.png'; | ||
| declare module '*.svg'; | ||
|
|
||
| declare const __WITH_ROZENITE__: boolean; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Rozenite DevTools plugins are opt-in. `__WITH_ROZENITE__` is only true when | ||
| // the dev server runs with WITH_ROZENITE=true; otherwise the bundler drops the | ||
| // require below and the app (including E2E runs) contains no DevTools code. | ||
| const plugins: typeof import('./rozenitePlugins') | undefined = | ||
| __WITH_ROZENITE__ ? require('./rozenitePlugins') : undefined; | ||
|
|
||
| export const startDevTools = plugins?.startDevTools ?? (() => {}); | ||
| export const useDevTools = plugins?.useDevTools ?? (() => {}); | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { | ||
| useNetworkActivityDevTools, | ||
| withOnBootNetworkActivityRecording, | ||
| } from '@rozenite/network-activity-plugin'; | ||
|
|
||
| export function startDevTools() { | ||
| withOnBootNetworkActivityRecording(); | ||
| } | ||
|
|
||
| export function useDevTools() { | ||
| useNetworkActivityDevTools(); | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| import { Stack } from 'expo-router'; | ||
| import { useDevTools } from '../components/rozenite'; | ||
|
|
||
| export default function RootLayout() { | ||
| useDevTools(); | ||
|
|
||
| return <Stack />; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // Rozenite DevTools plugins are opt-in. `__WITH_ROZENITE__` is only true when | ||
| // the dev server runs with WITH_ROZENITE=true; otherwise the bundler drops the | ||
| // require below and the app contains no DevTools code. | ||
| const plugins: typeof import('./rozenitePlugins') | undefined = | ||
| __WITH_ROZENITE__ ? require('./rozenitePlugins') : undefined; | ||
|
Check warning on line 5 in apps/tester-expo/components/rozenite.ts
|
||
|
dannyhw marked this conversation as resolved.
Resolved
|
||
|
|
||
| export const useDevTools = plugins?.useDevTools ?? (() => {}); | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { useNetworkActivityDevTools } from '@rozenite/network-activity-plugin'; | ||
|
|
||
| export function useDevTools() { | ||
| useNetworkActivityDevTools(); | ||
| } |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| declare const __WITH_ROZENITE__: boolean; |
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Rozenite DevTools plugins are opt-in. `__WITH_ROZENITE__` is only true when | ||
| // the dev server runs with WITH_ROZENITE=true; otherwise the bundler drops the | ||
| // require below and the app (including E2E runs) contains no DevTools code. | ||
| const plugins: typeof import('./rozenitePlugins') | undefined = | ||
| __WITH_ROZENITE__ ? require('./rozenitePlugins') : undefined; | ||
|
|
||
| export const startDevTools = plugins?.startDevTools ?? (() => {}); | ||
| export const useDevTools = plugins?.useDevTools ?? (() => {}); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import AsyncStorage from '@react-native-async-storage/async-storage'; | ||
| import type { NavigationContainerRefWithCurrent } from '@react-navigation/native'; | ||
| import { | ||
| useNetworkActivityDevTools, | ||
| withOnBootNetworkActivityRecording, | ||
| } from '@rozenite/network-activity-plugin'; | ||
| import { useReactNavigationDevTools } from '@rozenite/react-navigation-plugin'; | ||
| import { | ||
| createAsyncStorageAdapter, | ||
| useRozeniteStoragePlugin, | ||
| } from '@rozenite/storage-plugin'; | ||
|
|
||
| // ScriptManager caches remote scripts in AsyncStorage only when the host runs | ||
| // with WITH_PRELOAD=true (see index.js); otherwise this store stays empty. | ||
| const storages = [ | ||
| createAsyncStorageAdapter({ storages: { ScriptManager: AsyncStorage } }), | ||
| ]; | ||
|
|
||
| export function startDevTools() { | ||
| withOnBootNetworkActivityRecording(); | ||
| } | ||
|
|
||
| export function useDevTools( | ||
| navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList> | ||
| ) { | ||
| useNetworkActivityDevTools(); | ||
| useReactNavigationDevTools({ ref: navigationRef }); | ||
| useRozeniteStoragePlugin({ storages }); | ||
| } |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| declare const __WITH_ROZENITE__: boolean; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.