Giter Club home page Giter Club logo

denon's People

Contributors

a2-nier avatar brandonpsmith avatar codacy-badger avatar eliassjogreen avatar femave avatar freshfish70 avatar hong4rc avatar kamekyame avatar kylejune avatar leonelv avatar littledivy avatar mustachedninja avatar neale-forrest avatar nnmrts avatar notfilippo avatar olaven avatar pabloszx avatar pavelflegr avatar qu4k avatar ronhippler avatar t8 avatar taiprogramer avatar u-ways avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

denon's Issues

Installation Error

Trying to install denon on my laptop using

deno install denon --allow-read --allow-run https://deno.land/x/denon/denon.ts 

But it yields this error

error TS2345: Argument of type '{ cmd: string[]; }' is not assignable to parameter of type 'RunOptions'.

Object literal may only specify known properties, and 'cmd' does not exist in type 'RunOptions'.

What could be the issue?

deno_args are loaded empty from config file

Using a config file .denon.json with the content

{
    "files": [
        "src/main.ts"
    ],
    "quiet": false,
    "debug": true,
    "fullscreen": true,
    "extensions": [
        ".js",
        ".ts",
        ".json"
    ],
    "interval": 500,
    "watch": [
        "src"
    ],
    "execute": {
        ".js": [
            "deno",
            "run"
        ],
        ".ts": [
            "deno",
            "run"
        ]
    },
    "deno_args": [
        "--allow-net",
        "--allow-read",
        "--lock=lock.json",
        "--lock-write"
    ],
    "fmt": true,
    "test": true
}

when running denon --debugshow that the deno_args array is empty

