Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit ced7b80

Browse files
feat: refactor into CommonKeyValueDB and RedisClient, modernize
BREAKING CHANGE: ^^^
1 parent b5aabd0 commit ced7b80

File tree

19 files changed

+4456
-4797
lines changed

19 files changed

+4456
-4797
lines changed

.circleci/config.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ci
2+
3+
on: [push, workflow_dispatch]
4+
5+
env:
6+
NODE_OPTIONS: --max-old-space-size=5000
7+
8+
jobs:
9+
build-job:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- { uses: actions/checkout@v4, with: { persist-credentials: false } }
13+
- { uses: actions/setup-node@v4, with: { node-version: 'lts/*', cache: 'yarn' } }
14+
- run: yarn --frozen-lockfile
15+
- name: build
16+
run: yarn build
17+
- name: test
18+
run: yarn test
19+
20+
release-job:
21+
runs-on: ubuntu-latest
22+
if: github.ref_name == 'master'
23+
permissions:
24+
contents: write
25+
id-token: write
26+
steps:
27+
- { uses: actions/checkout@v4, with: { persist-credentials: true } }
28+
- { uses: actions/setup-node@v4, with: { node-version: 'lts/*', cache: 'yarn' } }
29+
30+
# Cache for npm/npx in ~/.npm
31+
- uses: actions/cache@v4
32+
with:
33+
path: ~/.npm
34+
key: npm-v1-${{ runner.os }}
35+
36+
- run: yarn --frozen-lockfile
37+
- run: yarn build-prod
38+
39+
- name: release
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
run: npx @naturalcycles/semantic-release

.husky/commit-msg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
[ -n "$CI" ] && exit 0
3+
. "$(dirname "$0")/_/husky.sh"
4+
5+
node_modules/.bin/commitlint-def $1
6+
# exit 1 # uncomment to debug

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
[ -n "$CI" ] && exit 0
3+
. "$(dirname "$0")/_/husky.sh"
4+
5+
node_modules/.bin/lint-staged-def

CHANGELOG.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1 @@
1-
# [2.0.0](https://github.com/NaturalCycles/redis-lib/compare/v1.1.1...v2.0.0) (2019-10-19)
2-
3-
4-
### Features
5-
6-
* impl CommonDB 2.0 ([4830225](https://github.com/NaturalCycles/redis-lib/commit/4830225))
7-
8-
9-
### BREAKING CHANGES
10-
11-
* ^^^
12-
13-
## [1.1.1](https://github.com/NaturalCycles/redis-lib/compare/v1.1.0...v1.1.1) (2019-09-20)
14-
15-
16-
### Bug Fixes
17-
18-
* adapt to new db-lib ([d3555be](https://github.com/NaturalCycles/redis-lib/commit/d3555be))
19-
20-
# [1.1.0](https://github.com/NaturalCycles/redis-lib/compare/v1.0.0...v1.1.0) (2019-08-23)
21-
22-
23-
### Features
24-
25-
* namespacePrefix; adopt to db-lib ([e3b35f4](https://github.com/NaturalCycles/redis-lib/commit/e3b35f4))
26-
27-
# 1.0.0 (2019-08-20)
28-
29-
30-
### Features
31-
32-
* first version ([a80ee79](https://github.com/NaturalCycles/redis-lib/commit/a80ee79))
1+
See [Github Releases](https://github.com/NaturalCycles/redis-lib/releases)

husky.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
{
22
"name": "@naturalcycles/redis-lib",
3-
"scripts": {},
3+
"scripts": {
4+
"prepare": "husky"
5+
},
46
"dependencies": {
5-
"@naturalcycles/db-lib": "^2.0.2",
6-
"@naturalcycles/js-lib": "^8.5.1",
7-
"@naturalcycles/nodejs-lib": "^6.11.1",
8-
"@types/ioredis": "^4.0.15",
9-
"chalk": "^2.4.2",
10-
"ioredis": "^4.14.0"
7+
"@naturalcycles/db-lib": "^9.9.2",
8+
"@naturalcycles/js-lib": "^14.217.0",
9+
"@naturalcycles/nodejs-lib": "^13.8.0",
10+
"ioredis": "^5.3.2"
1111
},
1212
"devDependencies": {
13-
"@naturalcycles/dev-lib": "^8.1.0",
14-
"@types/node": "^12.7.2",
15-
"dotenv": "^8.1.0",
16-
"jest": "^24.9.0"
17-
},
18-
"resolutions": {
19-
"@types/hapi__joi": "15.0.4"
13+
"@naturalcycles/dev-lib": "^13.49.2",
14+
"@types/node": "^20.12.2",
15+
"jest": "^29.7.0"
2016
},
2117
"files": [
2218
"dist",
@@ -29,17 +25,18 @@
2925
"main": "dist/index.js",
3026
"types": "dist/index.d.ts",
3127
"publishConfig": {
28+
"provenance": true,
3229
"access": "public"
3330
},
3431
"repository": {
3532
"type": "git",
3633
"url": "https://github.com/NaturalCycles/redis-lib"
3734
},
3835
"engines": {
39-
"node": ">=10.13"
36+
"node": ">=18.12"
4037
},
4138
"version": "2.0.0",
42-
"description": "Redis implementation of CommonDB interface",
39+
"description": "Redis implementation of CommonKeyValueDB interface",
4340
"author": "Natural Cycles Team",
4441
"license": "MIT"
4542
}

readme.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## @naturalcycles/redis-lib
22

3-
> Redis implementation of CommonDB interface
3+
> Redis implementation of CommonKeyValueDB interface
44
55
[![npm](https://img.shields.io/npm/v/@naturalcycles/redis-lib/latest.svg)](https://www.npmjs.com/package/@naturalcycles/redis-lib)
66
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
@@ -9,28 +9,22 @@
99

1010
- ...
1111

12-
# DEBUG namespaces
13-
14-
- `nc:redis-lib`
15-
- `ioredis`, `ioredis:redis`, `ioredis:connection`
16-
17-
# Packaging
18-
19-
- `engines.node >= 10.13`: Latest Node.js LTS
20-
- `main: dist/index.js`: commonjs, es2018
21-
- `types: dist/index.d.ts`: typescript types
22-
- `/src` folder with source `*.ts` files included
23-
2412
# Starting / debugging Redis server on OSX
2513

26-
brew install redis
27-
brew services start redis
28-
brew services stop redis
14+
```shell
15+
brew install redis
16+
brew services start redis
17+
brew services stop redis
18+
19+
redis-server /usr/local/etc/redis.conf
2920

30-
redis-server /usr/local/etc/redis.conf
21+
redis-cli ping
22+
redis-cli flushall
3123

32-
redis-cli ping
33-
redis-cli flushall
24+
# connect and list all keys
25+
redis-cli
26+
scan 0
27+
```
3428

3529
Location and size of local DB:
3630

src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
import { RedisDB, RedisDBCfg } from './redis.db'
2-
3-
export { RedisDBCfg, RedisDB }
1+
export * from './redisClient'
2+
export * from './redisKeyValueDB'

0 commit comments

Comments
 (0)