ds300 / ds300/patch-package

What to do when there's "src" and "lib" directory

Open
#304 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

There are modules that deliver their libraries already built, but still includes the `src`. Patching the `lib` is not going to be easy as it's most likely already transpiled and also patch-package doesn't seem to be able to recognize changes in there...

I'm currently stuck on this problem, I use react-native-paper, it ships with both "lib" and "src":

![image](https://user-images.githubusercontent.com/21032419/113503072-27ae4c80-9562-11eb-87d2-6c4e3723041c.png)

my patches where applied to `src`

```diff
diff --git a/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx b/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx
index 3b71389..a874e2b 100644
--- a/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx
+++ b/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx
@@ -58,6 +58,8 @@ const AvatarImage = ({
source,
style,
theme,
+ onError,
+ onLoad,
...rest
}: Props) => {
const { colors } = theme;
@@ -82,6 +84,8 @@ const AvatarImage = ({

)}

diff --git a/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx b/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx
index 503cfab..cd3933d 100644
--- a/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx
+++ b/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx
@@ -5,6 +5,7 @@ import Text from '../Typography/Text';
import Icon, { IconSource } from '../Icon';
import TouchableRipple from '../TouchableRipple/TouchableRipple';
import { withTheme } from '../../core/theming';
+import Badge from '../Badge';

type Props = React.ComponentPropsWithRef & {
/**
@@ -67,6 +68,7 @@ const DrawerItem = ({
style,
onPress,
accessibilityLabel,
+ badge,
...rest
}: Props) => {
const { colors, roundness } = theme;
@@ -100,22 +102,25 @@ const DrawerItem = ({
accessibilityState={{ selected: active }}
accessibilityLabel={accessibilityLabel}
>
-
- {icon ? : null}
-
- {label}
-
+
+
+ {icon ? : null}
+
+ I am patch-package
+
+
+ {!isNaN(badge) ? {badge} : null}



@@ -131,12 +136,17 @@ const styles = StyleSheet.create({
},
wrapper: {
flexDirection: 'row',
- alignItems: 'center',
- padding: 8,
+ alignItems: 'center'
},
label: {
marginRight: 32,
},
+ badgeContainer: {
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ padding: 8,
+ },
});

export default withTheme(DrawerItem);
```

When I build my app for production, the patches don't seem to get applied, as you can see above, there's **I am patch package**, just for me to verify if my patch is getting applied, but I don't see it on the build app. This is currently preventing me from deploying my app as it's a critical bug for me.

**IT WORKS IN DEVELOPMENT MODE BUT NOT IN PRODUCTION** is what I'm trying to say in this case.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.