3.1.0 • Published 9 months ago

leafy-db v3.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Leafy-db

Use github as database. Powered by git api. Only one dependency: node-fetch@2.x || 3.x

Instalation

yarn add leafy-db

or

npm i leafy-db

Setup

  1. Create private repository on github
  2. Create personal access token with "Read/Write access to code and commit statuses" on created repo
  3. Use the following code snippet:
import { LeafyManager, Github } from "leafy-db";

const database = LeafyManager({
  repository: Github(process.env.DB_REPO),
  token: process.env.DB_TOKEN,
});

const tables = {
  users: database.table<{ name: string }>("users.json"),
};

database.connect().then(() => {
  tables.users.get("admin").name // Get is sync because values stores in cache
  
  tables.users.set("admin", {name: "newname"}) // Returns promise that will expire after 60 seconds by default. That needed to decrease commit count.
})

Gitlab support?

The only one problem with gitlab is that i have no idea how to test if repo exists. If you want to use my wrapper with gitlab, tell me, ill fix that. All other things to integrate are done already!

3.0.3

10 months ago

3.0.2

10 months ago

3.1.0

9 months ago

3.0.1

10 months ago

2.3.8

12 months ago

2.3.7

12 months ago

2.3.9

12 months ago

3.0.0

10 months ago

2.3.4

1 year ago

2.3.6

1 year ago

2.3.5

1 year ago

2.3.3

1 year ago

2.3.0

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago