yarn 的简单使用。

初始化新项目

1
yarn init

添加依赖包

1
2
3
yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]

将依赖项添加到不同依赖项类别

分别添加到 devDependencies、peerDependencies 和 optionalDependencies:

1
2
3
yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional

升级依赖包

1
2
3
yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]

移除依赖包

1
yarn remove [package]

安装项目的全部依赖

1
yarn

或者

1
yarn install
03-17 02:41