Skip to content

Commit

Permalink
Merge pull request #38 from oslabs-beta/austin/readme
Browse files Browse the repository at this point in the history
added readme for npm package
  • Loading branch information
johnwdunn20 authored Dec 15, 2023
2 parents 458030a + 1177639 commit dc3f630
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 84 deletions.
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a name="readme-top"></a>
<a id="readme-top"></a>

<p align="center">
<img src="./extension/public/icon.png" alt="Logo" width="250"/>
Expand Down Expand Up @@ -33,31 +33,36 @@ React Query Rewind introduces a powerful DevTool extension designed to work in c

## Installation

1. Download npm package into your application.
1. Download npm package into your application.

```sh
npm i react-query-rewind
```
```sh
npm i react-query-rewind
```

2. Import the ReactQueryRewind component into the root of your applicaiton.
2. Import the ReactQueryRewind component into the root of your applicaiton.

_picture of importing the component_
_picture of importing the component_

```sh
import ReactQueryRewind from 'react-query-rewind'
```
```javascript
import ReactQueryRewind from 'react-query-rewind';
```

3. Place ReactQueryRewind next to the root of your application inside the QueryClientProvider component.
3. Place ReactQueryRewind next to the root of your application inside the QueryClientProvider component.

<p align="left">
<img src="./assets/component-placement.png" alt="Component Placement" width="600"/>
</p>
```javascript
ReactDOM.createRoot(document.getElementById('root')!).render(
<QueryClientProvider client={queryClient}>
<App />
<ReactQueryRewind />
</QueryClientProvider>
);
```

4. Open the Chrome DevTool Extension and start coding!
4. Open the Chrome DevTool Extension and start coding!

<p align="left">
<img src="./assets/chrome-devtool.png" alt="Component Placement" width="600"/>
</p>
<p align="left">
<img src="./assets/chrome-devtool.png" alt="Component Placement" width="600"/>
</p>

# Features

