-
-
Notifications
You must be signed in to change notification settings - Fork 982
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
Resolve circular dependencies on JS side #2970
Conversation
…ub.com/software-mansion/react-native-gesture-handler into @latekvo/resolve-circular-dependencies
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.
Looks good, let's hear what @j-piasecki has to say 😅
@m-bert I think you mentioned adding a CI workflow dedicated to making sure we don't introduce another cycle by accident, is that happening? |
@j-piasecki Yes, I did mention adding CI workflow 😅 In order for it to make sense we have to get rid of all circular dependencies. At the beginning we didn't care that much about the one connected with Also, we could add it to pre-commit hook, let me know what do you think. @latekvo could you add this workflow? |
@m-bert alright, should I add it to this PR, or do you think it deserves one of it's own? |
I think it would be nice to add it in this PR 😅 |
- name: Check for circular dependencies | ||
run: yarn madge --extensions js,ts,tsx --circular src |
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.
Would it be possible to add script in our package.json
and then use it here? Like yarn circular-dependency-check
. This way it would be easier to run this in our repo (we wouldn't have to remember all those arguments and so on).
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.
ok, will do
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.
don't we want a script for both the JS and the native side in this case?
or is this a bit far fetched for now?
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.
Is madge
capable of doing such things?
Also keep in mind that in order to add this script we would have to have 0 circular dependencies on native side (I don't say we have them, that's something that we have to check).
So in conclusion, it would be great to have such script for native, but not in this PR.
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.
Although madge
likely won't work, for kotlin
there is a tool called Classycle
which could be made into a workflow.
But of course, i don't think doing this in this PR would be a good idea either 😄
I was just asking if it was something you'd like to be done.
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 think it could be done, though first, it would be great to check how many of them are in the codebase to have an idea of the effort it would take.
package.json
Outdated
@@ -15,7 +15,8 @@ | |||
"lint:js": "eslint --ext '.js,.ts,.tsx' src/ example/src FabricExample/src MacOSExample/src && yarn prettier --check './{src,example,FabricExample,MacOSExample}/**/*.{js,jsx,ts,tsx}'", | |||
"lint:js-root": "eslint --ext '.js,.ts,.tsx' src/ && yarn prettier --check './src/**/*.{js,jsx,ts,tsx}'", | |||
"lint:android": "./android/gradlew -p android spotlessCheck -q", | |||
"checkIntegrity": "(cd ./FabricExample/android && ./gradlew generateCodegenArtifactsFromSchema -PskipCodegenCopyTask) && (cd ./android && ./gradlew checkIntegrityBetweenArchitectures)" | |||
"checkIntegrity": "(cd ./FabricExample/android && ./gradlew generateCodegenArtifactsFromSchema -PskipCodegenCopyTask) && (cd ./android && ./gradlew checkIntegrityBetweenArchitectures)", | |||
"checkForCircularDependencies": "yarn madge --extensions js,ts,tsx --circular src" |
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.
"checkForCircularDependencies": "yarn madge --extensions js,ts,tsx --circular src" | |
"circularDependencyCheck": "yarn madge --extensions js,ts,tsx --circular src" |
I think it is enough, we don't have to overcomplicate that name. Also I think using -
as separator is more readable than camelCase, but since we have checkIntegrity
script we can leave that (or we can change both, cc @j-piasecki)
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.
Yep, i agree but preferred to follow the convention instead of having both cases in a single filename next to eachother.
Same for the name, but since you prefer the latter one, I'll change it.
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.
Okay, I get what you mean by "same for the name" 😅 Currently we have only one script that starts with check
so I think it is a bit different compared to -
and camelCase. Starting with check
prefix isn't that bad, but having many scripts starting with the same prefix would make tab
autocomplete a bit frustrating 😅
This is a topic for discussion and I think that following Reanimated
convention would be better, but let's hear @j-piasecki opinion on that.
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 think we can merge it as is, but create a follow-up that will take care of this, given that we already have a ts-check
script (to use dashes instead of camelCase).
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.
alright
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.
…5714) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-native-gesture-handler](https://togithub.com/software-mansion/react-native-gesture-handler) | [`^2.17.1` -> `^2.18.1`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.17.1/2.18.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-gesture-handler/2.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-gesture-handler/2.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-gesture-handler/2.17.1/2.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-gesture-handler/2.17.1/2.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>software-mansion/react-native-gesture-handler (react-native-gesture-handler)</summary> ### [`v2.18.1`](https://togithub.com/software-mansion/react-native-gesture-handler/releases/tag/2.18.1) [Compare Source](https://togithub.com/software-mansion/react-native-gesture-handler/compare/2.18.0...2.18.1) #### 🐛 Bug fixes - Fix build on RN 0.74 by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3024](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3024) #### What's Changed - Bump ws from 6.2.2 to 6.2.3 in /example by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3003](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3003) - Bump requirejs from 2.3.6 to 2.3.7 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3009](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3009) - Bump fast-xml-parser from 4.2.5 to 4.4.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3016](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3016) - Bump ws from 6.2.2 to 6.2.3 in /docs by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3021](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3021) - Add documentation page for `Pressable` component by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2992](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2992) - Add docs page for Reanimated Swipeable by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2962](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2962) **Full Changelog**: software-mansion/react-native-gesture-handler@2.18.0...2.18.1 ### [`v2.18.0`](https://togithub.com/software-mansion/react-native-gesture-handler/releases/tag/2.18.0) [Compare Source](https://togithub.com/software-mansion/react-native-gesture-handler/compare/2.17.1...2.18.0) #### ❗ Important changes - Create a separate component out of the new Swipeable row by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2936](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2936) - Create gesturized pressable component by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2942](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2942), [https://github.com/software-mansion/react-native-gesture-handler/pull/2977](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2977), [https://github.com/software-mansion/react-native-gesture-handler/pull/2982](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2982), [https://github.com/software-mansion/react-native-gesture-handler/pull/2981](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2981) - Support for React Native 0.75 by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2966](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2966) #### 👍 Improvements - \[macOS] Add `ForceTouch` warning by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2954](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2954) - Remove shared value read on the JS thread during detector update by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2957](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2957) - Use a newer constructor for all Gesture Handler events on Android by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2967](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2967) - Persist rotation and pinch gesture through pointer changes on android by [@​coado](https://togithub.com/coado) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2983](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2983) - \[macOS] Add `NativeViewGestureHandler` by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3004](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3004) - Add `enabled` prop support to swipeable by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3011](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3011) #### 🐛 Bug fixes - Make handler comparator work only on non-null objects by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2964](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2964) - fix: bind scope to null to prevent issues with inline requires by [@​EvanBacon](https://togithub.com/EvanBacon) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2972](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2972) - Replace `queueMicrotask` with `requestAnimationFrame` by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2969](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2969) - Resolve circular dependencies on JS side by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2970](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2970) - Fix Android native buttons emitting 2 press events when talkback is enabled by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3002](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3002) - Fix `ScrollView` intercepting touches through out-of-bounds children by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3017](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3017) - Change `onPress` argument in buttons by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3006](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3006) - \[macOS] Fix handlers not responding after opening context menu by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3008](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3008) - \[iOS | macOS] Fix translation calculation in `LongPress` by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3013](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3013) - Fix cancelling manual activation gestures blocking interactivity on iOS by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3007](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3007) #### 🔢 Miscellaneous - Bump ws from 6.2.2 to 6.2.3 in /FabricExample by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2949](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2949) - Bump braces from 3.0.2 to 3.0.3 in /MacOSExample by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2956](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2956) - docs: bump `@swmansion/t-rex-ui` to 0.0.12 by [@​patrycjakalinska](https://togithub.com/patrycjakalinska) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2958](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2958) - Bump braces from 3.0.2 to 3.0.3 in /FabricExample by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2965](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2965) - Set consistent prettier version across all package.jsons by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2971](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2971) - Change naming scheme in package.json from camelCase to dash-case by [@​latekvo](https://togithub.com/latekvo) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2973](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2973) - Unify comments and simplify some conditions. by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2984](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2984) - docs: Update Expo installation instructions by [@​amandeepmittal](https://togithub.com/amandeepmittal) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2991](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2991) - Bump fast-loops from 1.1.3 to 1.1.4 in /docs by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2986](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2986) - Remove plural form in docs by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2995](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2995) - Bump fast-loops from 1.1.3 to 1.1.4 in /example by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2994](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2994) - Don't run old arch integrity check on every PR by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2998](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2998) - docs: fix footer on landing by [@​patrycjakalinska](https://togithub.com/patrycjakalinska) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2997](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2997) - docs: Replace HireUsSection with `@swmansion/t-rex-ui` component by [@​patrycjakalinska](https://togithub.com/patrycjakalinska) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2996](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2996) - Mention `drawerWillShow` in `DrawerLayout` docs by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3000](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3000) - chore: Refactor gradle task to JS scripts by [@​maciekstosio](https://togithub.com/maciekstosio) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3001](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3001) - Update dependencies related to tests by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3005](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3005) - \[macOS] Switch `hasPointerInside` to `containsPointInView` by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/3012](https://togithub.com/software-mansion/react-native-gesture-handler/pull/3012) #### New Contributors - [@​coado](https://togithub.com/coado) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2983](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2983) - [@​amandeepmittal](https://togithub.com/amandeepmittal) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2991](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2991) **Full Changelog**: software-mansion/react-native-gesture-handler@2.17.0...2.18.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/valora-inc/wallet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJucG0iLCJyZW5vdmF0ZSJdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: valora-bot <[email protected]>
This PR removes circular dependencies found via:
yarn madge --extensions js,ts,tsx --circular src