Skip to content

docs: add command resolution documentation for deno task#3159

Open
zqleslie wants to merge 6 commits into
denoland:mainfrom
zqleslie:task-command-resolution
Open

docs: add command resolution documentation for deno task#3159
zqleslie wants to merge 6 commits into
denoland:mainfrom
zqleslie:task-command-resolution

Conversation

@zqleslie
Copy link
Copy Markdown

Description

Adds documentation to the task runner reference explaining how deno task resolves command binaries.

This addresses denoland/deno#26523 where users were confused about:

  • Where deno task finds commands (e.g., ohm, tsc, eslint)
  • How package.json bin fields are resolved
  • Deno's equivalent to npx

What this adds

  • Command resolution order (node_modules/.bin -> package.json bin -> PATH)
  • Example with @ohm-js/cli
  • deno run -A npm:<pkg> as the npx equivalent
  • Explanation of how deno add integrates with task scripts

Relates to denoland/deno#26523

Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

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

  1. Existing content is corrupted in this diff. tha task, Node and npx binary suppor, file.tx, stdou, and firs are all regressions from the current page; please restore the original words/examples before adding the new section.
  2. node_modules directory exists (from deno install or deno add) is inaccurate for current Deno. With Deno 2.7.14, deno add npm:cowsay@1.6.0 only updates deno.json imports and deno.lock; it does not create node_modules, so the resolution description needs to distinguish cached npm dependencies from an actual node_modules/.bin directory.

Copy link
Copy Markdown
Contributor

@lunadogbot lunadogbot left a comment

Choose a reason for hiding this comment

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

Two blockers before this can land:

  1. runtime/reference/cli/task.md corrupts and reverts existing content: tha task, Node and npx binary suppor, file.tx, stdou, and firs are all regressions, and the current main Deno 2.8 task-output callout is dropped. Please rebase and preserve the existing page text before adding the new section.
  2. from deno install or deno add / reference its binaries is inaccurate as written. On Deno 2.7.14, deno add npm:cowsay@1.6.0 updates deno.json/deno.lock but creates no node_modules, and deno task say with "cowsay hello" fails until nodeModulesDir: "auto" materializes node_modules. Document that requirement instead of implying deno add alone is enough.

…iption

- Restore truncated words: 'the task', 'binary support', 'Workspace support',
  'exit code', 'don't want it', 'my_project', 'commands exit', 'Output the first',
  'package.json support', 'stdout'
- Fix redirect examples: file.txt (not file.tx)
- Correct node_modules description for Deno 2.7+: deno add does not create
  node_modules, only updates deno.json imports and deno.lock
@zqleslie
Copy link
Copy Markdown
Author

Thanks for the review! I've fixed all the truncation regressions and corrected the
ode_modules description for Deno 2.7+ (deno add only updates deno.json imports and deno.lock, it does not create a
ode_modules directory). All changes pushed.

Copy link
Copy Markdown
Contributor

@lunadogbot lunadogbot left a comment

Choose a reason for hiding this comment

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

Two blockers remain on this revision:

  1. Lines 145-158 still drop the current Deno 2.8 parallel-output callout from main, and line 155 changes the dependency graph so a no longer points at c despite "dependencies": ["b", "c"]. Please rebase and restore that existing content.
  2. Lines 677-727 overstate npm binary resolution. On Deno 2.7.14, deno add npm:cowsay@1.6.0 plus a "cowsay hello" task resolves the binary but fails loading transitive deps without node_modules; deno install from package.json creates node_modules/.bin and runs. Please document that distinction or use a sample that actually runs.
  • nit: last_modified should be bumped for this substantive page change.

Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

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

Two blockers remain on this revision:

  1. runtime/reference/cli/task.md lines 154-158 still show a connected only to b, but the example directly below has "dependencies": ["b", "c"]. Please restore the a to c edge so the diagram matches the task graph.
  2. Lines 677-679 say package bin entries are automatically available in task scripts. On Deno 2.7.14, a package.json dependency plus "cowsay hello" gives cowsay: command not found until deno install creates node_modules/.bin; deno add npm:cowsay@1.6.0 resolves the binary from the cache but then fails on transitive require("yargs") without node_modules. Please document the node_modules requirement instead of presenting package bin as a separate resolution step.
  • nit: last_modified is still 2026-03-12 for a substantive content change.

