From 2e18385bc208ce94b49ebb319546ab29f2797059 Mon Sep 17 00:00:00 2001 From: Yu-Hong Shen Date: Fri, 27 Mar 2026 13:28:45 +0000 Subject: [PATCH 1/3] docs(dlx): add missing usage examples and version range documentation - 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 --- packages/plugin-dlx/sources/commands/dlx.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/plugin-dlx/sources/commands/dlx.ts b/packages/plugin-dlx/sources/commands/dlx.ts index d85668ea6458..d94f3cdb9f7a 100644 --- a/packages/plugin-dlx/sources/commands/dlx.ts +++ b/packages/plugin-dlx/sources/commands/dlx.ts @@ -17,14 +17,27 @@ export default class DlxCommand extends BaseCommand { By default Yarn will download the package named \`command\`, but this can be changed through the use of the \`-p,--package\` flag which will instruct Yarn to still run the same command but from a different package. + 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. + Using \`yarn dlx\` as a replacement of \`yarn add\` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through \`dlx\` - neither their name, nor their version). `, examples: [[ `Use create-vite to scaffold a new Vite project`, `yarn dlx create-vite`, + ], [ + `Run a specific version of a package`, + `yarn dlx create-vite@5.0.0`, ], [ `Install multiple packages for a single command`, `yarn dlx -p typescript -p ts-node ts-node --transpile-only -e "console.log('hello!')"`, + ], [ + `Run the \`tsc\` binary from a specific version of typescript`, + `yarn dlx -p typescript@5.0.2 tsc --version`, + ], [ + `Run an alternate binary (\`tsserver\`) from the same package`, + `yarn dlx -p typescript@5.0.2 tsserver`, ]], }); From d787a964ad279c329efb649468fff4d90d629e66 Mon Sep 17 00:00:00 2001 From: Yu-Hong Shen Date: Sun, 29 Mar 2026 21:33:16 +0800 Subject: [PATCH 2/3] docs(dlx): clarify default behavior and when -p flag is needed 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) --- packages/plugin-dlx/sources/commands/dlx.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/plugin-dlx/sources/commands/dlx.ts b/packages/plugin-dlx/sources/commands/dlx.ts index d94f3cdb9f7a..7cbedae6d229 100644 --- a/packages/plugin-dlx/sources/commands/dlx.ts +++ b/packages/plugin-dlx/sources/commands/dlx.ts @@ -15,11 +15,9 @@ export default class DlxCommand extends BaseCommand { details: ` This command will install a package within a temporary environment, and run its binary script if it contains any. The binary will run within the current cwd. - By default Yarn will download the package named \`command\`, but this can be changed through the use of the \`-p,--package\` flag which will instruct Yarn to still run the same command but from a different package. + By default, Yarn will download the package named \`command\` and run the binary with the same name. The \`-p,--package\` flag is only needed when the binary you want to run has a different name than the package, or when you need to install multiple packages for a single command. - 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. + 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. This works both with and without the \`-p,--package\` flag. Using \`yarn dlx\` as a replacement of \`yarn add\` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through \`dlx\` - neither their name, nor their version). `, From 7de82d8637796405c9a0a7bd55b3addf8d29573d Mon Sep 17 00:00:00 2001 From: Clement Yan Date: Wed, 1 Apr 2026 01:01:44 +0800 Subject: [PATCH 3/3] versions --- .yarn/versions/b3a2d4e3.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .yarn/versions/b3a2d4e3.yml diff --git a/.yarn/versions/b3a2d4e3.yml b/.yarn/versions/b3a2d4e3.yml new file mode 100644 index 000000000000..14ccf038783a --- /dev/null +++ b/.yarn/versions/b3a2d4e3.yml @@ -0,0 +1,23 @@ +releases: + "@yarnpkg/cli": patch + "@yarnpkg/plugin-dlx": patch + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/core" + - "@yarnpkg/doctor"