ctrlcv-dev.comgithub

Yarncheatsheet

贡献者:BAI

Yarn

与 npm 对照表

npmyarn
npm inityarn init
npm installyarn
npm install gulp --saveyarn add gulp
npm install gulp --save-dev --save-exactyarn add gulp --dev --exact
npm install -g gulpyarn global add gulp
npm updateyarn upgrade
./node_modules/.bin/gulpyarn run gulp

yarn install

yarn install 的参数

SHELL
--no-lockfile
--pure-lockfile
--frozen-lockfile
--silent
--offline
--update-checksums
--check-files
--flat
--force
--ignore-scripts
--modules-folder <path>
--production[=true|false]

yarn add

SHELL
--dev
--peer
--optional
--exact
--tilde

These options are available for yarn add.

Workspaces

In package.json:

JSON
"workspaces": [
"packages/*"
]
TEXT
jest/
├─ package.json
└─ packages/
├─ jest-matcher-utils/
│ └─ package.json
└─ jest-diff/
└─ package.json

Resolution

In package.json:

JSON
"resolutions": {
"**/sass-brunch/node-sass": "4.5.2"
}

Create

BASH
yarn create react-app hello