Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SetVersionCommand

Hierarchy

Properties

cwd

cwd: undefined | string = Option.String(`--cwd`, {hidden: true})

onlyIfNeeded

onlyIfNeeded: boolean = Option.Boolean(`--only-if-needed`, false, {description: `Only lock the Yarn version if it isn't already locked`,})

useYarnPath

useYarnPath: undefined | false | true = Option.Boolean(`--yarn-path`, {description: `Set the yarnPath setting even if the version can be accessed by Corepack`,})

version

version: string = Option.String()

Static paths

paths: string[][] = [[`set`, `version`],]

Static usage

usage: Usage = Command.Usage({description: `lock the Yarn version used by the project`,details: `This command will set a specific release of Yarn to be used by Corepack: https://nodejs.org/api/corepack.html.By default it only will set the \`packageManager\` field at the root of your project, but if the referenced release cannot be represented this way, if you already have \`yarnPath\` configured, or if you set the \`--yarn-path\` command line flag, then the release will also be downloaded from the Yarn GitHub repository, stored inside your project, and referenced via the \`yarnPath\` settings from your project \`.yarnrc.yml\` file.A very good use case for this command is to enforce the version of Yarn used by any single member of your team inside the same project - by doing this you ensure that you have control over Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting different behavior.The version specifier can be:- a tag:- \`latest\` / \`berry\` / \`stable\` -> the most recent stable berry (\`>=2.0.0\`) release- \`canary\` -> the most recent canary (release candidate) berry (\`>=2.0.0\`) release- \`classic\` -> the most recent classic (\`^0.x || ^1.x\`) release- a semver range (e.g. \`2.x\`) -> the most recent version satisfying the range (limited to berry releases)- a semver version (e.g. \`2.4.1\`, \`1.22.1\`)- a local file referenced through either a relative or absolute path- \`self\` -> the version used to invoke the command`,examples: [[`Download the latest release from the Yarn repository`,`$0 set version latest`,], [`Download the latest canary release from the Yarn repository`,`$0 set version canary`,], [`Download the latest classic release from the Yarn repository`,`$0 set version classic`,], [`Download the most recent Yarn 3 build`,`$0 set version 3.x`,], [`Download a specific Yarn 2 build`,`$0 set version 2.0.0-rc.30`,], [`Switch back to a specific Yarn 1 release`,`$0 set version 1.22.1`,], [`Use a release from the local filesystem`,`$0 set version ./yarn.cjs`,], [`Use a release from a URL`,`$0 set version https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js`,], [`Download the version used to invoke the command`,`$0 set version self`,]],})

Methods

execute

  • execute(): Promise<0 | 1>

Generated using TypeDoc