Skip to content

Commit

Permalink
fix: deno 1.4.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4k committed Sep 14, 2020
1 parent 8fe6b80 commit 7c1e3e4
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ To install denon simply enter the following into a terminal:
#### deno.land

```bash
$ deno install --allow-read --allow-run --allow-write --allow-net -f -q --unstable https://deno.land/x/denon@2.3.3/denon.ts
$ deno install --allow-read --allow-run --allow-write --allow-net -f -q --unstable https://deno.land/x/denon@2.4.0/denon.ts
```

#### nest.land

```bash
$ deno install --allow-read --allow-run --allow-write --allow-net -f -q --unstable https://x.nest.land/denon@2.3.3/denon.ts
$ deno install --allow-read --allow-run --allow-write --allow-net -f -q --unstable https://x.nest.land/denon@2.4.0/denon.ts
```

> ⚠️ Make sure you are using `deno` version `^1.3.0` to install this executable. You can upgrade running `deno upgrade`.
Expand Down
2 changes: 1 addition & 1 deletion assets/example.cast
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{"version": 2, "width": 61, "height": 58, "timestamp": 1598897156, "env": {"SHELL": "/bin/zsh", "TERM": "xterm-256color"}}
[0.100668, "o", "\u001b[34m[*]\u001b[39m \u001b[90m[\u001b[3mmain\u001b[23m]\u001b[39m \u001b[0mv2.3.3\u001b[0m\r\n"]
[0.100668, "o", "\u001b[34m[*]\u001b[39m \u001b[90m[\u001b[3mmain\u001b[23m]\u001b[39m \u001b[0mv2.4.0\u001b[0m\r\n"]
[0.151823, "o", "\u001b[34m[*]\u001b[39m \u001b[90m[\u001b[3mdaem\u001b[23m]\u001b[39m \u001b[0mwatching path(s): *.*\u001b[0m\r\n\u001b[34m[*]\u001b[39m \u001b[90m[\u001b[3mdaem\u001b[23m]\u001b[39m \u001b[0mwatching extensions: ts,tsx,js,jsx,json\u001b[0m\r\n"]
[0.151927, "o", "\u001b[33m[!]\u001b[39m \u001b[90m[\u001b[3m#0\u001b[23m]\u001b[39m \u001b[0mstarting `deno run --allow-env --allow-net oak.ts`\u001b[0m\r\n"]
[0.267581, "o", "Webserver listening to \u001b[32m:9001\u001b[39m\r\n"]
Expand Down
2 changes: 1 addition & 1 deletion assets/example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 7 additions & 11 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020-present the denosaurs team. All rights reserved. MIT license.

// provide better logging, see src/log.ts
export * as log from "https://deno.land/x/[email protected].0/mod.ts";
export * as log from "https://deno.land/x/[email protected].1/mod.ts";

// colors for a pretty cli
export {
Expand All @@ -14,20 +14,20 @@ export {
italic,
red,
gray,
} from "https://deno.land/std@0.68.0/fmt/colors.ts";
} from "https://deno.land/std@0.69.0/fmt/colors.ts";

// configuration reading
export {
exists,
existsSync,
walk, // ... and one type of file monitoring
} from "https://deno.land/std@0.68.0/fs/mod.ts";
} from "https://deno.land/std@0.69.0/fs/mod.ts";

// configuration parsing (YAML)
export {
JSON_SCHEMA,
parse as parseYaml,
} from "https://deno.land/std@0.68.0/encoding/yaml.ts";
} from "https://deno.land/std@0.69.0/encoding/yaml.ts";

// file watching and directory matching
export {
Expand All @@ -36,14 +36,10 @@ export {
extname,
resolve,
globToRegExp,
} from "https://deno.land/[email protected]/path/mod.ts";

// configuration parsing and writing (JSON)
export { readJson } from "https://deno.land/[email protected]/fs/read_json.ts";
export { writeJson } from "https://deno.land/[email protected]/fs/write_json.ts";
} from "https://deno.land/[email protected]/path/mod.ts";

// event control
export { deferred, delay } from "https://deno.land/std@0.68.0/async/mod.ts";
export { deferred, delay } from "https://deno.land/std@0.69.0/async/mod.ts";

// permission management
export { grant } from "https://deno.land/std@0.68.0/permissions/mod.ts";
export { grant } from "https://deno.land/std@0.69.0/permissions/mod.ts";
2 changes: 1 addition & 1 deletion egg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "https://github.com/denosaurs/denon.git",
"stable": true,
"unlisted": false,
"version": "2.3.3",
"version": "2.4.0",
"files": [
"./assets/**/*",
"./README.md",
Expand Down
17 changes: 12 additions & 5 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ import {
extname,
JSON_SCHEMA,
parseYaml,
readJson,
resolve,
globToRegExp,
log,
} from "../deps.ts";

import { WatcherConfig } from "./watcher.ts";
import { RunnerConfig } from "./runner.ts";
import type { Args } from "./args.ts";
import type { RunnerConfig } from "./runner.ts";
import type { Template } from "./templates.ts";
import type { WatcherConfig } from "./watcher.ts";

import { merge } from "./merge.ts";
import { Args } from "./args.ts";
import { Template } from "./templates.ts";

const logger = log.create("conf");

Expand Down Expand Up @@ -77,11 +76,19 @@ async function readYaml(file: string): Promise<unknown> {
});
}

/** Read JSON config, throws if JSON format is not valid */
async function readJson(file: string): Promise<unknown> {
const source = await Deno.readTextFile(file);
return JSON.parse(source);
}


/** Safe import a TypeScript file */
async function importConfig(
file: string,
): Promise<Partial<DenonConfig> | undefined> {
try {
// deno-lint-ignore no-undef
const configRaw = await import(`file://${resolve(file)}`);
return configRaw.default as Partial<DenonConfig>;
} catch (error) {
Expand Down
6 changes: 3 additions & 3 deletions src/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { log } from "../deps.ts";

import { Denon, DenonEvent } from "../denon.ts";
import { CompleteDenonConfig } from "./config.ts";
import { ScriptOptions } from "./scripts.ts";
import type { Denon, DenonEvent } from "../denon.ts";
import type { CompleteDenonConfig } from "./config.ts";
import type { ScriptOptions } from "./scripts.ts";

const logger = log.create("daem");

Expand Down
2 changes: 1 addition & 1 deletion test_deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
export {
assertEquals,
assert,
} from "https://deno.land/std@0.68.0/testing/asserts.ts";
} from "https://deno.land/std@0.69.0/testing/asserts.ts";

0 comments on commit 7c1e3e4

Please sign in to comment.