Skip to main content

edcb

edcb is a build tool and task runner for Deno. It has support for formatting, linting, testing, code coverage, bundling, and more, and it can be used via command line or TypeScript import.

License Deno module Github
tag Build Code
coverage

edcb in action

Configuration

edcb can be be invoked via TypeScript. The cli.ts module exports the edcb CLI. The specified options will serve as defaults. For example, one can specify the ignore option for the check command, which will then be used if the --ignore flag was not provided on the command-line.

edcb will look for the dev.ts module in the working directory and run it if it exists. This allows one to lock a particular edcb version to a project. The edcb CLI then essentially becomes an alias for deno run -A --unstable dev.ts [args].

// file: dev.ts
import { cli } from "./cli.ts";

await cli({
  check: {
    ignore: "deps",
  },
  serve: {
    port: 1234,
    bundles: [{
      source: "index.ts",
      target: "index.js",
    }],
  },
});

Commands can be used individually by importing them from mod.ts.

import { check } from "./mod.ts";

await check({
  ignore: "deps",
});

CLI

The edcb CLI can be installed with Deno.

deno install -f -A --unstable https://deno.land/x/edcb/cli.ts

After installation, one may run commands in the project directory.

edcb <command>

Supported commands:

Common Flags

These are flags that are available for all commands.

--debug

Displays sub-process output. Per default, the output is only logged if the process failed. For example, a developer may use the flag to see the full code coverage report in order to write tests for the missing lines.

edcb <command> --debug

check

Formats, lints, and tests the project. Code coverage will be displayed and can optionally be uploaded to codecov.io.

edcb check

--ci

Changes the behavior as follows:

  1. Runs the Deno formatter with the --check flag.
  2. Generates a test coverage file.
  3. Uploads the test coverage file to codecov.io. This step likely fails on local systems.
edcb check --ci

--ignore

Ignores files and directories during formatting and linting. It has the same format as the --ignore option of deno fmt and deno lint.

edcb check --ignore=deps,docs

--temp

Provides the directory that is used to store temporary files. If none is specified, a directory will be created in the standard location for temporary files (e.g. /tmp).

edcb check --temp=some/path

serve

Starts an HTTP server with an optional WebSocket server that broadcasts file system changes. Note that the serve command would usually be used in conjunction with a edcb configuration file. The reason is that the bundles option cannot be specified via CLI.

edcb serve

--hostname

Specify the hostname used for the HTTP listener.

edcb serve --port=8080

--port

Specify the port number used for the HTTP listener.

edcb serve --hostname=localhost

--reload

Enable file change broadcasts via WebSocket.

edcb serve --reload

--root

Specify the root path for the file watcher.

edcb serve --root=.

--web-root

Specify the public directory from which static files are served.

edcb serve --web-root=docs