Skip to content

feat: implement deno module (v0.1)#1

Merged
TomChv merged 1 commit into
mainfrom
feat/add-deno-module
Jul 16, 2026
Merged

feat: implement deno module (v0.1)#1
TomChv merged 1 commit into
mainfrom
feat/add-deno-module

Conversation

@TomChv

@TomChv TomChv commented Jul 15, 2026

Copy link
Copy Markdown
Member

Implements the dagger/deno module in Dang, per the design in
designs/deno-module.md. It models a Deno project as a typed object graph and
maps Deno's toolchain onto Dagger's first-class verbs rather than wrapping the
CLI.

API (v0.1)

Deno (root)

  • version, base — toolchain config (constructor args)
  • install(ctr) — add the Deno CLI + DENO_DIR cache to any (glibc) container
  • project(ws, path, findUp) — resolve the project containing a path (find-up to the nearest deno.json/deno.jsonc)

DenoProject

  • introspection: config, source, container
  • checks (@check): lint, test, typeCheck, formatCheck
  • format (@generate → reviewable changeset)
  • compile → standalone binary (File!)

format and compile are intentionally different kinds: format is a no-arg
idempotent generator; compile is a build artifact you export. No @up and no
dependency-edit generators (design §3 has the rationale).

Tests

.dagger/modules/e2e installs this module and drives it against three sample
projects (clean, badly-formatted, jsr-dependency). All checks pass:

dagger check
# ✔ e-2-e:clean-project-check
# ✔ e-2-e:dirty-project-check
# ✔ e-2-e:install-check
# ✔ e-2-e:project-lookup-check
# ✔ e-2-e:with-deps-check

Verified end-to-end against a real engine (v1.0.0-beta.6).

Deltas from the design (recorded in §0)

  • compile output arg renamed outputoutputName (clashes with dagger's -o/--output)
  • permissions take bare names (["net", "read=/tmp"]); the module prefixes --allow-
  • audit deferred — deno audit isn't in the pinned Deno 2.1.4
  • install targets glibc bases (the bin binary is glibc-linked; musl/alpine uses the default base)
  • Resolved two "to verify" items: installed multi-file Dang modules with Workspace args work on beta.6; the base field default works (cache mount moved into container(ws))

Next (v0.2)

Multi-project discovery (projects, deno.json workspace members), *All bulk
verbs, and per-project checks.

See README.md for usage examples.

@TomChv
TomChv force-pushed the feat/add-deno-module branch 2 times, most recently from 06850a2 to a26c48d Compare July 16, 2026 13:27
Comment thread deno.dang Outdated
let root = if (findUp) {
findProjectRoot(ws, path)
} else {
let p = path.trimPrefix("/").trimSuffix("/")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why trim the prefix and suffix? Why not just leave the path as specified?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it's fixed

Comment thread deno.dang Outdated
"""
pub projects(ws: Workspace!): [DenoProject!]! {
let src = ws.directory(
"/",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"/",
".",

Should search from current location in the workspace, instead of workspace root.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread deno.dang
"/",
include: ["**/deno.json", "**/deno.jsonc"],
exclude: ["**/node_modules/**"],
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
)
)
// FIXME: findup a deno project from current location (`.`) and add it to the list.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed and test, now if you have:

/deno.json
/sub/deno.json

And execute from sub, you'll obtain ., ../

@TomChv
TomChv force-pushed the feat/add-deno-module branch from a26c48d to 86d4927 Compare July 16, 2026 14:03
A Dagger module for Deno projects, written in Dang. It models a Deno project as
a typed object graph and maps Deno's toolchain onto Dagger's first-class verbs
instead of wrapping the CLI.

- Root `Deno`: pinned `version` (2.9.3) + overridable `base`, and `install(ctr)`
  to add the Deno CLI + DENO_DIR cache to any container.
- `DenoProject`: `project(ws, path, findUp)` lookup + `projects(ws)` discovery;
  `config` / `source` / `container` introspection.
- Checks (`@check`): lint / test / typeCheck / formatCheck, each with a
  workspace-wide `*All` counterpart on the root that `dagger check` runs.
- `format` generator (`@generate`) returns a reviewable Changeset; `formatAll`
  covers the whole workspace.
- `compile` returns a standalone binary (a plain File output, not a verb).
- Permissions come from deno.json, not Dagger args: `test` runs `deno test -P`
  (reads `test.permissions`) and `compile` runs `deno compile -P` (bakes the
  top-level `permissions.default` set). `-P` needs Deno >= 2.5.0; below that,
  `test` falls back to `-A` and `compile` bakes no permissions (version-gated).
- e2e module (`.dagger/modules/e2e`) drives the installed module against sample
  fixtures (clean, unformatted, jsr-dependency, config permissions, compiled
  binary, legacy version); plus design doc and README.

Signed-off-by: Tom Chauveau <tom@dagger.io>
@TomChv
TomChv force-pushed the feat/add-deno-module branch from 86d4927 to a1270b3 Compare July 16, 2026 15:35

@kpenfound kpenfound left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go

@TomChv
TomChv merged commit 17f53d6 into main Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants