Skip to content

Commit fe32ce7

Browse files
committedMar 26, 2022
feat: prepare v5 stable release (#1538)
1 parent ec452c7 commit fe32ce7

31 files changed

+924
-969
lines changed
 

‎.dockerignore

-9
This file was deleted.

‎.eslintignore

-3
This file was deleted.

‎.eslintrc.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
}
4949
}
5050
],
51-
"@typescript-eslint/explicit-member-accessibility": [1, { "accessibility": "no-public" }],
51+
"@typescript-eslint/explicit-member-accessibility": [
52+
1,
53+
{ "accessibility": "no-public" }
54+
],
5255
"@typescript-eslint/no-empty-interface": 0,
5356
"@typescript-eslint/no-empty-function": 0,
5457
"@typescript-eslint/no-unused-vars": [
@@ -60,7 +63,7 @@
6063
},
6164
"overrides": [
6265
{
63-
"files": ["test/**/*", "test-cluster/**/*"],
66+
"files": ["test/cluster/*", "test/unit/*", "test/functional/*"],
6467
"env": {
6568
"mocha": true
6669
},

‎.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v2
4343
- name: Build and test cluster
44-
run: bash test-cluster/docker/main.sh
44+
run: bash test/cluster/docker/main.sh
4545

4646
code-coverage:
4747
needs: test

‎.releaserc.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"branches": [
3-
"v4",
4-
{ "name": "main", "channel": "next", "prerelease": "beta" }
5-
],
2+
"branches": ["main"],
63
"plugins": [
74
[
85
"@semantic-release/commit-analyzer",

‎README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ used in the world's biggest online commerce company [Alibaba](http://www.alibaba
1818
0. Full-featured. It supports [Cluster](http://redis.io/topics/cluster-tutorial), [Sentinel](http://redis.io/topics/sentinel), [Streams](https://redis.io/topics/streams-intro), [Pipelining](http://redis.io/topics/pipelining), and of course [Lua scripting](http://redis.io/commands/eval), [Redis Functions](https://redis.io/topics/functions-intro), [Pub/Sub](http://redis.io/topics/pubsub) (with the support of binary messages).
1919
0. High performance 🚀.
2020
0. Delightful API 😄. It works with Node callbacks and Native promises.
21-
0. Official TypeScript declarations.
2221
0. Transformation of command arguments and replies.
2322
0. Transparent key prefixing.
2423
0. Abstraction for Lua scripting, allowing you to [define custom commands](https://github.com/luin/ioredis#lua-scripting).
@@ -30,29 +29,28 @@ used in the world's biggest online commerce company [Alibaba](http://www.alibaba
3029
0. Supports Redis ACL.
3130
0. Sophisticated error handling strategy.
3231
0. Supports NAT mapping.
33-
0. Supports autopipelining
32+
0. Supports autopipelining.
3433

35-
# Versions
34+
**100% written in TypeScript and official declarations are provided:**
3635

37-
| NPM Version | Branch | Node.js Version | Redis Version |
38-
| ------------ | ------ | --------------- | --------------- |
39-
| 5.x.x (beta) | main | >= 12 | 2.6.12 ~ latest |
40-
| 4.x.x | v4 | >= 6 | 2.6.12 ~ 7 |
36+
<img width="837" src="resources/ts-screenshot.png" alt="TypeScript Screenshot" />
4137

42-
V5 is still in the beta stage. You can install it with:
38+
# Versions
4339

44-
```
45-
$ npm install ioredis@next
46-
```
40+
| NPM Version | Branch | Node.js Version | Redis Version |
41+
| -------------- | ------ | --------------- | --------------- |
42+
| 5.x.x (latest) | main | >= 12 | 2.6.12 ~ latest |
43+
| 4.x.x | v4 | >= 6 | 2.6.12 ~ 7 |
4744

4845
Refer to [CHANGELOG.md](CHANGELOG.md) for features and bug fixes introduced in v5.
4946

47+
🚀 [Upgrading from v4 to v5](https://github.com/luin/ioredis/wiki/Upgrading-from-v4-to-v5)
48+
5049
# Links
5150

5251
- [API Documentation](http://luin.github.io/ioredis/) ([Redis](http://luin.github.io/ioredis/classes/default.html), [Cluster](http://luin.github.io/ioredis/classes/Cluster.html))
5352
- [Changelog](CHANGELOG.md)
5453
- [Migrating from node_redis](https://github.com/luin/ioredis/wiki/Migrating-from-node_redis)
55-
- [Error Handling](#error-handling)
5654

5755
<hr>
5856

@@ -107,6 +105,12 @@ Medis starts with all the basic features you need:
107105
$ npm install ioredis
108106
```
109107

108+
In a TypeScript project, you may want to add TypeScript declarations for Node.js:
109+
110+
```shell
111+
$ npm install --save-dev @types/node
112+
```
113+
110114
## Basic Usage
111115

112116
```javascript
File renamed without changes.

‎bin/generateRedisCommander/index.js ‎bin/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function main() {
3838
});
3939

4040
fs.writeFileSync(
41-
path.join(__dirname, "..", "..", "lib/utils/RedisCommander.ts"),
41+
path.join(__dirname, "..", "lib/utils/RedisCommander.ts"),
4242
template.replace("////", () => interface)
4343
);
4444
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎docs/assets/search.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/classes/Cluster.html

+359-359
Large diffs are not rendered by default.

‎docs/classes/default.html

+359-359
Large diffs are not rendered by default.

‎docs/index.html

+1-1
Large diffs are not rendered by default.

‎docs/interfaces/CommonRedisOptions.html

+20-20
Large diffs are not rendered by default.

‎docs/interfaces/SentinelAddress.html

+1-1
Large diffs are not rendered by default.

‎docs/interfaces/SentinelConnectionOptions.html

+4-4
Large diffs are not rendered by default.

‎package-lock.json

+117-114
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+11-8
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
],
1010
"scripts": {
1111
"test:tsd": "npm run build && tsd",
12-
"test:js": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha \"test/helpers/*.ts\" \"test/**/*.ts\"",
12+
"test:js": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha \"test/helpers/*.ts\" \"test/unit/**/*.ts\" \"test/functional/**/*.ts\"",
1313
"test:cov": "nyc npm run test:js",
14-
"test:js:cluster": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha \"test-cluster/**/*.ts\"",
14+
"test:js:cluster": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha \"test/cluster/**/*.ts\"",
1515
"test": "npm run test:js && npm run test:tsd",
1616
"lint": "eslint --ext .js,.ts ./lib",
1717
"docs": "npx typedoc --logLevel Error --excludeExternals --excludeProtected --excludePrivate --readme none lib/index.ts",
@@ -31,6 +31,9 @@
3131
"sentinel",
3232
"pipelining"
3333
],
34+
"tsd": {
35+
"directory": "test/typing"
36+
},
3437
"author": "Zihua Li <i@zihua.li> (http://zihua.li)",
3538
"license": "MIT",
3639
"funding": {
@@ -58,25 +61,25 @@
5861
"@types/lodash.defaults": "^4.2.6",
5962
"@types/lodash.isarguments": "^3.1.6",
6063
"@types/mocha": "^9.1.0",
61-
"@types/node": "^17.0.18",
64+
"@types/node": "^14.18.12",
6265
"@types/redis-errors": "^1.2.1",
6366
"@types/sinon": "^10.0.11",
64-
"@typescript-eslint/eslint-plugin": "^5.12.0",
65-
"@typescript-eslint/parser": "^5.12.0",
67+
"@typescript-eslint/eslint-plugin": "^5.16.0",
68+
"@typescript-eslint/parser": "^5.16.0",
6669
"chai": "^4.3.6",
6770
"chai-as-promised": "^7.1.1",
68-
"eslint": "^8.9.0",
71+
"eslint": "^8.12.0",
6972
"eslint-config-prettier": "^8.4.0",
7073
"mocha": "^9.2.1",
7174
"nyc": "^15.1.0",
72-
"prettier": "^2.5.1",
75+
"prettier": "^2.6.1",
7376
"semantic-release": "^19.0.2",
7477
"server-destroy": "^1.0.1",
7578
"sinon": "^13.0.1",
7679
"ts-node": "^10.4.0",
7780
"tsd": "^0.19.1",
7881
"typedoc": "^0.22.12",
79-
"typescript": "^4.5.5",
82+
"typescript": "^4.6.3",
8083
"uuid": "^8.3.0"
8184
},
8285
"nyc": {

‎resources/ts-screenshot.png

47.7 KB
Loading

‎test-cluster/basic.ts ‎test/cluster/basic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from "chai";
2-
import Redis, { Cluster } from "../lib";
2+
import Redis, { Cluster } from "../../lib";
33

44
const masters = [30000, 30001, 30002];
55
const replicas = [30003, 30004, 30005];
File renamed without changes.
File renamed without changes.

‎test/docker/Dockerfile

-11
This file was deleted.

‎test/docker/main.sh

-22
This file was deleted.

‎test/docker/worker.sh

-16
This file was deleted.

‎test-d/commands.test-d.ts ‎test/typing/commands.test-d.ts

+24-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
import { expectError, expectType } from "tsd";
2-
import Redis from "../built";
2+
import Redis from "../../built";
33

44
const redis = new Redis();
55

66
// call
7-
expectType<Promise<unknown>>(redis.call('info'));
8-
expectType<Promise<unknown>>(redis.call('set', 'foo', 'bar'));
9-
expectType<Promise<unknown>>(redis.call('set', ['foo', 'bar']));
7+
expectType<Promise<unknown>>(redis.call("info"));
8+
expectType<Promise<unknown>>(redis.call("set", "foo", "bar"));
9+
expectType<Promise<unknown>>(redis.call("set", ["foo", "bar"]));
1010
expectType<Promise<unknown>>(redis.callBuffer("set", ["foo", "bar"]));
11-
expectType<Promise<unknown>>(redis.call('set', ['foo', 'bar'], (err, value) => {
12-
expectType<Error | undefined | null>(err);
13-
expectType<unknown | undefined>(value);
14-
}));
15-
16-
expectType<Promise<unknown>>(redis.call('get', 'foo', (err, value) => {
17-
expectType<Error | undefined | null>(err);
18-
expectType<unknown | undefined>(value);
19-
}));
20-
21-
expectType<Promise<unknown>>(redis.call('info', (err, value) => {
22-
expectType<Error | undefined | null>(err);
23-
expectType<unknown | undefined>(value);
24-
}));
11+
expectType<Promise<unknown>>(
12+
redis.call("set", ["foo", "bar"], (err, value) => {
13+
expectType<Error | undefined | null>(err);
14+
expectType<unknown | undefined>(value);
15+
})
16+
);
17+
18+
expectType<Promise<unknown>>(
19+
redis.call("get", "foo", (err, value) => {
20+
expectType<Error | undefined | null>(err);
21+
expectType<unknown | undefined>(value);
22+
})
23+
);
24+
25+
expectType<Promise<unknown>>(
26+
redis.call("info", (err, value) => {
27+
expectType<Error | undefined | null>(err);
28+
expectType<unknown | undefined>(value);
29+
})
30+
);
2531

2632
// GET
2733
expectType<Promise<string | null>>(redis.get("key"));

‎test-d/options.test-d.ts ‎test/typing/options.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expectType } from "tsd";
2-
import Redis, { Cluster } from "../built";
2+
import Redis, { Cluster } from "../../built";
33

44
expectType<Redis>(new Redis());
55

‎test-d/pipeline.test-d.ts ‎test/typing/pipeline.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expectType } from "tsd";
2-
import Redis from "../built";
2+
import Redis from "../../built";
33

44
const redis = new Redis();
55

0 commit comments

Comments
 (0)
Please sign in to comment.