Mac环境部署告一段落,同事多次建议为什么不用yarn。STF本身也包含了yarn.lock文件。简单学习一下yarn
的相关内容。
Yarn is a package manager for your code. Code is shared through something called a package (sometimes referred to as a module). A package contains all the code being shared as well as a package.json
file which describes the package.
dependency-types
Normal dependencies are usually installed from the npm registry.
所以yarn也是使用npm的registry。
yarn --version
# 根据package.json文件进行全量安装
yarn install
yarn
yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
- Add to devDependencies, peerDependencies, and optionalDependencies respectively:
yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional
yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]
yarn remove [package]
………………………………