Script Options

info

For the sake of brevity Typescript example omit the import for the DenonConfig:

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

Denon takes inspiration from the awesome velociraptor module in the way it handles scripts.

Scripts

Scripts are declared inside the scripts object and are identified by a name:

denon.json
{
"scripts": {
// they all resolve to `deno run app.ts` when you run `denon start`
"start": "app.ts",
// OR
"start": "run app.ts",
// OR
"start": "deno run app.ts"
}
}

Scripts can also be defined by a complex object:

denon.json
{
"scripts": {
"start": {
"cmd": "deno run app.ts",
// with an optional description that
// is shown when you run `denon` to list
// all the available
"desc": "Run the main server.",
// available options...
// they are described in the next paragraph
"allow": ["env", "write"],
"unstable": true
// running `denon start` will resolve in
// deno run --allow-env --allow-write --unstable app.ts
}
}
}

Script Options

Options can be script specific or be declared as global in the root of the config file.

Environment variables

Environment variables can be provided as an object and are passed directly to the child process.

denon.json
{
// globally applied to all scripts
"env": { "TOKEN": "SUPER SECRET TOKEN" },
"scripts": {
"start": {
"cmd": "deno run app.ts",
"desc": "Run the main server.",
// made available only in the
// `start` script
"env": { "PORT": 3000 }
}
}
}

Permissions

Permission can be granted to child processes. You can provide specific permissions for each script, but you can also declare permissions globally, following the same format.

denon.json
{
// globally applied to all scripts
// as object ...
"allow": {
"read": "/etc,/tmp", // --allow-read=/etc,/tmp
"env": true // --allow-env
},
// ... or as array
"allow": [
"run", // --allow-run
"net" // --allow-net
],
"scripts": {
"start": {
"cmd": "deno run app.ts",
// specific for a single script
// as object ...
"allow": {
"read": "/etc,/tmp", // --allow-read=/etc,/tmp
"env": true // --allow-env
},
// ... or as array
"allow": [
"run", // --allow-run
"net" // --allow-net
]
}
}
}

File watching

While file watching is a core feature of denon you always have the option of disabling file watching and run a script only once:

denon.json
{
// globally applied to all scripts
// now denon will essentialy be a script runner
"watch": false,
"scripts": {
"start": {
"cmd": "deno run app.ts",
"desc": "Run the main server.",
// you can still enable watch on a script-by-script basis
"watch": true
}
}
}

Import Map

Load import map file. Take a look a at the official docs for additional info.

caution

This feature in unstable in the current version of the deno executable.

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

TS config

Load tsconfig.json configuration file:

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

Unstable

Enable if the script is using unstable features of deno runtime:

denon.json
{
"scripts": {
"start": {
"cmd": "deno run app.ts",
"desc": "Run the main server.",
"unstable": true
}
}
}

Inspect and InspectBrk

Activate inspector on host:port. If inspectBrk is used the executions breaks at the start of the user script:

denon.json
{
"scripts": {
"start": {
"cmd": "deno run app.ts",
"desc": "Run the main server.",
"inspect": "127.0.0.1:9229",
// OR
"inspectBrk": "127.0.0.1:9229"
}
}
}

Lockfile

Check the specified lock file:

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

Cert

Load certificate authority from PEM encoded file:

denon.json
{
"scripts": {
"start": {
"cmd": "deno run app.ts",
"desc": "Run the main server.",
"cert": "cert.pem"
}
}
}

Log

Set log level: (possible values: debug, info)

denon.json
{
"scripts": {
"start": {
"cmd": "deno run app.ts",
"desc": "Run the main server.",
"log": "debug" // or "info"
}
}
}