Skip to content

Commit 053ed0d

Browse files
committed
Rollup setup and images fix
1 parent cb5c96a commit 053ed0d

10 files changed

Lines changed: 67 additions & 54 deletions

File tree

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dev-electron": "cd ./packages/react-native-query-devtool-app && electron-forge start",
1212
"build-server": "cd ./packages/react-native-query-devtool-app && electron-forge make",
1313
"publish-server": "cd ./packages/react-native-query-devtool-app && electron-forge publish",
14-
"build-client": "cd ./packages/react-native-query-devtool && tsup",
14+
"build-client": "cd ./packages/react-native-query-devtool && rm -rf dist && rollup -c",
1515
"publish-client": "cd ./packages/react-native-query-devtool && yarn publish --access public",
1616
"v3-example-ios": "cd ./example/react-query-v3 && expo start --ios",
1717
"v3-example-android": "cd ./example/react-query-v3 && expo start --android",
@@ -50,7 +50,6 @@
5050
"prettier": "^3.1.1",
5151
"react-native": "^0.72.9",
5252
"ts-node": "^10.9.2",
53-
"tsup": "^8.0.1",
5453
"typescript": "^5.3.3"
5554
}
5655
}

packages/react-native-query-devtool/package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"types": "./dist/index.d.ts",
1212
"files": [
1313
"src",
14-
"dist"
14+
"dist",
15+
"assets"
1516
],
1617
"license": "MIT",
1718
"keywords": [
@@ -28,6 +29,10 @@
2829
"react-native-json-tree":"^1.3.0"
2930
},
3031
"devDependencies": {
32+
"@rollup/plugin-image": "^3.0.3",
33+
"@rollup/plugin-typescript": "^11.1.6",
34+
"@rollup/plugin-commonjs": "^25.0.7",
35+
"@rollup/plugin-node-resolve": "^15.2.3",
3136
"@types/node": "^20.11.8",
3237
"@types/react": "^18.2.48",
3338
"@types/react-native": "^0.72.8",
@@ -36,8 +41,11 @@
3641
"babel-runtime": "^6.26.0",
3742
"react-native": "^0.72.9",
3843
"ts-node": "^10.9.2",
39-
"tsup": "^8.0.1",
40-
"typescript": "^5.3.3"
44+
"typescript": "^5.3.3",
45+
"react-native-svg": "15.1.0",
46+
"rollup": "^4.13.0",
47+
"rollup-plugin-dts": "^6.1.0",
48+
"rollup-plugin-peer-deps-external": "^2.2.4"
4149
},
4250
"peerDependencies": {
4351
"react": "*",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import resolve from '@rollup/plugin-node-resolve';
2+
import commonjs from '@rollup/plugin-commonjs';
3+
import typescript from '@rollup/plugin-typescript';
4+
import image from '@rollup/plugin-image';
5+
import dts from 'rollup-plugin-dts';
6+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
7+
8+
export default [
9+
{
10+
input: 'src/index.tsx',
11+
output: {
12+
file: 'dist/index.js',
13+
format: 'cjs',
14+
sourcemap: true,
15+
},
16+
17+
plugins: [
18+
peerDepsExternal(),
19+
resolve(),
20+
commonjs(),
21+
typescript({
22+
tsconfig: './tsconfig.json',
23+
}),
24+
image(),
25+
],
26+
},
27+
{
28+
input: 'src/index.tsx',
29+
output: [{ file: 'dist/index.d.ts', format: 'es' }],
30+
plugins: [dts()],
31+
external: ['react', 'react-native'],
32+
},
33+
];

packages/react-native-query-devtool/src/components/CopyButton/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
22

33
import { Image, Pressable, StyleSheet } from 'react-native';
4-
import Icons from '../../utils/images';
4+
5+
import copyIcon from '../../../assets/copy.png';
56

67
interface Props {
78
onPress?: () => void;
@@ -10,12 +11,7 @@ interface Props {
1011
const CopyButton: React.FC<Props> = ({ onPress }) => {
1112
return (
1213
<Pressable onPress={onPress}>
13-
<Image
14-
source={{
15-
uri: Icons.CopyIcon,
16-
}}
17-
style={styles.container}
18-
/>
14+
<Image source={copyIcon} style={styles.container} />
1915
</Pressable>
2016
);
2117
};

packages/react-native-query-devtool/src/components/FloatingButton/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import React from 'react';
33
import { Image, TouchableOpacity } from 'react-native';
44

55
import { styles } from './styles';
6-
import Icons from '../../utils/images';
6+
7+
import rqLogo from '../../../assets/rqlogo.png';
78

89
interface Props {
910
onPress: () => void;
@@ -16,12 +17,7 @@ const FloatingButton: React.FC<Props> = ({ onPress }) => {
1617
onPress={onPress}
1718
style={styles.container}
1819
>
19-
<Image
20-
style={styles.image}
21-
source={{
22-
uri: Icons.RQLogo,
23-
}}
24-
/>
20+
<Image style={styles.image} source={rqLogo} />
2521
</TouchableOpacity>
2622
);
2723
};

packages/react-native-query-devtool/src/components/SearchButton/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
22

33
import { Image, Pressable, StyleSheet } from 'react-native';
4-
import Icons from '../../utils/images';
4+
5+
import searchIcon from '../../../assets/search.png';
56

67
interface Props {
78
onPress?: () => void;
@@ -10,12 +11,7 @@ interface Props {
1011
const SearchButton: React.FC<Props> = ({ onPress }) => {
1112
return (
1213
<Pressable onPress={onPress}>
13-
<Image
14-
source={{
15-
uri: Icons.SearchIcon,
16-
}}
17-
style={styles.container}
18-
/>
14+
<Image source={searchIcon} style={styles.container} />
1915
</Pressable>
2016
);
2117
};

packages/react-native-query-devtool/src/components/Searchbar/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Image, TextInput, TouchableOpacity, View } from 'react-native';
44

55
import { styles } from './style';
66
import SearchbarProps from './types';
7-
import Icons from '../../utils/images';
7+
8+
import clearIcon from '../../../assets/clear.png';
89

910
const Searchbar: React.ForwardRefRenderFunction<TextInput, SearchbarProps> = (
1011
{ filter, placeholder = 'Filter', setFilter },
@@ -28,11 +29,7 @@ const Searchbar: React.ForwardRefRenderFunction<TextInput, SearchbarProps> = (
2829
activeOpacity={0.8}
2930
onPress={() => setFilter('')}
3031
>
31-
<Image
32-
source={{
33-
uri: Icons.SearchIcon,
34-
}}
35-
/>
32+
<Image source={clearIcon} />
3633
</TouchableOpacity>
3734
)}
3835
</View>

packages/react-native-query-devtool/src/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { StyleSheet } from 'react-native';
44

55
import ActionSheet, { ActionSheetRef } from 'react-native-actions-sheet';
66

7-
import Devtool from './components/Devtool';
8-
import FloatingButton from './components/FloatingButton';
9-
import RemoteDebugger from './components/RemoteDevtool';
10-
import { QueryDevtoolProps } from './types';
7+
import Devtool from '../src/components/Devtool';
8+
import FloatingButton from '../src/components/FloatingButton';
9+
import RemoteDebugger from '../src/components/RemoteDevtool';
10+
import { QueryDevtoolProps } from '../src/types';
1111

1212
const QueryNativeDevtool: React.FC<QueryDevtoolProps> = ({
1313
queryClient,

packages/react-native-query-devtool/src/utils/images.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

tsconfig.json renamed to packages/react-native-query-devtool/tsconfig.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"compilerOptions": {
3-
"target": "ES6",
3+
"target": "ESNext",
4+
"module": "CommonJS",
45
"allowJs": true,
5-
"module": "commonjs",
66
"skipLibCheck": true,
77
"esModuleInterop": true,
88
"noImplicitAny": true,
99
"sourceMap": true,
10-
"baseUrl": ".",
11-
"outDir": "packages/react-native-query-devtool/dist",
10+
"baseUrl": "./src",
11+
"outDir": "./dist",
1212
"moduleResolution": "node",
1313
"resolveJsonModule": true,
1414
"jsx": "react-jsx"
1515
},
16-
"include": ["packages/react-native-query-devtool/src/**/*"]
16+
"include": ["./src/**/*", "./assets/**/*"],
17+
"exclude": ["node_modules"]
1718
}

0 commit comments

Comments
 (0)