forked from fireproof-storage/fireproof
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
15,920 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"ignorePatterns": ["node_modules", "coverage", "dist"], | ||
"plugins": ["simple-import-sort"], | ||
"parser": "@typescript-eslint/parser", | ||
"env": { "browser": true, "node": true, "es6": true }, | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"settings": { | ||
"react": { | ||
"pragma": "React", | ||
"version": "detect" | ||
} | ||
}, | ||
"rules": { | ||
"simple-import-sort/imports": "error", | ||
"simple-import-sort/exports": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
coverage | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# @fireproof/react-native | ||
|
||
React Native bindings for Fireproof | ||
|
||
## Installation | ||
|
||
* Add `@fireproof/react-native` dependency. We also need to add any native module dependencies so they autolink properly. | ||
|
||
pnpm add @fireproof/react-native react-native-quick-crypto react-native-mmkv react-native-fast-encoder | ||
pnpm pods | ||
|
||
* Install polyfills as early as possible in your application (`index.js` or `App.tsx`) | ||
|
||
import '@fireproof/react-native/polyfills'; | ||
|
||
## Development | ||
|
||
To develop your application, run | ||
|
||
pnpm start | ||
|
||
in its root directory. Then select `i` or `a` to run iOS or Android simulators respectively. You might need to build with XCode or Android Studio at first, to properly compile the native modules. | ||
|
||
See the `examples/react-native` app for a working code sample. | ||
|
||
## Caveats | ||
|
||
Until `react-native-quick-crypto` gets support for `subtle.encrypt()` and `subtle.decrypt()` for `aes`, you need to use `{public: true}` database option: | ||
|
||
```js | ||
const { database, useDocument } = useFireproof('TodoDB', { public: true }); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"name": "@fireproof/react-native", | ||
"version": "0.18.0", | ||
"description": "Fireproof live database, JavaScript API and React Native hooks", | ||
"type": "module", | ||
"module": "src/index.js", | ||
"main": "src/index.js", | ||
"react-native": "src/index.js", | ||
"types": "dist/index.d.ts", | ||
"homepage": "https://use-fireproof.com", | ||
"keywords": [ | ||
"react-native", | ||
"database", | ||
"json", | ||
"live", | ||
"sync" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/fireproof-storage/fireproof.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/fireproof-storage/fireproof/issues" | ||
}, | ||
"files": [ | ||
"src" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./src/index.tsx", | ||
"types": "./src/index.tsx", | ||
"default": "./src/index.tsx" | ||
}, | ||
"./polyfills": "./src/polyfills.tsx" | ||
}, | ||
"scripts": { | ||
"prepublishOnly": "cp ../../README.md . && npm run build", | ||
"postpublish": "rm README.md", | ||
"build": "tsup", | ||
"build:clean": "rm -rf dist", | ||
"build:watch": "tsup --watch", | ||
"clean": "rm -rf node_modules", | ||
"format:check": "prettier . --check", | ||
"format:fix": "prettier . --write", | ||
"lint:check": "eslint . --ext .ts,.tsx", | ||
"lint:fix": "eslint . --ext .ts,.tsx --fix", | ||
"start": "tsup -w" | ||
}, | ||
"author": "J Chris Anderson", | ||
"license": "Apache-2.0 OR MIT", | ||
"gptdoc": "Fireproof/React Native/Usage: import { useLiveQuery, useDocument } from 'use-fireproof'; function App() { const result = useLiveQuery(doc => doc.word, { limit: 10 }); const [{ count }, setDoc, saveDoc] = useDocument({_id: 'count', count: 0}); return (<><p>{count} changes</p><input type='text' onChange={() => saveDoc({count: count + 1})} onSubmit={e => useLiveQuery.database.put({word: e.target.value})} /><ul>{result.map(row => (<li key={row.id}>{row.key}</li>))}</ul></>)}", | ||
"dependencies": { | ||
"@craftzdog/react-native-buffer": "^6.0.5", | ||
"@fireproof/core": "file:../../dist/fireproof-core/fireproof-core-0.0.0-dev.tgz", | ||
"@ipld/dag-json": "^10.1.2", | ||
"event-target-shim": "^6.0.2", | ||
"react-native-fast-encoder": "^0.1.12", | ||
"react-native-mmkv": "<3", | ||
"react-native-quick-crypto": "^0.7.1", | ||
"readable-stream": "^4.5.2", | ||
"use-fireproof": "file:../../dist/use-fireproof/use-fireproof-0.0.0-dev.tgz" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=18.0.0", | ||
"react-native": "*" | ||
}, | ||
"devDependencies": { | ||
"@babel/runtime": "^7.20.0", | ||
"@testing-library/react": "^14.1.2", | ||
"@types/react": "^18.2.48", | ||
"@types/readable-stream": "^4.0.11", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-simple-import-sort": "^12.1.0", | ||
"prettier": "^3.2.5", | ||
"randombytes": "^2.1.0", | ||
"typescript": "^5.4.5" | ||
} | ||
} |
Oops, something went wrong.