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

fix: init when there's a package.json in folder #1980

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

thymikee
Copy link
Member

Summary:

When init in a folder that contains any kind of package.json the failed with:

error Failed to load configuration of your project.

This is due to reactNativeVersion introduced in #1870 accessing the initialConfig.reactNativePath getter, which throws in situations where there's no package.json file available in the directory. Reading this in finalConfig is fine, because when there's no package.json, it skips the logic inside the .reduce, which accesses initialConfig.reactNativePath variable.

Tbh, this is rather convoluted logic and because of that during code review we failed identifying it as a potential problem. Let's treat this as a band-aid for now and as a followup think about refactoring this piece.

Test Plan:

I haven't really tested the versioned link generation, so please make sure to verify it

Copy link
Collaborator

@TMisiukiewicz TMisiukiewicz left a comment

Choose a reason for hiding this comment

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

👍

@szymonrybczak
Copy link
Collaborator

FYI I checked if links generation works correctly. It works same as before. ✅
CleanShot 2023-06-22 at 11 05 00@2x

Copy link
Member

@kelset kelset left a comment

Choose a reason for hiding this comment

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

can confirm that the fix work, managed to test locally to generate the diff patch for upgrade-helper and by locally using this fix everything worked 👍

react-native-community/rn-diff-purge@6ba5199

let's merge this one, cp into 11.x and create a new CLI release :) no rush though, atm we're aiming at doing 0.72.1 early next week

@thymikee thymikee merged commit 170171a into main Jun 22, 2023
7 checks passed
@thymikee thymikee deleted the fix/fail-when-packagejson branch June 22, 2023 12:18
thymikee added a commit that referenced this pull request Jun 22, 2023
* fix: init when there's a package.json in folder

* test: update snapshots

---------

Co-authored-by: szymonrybczak <szymon.rybczak@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants