diff --git a/README.md b/README.md index 7630d14..e1682fd 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/assets/example.cast b/assets/example.cast index 5c2fbf2..ce2b279 100644 --- a/assets/example.cast +++ b/assets/example.cast @@ -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"] diff --git a/assets/example.svg b/assets/example.svg index 75fe529..299cde9 100644 --- a/assets/example.svg +++ b/assets/example.svg @@ -1 +1 @@ -[*][main]v2.3.3[*][daem]watchingpath(s):*.*[*][daem]watchingextensions:ts,tsx,js,jsx,json[!][#0]starting`denorun--allow-env--allow-netoak.ts`Webserverlisteningto:9001[*][daem]restartingduetochanges...^C \ No newline at end of file +[*][main]v2.4.0[*][daem]watchingpath(s):*.*[*][daem]watchingextensions:ts,tsx,js,jsx,json[!][#0]starting`denorun--allow-env--allow-netoak.ts`Webserverlisteningto:9001[*][daem]restartingduetochanges...^C \ No newline at end of file diff --git a/deps.ts b/deps.ts index 9f071f1..e0b95b3 100644 --- a/deps.ts +++ b/deps.ts @@ -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/branch@0.1.0/mod.ts"; +export * as log from "https://deno.land/x/branch@0.1.1/mod.ts"; // colors for a pretty cli export { @@ -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 { @@ -36,14 +36,10 @@ export { extname, resolve, globToRegExp, -} from "https://deno.land/std@0.68.0/path/mod.ts"; - -// configuration parsing and writing (JSON) -export { readJson } from "https://deno.land/std@0.68.0/fs/read_json.ts"; -export { writeJson } from "https://deno.land/std@0.68.0/fs/write_json.ts"; +} from "https://deno.land/std@0.69.0/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"; diff --git a/egg.json b/egg.json index de00469..b094adb 100644 --- a/egg.json +++ b/egg.json @@ -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", diff --git a/src/config.ts b/src/config.ts index 9c1737a..099ae4a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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"); @@ -77,11 +76,19 @@ async function readYaml(file: string): Promise { }); } +/** Read JSON config, throws if JSON format is not valid */ +async function readJson(file: string): Promise { + const source = await Deno.readTextFile(file); + return JSON.parse(source); +} + + /** Safe import a TypeScript file */ async function importConfig( file: string, ): Promise | undefined> { try { + // deno-lint-ignore no-undef const configRaw = await import(`file://${resolve(file)}`); return configRaw.default as Partial; } catch (error) { diff --git a/src/daemon.ts b/src/daemon.ts index aba61c0..3262aba 100644 --- a/src/daemon.ts +++ b/src/daemon.ts @@ -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"); diff --git a/test_deps.ts b/test_deps.ts index 22c0cd1..b080919 100644 --- a/test_deps.ts +++ b/test_deps.ts @@ -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";