Skip to content

Commit

Permalink
Initial reactotron-apollo-client
Browse files Browse the repository at this point in the history
  • Loading branch information
jyoes committed Sep 8, 2023
1 parent bc85d32 commit b463628
Show file tree
Hide file tree
Showing 13 changed files with 682 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/reactotron-apollo-client/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
]
}
7 changes: 7 additions & 0 deletions lib/reactotron-apollo-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
npm-debug.log
coverage
.nyc_output
dist
yarn-error.log
.idea
9 changes: 9 additions & 0 deletions lib/reactotron-apollo-client/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/.vscode
**/android
**/build
**/compiled
**/dist
**/ios
**/package.json
**/release
CHANGELOG.md
5 changes: 5 additions & 0 deletions lib/reactotron-apollo-client/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"semi": false,
"trailingComma": "es5"
}
14 changes: 14 additions & 0 deletions lib/reactotron-apollo-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

### [0.1.2](https://github.com/infinitered/reactotron/compare/reactotron-@apollo/[email protected]@apollo/[email protected]) (2023-07-06)

### [0.1.1](https://github.com/infinitered/reactotron/compare/reactotron-@apollo/[email protected]@apollo/[email protected]) (2023-06-15)

## 0.1.0 (2023-06-15)


### Features

* **lib:** add `@apollo/client` plugin ([#1291](https://github.com/infinitered/reactotron/issues/1291)) ([a5637fa](https://github.com/infinitered/reactotron/commit/a5637fae2a3eabcea27cc491d13d0174c46be9e9))
21 changes: 21 additions & 0 deletions lib/reactotron-apollo-client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 - 3016 Infinite Red LLC.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
45 changes: 45 additions & 0 deletions lib/reactotron-apollo-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# reactotron-apollo-client

Log updates to your [@apollo/client](https://github.com/mrousavy/@apollo/client) store in the Reactotron timeline.

# Installing

```bash
npm i --save-dev reactotron-apollo-client
# or
yarn add -D reactotron-apollo-client
```

## Usage

Import your mmkv storage instance:

```js
import { MMKV } from "@apollo/client"
export const storage = new MMKV()
```

To use the `mmkvPlugin`, add the additional plugin on the `import` line.

```js
import Reactotron from "reactotron-react-native"
import mmkvPlugin from "reactotron-apollo-client"
import { storage } from "./mmkv/storage/instance/location" // <--- update this location
...
Reactotron.configure()
.use(mmkvPlugin({ storage })) // <--- here we go!
.connect()
```

And you're done! Now you can see your MMKV in Reactotron.

## Advanced Usage

`mmkvPlugin()` accepts an object with an `ignore` key. The value is an array of strings you would like to prevent sending to Reactotron.

```js
mmkvPlugin({
storage,
ignore: ["secret"],
})
```
83 changes: 83 additions & 0 deletions lib/reactotron-apollo-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"name": "reactotron-apollo-client",
"version": "0.0.1",
"description": "A Reactotron plugin for @apollo/client.",
"author": "Infinite Red",
"license": "MIT",
"bugs": {
"url": "https://github.com/infinitered/reactotron/issues"
},
"homepage": "https://github.com/infinitered/reactotron/tree/beta/lib/reactotron-apollo-client",
"repository": "https://github.com/infinitered/reactotron/tree/beta/lib/reactotron-apollo-client",
"files": [
"dist",
"LICENSE"
],
"main": "dist/reactotron-apollo-client.umd.js",
"module": "dist/reactotron-apollo-client.es5.js",
"typings": "dist/types/reactotron-apollo-client.d.ts",
"scripts": {
"test": "jest --passWithNoTests",
"test:watch": "jest --watch --notify",
"format": "prettier '*.{js,ts,tsx,json,md,css,yml}|**/*.{js,ts,tsx,json,md,css,yml}'",
"format:check": "yarn format --check",
"format:write": "yarn format --write",
"prebuild": "yarn clean",
"build": "yarn tsc && yarn compile",
"prebuild:dev": "yarn clean",
"build:dev": "yarn tsc && yarn compile:dev",
"clean": "trash dist",
"lint": "eslint 'src/**/**.{ts,tsx}'",
"compile": "NODE_ENV=production rollup -c rollup.config.ts",
"compile:dev": "NODE_ENV=development rollup -c rollup.config.ts",
"tsc": "tsc",
"typecheck": "tsc",
"ci:test": "yarn test --runInBand"
},
"peerDependencies": {
"@apollo/client": "*",
"reactotron-core-client": "*"
},
"dependencies": {
"ramda": "^0.25.0"
},
"devDependencies": {
"@apollo/client": "^3.8.3",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.21.0",
"@types/jest": "^29.4.0",
"@types/node": "^11.9.5",
"@types/ramda": "^0.25.50",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^29.4.3",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-standard": "^5.0.0",
"graphql": "^16.8.0",
"jest": "^29.4.3",
"prettier": "^2.8.4",
"reactotron-core-client": "workspace:*",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-babel-minify": "^7.0.0",
"rollup-plugin-filesize": "^6.0.1",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-resolve": "^0.0.1-predev.1",
"testdouble": "^3.16.8",
"trash-cli": "^5.0.0",
"ts-jest": "^29.0.5",
"typescript": "4.9.5"
},
"eslintConfig": {
"root": false
}
}
8 changes: 8 additions & 0 deletions lib/reactotron-apollo-client/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "reactotron-apollo-client",
"targets": {
"version": {
"executor": "@jscutlery/semver:version"
}
}
}
39 changes: 39 additions & 0 deletions lib/reactotron-apollo-client/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import resolve from "rollup-plugin-node-resolve"
import babel from "rollup-plugin-babel"
import filesize from "rollup-plugin-filesize"
import minify from "rollup-plugin-babel-minify"

const pkg = require("./package.json")

const LIBRARY_NAME = "reactotron-apollo-client"
const GLOBALS = ["@apollo/client", "graphql"]

export default {
input: "src/reactotron-apollo-client.ts",
output: [
{
file: pkg.main,
name: LIBRARY_NAME,
format: "umd",
sourcemap: true,
globals: GLOBALS,
},
{
file: pkg.module,
format: "es",
sourcemap: true,
globals: GLOBALS,
},
],
plugins: [
resolve({ extensions: [".ts"] }),
babel({ extensions: [".ts"], runtimeHelpers: true }),
process.env.NODE_ENV === "production"
? minify({
comments: false,
})
: null,
filesize(),
],
external: ["@apollo/client", "reactotron-core-client", "graphql"],
}
Loading

0 comments on commit b463628

Please sign in to comment.