Skip to content
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

Apply --reset-cache argument to bundle command #20706

Closed
wants to merge 1 commit into from
Closed

Apply --reset-cache argument to bundle command #20706

wants to merge 1 commit into from

Conversation

rozele
Copy link
Contributor

@rozele rozele commented Aug 17, 2018

The --reset-cache argument was not working correctly with the bundle command. This ensures the --reset-cache arg is passed to metro.

Fixes #20703

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.

Test Plan:

Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!

  1. Modified react-native in a node_modules folder of a test app.
  2. Used --reset-cache arg
  3. Observed that cache was reset.

Release Notes:

Help reviewers and the release process by writing your own release notes. See below for an example.

[CATEGORY] [TYPE] [LOCATION] - Message

[GENERAL][CLI][local-cli/bundle/buildBundle.js] - Apply --reset-cache argument to bundle command

The `--reset-cache` argument was not working correctly with the `bundle` command. This ensures the `--reset-cache` arg is passed to metro.

Fixes #20703
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 17, 2018
@react-native-bot react-native-bot added Core Team Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Aug 17, 2018
facebook-github-bot pushed a commit to facebook/metro that referenced this pull request Aug 17, 2018
Summary:
When the `resetCache` option is set on the bundler, it should also be passed to the `DependencyGraph` and `jest-haste-map` to clean up any cached files there.

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

**Summary**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

While trying to get `react-native-windows` working against the `react-native@0.57` RC, I ran into a series of issues because the `jest-haste-map` cache was not cleaned up when the `--reset-cache` flag was set on the `react-native` CLI. Not only was the option not being passed to `metro` (see facebook/react-native#20706), but `metro` was not passing the `resetCache` option to the `DependencyGraph` and `jest-haste-map`.

**Test plan**

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

1. yarn test
2. Validated in `react-native-windows`, where the problem was occurring. I had a case where if my `hasteImpl` implementation from `metro.config.js` had a bug. Even after fixing the bug, the `jest-haste-map` was cached with missing haste modules. Only after deleting that file could I get back to a state where the fixed `metro.config.js` would work. After making this change, using `--reset-cache` from the `react-native` CLI could clear the haste map cache.
Pull Request resolved: #223

Differential Revision: D9377632

Pulled By: rafeca

fbshipit-source-id: e67b5eeb84937daedc7e9f7b5a7d93e11e0d7edb
@hramos
Copy link
Contributor

hramos commented Aug 18, 2018

Looks like we need to wait for Metro to cut a new release that includes facebook/metro@387d487 before landing this.

@rozele
Copy link
Contributor Author

rozele commented Aug 20, 2018

@hramos - there is nothing blocking this from being merged. This change will still fix an issue where --reset-cache on the bundle command will not be passed to metro. If this is merged now, we'll at least get the transform cache reset behavior. The change in metro is only to pass the --reset-cache flag internally to the jest-haste-map.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Aug 20, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was closed by @rozele in 7062e5b.

Once this commit is added to a release, you will see the corresponding version tag below the description at 7062e5b. If the commit has a single master tag, it is not yet part of a release.

@facebook facebook locked as resolved and limited conversation to collaborators Aug 20, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 20, 2018
kelset pushed a commit that referenced this pull request Aug 22, 2018
Summary:
The `--reset-cache` argument was not working correctly with the `bundle` command. This ensures the `--reset-cache` arg is passed to metro.

Fixes #20703

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull Request resolved: #20706

Differential Revision: D9400548

Pulled By: hramos

fbshipit-source-id: 2c7ed0226cfcdffa8cc77506500c314552baef3f
aleclarson pushed a commit to aleclarson/react-native that referenced this pull request Sep 16, 2018
Summary:
The `--reset-cache` argument was not working correctly with the `bundle` command. This ensures the `--reset-cache` arg is passed to metro.

Fixes facebook#20703

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull Request resolved: facebook#20706

Differential Revision: D9400548

Pulled By: hramos

fbshipit-source-id: 2c7ed0226cfcdffa8cc77506500c314552baef3f
grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
Summary:
The `--reset-cache` argument was not working correctly with the `bundle` command. This ensures the `--reset-cache` arg is passed to metro.

Fixes #20703

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull Request resolved: facebook/react-native#20706

Differential Revision: D9400548

Pulled By: hramos

fbshipit-source-id: 2c7ed0226cfcdffa8cc77506500c314552baef3f
@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
Summary:
The `--reset-cache` argument was not working correctly with the `bundle` command. This ensures the `--reset-cache` arg is passed to metro.

Fixes facebook#20703

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull Request resolved: facebook#20706

Differential Revision: D9400548

Pulled By: hramos

fbshipit-source-id: 2c7ed0226cfcdffa8cc77506500c314552baef3f
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--reset-cache options broken for React Native CLI
4 participants