重要提示: 此中文文档针对的是 Yarn 2 版本。
有关 1.x 版本的中文文档,请点击进入 yarn.bootcss.com。
Yarn
yarn addyarn binyarn cache cleanyarn config getyarn config setyarn configyarn constraints queryyarn constraints sourceyarn constraintsyarn dedupeyarn dlxyarn execyarn explain peer-requirementsyarn infoyarn inityarn installyarn linkyarn nodeyarn npm audityarn npm infoyarn npm loginyarn npm logoutyarn npm publishyarn npm tag addyarn npm tag listyarn npm tag removeyarn npm whoamiyarn packyarn patch-commityarn patchyarn plugin import from sourcesyarn plugin importyarn plugin listyarn plugin removeyarn plugin runtimeyarn rebuildyarn removeyarn runyarn searchyarn set resolutionyarn set version from sourcesyarn set versionyarn stageyarn unplugyarn upyarn upgrade-interactiveyarn version applyyarn version checkyarn versionyarn whyyarn workspaceyarn workspaces focusyarn workspaces foreachyarn workspaces list

yarn stage

Plugin

To use this command, first install the stage plugin: yarn plugin import stage

Add all yarn files to your vcs.

Usage

$> yarn stage

Examples

Adds all modified project files to the staging area :

yarn stage

Creates a new commit containing all modified project files :

yarn stage --commit

Options

Definition
Description

-c,--commit

Commit the staged files

-r,--reset

Remove all files from the staging area

-n,--dry-run

Print the commit message and the list of modified files without staging / committing

Details

This command will add to your staging area the files belonging to Yarn (typically any modified package.json and .yarnrc.yml files, but also linker-generated files, cache data, etc). It will take your ignore list into account, so the cache files won't be added if the cache is ignored in a .gitignore file (assuming you use Git).

Running --reset will instead remove them from the staging area (the changes will still be there, but won't be committed until you stage them back).

Since the staging area is a non-existent concept in Mercurial, Yarn will always create a new commit when running this command on Mercurial repositories. You can get this behavior when using Git by using the --commit flag which will directly create a commit.