Skip to content

Commit

Permalink
fix(lint): ensure that deno lint passes
Browse files Browse the repository at this point in the history
Deno lint was failing due to the deprecation of Deno.copy as well as a re-declared global identifier
for $. Both of these issues are now fixed, however as a side effect, the version of the std library
needed to be updated to have access to the ioutil.copy method, and since the std lib was updated to
the latest, the supported semver version of deno in the readme also needed to be udpate.
  • Loading branch information
andrewbrey authored and c4spar committed Aug 13, 2021
1 parent 6b106b9 commit 513a4da
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-dzx?label=issues&logo=github">
</a>
<a href="https://deno.land/">
<img alt="Deno version" src="https://img.shields.io/badge/deno-^1.10.0-blue?logo=deno&color=blue" />
<img alt="Deno version" src="https://img.shields.io/badge/deno-^1.13.0-blue?logo=deno&color=blue" />
</a>
<a href="https://github.com/c4spar/deno-dzx/blob/main/LICENSE">
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-dzx?logo=github" />
Expand Down
4 changes: 2 additions & 2 deletions src/cli/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Command, ValidationError } from "./deps.ts";
import { Command, copy, ValidationError } from "./deps.ts";
import { error } from "../_utils.ts";
import { path } from "../../mod.ts";

Expand All @@ -14,7 +14,7 @@ export function bundleCommand() {
}
script = await Deno.makeTempFile({ suffix: ".ts" });
const tmpFile = await Deno.open(script, { write: true });
await Deno.copy(Deno.stdin, tmpFile);
await copy(Deno.stdin, tmpFile);
tmpFile.close();
}
console.log(
Expand Down
4 changes: 2 additions & 2 deletions src/cli/compile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { preBundle } from "./bundle.ts";
import { error } from "../_utils.ts";
import { Command, ValidationError } from "./deps.ts";
import { Command, copy, ValidationError } from "./deps.ts";

export function compileCommand() {
return new Command<void>()
Expand Down Expand Up @@ -39,7 +39,7 @@ export function compileCommand() {
}
script = await Deno.makeTempFile();
const tmpFile = await Deno.open(script);
await Deno.copy(Deno.stdin, tmpFile);
await copy(Deno.stdin, tmpFile);
}
if (["-h", "--help"].includes(script)) {
this.showHelp();
Expand Down
1 change: 1 addition & 0 deletions src/cli/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { Command } from "https://deno.land/x/cliffy@v0.18.2/command/command.ts";
export {
ValidationError,
} from "https://deno.land/x/cliffy@v0.18.2/flags/_errors.ts";
export { copy } from "https://deno.land/std@0.104.0/io/mod.ts";
22 changes: 11 additions & 11 deletions src/runtime/deps.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
export * as async from "https://deno.land/std@0.93.0/async/mod.ts";
export type { Deferred } from "https://deno.land/std@0.93.0/async/mod.ts";
export * as path from "https://deno.land/std@0.93.0/path/mod.ts";
export * as async from "https://deno.land/std@0.104.0/async/mod.ts";
export type { Deferred } from "https://deno.land/std@0.104.0/async/mod.ts";
export * as path from "https://deno.land/std@0.104.0/path/mod.ts";
export type {
FormatInputPathObject,
GlobOptions,
GlobToRegExpOptions,
ParsedPath,
} from "https://deno.land/std@0.93.0/path/mod.ts";
export * as io from "https://deno.land/std@0.93.0/io/mod.ts";
export type { ReadLineResult } from "https://deno.land/std@0.93.0/io/mod.ts";
export * as fs from "https://deno.land/std@0.93.0/fs/mod.ts";
export * as log from "https://deno.land/std@0.93.0/log/mod.ts";
} from "https://deno.land/std@0.104.0/path/mod.ts";
export * as io from "https://deno.land/std@0.104.0/io/mod.ts";
export type { ReadLineResult } from "https://deno.land/std@0.104.0/io/mod.ts";
export * as fs from "https://deno.land/std@0.104.0/fs/mod.ts";
export * as log from "https://deno.land/std@0.104.0/log/mod.ts";
export type {
LevelName,
LogConfig,
} from "https://deno.land/std@0.93.0/log/mod.ts";
export * as flags from "https://deno.land/std@0.93.0/flags/mod.ts";
} from "https://deno.land/std@0.104.0/log/mod.ts";
export * as flags from "https://deno.land/std@0.104.0/flags/mod.ts";
export type {
ArgParsingOptions,
Args,
} from "https://deno.land/std@0.93.0/flags/mod.ts";
} from "https://deno.land/std@0.104.0/flags/mod.ts";
export { colors } from "https://deno.land/x/cliffy@v0.18.2/ansi/colors.ts";
export { default as shq } from "https://esm.sh/shq@1.0.2";
4 changes: 2 additions & 2 deletions src/runtime/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { cd } from "./cd.ts";
import { exec } from "./exec.ts";
import { quote } from "./quote.ts";

export type $ = typeof exec & typeof colors & {
export type $Global = typeof exec & typeof colors & {
shell: string;
prefix: string;
mainModule: string;
Expand All @@ -17,7 +17,7 @@ export type $ = typeof exec & typeof colors & {
time: number;
};

export const $: $ = exec as $;
export const $: $Global = exec as $Global;

Object.setPrototypeOf($, Object.getPrototypeOf(colors));

Expand Down
8 changes: 4 additions & 4 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {
$,
$Global,
async as _async,
cd as _cd,
flags as _flags,
Expand All @@ -25,7 +25,7 @@ import type {

declare global {
// dzx
const $: $;
const $: $Global;
const cd: typeof _cd;
const quote: typeof _quote;

Expand Down Expand Up @@ -64,7 +64,7 @@ declare global {

interface Window {
// dzx
$: $;
$: $Global;
cd: typeof _cd;
quote: typeof _quote;

Expand All @@ -79,7 +79,7 @@ declare global {

interface WorkerGlobalScope {
// dzx
$: $;
$: $Global;
cd: typeof _cd;
quote: typeof _quote;

Expand Down

0 comments on commit 513a4da

Please sign in to comment.