Expand Down Expand Up @@ -100,8 +105,8 @@ Rui Fan - [GitHub](https://github.com/ruifan-IU) - [LinkedIn](https://www.linked
# Links
[![Medium](https://img.shields.io/badge/Medium-12100E?style=for-the-badge&logo=medium&logoColor=white)](MEDIUMARTICLELINKHERE)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](LINKEDINHERE)
[![Medium](https://img.shields.io/badge/Medium-12100E?style=for-the-badge&logo=medium&logoColor=white)](https://medium.com/@teeringe/react-query-rewind-time-travel-debugging-made-simple-46aaeeafd497)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/react-query-rewind/)
Project Link: [React Query Rewind](https://github.com/oslabs-beta/react-query-rewind-chrome)
Expand Down
61 changes: 61 additions & 0 deletions package/README copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# React Query Rewind
See https://github.com/oslabs-beta/react-query-rewind/blob/main/README.md for a complete overview.

This document details setting up the package and examples for a testing environment.

## Production Installation and Set-Up
Install the pacakage with:
`npm i -D react-query-rewind`

Import the ReactQueryRewind component and place it as close as possible to the root of your app.

Download the chrome extension from ***insert url here*** in order to time travel state in a developer toosl panel within your chrome browser.

## Example

```javascript
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

const queryClient = new QueryClient();

ReactDOM.createRoot(document.getElementById('root')!).render(
<QueryClientProvider client={queryClient}>
<ReactQueryRewind/>
<App />
<ReactQueryDevtools />
</QueryClientProvider>
);
```

## Set-Up Examples
**From the package directory:**
Run with "1" or "2" depending on which example you'd like to set up
1. `npm run install-all`
1. Installs all dependencies for the package and both example apps
2. `npm run link-dependencies-1` or `npm run link-dependencies-2`
1. Installs all peer dependencies in our package to ensure there are no duplicates
2. Can see all packages currently linked with *`npm ls -g --depth=0 --link=tr`*
3. `npm run watch`
1. Starts rollup in watch mode and creates dist folder
4. `npm run link-package-1` *or* `npm run link-package-2`
1. Links React Query Rewind
5. `npm run example-1` *or* `npm run example-2`
1. Starts the example server with webpack. Note: this is a hot reload, but it does not always pick up changes to the npm package

# Publishing
1. `npm login` to login to the npm site. Follow the instructions to publish your npm package
2. `npm publish`

# Development
Contributions are always welcome. Please create a fork from https://github.com/oslabs-beta/react-query-rewind.


### Future Development Needs
- Rollup currently does not build on older macs or on Linux (we have not confirmed the issue on Windows yet)
- Some developers on older macs need to install @rollup/rollup-darwin-x64 to get the build working
- Github actions uses linux and as a result, our test.yml script installs @rollup/rollup-darwin-x64 to ensure the build works properly
- Future development should ensure that builds work correclty regardless of the developer's machine and remove the installation of @rollup/rollup-darwin-x64 from the tests.yml file
167 changes: 106 additions & 61 deletions package/README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,106 @@
# React Query Rewind
See https://github.com/oslabs-beta/react-query-rewind/blob/main/README.md for a complete overview.

This document details setting up the package and examples for a testing environment.

## Production Installation and Set-Up
Install the pacakage with:
`npm i -D react-query-rewind`

Import the ReactQueryRewind component and place it as close as possible to the root of your app.

Download the chrome extension from ***insert url here*** in order to time travel state in a developer toosl panel within your chrome browser.

## Example

```javascript
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

const queryClient = new QueryClient();

ReactDOM.createRoot(document.getElementById('root')!).render(
<QueryClientProvider client={queryClient}>
<ReactQueryRewind/>
<App />
<ReactQueryDevtools />
</QueryClientProvider>
);
```

## Set-Up Examples
**From the package directory:**
Run with "1" or "2" depending on which example you'd like to set up
1. `npm run install-all`
1. Installs all dependencies for the package and both example apps
2. `npm run link-dependencies-1` or `npm run link-dependencies-2`
1. Installs all peer dependencies in our package to ensure there are no duplicates
2. Can see all packages currently linked with *`npm ls -g --depth=0 --link=tr`*
3. `npm run watch`
1. Starts rollup in watch mode and creates dist folder
4. `npm run link-package-1` *or* `npm run link-package-2`
1. Links React Query Rewind
5. `npm run example-1` *or* `npm run example-2`
1. Starts the example server with webpack. Note: this is a hot reload, but it does not always pick up changes to the npm package

# Publishing
1. `npm login` to login to the npm site. Follow the instructions to publish your npm package
2. `npm publish`

# Development
Contributions are always welcome. Please create a fork from https://github.com/oslabs-beta/react-query-rewind.


### Future Development Needs
- Rollup currently does not build on older macs or on Linux (we have not confirmed the issue on Windows yet)
- Some developers on older macs need to install @rollup/rollup-darwin-x64 to get the build working
- Github actions uses linux and as a result, our test.yml script installs @rollup/rollup-darwin-x64 to ensure the build works properly
- Future development should ensure that builds work correclty regardless of the developer's machine and remove the installation of @rollup/rollup-darwin-x64 from the tests.yml file
<a id="readme-top"></a>

<p align="center">
<img src="./assets/icon.png" alt="Logo" width="250"/>
</p>

# Technologies

[![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E)](https://www.javascript.com/)
[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB)](https://reactjs.org/)
[![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white)](https://html.com/html5/)
[![Webpack](https://img.shields.io/badge/webpack-%238DD6F9.svg?style=for-the-badge&logo=webpack&logoColor=black)](https://webpack.js.org/)
[![D3](https://img.shields.io/badge/d3%20js-F9A03C?style=for-the-badge&logo=d3.js&logoColor=white)](https://d3js.org/)
[![ESLint](https://img.shields.io/badge/eslint-3A33D1?style=for-the-badge&logo=eslint&logoColor=white)](https://eslint.org/)
[![Material UI](https://img.shields.io/badge/Material%20UI-007FFF?style=for-the-badge&logo=mui&logoColor=white)](https://mui.com/)
[![Jest](https://img.shields.io/badge/Jest-C21325?style=for-the-badge&logo=jest&logoColor=white)](https://jestjs.io/)
[![Babel](https://img.shields.io/badge/Babel-F9DC3E?style=for-the-badge&logo=babel&logoColor=white)](https://babeljs.io/)

# Overview

React Query Rewind introduces a powerful DevTool extension designed to work in conjunction with React Query's built-in DevTools in order to optimize time-traveling through state changes in an application. This open-source extension is tailored to enhance the debugging experience for React Query users, allowing them to explore state changes and component relationships with ease.

# Getting Started

## Prerequisites

1. React Query installed and in use in your application.

2. Install RQRewind Chrome Extension.

<!-- _link / picture of Extension in Chrome Store_ -->

## Installation

1. Download npm package into your application.

```sh
npm i react-query-rewind
```

2. Import the ReactQueryRewind component into the root of your applicaiton.

_picture of importing the component_

```javascript
import ReactQueryRewind from 'react-query-rewind';
```

3. Place ReactQueryRewind next to the root of your application inside the QueryClientProvider component.

```javascript
ReactDOM.createRoot(document.getElementById('root')!).render(
<QueryClientProvider client={queryClient}>
<App />
<ReactQueryRewind />
</QueryClientProvider>
);
```

4. Open the Chrome DevTool Extension and start coding!

<p align="left">
<img src="./assets/chrome-devtool.png" alt="Component Placement" width="600"/>
</p>

# Features

- <b>Query States: </b>Upon opening RQRewind in Chrome Dev Tools, you will see the Queries tab open with a drop down menu listing the query keys of all the incoming queries. Select the queries that you want to monitor, make changes on the web app, and the changes of query states will be logged as reflected by the growing number above the play bar. Use the play bar to navigate to a particular state snapshot that you would like to inspect.

<p align="center"><img src="./assets/query-states.gif" width='800' style="margin-top: 1em; margin-bottom: 1em;"></p>

- <b>State Diff: </b>Toggle on the Diff button to see state changes between each snapshot highlighted. Turn on the switch on top of the page to show only parts of the state that are changed.

<p align="center"><img src="./assets/state-diff.gif" width='800' style="margin-top: 1em; margin-bottom: 1em;"></p>

- <b>Live UI Change: </b>As you review the state change history, there is also the option to turn on the time travel mode by clicking on the clock icon button. Under time travel mode, when visiting a logged state snapshot on RQRewindl, the UI of the app will change accordingly. Turn off time travel mode for RQRewind to continue logging future state changes.

<p align="center"><img src="./assets/UI-change.gif" width='800' style="margin-top: 1em; margin-bottom: 1em;"></p>

- <b>Component Tree: </b> Click on the Component Tree tab and turn on the Start Profiling switch. Click on any component on the app, and view the component tree that is rendered on the dev tools panel.

<p align="center"><img src="./assets/component-tree.gif" width='800' style="margin-top: 1em; margin-bottom: 1em;"></p>

# Contact Information

Austin Cavanagh - [GitHub](https://github.com/austin-cavanagh) - [LinkedIn](https://www.linkedin.com/in/austincavanagh/) - austin.cavanagh.cs@gmail.com

Emma Teering - [GitHub](https://github.com/eteering) - [LinkedIn](https://www.linkedin.com/in/emma-teering/) - teeringe@gmail.com

John Dunn - [GitHub](https://github.com/johnwdunn20) - [LinkedIn](https://www.linkedin.com/in/johnwdunn/) - johnwdunn20@gmail.com

Rui Fan - [GitHub](https://github.com/ruifan-IU) - [LinkedIn](https://www.linkedin.com/in/rui-fan-868231299/) - rfan1986@gmail.com

# Links

[![Medium](https://img.shields.io/badge/Medium-12100E?style=for-the-badge&logo=medium&logoColor=white)](https://medium.com/@teeringe/react-query-rewind-time-travel-debugging-made-simple-46aaeeafd497)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/react-query-rewind/)

Project Link: [React Query Rewind](https://github.com/oslabs-beta/react-query-rewind-chrome)

# License

_MIT Link_

<p align="right">(<a href="#readme-top">back to top</a>)</p>
Binary file added package/assets/UI-change.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added package/assets/chrome-devtool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added package/assets/component-tree.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added package/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added package/assets/query-states.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added package/assets/state-diff.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions package/examples/example-2/client/src/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ const queryClient = new QueryClient({
});

ReactDOM.createRoot(document.getElementById('root')!).render(
// <React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
{/* <ReactQueryDevtools /> */}
<ReactQueryRewind />
</QueryClientProvider>
// </React.StrictMode>
);

0 comments on commit dc3f630

Please sign in to comment.