From 4ebe2f5e8459e41dcee9f2f0061e0748e1ac577c Mon Sep 17 00:00:00 2001 From: Xicheng Guo Date: Wed, 24 Jan 2024 13:42:25 +0800 Subject: [PATCH 1/2] update readme --- README.en.md | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 12 ++-- package.json | 15 ++++- 3 files changed, 175 insertions(+), 6 deletions(-) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..6c6dcd2 --- /dev/null +++ b/README.en.md @@ -0,0 +1,154 @@ +[简体中文](README.md) | ENGLISH + +# TinyCRUD + +![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/GuoXiCheng/TinyCRUD/ci.yml) +![Codecov branch](https://img.shields.io/codecov/c/github/GuoXiCheng/TinyCRUD/main) + +## Introduction + +TinyCRUD is a lightweight data storage library based on the Issue API of the code hosting platform. It can use Issue as a database table, and the comments of Issue as data table records. It serializes/deserializes data through the Issue API to achieve data addition, deletion, modification and query. + +## Applicable scenarios + +TinyCRUD is suitable for small teams or personal projects that require simple and lightweight data storage, but do not want or need to set up a complex database system. + +## Supported code hosting platforms + + + + + + + + + + + + +
+

+ +

+
+

+ +

+
+

+ +

+
+ Github API latest + + Gitlab API v4 + + Gitee API v5 +
+ +## Supported request libraries + + + + + + + + + + +
+ + +

+ +

+
+ axios + + wx(WeChat Mini Program) +
+ +## Installation + +```shell +npm install tiny-crud +``` + +## Usage + +### Initialization + +```ts +import axios from "axios"; +import { createRequest } from "tiny-crud"; + +const GithubRequest = createRequest({ + httpLib: "axios", + httpClient: axios, + accessToken: "Your Personal Access Token", + + platform: "github", + owner: "Your Owner", + repo: "Your Repo", +}); +``` + +### Create Model + +```ts +import { BaseModel } from "tiny-crud"; + +export interface UserModel extends BaseModel { + name: string; + age: number; + gender: string; +} +``` + +### Create Repository + +```ts +import { GithubRepository } from "tiny-crud"; +import { githubRequest } from "./github-request"; + +export class UserRepository extends GithubRepository { + constructor() { + super(githubRequest, "Your Issue Number"); + } +} +``` + +### Basic Operations + +```ts +const userRepository = new UserRepository(); + +// create data +userRepository.create({ + name: "John", + age: 30, + gender: "male", +}); + +// find data +userRepository.find(); + +// update data +userRepository.updateById(1, { + name: "Mary", + age: 25, + gender: "female", +}); + +// delete data +userRepository.deleteById(1); +``` + +## Documentation + +👉[TinyCRUD Docs](https://guoxicheng.top/en/projects/TinyCRUD-Docs) + +## License + +[MIT](https://github.com/GuoXiCheng/TinyCRUD/blob/main/LICENSE) \ No newline at end of file diff --git a/README.md b/README.md index e4b7e71..59a45b5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +简体中文 | [English](README.en.md) + # TinyCRUD ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/GuoXiCheng/TinyCRUD/ci.yml) @@ -33,13 +35,13 @@ TinyCRUD 适合用于满足小型团队或个人项目中需要简单、轻量 - API latest ✔ + Github API latest - API v4 ✔ + Gitlab API v4 - API v5 ✔ + Gitee API v5 @@ -59,10 +61,10 @@ TinyCRUD 适合用于满足小型团队或个人项目中需要简单、轻量 -

axios ✔

+

axios

- wx(微信小程序) ✔ + wx(微信小程序) diff --git a/package.json b/package.json index 5214362..f4df1ea 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tiny-crud", "version": "1.1.0", - "description": "A tiny CRUD library based on Git Issue API", + "description": "Lightweight Data Repository Based on Git Issue API", "main": "dist/bundle.cjs.js", "module": "dist/bundle.esm.js", "types": "dist/index.d.ts", @@ -17,6 +17,19 @@ "dist/bundle.esm.js", "dist/index.d.ts" ], + "keywords": [ + "git", + "issue", + "crud", + "data", + "repository", + "api" + ], + "homepage": "https://guoxicheng.top/projects/TinyCRUD-Docs", + "repository": { + "type": "git", + "url": "https://github.com/GuoXiCheng/TinyCRUD.git" + }, "devDependencies": { "@babel/preset-env": "^7.23.3", "@babel/preset-typescript": "^7.23.3", From efb52648712332b4ce47e76e6c96cbece23c58aa Mon Sep 17 00:00:00 2001 From: Xicheng Guo Date: Wed, 24 Jan 2024 14:49:12 +0800 Subject: [PATCH 2/2] update readme --- README.en.md | 7 ++++--- README.md | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.en.md b/README.en.md index 6c6dcd2..bc055a6 100644 --- a/README.en.md +++ b/README.en.md @@ -7,9 +7,9 @@ ## Introduction -TinyCRUD is a lightweight data storage library based on the Issue API of the code hosting platform. It can use Issue as a database table, and the comments of Issue as data table records. It serializes/deserializes data through the Issue API to achieve data addition, deletion, modification and query. +TinyCRUD is a lightweight data storage library based on the Issue API of the code hosting platform. It can use Issues as database tables, and Issue comments as records in these tables. It performs data serialization/deserialization through the Issue API to enable data addition, deletion, modification, and querying. -## Applicable scenarios +## Applicable Scenarios TinyCRUD is suitable for small teams or personal projects that require simple and lightweight data storage, but do not want or need to set up a complex database system. @@ -147,7 +147,8 @@ userRepository.deleteById(1); ## Documentation -👉[TinyCRUD Docs](https://guoxicheng.top/en/projects/TinyCRUD-Docs) +- more detailed documentation 👉[TinyCRUD Docs](https://guoxicheng.top/en/projects/TinyCRUD-Docs) +- If you find it helpful, please consider giving it a little star, and thank you for your support! 🌟 ## License diff --git a/README.md b/README.md index 59a45b5..5d540bc 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ userRepository.updateById(1, { userRepository.deleteById(1); ``` -## 说明 +## 详细文档 * 更好的阅读体验以及详细的使用文档请戳 👉[TinyCRUD Docs](https://guoxicheng.top/projects/TinyCRUD-Docs/) * 如果对你有帮助的话可以给颗小星星,感谢支持!🌟