yarn 笔记之快速应用

yarn 的安装

brew install yarn

或者

npm install --global yarn

更多安装方式

yarn --version

设置淘宝源

# 查看源
$ yarn config get registry
https://registry.yarnpkg.com

# 设置源
$ yarn config set registry 'https://registry.npm.taobao.org'

新建新项目

yarn init

例子: CRUD(新增、查询、修改、删除)包

添加js包如(angular、jquery)

yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]

查询

yarn list

升级js包

yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]

删除js包

yarn remove [package]

安装项目的js包(依籁关系)

yarn

yarn install

另个项目连接的当前项目中 yarn link

$ cd react
$ yarn link
yarn link vx.x.x
success Registered "react".
info You can now run `yarn link "react"` in the projects where you want to use this module and it will be used instead.
$ cd ../react-relay
$ yarn link react
yarn link vx.x.x
success Registered "react".

查看依籁关系(yarn why)

yarn why react

官方文档

参考:

https://yarnpkg.com/en/docs/usage

Comments