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