yarn詳細入門教程
Yarn簡介
Yarn 是 Facebook, Google, Exponent 和 Tilde 開發的一款新的 JavaScript 包管理工具。就像我們可以從官方文件瞭解那樣,它的目的是解決這些團隊使用 npm 面臨的少數問題.
一鍵安裝
官網指令碼:
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --nightly
或者:
最簡單的方法是執行:
npm install -g yarn
現在的yarn安裝頁面是這麼說的:
注意:通常情況下不建議通過npm進行安裝。npm安裝是非確定性的,程式包沒有簽名,並且npm除了做了基本的SHA1雜湊之外不執行任何完整性檢查,這給安裝系統程式帶來了安全風險。
基於這些原因,強烈建議你通過最適合於你的作業系統的安裝方法來安裝yarn。
以這種速度發展下去的話,如果yarn要宣佈他們自己的registry,讓開發者慢慢淘汰npm的話,我們一點都不會感到驚訝。
安裝成功後即可檢視版本:
yarn –version
常用命令
初始化一個新專案
yarn init
新增依賴包
yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
將依賴項新增到不同依賴項類別中
分別新增到 devDependencies、peerDependencies 和 optionalDependencies 類別中:
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]
安裝專案的全部依賴
yarn
或者
yarn install
例如:
$ yarn install
yarn install v1.13.0-20181121.1436
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] ? Resolving packages...
[2/4] ? Fetching packages...
[3/4] ? Linking dependencies...
warning " > babel-jest@23.6.0" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
[4/4] ? Building fresh packages...
$ lerna bootstrap
lerna notice cli v3.4.3
lerna info Bootstrapping 5 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna success Bootstrapped 5 packages
✨ Done in 271.39s.
$ yarn build
yarn run v1.13.0-20181121.1436
$ lerna run build --ignore selenium-ide-extension-boilerplate
lerna notice cli v3.4.3
lerna info filter [ '!selenium-ide-extension-boilerplate' ]
lerna info Executing command in 4 packages: "yarn run build"
$ yarn run browserify src/index.js -s browser-webdriver -o build/webdriver.js
$ /Users/jack/ui/selenium-ide/packages/browser-webdriver/node_modules/.bin/browserify src/index.js -s browser-webdriver -o build/webdriver.js
$ rollup -c
$ babel -d dist src --ignore=__test__
src/capabilities.js -> dist/capabilities.js
src/child.js -> dist/child.js
src/config.js -> dist/config.js
src/index.js -> dist/index.js
src/npm.js -> dist/npm.js
src/versioner.js -> dist/versioner.js
$ rm -rf build && env NODE_ENV=production webpack
Hash: 5f687715a247631dc1c4
Version: webpack 3.12.0
Time: 108660ms
Asset Size Chunks Chunk Names
escape.js.map 14.2 kB 6 [emitted] escape
media/selenium_blue_white32@3x.84ab23d0.svg 3.62 kB [emitted]
media/selenium-ide.9b39b00c.svg 21.8 kB [emitted]
playback.js 99.7 kB 0 [emitted] playback
record.js 39.4 kB 1 [emitted] record
neo.js 2.43 MB 2 [emitted] [big] neo
atoms.js 494 kB 3 [emitted] [big] atoms
background.js 12 kB 4 [emitted] background
polyfills.js 7.15 kB 5 [emitted] polyfills
escape.js 2.99 kB 6 [emitted] escape
playback.js.map 387 kB 0 [emitted] playback
record.js.map 162 kB 1 [emitted] record
neo.js.map 8.53 MB 2 [emitted] neo
atoms.js.map 2.23 MB 3 [emitted] atoms
background.js.map 54.8 kB 4 [emitted] background
polyfills.js.map 40.6 kB 5 [emitted] polyfills
media/selenium-ide.461193c2.ttf 7.44 kB [emitted]
vendor/global.js 825 bytes [emitted]
vendor/selenium-browserdetect.js 5.27 kB [emitted]
prompt.js 7.25 kB [emitted]
highlight.css 952 bytes [emitted]
../bootstrap.html 1.57 kB [emitted]
../manifest.json 1.74 kB [emitted]
indicator.js 694 bytes [emitted]
../indicator.html 1.03 kB [emitted]
../icons/icon128.png 5.88 kB [emitted]
../icons/icon_menu32.png 1.22 kB [emitted]
../icons/icon16.png 612 bytes [emitted]
../icons/icon_menu16.png 552 bytes [emitted]
../icons/icon_menu64.png 2.76 kB [emitted]
../icons/icon32.png 1.29 kB [emitted]
../icons/icon64.png 2.91 kB [emitted]
../index.html 315 bytes [emitted]
[133] ./content/commands-api.js 6.84 kB {0} [built]
[146] ./content/escape.js 5.11 kB {0} {6} [built]
[229] ./content/locatorBuilders.js 11.6 kB {3} [built]
[320] multi ./content/setup 28 bytes {5} [built]
[321] ./content/setup.js 1.28 kB {5} [built]
[322] multi ./content/commands-api 28 bytes {0} [built]
[385] multi ./background/background 28 bytes {4} [built]
[386] ./background/background.js 5.09 kB {4} [built]
[387] multi ./content/record 28 bytes {1} [built]
[388] ./content/record.js 19.5 kB {1} [built]
[389] ./content/record-api.js 9.7 kB {1} [built]
[390] ./content/prompt-recorder.js 2.41 kB {1} [built]
[391] multi ./content/escape 28 bytes {6} [built]
[392] multi react-hot-loader/patch ./neo/containers/Root 40 bytes {2} [built]
[396] ./neo/containers/Root/index.jsx 1.61 kB {2} [built]
+ 1075 hidden modules
Child html-webpack-plugin for "../index.html":
1 asset
[0] ../node_modules/html-webpack-plugin/lib/loader.js!./neo/index.html 720 bytes {0} [built]
+ 3 hidden modules
lerna success run Ran npm script 'build' in 4 packages:
lerna success - browser-webdriver
lerna success - selenium-ide-extension
lerna success - selenium-side-runner
lerna success - selianize
✨ Done in 130.43s.
$ npm start
> selenium-ide@ start /Users/jack/ui/selenium-ide
> cd packages/selenium-ide && yarn start
yarn run v1.13.0-20181121.1436
$ env NODE_ENV=test webpack-dev-server --hot
Project is running at http://localhost:8081/
webpack output is served from /assets/
Hash: a6db07ced022ebcba304
Version: webpack 3.12.0
Time: 43408ms
Asset Size Chunks Chunk Names
prompt.js 7.25 kB [emitted]
media/selenium_blue_white32@3x.84ab23d0.svg 3.62 kB [emitted]
media/selenium-ide.9b39b00c.svg 21.8 kB [emitted]
playback.js 617 kB 0 [emitted] [big] playback
record.js 298 kB 1 [emitted] [big] record
neo.js 18.7 MB 2 [emitted] [big] neo
atoms.js 5.16 MB 3 [emitted] [big] atoms
background.js 988 kB 4 [emitted] [big] background
polyfills.js 957 kB 5 [emitted] [big] polyfills
escape.js 898 kB 6 [emitted] [big] escape
highlight.css 952 bytes [emitted]
vendor/global.js 825 bytes [emitted]
vendor/selenium-browserdetect.js 5.27 kB [emitted]
media/selenium-ide.461193c2.ttf 7.44 kB [emitted]
../bootstrap.html 1.57 kB [emitted]
../indicator.html 1.03 kB [emitted]
indicator.js 694 bytes [emitted]
../manifest.json 1.74 kB [emitted]
../icons/icon_menu64.png 2.76 kB [emitted]
../icons/icon_menu32.png 1.22 kB [emitted]
../icons/icon128.png 5.88 kB [emitted]
../icons/icon_menu16.png 552 bytes [emitted]
../icons/icon16.png 612 bytes [emitted]
../icons/icon64.png 2.91 kB [emitted]
../icons/icon32.png 1.29 kB [emitted]
../index.html 315 bytes [emitted]
[40] (webpack)-dev-server/client?http://localhost:8081 7.93 kB {2} {3} {4} {5} {6} [built]
[41] (webpack)/hot/dev-server.js 1.61 kB {2} {3} {4} {5} {6} [built]
[170] ./src/content/commands-api.js 7.77 kB {0} [built]
[183] ./src/content/escape.js 5.96 kB {0} {6} [built]
[432] multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./content/setup 52 bytes {5} [built]
[433] ./src/content/setup.js 1.36 kB {5} [built]
[434] multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./content/commands-api 52 bytes {0} [built]
[497] multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./background/background 52 bytes {4} [built]
[498] ./src/background/background.js 6.57 kB {4} [built]
[499] multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./content/record 52 bytes {1} [built]
[500] ./src/content/record.js 23.2 kB {1} [built]
[503] multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./content/escape 52 bytes {6} [built]
[504] multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server react-hot-loader/patch ./neo/containers/Root 64 bytes {2} [built]
[505] ./node_modules/react-hot-loader/patch.js 40 bytes {2} [built]
[600] ./src/neo/containers/Root/index.jsx 1.82 kB {2} [built]
+ 1163 hidden modules
Child html-webpack-plugin for "../index.html":
1 asset
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/neo/index.html 720 bytes {0} [built]
[1] ./node_modules/html-webpack-plugin/node_modules/lodash/lodash.js 540 kB {0} [built]
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
webpack: Compiled successfully.
相關文章
- 新手入門,webpack入門詳細教程Web
- Argo CD 詳細入門教程Go
- Python快速入門,附詳細影片教程Python
- dubbo整合springboot最詳細入門教程Spring Boot
- 一份詳細的asyncio入門教程
- 比官方還詳細的ByteBuddy入門教程
- 埠轉發工具Rinetd詳細入門教程
- Modelsim模擬新手入門最詳細教程
- 全網最詳細的Spring入門教程Spring
- java 入門教程(非常詳細!1.6w+ 文字)Java
- 2020年Python基礎教程,Python快速入門教程(非常詳細)Python
- Hadoop Yarn框架詳細解析HadoopYarn框架
- 物聯網超詳細入門教程免費分享-千鋒
- Node入門教程(7)第五章:node 模組化(下) npm與yarn詳解NPMYarn
- 2019新媒體運營超詳細入門教程-千鋒出品
- nginx rails 詳細站點配置入門教程NginxAI
- Hadoop入門(二)之 HDFS 詳細解析Hadoop
- XML從入門到深入(超詳細)XML
- Hadoop 學習系列(三)之 YARN 詳細解析HadoopYarn
- 如何入門GO語言?這份GO語言超詳細入門教程你值得擁有-千鋒Go
- Hadoop 入門筆記—核心元件 YARNHadoop筆記元件Yarn
- Vuex詳細教程Vue
- Vagrant詳細教程
- Nginx 詳細教程Nginx
- Emacs詳細教程Mac
- node.js,express入門看詳細篇Node.jsExpress
- Canal詳細入門實戰(使用總結)
- 詳解前端HTTP協議入門教程前端HTTP協議
- Next.js 入門超詳解教程JS
- 最佳實踐教程:nvm安裝詳細教程(安裝nvm、node、npm、cnpm、yarn及環境變數配置)NPMYarn變數
- webpack4.x最詳細入門講解Web
- 超詳細,手把手教你入門.NET for LinuxLinux
- CreateJS入門 -- 註釋詳細到爆炸(My Style)JS
- NodeJS入門(一)---nodejs詳細安裝步驟NodeJS
- 0001_01_Java程式入門_詳細筆記Java筆記
- 收藏|Numpy詳細教程
- SourceTree詳細使用教程
- Vue Router詳細教程Vue