@zqleslie
Copy link
Copy Markdown
Author

Lint is now passing on the latest commit. Ready for review.

Copy link
Copy Markdown
Contributor

@lunadogbot lunadogbot left a comment

Choose a reason for hiding this comment

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

Two blockers remain after the latest comment:

  1. Lines 154-158 still show a connected only to b, but the example has "dependencies": ["b", "c"]. Please restore the a to c edge so the diagram matches the task graph.
  2. Lines 677-679 still say package bin entries are automatically available in task scripts. On Deno 2.7.14, a package.json dependency plus "cowsay hello" gives cowsay: command not found until deno install creates node_modules/.bin; an import from deno add npm:cowsay@1.6.0 resolves cowsay but fails loading yargs without node_modules. Please document the node_modules requirement.
  • nit: last_modified is still 2026-03-12 for a substantive content change.

Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

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

Two blockers remain on the current head:

  1. // / in the dependency diagram still shows a connected only to b, but the JSON directly below has "dependencies": ["b", "c"]. Please restore the a to c edge so the diagram matches the example.
  2. Deno automatically makes those commands available within task scripts still overstates npm bin resolution. A package.json dependency is not enough until node_modules/.bin exists; deno add npm:<pkg> also does not create node_modules. Please document that tasks can run those binaries once deno install or equivalent npm-compatible tooling has materialized node_modules/.bin.
  • nit: last_modified is still 2026-03-12 for this content addition.

@zqleslie
Copy link
Copy Markdown
Author

Hi @lucacasonato @bartlomieju - just a quick ping: the lint issues have been resolved in the latest commit. The CI is now passing. Ready for re-review! ??

@zqleslie
Copy link
Copy Markdown
Author

Hi @lucacasonato @bartlomieju - lint issues have been resolved in the latest commit. CI is now passing. Ready for re-review!

Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

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

The latest comments say the earlier issues were fixed, but both blockers are still present on 1b281fb78fd8debf1b76195aadbf40e4e2abc8a2:

  1. // / in the dependency diagram still omits the edge from a to c, while the JSON directly below still has "dependencies": ["b", "c"]. Please restore the a to c edge so the diagram matches the example.
  2. Deno automatically makes those commands available within task scripts is still too broad. On Deno 2.7.14, a package.json dependency plus "cowsay hello" gives cowsay: command not found until node_modules/.bin exists; deno add npm:cowsay@1.6.0 resolves cowsay but fails loading transitive yargs without node_modules. Please tie this behavior to materialized node_modules/.bin, not package bin alone.
  • nit: last_modified is still 2026-03-12 for this content addition.

Copy link
Copy Markdown
Contributor

@lunadogbot lunadogbot left a comment

Choose a reason for hiding this comment

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

The follow-up comments say the latest commit is ready, but the current head still has the same two blockers.

  1. // / in the dependency diagram still omits the edge from a to c, while the JSON directly below still has "dependencies": ["b", "c"]. Please restore the a to c edge so the diagram matches the task graph.
  2. Deno automatically makes those commands available within task scripts still overstates npm bin resolution. A package.json dependency is not enough until node_modules/.bin exists, and deno add npm:<pkg> does not create node_modules; please tie this behavior to materialized node_modules/.bin instead of package bin alone.
  • nit: last_modified is still 2026-03-12 for this content addition.

Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

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

The latest comments say this is ready, but the current head still has the same blockers.

  1. // / in the dependency diagram still omits the edge from a to c, while the JSON directly below still has "dependencies": ["b", "c"]. Please restore the a to c edge so the diagram matches the example.
  2. Deno automatically makes those commands available within task scripts still overstates npm bin resolution. A package.json dependency is not enough until node_modules/.bin exists, and deno add npm:<pkg> does not create node_modules; please tie this behavior to materialized node_modules/.bin instead of package bin alone.
  • nit: last_modified is still 2026-03-12 for this content addition.

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