Skip to content

Commit

Permalink
fix: 1.40 deprecation warnings (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauorriols authored Jan 26, 2024
1 parent 9085102 commit f21311b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions deployctl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

// Copyright 2021 Deno Land Inc. All rights reserved. MIT license.

// deno-lint-ignore-file no-deprecated-deno-api
import { semverGreaterThanOrEquals, setColorEnabled } from "./deps.ts";
import { Args, parseArgs } from "./src/args.ts";
import { error } from "./src/error.ts";
Expand All @@ -16,6 +15,7 @@ import { fetchReleases, getConfigPaths } from "./src/utils/info.ts";
import configFile from "./src/config_file.ts";
import inferConfig from "./src/config_inference.ts";
import { wait } from "./src/utils/spinner.ts";
import { isTerminal } from "./src/utils/mod.ts";

const help = `deployctl ${VERSION}
Command line tool for Deno Deploy.
Expand All @@ -42,7 +42,7 @@ const args = parseArgs(Deno.args);

setColoring(args);

if (Deno.isatty(Deno.stdin.rid)) {
if (isTerminal(Deno.stdin)) {
let latestVersion;
// Get the path to the update information json file.
const { updatePath } = getConfigPaths();
Expand Down Expand Up @@ -160,7 +160,7 @@ function setColoring(args: Args) {
}

function setAutoColoring() {
if (Deno.isatty(Deno.stdout.rid)) {
if (isTerminal(Deno.stdout)) {
setColorEnabled(true);
} else {
setColorEnabled(false);
Expand Down
2 changes: 1 addition & 1 deletion deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export {
Spinner,
type SpinnerOptions,
wait,
} from "https://raw.githubusercontent.com/denosaurs/wait/9471d5cb37f31065fd867c85a8b1511091a24ee7/mod.ts";
} from "https://raw.githubusercontent.com/denosaurs/wait/453df8babdd72c59d865c5a616c5b04ee1154b9f/mod.ts";

export * as tty from "https://deno.land/x/[email protected]/mod.ts";
4 changes: 2 additions & 2 deletions src/subcommands/top.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2021 Deno Land Inc. All rights reserved. MIT license.

// deno-lint-ignore-file no-deprecated-deno-api
import { Args } from "../args.ts";
import { API } from "../utils/api.ts";
import TokenProvisioner from "../utils/access_token.ts";
Expand All @@ -9,6 +8,7 @@ import { delay, encodeHex, tty } from "../../deps.ts";
import { error } from "../error.ts";
import { ProjectStats } from "../utils/api_types.ts";
import { sha256 } from "../utils/hashing_encoding.ts";
import { isTerminal } from "../utils/mod.ts";

const help = `
Project monitoring (ALPHA)
Expand Down Expand Up @@ -58,7 +58,7 @@ export default async function topSubcommand(args: Args) {
format = args.format;
break;
case undefined:
format = Deno.isatty(Deno.stdout.rid) ? "table" : "json";
format = isTerminal(Deno.stdout) ? "table" : "json";
break;
default:
error(
Expand Down
12 changes: 12 additions & 0 deletions src/utils/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import { semverGreaterThanOrEquals } from "../../deps.ts";

export { parseEntrypoint } from "./entrypoint.ts";
export { API, APIError } from "./api.ts";
export { walk } from "./walk.ts";
export { fromFileUrl, resolve } from "../../deps.ts";

// deno-lint-ignore no-explicit-any
export function isTerminal(stream: any) {
if (semverGreaterThanOrEquals(Deno.version.deno, "1.40.0")) {
return stream.isTerminal();
} else {
// deno-lint-ignore no-deprecated-deno-api
return Deno.isatty(stream.rid);
}
}
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const VERSION = "1.10.2";
export const VERSION = "1.10.3";

export const MINIMUM_DENO_VERSION = "1.28.3";

0 comments on commit f21311b

Please sign in to comment.