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" diff --git a/packages/plugin-dlx/sources/commands/dlx.ts b/packages/plugin-dlx/sources/commands/dlx.ts index d85668ea6458..7cbedae6d229 100644 --- a/packages/plugin-dlx/sources/commands/dlx.ts +++ b/packages/plugin-dlx/sources/commands/dlx.ts @@ -15,16 +15,27 @@ 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. 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). `, 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`, ]], });