引言:本文主要介紹了React Native開發(fā)過程中,如果有自定義的庫、組件、修改的第三方插件,團(tuán)隊(duì)成員之間如何保證代碼的統(tǒng)一和獨(dú)有性。最初用CornerStone(SVN),如果第三庫使用比較多的情況下,明顯會(huì)降低代碼更新的效率。統(tǒng)一由npm服務(wù)器進(jìn)行托管,主要受網(wǎng)絡(luò)條件限制,更新速度慢。
一、安裝verdaccio
打開終端,執(zhí)行下面的指令
npm intsall verdaccio -g
啟動(dòng)verdaccio
verdaccio
設(shè)置npm鏡像
npm set registry?http://localhost:4873/
npm adduser --registry http://localhost:4873/
輸入用戶名、密碼、郵箱
成功顯示?Logged in as username on http://localhost:4873/:4873.
cd到項(xiàng)目根目錄,需包含pakage.json和README.md文件,上傳項(xiàng)目
npm publish --registry http://localhost:4873
每次上傳時(shí)需修改版本號(hào)
二、安裝鏡像管理工具nrm
npm install nrm -g
nrm ls 查看鏡像
nrm current 查看當(dāng)前鏡像
添加新鏡像
nrm add verdaccio http://localhost:4873/
更換鏡像
nrm use verdaccio
項(xiàng)目根目錄,執(zhí)行
npm install+插件名稱?
比如?npm install helloRedux