Skip to main content

🍳🦕 deno make

deno make integrates seemlessly within your deno.jsonc configuration file to provide an extended set of features to the deno task runner.

You can assign default permissions and flags to deno subcommands, environment variables, assign descriptions and more.

deno make

💭 Why ?

While the default deno task runner is great, it is not always suitable for long scripts as it’s not possible to split them into multiple lines, and passing flags to deno subcommands is often tedious.

deno make solves these issues by computing dynamically deno commands flags before calling the default deno task runner, in addition to providing a few extra features.

📚 Usage

1. Register deno make in deno.jsonc

// deno.jsonc
{
  "tasks": {
    "make": "deno run --allow-env --allow-read --allow-write=.deno-make.json --allow-run=deno https://deno.land/x/make/mod.ts $0"
  }
}

2. Configure "deno-make" tasks in deno.jsonc

// deno.jsonc
{
  "+tasks": {
    "start": {
      "description": "🍱 Start application",
      "task": "deno run mod.ts",
      "deno": {
        "run": { // For "deno run" subcommand
          "unstable": true, // ➡️ --unstable
          "permissions": {
            "prompt": false, // ➡️ --no-prompt
            "read": true, // ➡️ --allow-read
            "run": false, // ➡️ --deny-run
            "net": [ // ➡️ --allow-net=https://deno.land,https://example.com
              "https://deno.land",
              "https://example.com"
            ],
            "write": { // ➡️ --allow-write=/tmp --deny-write=/root
              "allow": [
                "/tmp"
              ],
              "deny": [
                "/root"
              ]
            }
          }
        }
      },
      // Configure environment variables
      "env": {
        "FOO": true, // ➡️ Inherit FOO environment variable
        "BAR": "bar" // ➡️ Set BAR environment variable to "bar"
      }
    },
    // Write "multi-line" tasks using arrays (they will be joined with "\n")
    "test": {
      "description": "🧪 Run tests and print collected coverage",
      "task": [
        "rm -rf .coverage &&",
        "deno test &&",
        "deno coverage .coverage"
      ],
      "deno": {
        "test": { // For "deno test" subcommand
          "unstable": true, // ➡️ --unstable
          "permissions": { // ➡️ --allow-all
            "all": true
          },
          "coverage": ".coverage", // ➡️ --coverage=.coverage
          "parallel": true // ➡️ --parallel
        },
        "coverage": { // For "deno coverage" subcommand
          "quiet": true // ➡️ --quiet
        }
      }
    }
  }
}

3. Run tasks with deno task make instead

deno task make run
deno task make