Skip to content

Commit

Permalink
fix: updated some types for deno 0.38.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ronhippler committed Mar 30, 2020
1 parent 800fc99 commit db6e602
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions denon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ if (import.meta.main) {
"--": true
});

const remaningFlags = flags._.map(f => String(f));

if (flags.debug) {
config.debug = flags.debug;
}
Expand Down Expand Up @@ -110,18 +112,18 @@ if (import.meta.main) {
}

if (config.files.length < 1) {
if (flags._.length < 1 || !(await exists(flags._[0]))) {
if (remaningFlags.length < 1 || !(await exists(remaningFlags[0]))) {
fail(
"Could not start denon because no file was provided, use -h for help"
);
}
}

if (flags._[0]) {
if (!(await exists(flags._[0]))) {
if (remaningFlags[0]) {
if (!(await exists(remaningFlags[0]))) {
fail("Could not start denon because file does not exist");
} else {
const file = resolve(flags._[0]);
const file = resolve(remaningFlags[0]);

config.files.push(file);
config.watch.push(dirname(file));
Expand Down Expand Up @@ -174,7 +176,7 @@ if (import.meta.main) {

debug(`Running "${args.join(" ")}"`);
proc = Deno.run({
args: args
cmd: args
});
};
};
Expand Down
10 changes: 5 additions & 5 deletions watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ export async function* watch(
{
interval = 500,
maxDepth = Infinity,
exts = null,
match = null,
skip = null
exts = undefined,
match = undefined,
skip = undefined
}: WatchOptions = {}
): AsyncGenerator<FileChange[]> {
let prevFiles = {};
let prevFiles: { [filename: string]: number | null } = {};

// First walk the target path so we dont create `Created` events for files that are already there
for await (const { filename, info } of walk(target, {
Expand All @@ -64,7 +64,7 @@ export async function* watch(
}

while (true) {
const currFiles = {};
const currFiles: { [filename: string]: number | null } = {};
const changes = [];
const start = Date.now();

Expand Down

0 comments on commit db6e602

Please sign in to comment.