Skip to content

docs(dlx): add missing usage examples and version range documentation#7083

Open
syhstanley wants to merge 2 commits intoyarnpkg:masterfrom
syhstanley:fix/dlx-doc-missing-examples
Open

docs(dlx): add missing usage examples and version range documentation#7083
syhstanley wants to merge 2 commits intoyarnpkg:masterfrom
syhstanley:fix/dlx-doc-missing-examples

Conversation

@syhstanley
Copy link
Copy Markdown

What's the problem this PR addresses?

The yarn dlx documentation was missing several common usage patterns, causing confusion in the wider ecosystem. Notably, the Rust community incorrectly concluded that yarn dlx does not support version pinning because the docs never demonstrated it.

Fixes #7072

How did you fix it?

Added two new paragraphs to the details section:

  • Documents the @version suffix syntax (e.g. pkg@1.0.0, pkg@^2)
  • Clarifies multi-binary package behavior and the Binary not found error

Added three new examples:

  • yarn dlx create-vite@5.0.0 — version specifier
  • yarn dlx -p typescript@5.0.2 tsc --version — named binary from versioned package
  • yarn dlx -p typescript@5.0.2 tsserver — alternate binary from same package

All examples were verified to work correctly.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

- Document @Version suffix syntax for specifying package versions
- Add example: yarn dlx create-vite@5.0.0
- Add example: yarn dlx -p typescript@5.0.2 tsc --version (named binary)
- Add example: yarn dlx -p typescript@5.0.2 tsserver (alternate binary)
- Clarify multi-binary behavior and Binary not found error

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@clemyan clemyan left a comment

Choose a reason for hiding this comment

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

Need to mark @yarnpkg/cli and @yarnpkg/plugin-dlx for patch release


Version ranges can be appended to the package name using the \`@\` suffix (e.g. \`pkg@1.0.0\` or \`pkg@^2\`). When no range is specified, Yarn will use the \`latest\` dist-tag.

When a package ships multiple binaries, use \`-p,--package\` to specify the package (with an optional version) and pass the desired binary name as the command. If the binary name matches one of the package's binaries it will be invoked directly; otherwise Yarn will report a \`Binary not found\` error.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Without using -p, I think the default is to run the bin with the same name as the package name? If so please clarify that -p is only needed when running a bin that does not match the package name or when needing multiple packages.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated.

Address review feedback: explain that without -p, Yarn runs the binary
matching the package name, and -p is only needed for mismatched names
or multiple packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

dlx document missing 4 more cases

3 participants