Skip to content

Commit 6b01678

Browse files
committed
first commit
0 parents  commit 6b01678

File tree

12 files changed

+10886
-0
lines changed

12 files changed

+10886
-0
lines changed

.eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
build/
3+
package-lock.json
4+
yarn.json
5+
.vscode/
6+
packages/**/node_modules/

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.log
2+
.DS_Store
3+
.vscode
4+
build
5+
logs
6+
node_modules
7+
npm-debug.log*
8+
packages/**/npm-debug.log*
9+
yarn-debug.log*
10+
packages/**/yarn-debug.log*
11+
yarn-error.log*
12+
packages/**/yarn-error.log*
13+
package-lock.json
14+
packages/**/node_modules/
15+
packages/**/package-lock.json

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4
4+
}

lerna.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"packages": ["packages/*"],
3+
"version": "0.0.1"
4+
}

package.json

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"name": "async-storage-flipper",
3+
"version": "0.0.5",
4+
"description": "React Native's Async Storage debugger for Flipper",
5+
"main": "index.js",
6+
"scripts": {
7+
"test:code": "eslint --max-warnings=0 --ignore-path .gitignore --ext .js,.ts,.tsx .",
8+
"fix": "npm run fix:other && npm run fix:code",
9+
"fix:code": "npm run test:code -- --fix",
10+
"fix:other": "npm run prettier -- --write",
11+
"prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore"
12+
},
13+
"keywords": [
14+
"flipper",
15+
"react-native",
16+
"async-storage"
17+
],
18+
"author": "Faustino Kialungila <[email protected]>",
19+
"license": "MIT",
20+
"devDependencies": {
21+
"eslint": "^6.8.0",
22+
"eslint-config-prettier": "^6.10.1",
23+
"eslint-plugin-import": "^2.20.2",
24+
"eslint-plugin-jsx-a11y": "^6.2.3",
25+
"eslint-plugin-prettier": "^3.1.3",
26+
"eslint-plugin-react": "^7.19.0",
27+
"lerna": "^3.20.2",
28+
"prettier": "^2.0.4"
29+
},
30+
"eslintConfig": {
31+
"extends": [
32+
"prettier",
33+
"prettier/@typescript-eslint",
34+
"prettier/react"
35+
],
36+
"plugins": [
37+
"prettier"
38+
],
39+
"rules": {
40+
"curly": "warn",
41+
"no-console": [
42+
"warn",
43+
{
44+
"allow": [
45+
"warn",
46+
"error",
47+
"info"
48+
]
49+
}
50+
],
51+
"no-else-return": "warn",
52+
"no-useless-return": "warn",
53+
"prefer-const": [
54+
"warn",
55+
{
56+
"destructuring": "all"
57+
}
58+
],
59+
"prefer-template": "warn",
60+
"prettier/prettier": "warn",
61+
"no-restricted-syntax": [
62+
"warn",
63+
{
64+
"selector": "JSXText[value=/\\w/]",
65+
"message": "Use 't(...)' instead of literal text in JSX"
66+
}
67+
]
68+
}
69+
}
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { addPlugin } from 'react-native-flipper';
2+
3+
function bootstrapPlugin() {
4+
return new Promise((resolve) => {
5+
addPlugin({
6+
getId: () => 'async-storage-flipper',
7+
onConnect: (connection) => {
8+
return resolve(connection);
9+
},
10+
onDisconnect: () => {},
11+
runInBackground: () => true,
12+
});
13+
});
14+
}
15+
16+
function flipping(storage) {
17+
bootstrapPlugin()
18+
.then((currentConnection) => {
19+
if (currentConnection) {
20+
storage.getAllKeys().then((keys) => {
21+
storage.multiGet(keys).then((data) => {
22+
data.map((_, i, store) => {
23+
let key = store[i][0];
24+
let value = store[i][1];
25+
if (
26+
(value.startsWith('{') &&
27+
value.endsWith('}')) ||
28+
(value.startsWith('[') && value.endsWith(']'))
29+
) {
30+
value = JSON.parse(value);
31+
}
32+
currentConnection.send('newElement', {
33+
key,
34+
value,
35+
id: key + i,
36+
});
37+
});
38+
});
39+
});
40+
}
41+
})
42+
.catch((err) => console.error(err));
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "async-storage-flipper-plugin",
3+
"version": "0.0.5",
4+
"description": "React Native's Async Storage debugger plugin for Flipper",
5+
"main": "index.js",
6+
"keywords": [
7+
"flipper",
8+
"flipper-plugin",
9+
"react-native",
10+
"async-storage"
11+
],
12+
"author": "Faustino Kialungila <[email protected]>",
13+
"repository": {
14+
"url": "https://github.com/Fausto95/rn-async-storage-flipper"
15+
},
16+
"license": "MIT",
17+
"peerDependencies": {
18+
"@react-native-community/async-storage": "^1.4.0",
19+
"react-native": "^0.62.0",
20+
"react-native-flipper": "^0.37.0"
21+
},
22+
"dependencies": {
23+
"react-native-flipper": "^0.37.0"
24+
},
25+
"devDependencies": {}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
react-native-flipper@^0.37.0:
6+
version "0.37.0"
7+
resolved "https://registry.npmjs.org/react-native-flipper/-/react-native-flipper-0.37.0.tgz#15187696e7361553952a83c77dcf53e508261662"
8+
integrity sha512-ZnL31EfUoXpFY4zddm/8hW6hh7+wr1VXFV+2s9TWx5F9XQ/bNVFsP+2/bbTVwYE678caZOpmHxkWebkVb2PTtA==
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Text, Panel, ManagedDataInspector, createTablePlugin } from 'flipper';
2+
3+
function renderSidebar(row) {
4+
return (
5+
<Panel floating={false} heading={'Data'}>
6+
<ManagedDataInspector data={row} expandRoot={true} />
7+
</Panel>
8+
);
9+
}
10+
11+
const columns = {
12+
key: {
13+
value: 'Key',
14+
},
15+
value: {
16+
value: 'Value',
17+
},
18+
};
19+
20+
const columnSizes = {
21+
key: '20%',
22+
value: 'flex',
23+
};
24+
25+
function buildRow(row) {
26+
return {
27+
columns: {
28+
key: {
29+
value: <Text>{row.key}</Text>,
30+
filterValue: row.key,
31+
},
32+
value: {
33+
value: <Text>{JSON.stringify(row.value)}</Text>,
34+
filterValue: JSON.stringify(row.value),
35+
},
36+
},
37+
key: row.id,
38+
copyText: JSON.stringify(row),
39+
filterValue: `${row.key} ${JSON.stringify(row.value)}`,
40+
};
41+
}
42+
43+
export default createTablePlugin({
44+
method: 'newElement',
45+
columns,
46+
columnSizes,
47+
renderSidebar,
48+
buildRow,
49+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "async-storage-flipper",
3+
"version": "0.0.5",
4+
"description": "React Native's Async Storage logger for Flipper",
5+
"main": "index.js",
6+
"icon": "apps",
7+
"title": "React Native Async Storage Logger",
8+
"category": "Logger",
9+
"keywords": [
10+
"flipper",
11+
"react-native",
12+
"async-storage"
13+
],
14+
"author": "Faustino Kialungila <[email protected]>",
15+
"license": "MIT",
16+
"repository": {
17+
"url": "https://github.com/Fausto95/rn-async-storage-flipper"
18+
},
19+
"dependencies": {
20+
"flipper": "^0.37.0"
21+
},
22+
"devDependencies": {}
23+
}

0 commit comments

Comments
 (0)