Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
geekact committed Dec 13, 2023
0 parents commit c521e48
Show file tree
Hide file tree
Showing 15 changed files with 6,022 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pre Release

on:
release:
types: [prereleased]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version-file: 'package.json'
- run: pnpm install
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
tag: next
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release

on:
release:
types: [released]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version-file: 'package.json'
- run: pnpm install
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
tag: latest
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.idea/
.DS_Store
dist/
*.log
node_modules/
coverage
.nyc_output
TODO
/test.*
/dist/
/build/
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
16 changes: 16 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
semi: true
singleQuote: true
# Change when properties in objects are quoted.
# If at least one property in an object requires quotes, quote all properties.
quoteProps: consistent
tabWidth: 2
printWidth: 80
endOfLine: lf
trailingComma: all
bracketSpacing: true
# Include parentheses around a sole arrow function parameter.
arrowParens: always
proseWrap: preserve
jsxSingleQuote: false
# Put > on the last line instead of at a new line.
bracketSameLine: false
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode"]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"typescript.preferences.quoteStyle": "single",
"typescript.suggest.autoImports": true,
"editor.tabSize": 2,
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"cSpell.ignoreWords": ["mmkv"]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## [0.0.1](https://github.com/foca-js/foca-mmkv-storage)  (2023-12-13)

- 首次发布
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 geekact

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.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# foca-mmkv-storage

react-native 端的持久化引擎,基于 [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv)

[![License](https://img.shields.io/github/license/foca-js/foca-mmkv-storage?logo=open-source-initiative)](https://github.com/foca-js/foca-mmkv-storage/blob/master/LICENSE)
[![npm](https://img.shields.io/npm/v/foca-mmkv-storage?logo=npm)](https://www.npmjs.com/package/foca-mmkv-storage)

# 安装

```bash
# pnpm
pnpm add foca-mmkv-storage
cd ios && pod install
```

# 使用

```diff
import { store } from 'foca';
+import { mmkvStorage } from 'foca-mmkv-storage';

store.init({
persist: [
{
key: 'my-project',
version: '1',
+ engine: mmkvStorage,
models: [],
},
],
});
```

也可以定制参数

```diff
import { store } from 'foca';
+import { createMmkvStorage } from 'foca-mmkv-storage';

store.init({
persist: [
{
key: 'my-project',
version: '1',
+ engine: createMmkvStorage({...}),
models: [],
},
],
});
```
64 changes: 64 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "foca-mmkv-storage",
"version": "0.0.1",
"repository": "git@github.com:foca-js/foca-mmkv-storage.git",
"keywords": [
"redux-persist",
"react-native-persist"
],
"description": "Foca持久化react-native引擎",
"contributors": [
"夜葬 <fanwenhua1990@gmail.com> (https://github.com/geekact)"
],
"license": "MIT",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"sideEffects": false,
"scripts": {
"prepublishOnly": "tsup",
"prepare": "husky install"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"volta": {
"node": "18.16.0",
"pnpm": "8.10.0"
},
"packageManager": "pnpm@8.8.0",
"files": [
"dist",
"LICENSE",
"package.json",
"README.md",
"CHANGELOG.md"
],
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"peerDependencies": {
"foca": ">=3.1.0"
},
"dependencies": {
"react-native-mmkv": "^2.11.0"
},
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@swc/core": "^1.3.100",
"@types/node": "^20.10.4",
"foca": "^3.2.0",
"husky": "^8.0.3",
"prettier": "^3.1.1",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit c521e48

Please sign in to comment.