forked from react-native-community/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/generate source map #6
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2285b38
generated source map through
jessieAnhNguyen 652290d
fixed SHA-1 error
jessieAnhNguyen deffdd2
Merge branch 'master' of https://github.com/MLH-Fellowship/cli into f…
jessieAnhNguyen f560481
implemented the source map steps
jessieAnhNguyen e3fe062
added transformer package and profile-hermes.md
jessieAnhNguyen 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 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 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,61 @@ | ||
# Visualize JavaScript's performance in a React Native app using Hermes | ||
|
||
## How to profile your app using Hermes | ||
|
||
- Instructions on how to enable Hermes: [Using Hermes](https://reactnative.dev/docs/hermes) | ||
- How to profile the app: | ||
- Open Developer Menu with `Cmd+M` or Shake the device. Select `Enable Sampling Profiler` | ||
- Execute JavaScript by using the app's functions (pressing buttons, etc.) | ||
- Open Developer Menu again, select `Disable Sampling Profiler`. A toast shows the location where the sampling profiler is saved - usually in `/data/user/0/com.appName/cache/*.cpuprofile`. | ||
|
||
## How to pull the sampling profiler to your local machine | ||
|
||
### React Native CLI | ||
|
||
Usage: | ||
|
||
### `react-native profile-hermes [destinationDir]` | ||
|
||
Pull and convert a Hermes tracing profile to Chrome tracing profile, then store them in the directory <destinationDir> of the local machine. `destinationDir` is optional, if provided, pull the file to that directory (if not present, pull to the current React Native app root directory) | ||
|
||
Options: | ||
|
||
#### `--fileName [string]` | ||
|
||
File name of the profile to be downloaded, eg. sampling-profiler-trace8593107139682635366.cpuprofile. If not provided, pull the latest file | ||
|
||
#### `--verbose` | ||
|
||
Listing adb commands that are run internally to pull the file from Android device | ||
|
||
#### `--raw` | ||
|
||
Pull the original Hermes tracing profile without any transformation | ||
|
||
#### `--sourcemap-path [string]` | ||
|
||
The local path to where source map file is stored, eg. Users/.../Desktop/sourcemap.json | ||
|
||
#### `--generate-sourcemap` | ||
|
||
Generate the JS bundle and source map | ||
|
||
## Common errors encountered during the process | ||
|
||
#### adb: no devices/emulators found | ||
|
||
Solution: make sure your Android device/ emulator is connected and running. The command only works when it can access adb | ||
|
||
#### There is no file in the cache/ directory | ||
|
||
User may have forgotten to record a profile from the device (instruction on how to enable/ disable profiler is above) | ||
|
||
## Testing plan | ||
|
||
Using `yarn link` as instructed by the CLI's [Testing Plan](https://github.com/MLH-Fellowship/cli/blob/master/CONTRIBUTING.md#testing-your-changes) does not work for us. | ||
|
||
### Reason: | ||
|
||
Get the error `ReferenceError: SHA-1 for file ... is not computed` even if we run `react-native start --watchFolders /path/to/cloned/cli/`. That's because we use the command `react-native bundle` within our code, which creates a new Metro Server that can't find the symlinked folder | ||
|
||
### Solution: |
This file contains 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 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 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 was deleted.
Oops, something went wrong.
This file was deleted.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing the settings.json changes weren't intentional?