[DENON] Debug enabled!
[DENON] Required permissions "read" and "run" granted
[DENON] Reading config from .denon | .denon.json | .denonrc | .denonrc.json
[DENON] Args: --debug
[DENON] Flags: {"debug":true,"help":false,"fullscreen":false,"quiet":false,"files":[],"runnerFlags":[],"deno_args":[],"fmt":false,"test":false}
[DENON] Config: {"files":["src/main.ts"],"quiet":false,"debug":true,"fullscreen":false,"extensions":[".js",".ts",".json"],"interval":500,"watch":["src"],**"deno_args":[],**"execute":{".js":["deno","run"],".ts":["deno","run"]},"fmt":false,"test":false}
[DENON] Files: /***/deno/deno-test/src/main.ts
[DENON] Paths: /***/deno/deno-test/src
[DENON] Running "deno run /***/deno/deno-test/src/main.ts"
[DENON] Creating watchers
[DENON] Creating watcher for paths "/***/deno/deno-test/src"
[DENON] Watching /***/deno/deno-test/src
error: Uncaught PermissionDenied: network access to "localhost:1234", run again with the --allow-net flag
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
    at Object.listen ($deno$/ops/net.ts:51:10)
    at listen ($deno$/net.ts:152:22)
    at Application.serve (server.ts:261:20)
    at Application.listen (application.ts:106:31)
    at startServer (file:///***/deno/deno-test/src/server.ts:19:13)
    at file:///***/deno/deno-test/src/main.ts:8:7

Seems like they get overwritten by the the default flags. applyIfDefined seems to do that.

Trigger failsafe if many reloads are triggered

Not sure if this is the correct way to do it, but I wanted to save a cache script I could easily run.

"cache": {
      "desc": "Cache versions and update lock file",
      "cmd": "deno cache server.ts --lock-write",
      "lock": "./lock.json"
}

The result however when running denon cache is an endless loop instead of just executing it once, looks like this:

Skรคrmavbild 2020-05-29 kl  19 10 40

Now is this a bug or aren't you suppose to add and execute scripts in this way?

Error when installing

error: TS2345 [ERROR]: Argument of type '{ type: string; }' is not assignable to parameter of type 'string'.
await Deno.symlink(originSrcFilePath, dest, {

at https://deno.land/[email protected]/fs/copy.ts:117:49

TS2345 [ERROR]: Argument of type '{ type: string; }' is not assignable to parameter of type 'string'.
Deno.symlinkSync(originSrcFilePath, dest, {

at https://deno.land/[email protected]/fs/copy.ts:141:47

TS2345 [ERROR]: Argument of type '{ type: string; }' is not assignable to parameter of type 'string'.
await Deno.symlink(src, dest, {

at https://deno.land/[email protected]/fs/ensure_symlink.ts:33:35

TS2345 [ERROR]: Argument of type '{ type: string; }' is not assignable to parameter of type 'string'.
Deno.symlinkSync(src, dest, {

at https://deno.land/[email protected]/fs/ensure_symlink.ts:65:33

Found 4 errors.

i'm using xubuntu 20.04

Tests not running anymore?

Just updated, and it seems deno test is not run anymore, and as mentioned here #50 it's not possible to have &/&& to run multiple commands one after another?

Maybe adding a "test" to a scripts-object would be useful. (this has been an option before i updated though it was in the main config; seems like it isn't mentioned in the README anymore, has it been removed?)

Support for sequential scripts

I am using denon inside a Docker container build with the hayd deno image and would like to support file watching/restart that rebundles my client scripts then runs server.ts... however, I don't believe I am able to do this without passing multiple cmds into my denon.json script... If I use multiple scripts, denon hangs on the first one called, and if I pre bundle, then I am only getting file watching/restart on my server-side code.

Deno requests network access. Grant?

Describe the bug
With each run of denon, I get this question:

๏ธโš ๏ธ Deno requests network access. Grant? [g/d (g = grant, d = deny)]

To Reproduce
Steps to reproduce the behavior:
1. denon --allow-net

Expected behavior
--allow-net should avoid this question

Setup

  • OS: Ubuntu 20.04, WSL2
  • Deno version: 1.1.1
  • Denon version: 2.2.0

Can't find scripts

Denon can't see scripts property in denon.config.ts.

To Reproduce

// denon.config.ts
import { DenonConfig } from "https://deno.land/x/denon/mod.ts";

const config: DenonConfig = {
  scripts: {
    build: {
      cmd: "build.ts",
      desc: "run my build.ts file",
    },
  },
};
export default config;

run denon to view scripts
output is

[denon] v2.1.0
[denon] It looks like you don't have any scripts...
[denon] You can add scripts to your `denon.config.ts` file. Check the docs.

Expected behavior
denon should list build as a script

Setup

  • OS: Windows
  • Deno version: 1.0.4
  • Denon version: 2.1.0

Bad resource ID

This seems to happen a lot when I ctrl + s and the process restarts, any idea on why?

error: Uncaught BadResource: Bad resource ID
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
    at async runStatus ($deno$/process.ts:22:15)
    at async Daemon.monitor (https://deno.land/x/denon/src/daemon.ts:63:15)

My .denon.json file:

{
  "scripts": {
    "start": {
      "cmd": "deno run ./src/index.ts",
      "desc": "Starting up Client...",
      "allow": [
        "env", "hrtime", "read", "net"
      ],
      "unstable": true
    },
    "test": {
      "cmd": "deno test tests/tests.ts",
      "desc": "Running tests...",
      "allow": [
        "env", "read"
      ]
    }
  }
}

v2.0.0 not working

Please see attached screenshots.

If I use denon --allow-net run index.js as per the README then I get a crash. If I use denon run --allow-net index.js it seems to work, but when I update the file nothing happens.

deno 1.0.2

Screenshot from 2020-05-23 11-11-55
Screenshot from 2020-05-23 11-12-28

deno.json match subdirectory

Describe the bug
Specifying directory in match section of deno.json does not seem to have an effect.

To Reproduce
Add:
"match": [
".",
"./client/*"
],
to deno.json
start denon using: denon run --allow-read --allow-net server.ts
Change any files in the ./client/ directory but deno does not re-start.

Expected behavior
deno should restart when a file in ./client/ directory is changed.

Configuration or Project
{ "$schema": "https://deno.land/x/denon/schema.json", "scripts": { "start": { "cmd": "server.ts", "desc": "Run the main server.", "allow": [ "env", "net", "write" ], "unstable": true } }, "watcher": { "interval": 350, "exts": [ "jsx", "tsx", "ts", "js", "json", "html" ], "match": [ "*.*", "./client/*" ], "skip": [ "*/.git/*" ], "legacy": false } }

Setup

  • OS: Ubuntu 20.04 on WSL2
  • Deno version: 1.0.4
  • Denon version: 2.0.2

Issue when running!

I ahve imports map and custom tsconfig.

I usually run this
deno run -A --importmap=imports.json --config ./tsconfig.json index.ts

I have .denonrc.json

{
  "files": [
    "index.ts",
    "src/**/*.ts"
  ],
  "quiet": false,
  "debug": true,
  "fullscreen": true,
  "extensions": [
    "js",
    "ts",
    "json"
  ],
  "match": [
    "*.ts"
  ],
  "skip": [
    "*_test.ts",
    "*_test.js"
  ],
  "interval": 500,
  "watch": [
    "src/"
  ],
  "execute": {
    ".js": ["deno", "run"],
    ".ts": ["deno", "run"]
  }
}

When i run this denon -A --config .denonrc.json --importmap=imports.json index.ts, i have following error error: Uncaught #<Object>

Use from code

Denon is currently easiest used with a config file but should be easier to use from code. This would allow for more programmatically assigned configuration options, etc. Another perk of this could perhaps be easier use of events.

Can not install

Administrator@TAIDEPTRAI-PC MINGW64 /d/Code/hello-deno
$ deno install --unstable --allow-read --allow-run -f https://deno.land/x/denon/denon.ts
Download https://deno.land/x/denon/denon.ts
Compile https://deno.land/x/denon/denon.ts
Download https://deno.land/x/denon/deps.ts
Download https://deno.land/x/denon/cli.ts
Download https://deno.land/x/denon/denon_config.ts
Download https://deno.land/x/denon/log.ts
Download https://deno.land/x/denon/watcher.ts
Download https://deno.land/[email protected]/flags/mod.ts
Download https://deno.land/[email protected]/fs/mod.ts
Download https://deno.land/[email protected]/path/mod.ts
Download https://deno.land/[email protected]/async/mod.ts
Download https://deno.land/[email protected]/fmt/mod.ts
Download https://deno.land/[email protected]/permissions/mod.ts
Download https://deno.land/[email protected]/testing/asserts.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/testing/diff.ts
Download https://deno.land/[email protected]/fs/empty_dir.ts
Download https://deno.land/[email protected]/fs/ensure_dir.ts
Download https://deno.land/[email protected]/fs/ensure_file.ts
Download https://deno.land/[email protected]/fs/ensure_link.ts
Download https://deno.land/[email protected]/fs/ensure_symlink.ts
Download https://deno.land/[email protected]/fs/exists.ts
Download https://deno.land/[email protected]/fs/expand_glob.ts
Download https://deno.land/[email protected]/fs/move.ts
Download https://deno.land/[email protected]/fs/copy.ts
Download https://deno.land/[email protected]/fs/read_file_str.ts
Download https://deno.land/[email protected]/fs/write_file_str.ts
Download https://deno.land/[email protected]/fs/read_json.ts
Download https://deno.land/[email protected]/fs/write_json.ts
Download https://deno.land/[email protected]/fs/walk.ts
Download https://deno.land/[email protected]/fs/eol.ts
Download https://deno.land/[email protected]/path/win32.ts
Download https://deno.land/[email protected]/path/posix.ts
Download https://deno.land/[email protected]/path/common.ts
Download https://deno.land/[email protected]/path/separator.ts
Download https://deno.land/[email protected]/path/interface.ts
Download https://deno.land/[email protected]/path/glob.ts
Download https://deno.land/[email protected]/path/_constants.ts
Download https://deno.land/[email protected]/path/_util.ts
Download https://deno.land/[email protected]/path/_globrex.ts
Download https://deno.land/[email protected]/fs/_util.ts
Download https://deno.land/[email protected]/async/deferred.ts
Download https://deno.land/[email protected]/async/delay.ts
Download https://deno.land/[email protected]/async/mux_async_iterator.ts
Download https://deno.land/[email protected]/fmt/sprintf.ts
error: TS2322 [ERROR]: Type 'string' is not assignable to type 'boolean'.
  return srcArray.reduce(
  
    at https://deno.land/[email protected]/fs/_util.ts:20:3

Not Watching Files

Hey,

With the --watch flag or options present, denon doesn't seem to watch for changes. I assume i can run a a Deno app with Denon, make a change to the file, and it would show the new change without restarting the server.

My Setup

  • Windows 10
  • Deno application using Drash, with Denon
  • Deno Version:
PS Some\Path\To\My\Project> deno --version
deno 0.33.0
v8 8.1.108
typescript 3.7.2

Command
I can running the following command to use denon to initiate the server:

Note: the below command is the way it is because after installing denon, the command for it isn't working and i can't be bothered to look into it yet

deno --allow-net --allow-read --allow-run --allow-env --allow-write https://deno.land/x/denon/denon.ts

Config

# .denonrc
{
    "files": [
        "app.ts"
    ],
    "quiet": false,
    "debug": true,
    "fullscreen": true,
    "extensions": [
        "js",
        "ts"
    ],
    "match": [
        "*.ts"
    ],
    "skip": [
        "*_test.ts",
        "*_test.js"
    ],
    "interval": 500,
    "watch": [
        "./"
    ],
    "execute": {
        ".ts": ["deno", "--allow-read", "--allow-env", "--allow-write", "--allow-run", "--allow-net"]
    }
}

Summary
Denon runs the app fine, it starts the correct file, and i can view the project in the browser, but watch doesn't 'seem' o be working, for example, i have a console.log('Hello'), i run the app, change the log text to console.log('Hello world'), but still see "Hello" and not "Hello World"

denon v2.1.0 CLI commands errors

an issue while using denon CLI commands
im trying to run denon --init and it responds with an error

PS D:\deno\denon> denon --init
๏ธโš ๏ธ Deno requests network access. Grant? [g/d (g = grant, d = deny)] g
[denon] fetching template from https://deno.land/x/[email protected]/templates/denon.json
[denon] denon.json is not a denon template. All templates are available on https://deno.land/x/[email protected]/templates/

and when i try to upgrade this error pops out

Screenshots
denon

Setup

  • OS: (windows,)
  • Deno version: (1.0.3)
  • Denon version: (V2.1.0)

Installation error on Windows/WSL

Hey guys, i have an issue while installing denon. I installed deno (v1.0.1) some minutes ago and now i've tried to install denon. I get this error on Windows and Windows WSL Ubuntu:

....
Compile https://deno.land/x/denon/denon.ts
error: TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
await Deno.symlink(originSrcFilePath, dest, type);
~~~~
at https://deno.land/[email protected]/fs/copy.ts:114:47

TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
Deno.symlinkSync(originSrcFilePath, dest, type);
~~~~
at https://deno.land/[email protected]/fs/copy.ts:132:45

TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
await Deno.symlink(src, dest, srcFilePathType);
~~~~~~~~~~~~~~~
at https://deno.land/[email protected]/fs/ensure_symlink.ts:31:33

TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
Deno.symlinkSync(src, dest, srcFilePathType);
~~~~~~~~~~~~~~~
at https://deno.land/[email protected]/fs/ensure_symlink.ts:58:31

Found 4 errors.

How to properly attach tsconfig.json?

Hello :)

files:
https://gist.github.com/Tnifey/5339e42b92348ab45dc96cca27ce9776

If i run deno run --config tsconfig.json test.ts
prints Decorator loaded [Function: Entity] without errors

but when I run denon

[DENON] Watching /mnt/s/test/test.ts, /mnt/s/test
Compile file:///mnt/s/test/test.ts
Decorator loaded [Function: Entity]
error: TS1219 [ERROR]: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' 
option in your 'tsconfig' or 'jsconfig' to remove this warning.
class Entity {
      ~~~~~~
    at file:///mnt/s/test/test.ts:8:7

prints error, like there is no tsconfig.json loaded but decorator is working

i tried to change "--config=tsconfig.json" in .denon.json to "--config tsconfig.json"
but it spits

error: Found argument '--config tsconfig.json' which wasn't expected, or isn't valid in this context
        Did you mean --config?

My question is how to properly attach tsconfig.json into .denon.json that it won't print any error?

Cannot find name 'env' in denon.config.ts

Describe the bug

As screenshots below:

Configuration or Project

import { DenonConfig } from "https://deno.land/x/denon/mod.ts"
export { config as env } from "https://deno.land/x/dotenv/mod.ts"

const config: DenonConfig = {
  env: env(), // Cannot find name 'env'
  scripts: {
    start: {
      cmd: "deno run src/server.ts",
      desc: "start from server.ts file",
      watch: true,
      env: {
        PORT: Deno.env.get('PORT') || "8080",
      },
      allow: [
        "env",
        "net",
        "read",
        "write",
        "plugin",
      ],
      unstable: true
    },
  },
  logger: {
    debug: true,
  },
  watcher: {
    exts: ["ts", "json", "ini"],
    skip: ["super_duper_secret/*"],
  },
}

export default config

Screenshots

Setup

  • OS: (e.g. macOS, windows, linux) MacOS
  • Deno version: (deno version) 1.0.5
  • Denon version: (denon --version) v2.2.0

Additional context

Why denon --version need to compile denon.config.ts instead of return version number directly?

typo in scripts.ts | inspect / inspect-brk

Hello :)
there is an error with inspect and inspect-brk in scripts config

$ denon start
[denon] v2.0.0
[denon] starting `deno run --allow-all --config tsconfig.json --inspect=localhost:9229} src/main.ts`
error: Invalid value for '--inspect=<HOST:PORT>': invalid IP address syntax

there is additional braces at end of pushed strings

flags.push(`--inspect=${options.inspect}}`);

flags.push(`--inspect-brk=${options.inspectBrk}}`);

denon upgrade

A denon upgrade command as an alias for deno install denon -f --allow-read --allow-run https://deno.land/x/denon/denon.ts would be useful. denon upgrade could be able to select version if entered otherwise it would just use latest. This would probably be done with denon upgrade v1.6.0

Events

Emit events that trigger certain scripts or commands, this would allow for live-reload of websites, linting, formatting etc. A good inspiration for events would be nodemon events. The events would also not block the normal function or executors of denon and should probably be called before the executors are called.

I propose that the bare minimum events would be:

  • start
  • restart
  • exit

And would be specified in the config like the following:

"events": {
	"start": "deno run ./setup.ts",
	"restart": "deno fmt",
	"exit": "deno run ./finish.ts"
}

Support for outputting the bundle to a file

Deno will create an executable file with e.g. deno bundle src.ts > dist.ts. It looks like this package currently supports bundling, but not really outputting the bundle to a file.

Plugins

Once events are implemented a use of them could be for plugins. These would be written in a specific denon plugin configuration file with only the events. These plugins could perhaps be written directly in deno and imported as such with #23. The plugins should be imported in the denonrc configuration files by an URL that extends the current configuration file with the event specific commands of the plugin.

An example denon plugin:

{
	"events": {
		"restart": "do live reload"
	}
}

The plugin would be imported like the following:

{
	"plugins": [
		"https://example.com/live_reload.json"
	]
}

Absolute path monitoring

Passing an absolute path on Linux to the match property doesn't work. It will ignore file changes in this path:

  "watcher": {
    "interval": 350,
    "exts": ["ts", "html"],
    "match": ["/home/user/javascript/myWebComponents/**/*.*"],
    "skip": ["*/.git/*"]
  }

It would make things easier if the watcher would accept absolute paths.

Feature Request: Implement Test Directories

What

Add the ability to select only certain directories for running tests

Why

Currently when using the flag or config --test denon runs deno test without an option to select which directories to look and run tests in.

Deno provides this option. ie:

$ deno test src/fetch_test.ts src/signal_test.ts

Giving this ability would allow us to have other folders and files in our root directory which are ignored.

Related files

https://github.com/eliassjogreen/denon/blob/a2d386958a41d21b94875b9ab11b0be2673e502c/denon.ts#L73
image
https://github.com/eliassjogreen/denon/blob/a2d386958a41d21b94875b9ab11b0be2673e502c/denon.ts#L158
image

https://github.com/eliassjogreen/denon/blob/a2d386958a41d21b94875b9ab11b0be2673e502c/cli.ts#L12

Suggested Solution

To implement this:

  1. add another argument to cli.ts deno_test_args.
  2. Remove adding working directory automatically to watch paths
  3. Create config.test_watch variable in denon.ts and use it here:
    https://github.com/eliassjogreen/denon/blob/a2d386958a41d21b94875b9ab11b0be2673e502c/denon.ts#L158
  4. Add tests

Background - How I found this issue

I had to use a local node_modules folder in a project as I can't quite make the shift over to deno completely yet. This meant that the test runner as it is traversed the node_modules directory and tried to run any tests it found there. Causing it to fail.
I solved this by building my own denon by removing the addition of the root directory and adding the ...config.watch argument to the end of the executor function shown above.

If you agree with the approach above I don't mind implementing this. Let me know.

denon [script name] doesn't kill app on reload

I have a simple web server application running with oak. When I use the command denon run --allow-net app.ts the auto reload successfully kill the webserver on each reload.

But when I use the denon dev command and using the denon.json file, the application isn't killed on each reload. For example, if I run the webserver on 8080 port, then change it to 8081 then save, I end up with 2 webserver. If I doesn't change the port between two save, I hand up with an error saying one app already use this port.

Here is my denon.json file
01

And my app.ts file
02

denon test and fmt broken

After updating deno and denon, denon test and fmt stopped working for me. I would usually just run denon test and it would run all my test files once I made a modification. With the current version, it just tells me I need to specify a file and if I do it appears to just run the file without running the tests. deno test and deno test binary_heap_test.ts both work but do not work with denon test.

$ deno install -Af --unstable https://deno.land/x/denon/denon.ts
Download https://deno.land/x/denon/denon.ts
Compile https://deno.land/x/denon/denon.ts
Download https://deno.land/x/denon/deps.ts
Download https://deno.land/x/denon/cli.ts
Download https://deno.land/x/denon/denon_config.ts
Download https://deno.land/x/denon/log.ts
Download https://deno.land/x/denon/watcher.ts
Download https://deno.land/[email protected]/flags/mod.ts
Download https://deno.land/[email protected]/fs/mod.ts
Download https://deno.land/[email protected]/path/mod.ts
Download https://deno.land/[email protected]/async/mod.ts
Download https://deno.land/[email protected]/fmt/mod.ts
Download https://deno.land/[email protected]/permissions/mod.ts
Download https://deno.land/[email protected]/testing/asserts.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/testing/diff.ts
Download https://deno.land/[email protected]/fs/empty_dir.ts
Download https://deno.land/[email protected]/fs/ensure_dir.ts
Download https://deno.land/[email protected]/fs/ensure_file.ts
Download https://deno.land/[email protected]/fs/ensure_link.ts
Download https://deno.land/[email protected]/fs/ensure_symlink.ts
Download https://deno.land/[email protected]/fs/exists.ts
Download https://deno.land/[email protected]/fs/expand_glob.ts
Download https://deno.land/[email protected]/fs/move.ts
Download https://deno.land/[email protected]/fs/copy.ts
Download https://deno.land/[email protected]/fs/read_file_str.ts
Download https://deno.land/[email protected]/fs/write_file_str.ts
Download https://deno.land/[email protected]/fs/read_json.ts
Download https://deno.land/[email protected]/fs/write_json.ts
Download https://deno.land/[email protected]/fs/walk.ts
Download https://deno.land/[email protected]/fs/eol.ts
Download https://deno.land/[email protected]/path/win32.ts
Download https://deno.land/[email protected]/path/posix.ts
Download https://deno.land/[email protected]/path/common.ts
Download https://deno.land/[email protected]/path/separator.ts
Download https://deno.land/[email protected]/path/interface.ts
Download https://deno.land/[email protected]/path/glob.ts
Download https://deno.land/[email protected]/path/_constants.ts
Download https://deno.land/[email protected]/path/_util.ts
Download https://deno.land/[email protected]/path/_globrex.ts
Download https://deno.land/[email protected]/fs/_util.ts
Download https://deno.land/[email protected]/async/deferred.ts
Download https://deno.land/[email protected]/async/delay.ts
Download https://deno.land/[email protected]/async/mux_async_iterator.ts
Download https://deno.land/[email protected]/fmt/sprintf.ts
โœ… Successfully installed denon
/home/kyle/.deno/bin/denon
$ denon test
[DENON] Could not start denon because no file was provided, use -h for help
$ denon test binary_heap_test.ts
[DENON] Watching /mnt/c/Users/kylej/projects/deno/collections
[DENON] Detected 1 change. Rerunning...
[DENON] Detected 1 change. Rerunning...

Uncaught NotFound: No such file or directory (os error 2)

Tried to install as per the docs, didn't work, said:

Add /Users/danknights/.deno/bin to PATH export PATH="/Users/danknights/.deno/bin:$PATH"

Added the path and tried again, the above message went away, tried denon init and got this:

[denon] v2.0.2
[denon] watching path(s): *.*
[denon] watching extensions: ts,js,json
[denon] starting `init`
error: Uncaught NotFound: No such file or directory (os error 2)
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
    at Object.run ($deno$/ops/process.ts:41:10)
    at Object.run ($deno$/process.ts:118:15)
    at Runner.execute (https://deno.land/x/denon/src/runner.ts:117:17)
    at Daemon.start (https://deno.land/x/denon/src/daemon.ts:45:40)
    at Daemon.iterate (https://deno.land/x/denon/src/daemon.ts:122:10)
    at iterate.next (<anonymous>)
    at https://deno.land/x/denon/denon.ts:144:18

Is this a bug or am I missing something?

Allow flag type warning

Describe the bug
I used the allow flag to specification (see the documentation : here), but the linter prints warning on the boolean type for the allow flag"env": true due to deno flag type (Array<String> | Object --> schema.json )

To Reproduce
Steps to reproduce the behavior:
1. Go to denon.json
2. Scroll down to env: true
3. See the warning: Incorrect type. Expected "string".

Expected behavior
No linter warning

Configuration or Project

{
  "$schema": "https://deno.land/x/denon/schema.json",
  "allow": {
    "net": true, 
    "env": true, 
    "read": true, 
    "write": true, 
    "plugin": true
  },
  "unstable": true,
  "inspect": "127.0.0.1:9229",
  "scripts": {
    "start": {
      "cmd": "deno run index.ts",
      "desc": "run my deno server file",
      "lock": "lock.json"
    }
  }
}

Screenshots
If applicable, add screenshots to help explain your problem.

Setup

  • OS: macOS v10.15.5
  • Deno version: 1.1.1
  • Denon version: v2.1.0

Deleted path

If a path currently being watched is deleted the following error is thrown:

error: Uncaught NotFound: The system cannot find the path specified. (os error 3)
โ–บ $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)

A nicer exception should be thrown by the watcher and cli should (probably) be able to handle it.

Inspect Config Doc is Incorrect

The documentation outlines you can use inspect in your config:

"inspect": "localhost:1234"

But Deno is saying localhost is not a valid host to use. If we switch localhost with 127.0.0.1 (or similar), it works:

"inspect": "127.0.0.1:1234"

How To Replicate
Add "inspect": "localhost:9229", to a script in your config and run

[doc] Clarify permissions format

In README#permissions, it shows this example:

Permission can be granted to child processes.

{
  // globally applied to all scripts
  "allow": {
    "read": "/etc", // --allow-read=/etc
    "env": true     // --allow-env
  },

  "scripts": {
    "start": {
      "cmd": "deno run app.ts",
      "desc": "Run the main server.",

      "allow": [
        "run", // --allow-run
        "net", // --allow-net
      ]
    }
  }
}

but it doesn't make clear which format/s is/are acceptable. For example:

  1. Does the top-level allow key accept an array of boolean values in addition to the object format?
  2. Does each script's allow key accept an object value (like the top-level example) with keys' values corresponding to granular permission values?
  3. How does the object format work if a permission has multiple values? Should an array be supplied, like so?
{
  "allow": {
    "read": [
      "/etc",
      "/opt"
    ], // --allow-read=/etc,/opt
    "env": true // --allow-env
  }
}

Watch Is Not An Option

In the documentation, it mentions watch can be used for an option in the allow property of a script which I don't believe is a supported option for Deno, and if used, errors:

Denon Config

// denon.json
{
  "scripts": {
    "start": {
      "cmd": "deno run app.ts",
      "desc": "Run the main server.",
      "allow": [
        "env",
        "net",
        "read",
        "write",
        "run"
      ],
      "inspect": "localhost:9229",
      "log": "debug"
    }
  },
  "watcher": {
    "interval": 350,
    "exts": ["js", "ts", "json"],
    "match": ["*.*"],
    "skip": [".git/*"],
    "legacy": false
  },
  "logger": {
    "fullscreen": false,
    "quiet": false,
    "debug": true
  }
}

Command Ran

// Note i haven't installed it - personal preference
deno run --unstable --allow-read --allow-run https://deno.land/x/denon/denon.ts start

Error

$ deno run --unstable --allow-read --allow-run https://deno.land/x/denon/denon.ts start
[denon] v2.0.2
[denon] watching path(s): *.*
[denon] watching extensions: js,ts,json
[denon] starting `deno run --allow-env --allow-net --allow-read --allow-write --allow-run --allow-watch --log-level debug --inspect=localhost:9229 app.ts`
 S: starting process with pid 10614
 M: monitoring status of process with pid 10614
error: Found argument '--allow-watch' which wasn't expected, or isn't valid in this context
        Did you mean --allow-write?

USAGE:
    deno run <SCRIPT_ARG>... --allow-env --allow-net=<allow-net> --allow-read=<allow-read> --allow-run --allow-write=<allow-write>

For more information try --help
 M: got status of process with pid 10614
 M: process with pid 10614 exited on its own
[denon] app crashed - waiting for file changes before starting ...

๐Ÿž Recommended install steps fail with 16 errors

The recommended install steps on the README fail with 16 type errors.

deno install denon https://deno.land/x/denon/denon.ts --allow-read --allow-run --allow-net

It appears Deno install now has stricter TypeScript configuration;

deno --version
deno 0.36.0
v8 8.1.310
typescript 3.8.3

Git Bash denon: command not found

Administrator@TAIDEPTRAI-PC MINGW64 ~
$ deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts
Download https://deno.land/x/denon/denon.ts
Download https://deno.land/x/denon/deps.ts
...
Compile https://deno.land/x/denon/denon.ts
โœ… Successfully installed denon
C:\Users\Administrator\.deno\bin\denon.cmd

Administrator@TAIDEPTRAI-PC MINGW64 ~
$ denon
bash: denon: command not found

Administrator@TAIDEPTRAI-PC MINGW64 ~
$

After this.
Close and open Git bash. Still not working.
Powershell works well.

0.31.0 support

Due to some breaking changes to deno 0.31.0 (denoland/deno#3722) denon no longer works. This is because the way it watches multiple paths in parallel is with worker blobs and the support for those were removed this release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.