Skip to content

Commit

Permalink
deps: deno@2.0.0-rc.5 (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
uki00a authored Sep 25, 2024
1 parent a1041a5 commit 346d9c8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .denov
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0-rc.0
2.0.0-rc.5
6 changes: 3 additions & 3 deletions .octocov.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# generated by octocov init
codeToTestRatio:
code:
- '**/*.ts'
- '!tests/*.ts'
- "**/*.ts"
- "!tests/*.ts"
test:
- 'tests/*.ts'
- "tests/*.ts"
coverage:
paths:
- coverage/lcov.info
Expand Down
9 changes: 5 additions & 4 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"exclude": [
"benchmark/node_modules"
"benchmark/node_modules",
"tmp"
],
"lint": {
"exclude": [
Expand All @@ -10,15 +11,15 @@
"rules": { "include": ["no-console"] }
},
"test": {
"exclude": ["benchmark/", "tmp/", "vendor/"]
"exclude": ["benchmark/", "vendor/"]
},
"tasks": {
"lock": "rm deno.lock && DENO_FUTURE=1 deno cache --reload mod.ts experimental/**/mod.ts tests/**/*.ts",
"check:deno-json": "deno run --allow-read=deno.json tools/check_deno_json.js",
"test": "DENO_FUTURE=1 deno test --allow-net --allow-read=tests --allow-write=tests/tmp --allow-run=redis-server,redis-cli --coverage=coverage --trace-leaks --frozen-lockfile",
"test:doc": "deno test --doc --no-run --import-map=import_map.test.json",
"test:doc": "deno check --doc-only --import-map=import_map.test.json README.md experimental/cluster/README.md",
"coverage": "deno coverage ./coverage --lcov --output=coverage/lcov.info",
"make_mod": "deno run --allow-read --allow-write --allow-run --check tools/make_mod.ts",
"make_mod": "deno run --allow-read --allow-write --allow-run=deno --check tools/make_mod.ts",
"bench:deno-redis": "DENO_NO_PACKAGE_JSON=1 deno run --unstable --allow-net=127.0.0.1:6379 --allow-read --allow-env --allow-write=tmp --import-map=benchmark/import_map.json benchmark/deno-redis.ts",
"bench:ioredis": "node benchmark/ioredis.js"
}
Expand Down
2 changes: 1 addition & 1 deletion errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class InvalidStateError extends Error {
}
}

export function isRetriableError(error: Error): boolean {
export function isRetriableError(error: unknown): boolean {
return (error instanceof Deno.errors.BadResource ||
error instanceof Deno.errors.BrokenPipe ||
error instanceof Deno.errors.ConnectionAborted ||
Expand Down
7 changes: 6 additions & 1 deletion experimental/cluster/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ class ClusterExecutor implements CommandExecutor {
const reply = await r.sendCommand(command, args, options);
return reply;
} catch (err) {
lastError = err;
if (err instanceof Error) {
lastError = err;
} else {
throw err; // An unexpected error occurred.
}

if (err instanceof Deno.errors.BadResource) {
tryRandomNode = true;
if (ttl < kRedisClusterRequestTTL / 2) {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function ensureTerminated(
await process.status;
} catch (error) {
const alreadyKilled = error instanceof TypeError &&
error.message === "Child process has already terminated.";
error.message === "Child process has already terminated";
if (alreadyKilled) {
return;
}
Expand Down
14 changes: 9 additions & 5 deletions tools/make_mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ interface Node {
declarationKind: "export" | "private";
}

async function doc(fileName: string): Promise<Array<Node>> {
interface Doc {
nodes: Array<Node>;
}

async function doc(fileName: string): Promise<Doc> {
const deno = new Deno.Command(Deno.execPath(), {
args: ["doc", "--json", fileName],
});
Expand Down Expand Up @@ -52,7 +56,7 @@ let content = `// Generated by tools/make_mod.ts. Don't edit.\n`;
// Expose public variables from protocol/shared/types.ts
{
const fileName = "protocol/shared/types.ts";
const variables = (await doc(fileName)).filter((node) => {
const variables = (await doc(fileName)).nodes.filter((node) => {
return node.kind === "variable";
}).map((node) => node.name);
content += `export { ${variables.join(",")} } from "./${fileName}";\n`;
Expand All @@ -61,7 +65,7 @@ let content = `// Generated by tools/make_mod.ts. Don't edit.\n`;
// Expose public functions from redis.ts.
{
const fileName = "redis.ts";
const functions = (await doc(fileName)).filter((node) => {
const functions = (await doc(fileName)).nodes.filter((node) => {
return node.kind === "function";
}).map((node) => node.name);
content += `export { ${functions.join(",")} } from "./${fileName}";\n`;
Expand All @@ -70,15 +74,15 @@ let content = `// Generated by tools/make_mod.ts. Don't edit.\n`;
// Expose public classes from errors.ts
{
const fileName = "errors.ts";
const classes = (await doc(fileName)).filter((node) => {
const classes = (await doc(fileName)).nodes.filter((node) => {
return node.kind === "class";
}).map((node) => node.name);
content += `export { ${classes.join(",")} } from "./${fileName}";\n`;
}

// Expose types from *.ts.
for (const f of files) {
const types = (await doc(f)).filter((node) => {
const types = (await doc(f)).nodes.filter((node) => {
return (node.kind === "interface" || node.kind === "typeAlias") &&
node.declarationKind !== "private";
}).map((node) => node.name);
Expand Down

0 comments on commit 346d9c8

Please sign in to comment.