Skip to content

Commit

Permalink
Merge pull request #71 from firstbatchxyz/erhant/peer-deps
Browse files Browse the repository at this point in the history
Issue fixes & peer dependency fix
  • Loading branch information
erhant authored Jan 3, 2024
2 parents a58fd15 + eb4e5d3 commit 611b1c4
Show file tree
Hide file tree
Showing 21 changed files with 12,168 additions and 1,115 deletions.
8 changes: 0 additions & 8 deletions .editorconfig

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/build.yml

This file was deleted.

64 changes: 21 additions & 43 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,43 @@ on:
types: [published]

jobs:
test:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 19.x
node-version: 20

- name: Start Redis
uses: supercharge/[email protected]
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
redis-version: 7
redis-port: 6379
version: 8
run_install: false # use caching via later commands

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: yarn

- name: Formatting
run: yarn format

- name: Linting
run: yarn lint
run: pnpm install

- name: Build
run: yarn build

- name: Run tests
run: yarn test

publish:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Build package
run: pnpm build

- run: yarn
- run: yarn build
- uses: JS-DevTools/npm-publish@v3
id: publish
with:
Expand Down
42 changes: 24 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
name: test

# run when `dev` has a push or PR
# or when `master` has a push
on:
pull_request:
types:
- opened
branches:
- dev
- master
push:
branches:
- master
- dev

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 19.x
node-version: 20

- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 7
redis-port: 6379

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: yarn
run: pnpm install

- name: Build package
run: pnpm build

- name: Run tests
run: yarn test
run: pnpm test
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<p align="center">
<a href="https://opensource.org/licenses/MIT" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-yellow.svg">
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-7CB9E8.svg">
</a>
<a href="https://www.npmjs.com/package/hollowdb" target="_blank">
<img alt="NPM" src="https://img.shields.io/npm/v/hollowdb?logo=npm&color=CB3837">
Expand All @@ -24,9 +24,6 @@
<a href="./.github/workflows/test.yml" target="_blank">
<img alt="Workflow: Tests" src="https://github.com/firstbatchxyz/hollowdb/actions/workflows/test.yml/badge.svg?branch=master">
</a>
<a href="./.github/workflows/build.yml" target="_blank">
<img alt="Workflow: Build" src="https://github.com/firstbatchxyz/hollowdb/actions/workflows/build.yml/badge.svg?branch=master">
</a>
<a href="https://discord.gg/2wuU9ym6fq" target="_blank">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/2wuU9ym6fq?style=flat">
</a>
Expand All @@ -47,10 +44,15 @@ Depending on your use-cases, we have several optional dependencies:
- You can use [hollowdb-prover](https://www.npmjs.com/package/hollowdb-prover) as a simple utility that generates zero-knowledge proofs that are verifiable by HollowDB.
- You can use LMDB cache within your Warp instance via [warp-contracts-lmdb](https://www.npmjs.com/package/warp-contracts-lmdb).
- You can use Redis cache within your warp instance via [warp-contracts-redis](https://www.npmjs.com/package/warp-contracts-redis) together with [ioredis](https://www.npmjs.com/package/ioredis).
- When you are evaluating a contract that uses ZK proofs, you should also use [warp-contracts-plugin-snarkjs](https://www.npmjs.com/package/warp-contracts-plugin-snarkjs) and [warp-contracts-plugin-ethers](https://www.npmjs.com/package/warp-contracts-plugin-ethers).

## Usage

You can read the full documentation of HollowDB at <https://docs.hollowdb.xyz>. If you are interested in customizing the smart contract of HollowDB and extending its SDKs, refer to this [README](./src/contracts/README.md).
You can read the full documentation of HollowDB at <https://docs.hollowdb.xyz>.

> [!NOTE]
>
> If you are interested in customizing the smart contract of HollowDB and extending its SDKs, refer to this [README](./src/contracts/README.md).
## Examples

Expand All @@ -64,7 +66,7 @@ Check out the [examples](./examples/) folder for a few examples of HollowDB usag
You can run all tests via:

```sh
yarn test
pnpm test
```

Tests operate on a local Arweave instance using [arlocal](https://www.npmjs.com/package/arlocal). They will run for all cache types (LMDB, Redis, LevelDB). You will need to have a Redis server running for some of the tests to pass, the URL shall be specified [here](./tests/constants/index.ts).
Expand All @@ -74,6 +76,6 @@ Tests operate on a local Arweave instance using [arlocal](https://www.npmjs.com/
You can check the formatting of the code or lint everything with the following commands:

```sh
yarn format # prettier
yarn lint # eslint
pnpm format # prettier
pnpm lint # eslint
```
19 changes: 19 additions & 0 deletions examples/simple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Simple Example

In this example, we simply put and get a value from HollowDB.

```sh
yarn install
```

Run the example:

```sh
node index.js
```

You can also use a bundler (Irys) with, if you have funded your wallet:

```sh
USE_IRYS=true node index.js
```
44 changes: 0 additions & 44 deletions examples/simple/example.js

This file was deleted.

Loading

0 comments on commit 611b1c4

Please sign in to comment.