Skip to content

Commit 4ec80f6

Browse files
committed
apply template
1 parent 6c7be95 commit 4ec80f6

11 files changed

+2237
-28
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# https://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 2

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Tell github that .re and .rei files are Reason, sometimes recognized as C/C++
2+
*.re linguist-language=Reason
3+
*.rei linguist-language=Reason

.github/workflows/build.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version:
12+
- 8.x
13+
- 10.x
14+
- 12.x
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- name: Install
23+
run: |
24+
yarn install \
25+
--non-interactive \
26+
--frozen-lockfile
27+
- name: Test
28+
run: yarn test
29+
env:
30+
CI: true

.gitignore

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
# Ocaml / Reason / BuckleScript artifacts
2-
.bsb.lock
3-
**/lib/bs
4-
**/lib/ocaml
5-
**/.merlin
1+
*.log
62

7-
# macos crap
3+
# macOS crap
84
.DS_Store
5+
96
# node
107
node_modules
8+
119
# npm unused lock file (we use yarn.lock)
12-
package-lock.json
10+
package-lock.json
11+
12+
# Ocaml / Reason / BuckleScript artifacts
13+
#*.bs.js # we do want this files to ensure zero-cost
14+
.bsb.lock
15+
**/lib/bs
16+
**/lib/ocaml
17+
**/.merlin

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.bs.js
2+
package.json

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog of `@reason-react-native/async-storage`

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 reason-react-native
3+
Copyright (c) 2019 @reason-react-native contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+154-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,154 @@
1-
# async-storage
1+
# `@reason-react-native/async-storage`
2+
3+
[![Build Status](https://github.com/reason-react-native/async-storage/workflows/Build/badge.svg)](https://github.com/reason-react-native/async-storage/actions)
4+
[![Version](https://img.shields.io/npm/v/@reason-react-native/async-storage.svg)](https://www.npmjs.com/@reason-react-native/async-storage)
5+
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)
6+
7+
[ReasonML](https://reasonml.github.io) /
8+
[BuckleScript](https://bucklescript.github.io) bindings for
9+
[`@react-native-community/async-storage`](https://github.com/react-native-community/async-storage).
10+
11+
Exposed as `ReactNativeAsyncStorage` module.
12+
13+
`@reason-react-native/async-storage` X.y._ means it's compatible with
14+
`@react-native-community/async-storage` X.y._
15+
16+
## Installation
17+
18+
When
19+
[`@react-native-community/async-storage`](`https://github.com/react-native-community/async-storage`)
20+
is properly installed & configured by following their installation instructions,
21+
you can install the bindings:
22+
23+
```console
24+
npm install @reason-react-native/async-storage
25+
# or
26+
yarn add @reason-react-native/async-storage
27+
```
28+
29+
`@reason-react-native/async-storage` should be added to `bs-dependencies` in
30+
your `bsconfig.json`. Something like
31+
32+
```diff
33+
{
34+
//...
35+
"bs-dependencies": [
36+
"reason-react",
37+
"reason-react-native",
38+
// ...
39+
+ "@reason-react-native/async-storage"
40+
],
41+
//...
42+
}
43+
```
44+
45+
## Usage
46+
47+
### Types
48+
49+
#### `ReactNativeAsyncStorage.asyncStorageState`
50+
51+
```re
52+
{
53+
.
54+
[@bs.meth] "getItem": unit => Js.Promise.t(Js.Null.t(string)),
55+
[@bs.meth] "setItem": string => Js.Promise.t(unit),
56+
[@bs.meth] "mergeItem": string => Js.Promise.t(unit),
57+
[@bs.meth] "removeItem": unit => Js.Promise.t(unit),
58+
}
59+
```
60+
61+
### Methods
62+
63+
#### `ReactNativeAsyncStorage.getItem`
64+
65+
```re
66+
string => Js.Promise.t(Js.Null.t(string))
67+
```
68+
69+
#### `ReactNativeAsyncStorage.setItem`
70+
71+
```re
72+
(string, string) => Js.Promise.t(unit)
73+
```
74+
75+
#### `ReactNativeAsyncStorage.removeItem`
76+
77+
```re
78+
string => Js.Promise.t(unit)
79+
```
80+
81+
#### `ReactNativeAsyncStorage.mergeItem`
82+
83+
```re
84+
(string, string) => Js.Promise.t(unit)
85+
```
86+
87+
#### `ReactNativeAsyncStorage.clear`
88+
89+
```re
90+
unit => Js.Promise.t(unit)
91+
```
92+
93+
#### `ReactNativeAsyncStorage.getAllKeys`
94+
95+
```re
96+
unit => Js.Promise.t(Js.Null.t(array(string)))
97+
```
98+
99+
#### `ReactNativeAsyncStorage.multiGet`
100+
101+
```re
102+
array(string) => Js.Promise.t(array((string, Js.Null.t(string))))
103+
```
104+
105+
#### `ReactNativeAsyncStorage.multiSet`
106+
107+
```re
108+
array((string, string)) => Js.Promise.t(unit)
109+
```
110+
111+
#### `ReactNativeAsyncStorage.multiMerge`
112+
113+
```re
114+
array((string, string)) => Js.Promise.t(unit)
115+
```
116+
117+
#### `ReactNativeAsyncStorage.multiRemove`
118+
119+
```re
120+
array(string) => Js.Promise.t(unit)
121+
```
122+
123+
#### `ReactNativeAsyncStorage.flushGetRequests`
124+
125+
```re
126+
unit => unit
127+
```
128+
129+
#### `ReactNativeAsyncStorage.useAsyncStorage`
130+
131+
```re
132+
string => asyncStorageState
133+
```
134+
135+
---
136+
137+
## Changelog
138+
139+
Check the [changelog](./CHANGELOG.md) for more informations about recent
140+
releases.
141+
142+
---
143+
144+
## Contribute
145+
146+
Read the
147+
[contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md)
148+
before contributing.
149+
150+
## Code of Conduct
151+
152+
We want this community to be friendly and respectful to each other. Please read
153+
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
154+
so that you can understand what actions will and will not be tolerated.

package.json

+37-12
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"author": "tatchi (https://github.com/tatchi)",
7+
"peerDependencies": {
8+
"@react-native-community/async-storage": "^1.6.0"
9+
},
810
"repository": "https://github.com/reason-react-native/async-storage.git",
911
"license": "MIT",
1012
"keywords": [
1113
"reason",
1214
"reasonml",
1315
"bucklescript",
14-
"react-native",
15-
"react-native-async-storage",
16-
"async-storage"
16+
"react-native"
1717
],
1818
"files": [
1919
"*",
@@ -24,16 +24,41 @@
2424
"!lib/ocaml"
2525
],
2626
"scripts": {
27-
"start": "bsb -make-world -w",
28-
"build": "bsb -make-world",
29-
"clean": "bsb -clean-world",
30-
"test": "bsb -clean-world -make-world"
27+
"format:most": "prettier --write \"**/*.{md,json,js,css}\"",
28+
"format:re": "find . -name \"*.re\" -or -name \"*.rei\" | grep -v \"node_modules\" | xargs bsrefmt --in-place",
29+
"format": "yarn format:most && yarn format:re",
30+
"re:start": "bsb -make-world -w",
31+
"re:build": "bsb -make-world",
32+
"re:clean-build": "bsb -clean-world -make-world",
33+
"start": "yarn re:start",
34+
"build": "yarn re:build",
35+
"test": "yarn re:clean-build",
36+
"release": "npmpub"
3137
},
3238
"devDependencies": {
33-
"bs-platform": "^5.0.4",
34-
"@react-native-community/async-storage": "^1.6.1"
39+
"bs-platform": "^5.2.0",
40+
"husky": "^1.3.0",
41+
"lint-staged": "^8.1.0",
42+
"npmpub": "^5.0.0",
43+
"prettier": "^1.18.0"
3544
},
36-
"peerDependencies": {
37-
"@react-native-community/async-storage": "^1.6.1"
45+
"prettier": {
46+
"trailingComma": "all",
47+
"proseWrap": "always"
48+
},
49+
"lint-staged": {
50+
"*.{md,json,js,css}": [
51+
"prettier --write",
52+
"git add"
53+
],
54+
"*.{re,rei}": [
55+
"bsrefmt --in-place",
56+
"git add"
57+
]
58+
},
59+
"husky": {
60+
"hooks": {
61+
"pre-commit": "lint-staged"
62+
}
3863
}
3964
}

0 commit comments

Comments
 (0)