forked from redis/ioredis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
58 lines (50 loc) · 1.39 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const returnTypes = require("./returnTypes");
const argumentTypes = require("./argumentTypes");
const sortArguments = require("./sortArguments");
const typeMaps = require("./typeMaps");
const overrides = require("./overrides");
const { getCommanderInterface } = require("@ioredis/interface-generator");
const HEADER = `/**
* This file is generated by @ioredis/interface-generator.
* Don't edit it manually. Instead, run \`npm run generate\` to update
* this file.
*/
`;
const ignoredCommands = ["monitor", "multi"];
const commands = require("@ioredis/commands")
.list.filter((name) => !ignoredCommands.includes(name))
.sort();
const fs = require("fs");
const path = require("path");
const template = fs.readFileSync(path.join(__dirname, "/template.ts"), "utf8");
async function main() {
const interface = await getCommanderInterface({
commands,
complexityLimit: 50,
redisOpts: {
port: process.env.REDIS_PORT,
},
overrides,
returnTypes,
argumentTypes,
sortArguments,
typeMaps: typeMaps,
ignoredBufferVariant: [
"incrbyfloat",
"type",
"info",
"latency",
"lolwut",
"memory",
"cluster",
"geopos",
],
});
fs.writeFileSync(
path.join(__dirname, "..", "lib/utils/RedisCommander.ts"),
HEADER + template.replace("////", () => interface)
);
}
main()
.catch(console.error)
.then(() => process.exit(0));