balabala,固然是有需求的時候嘛html
介紹和安裝verdaccionginx
備註:git
程序啓動後,配置文件爲/home/work/.config/verdaccio/config.yamlgithub
密碼文件所在位置:/home/work/.config/verdaccio/htpasswdweb
日誌文件所在文職:/home/work/verdaccio.lognpm
推薦博客1json
官方詳細文檔verdacciogitlab
Nodejs環境全局安裝(root)網站
npm install –g verdaccio
pm2 運行程序,注意請切換成普通用戶work,不須要rootui
pm2 start verdaccio
修改配置文件,配置文件以下,
參照默認文件修改內容以下
從官方ui主題倉庫fork到我的賬號,而後克隆到本地開始進行自定義修改
自定義界面後須要發佈版本到npm中,根據配置文件的theme設定重啓後會自定應用
從官方倉庫中fock出來,修改搜索關鍵字favicon, title, logo等,footer和header也能夠修改一下
修改package.json中的name屬性,修改成 verdaccio-theme-****
安裝依賴,打包,等錄npm,發佈到npm倉庫(可發佈到共有npm,也能夠發佈到剛剛新起的npm私有倉庫服務)
npm install && npm run build && npm login && npm publish
npm i verdaccio-theme-**** -g
服務端安裝剛剛發佈的主題包(root, 全局安裝,由於verdaccio是動態加載插件)
最後在配置文件中修改主題配置
theme:
****:
a:b
su work
pm2 restart verdaccio 重啓服務生效
刷新頁面吧親。不知道爲何,僅寫theme: ****或者換行不生效,反正我也不懂,能用就行
去網站生成密碼,而後將密碼添加到服務端密碼文件中,記得重啓服務
#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#
# path to a directory with all packages
storage: ./storage
# path to a directory with plugins to include
plugins: ./plugins
web:
title: Qianjunet npm repo
# comment out to disable gravatar support
# gravatar: false
# by default packages are ordercer ascendant (asc|desc)
# sort_packages: asc
auth:
htpasswd:
file: ./htpasswd
# Maximum amount of users allowed to register, defaults to "+inf".
# You can set this to -1 to disable registration.
max_users: -1
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
'@*/*':
# scoped packages
# access: $all
access: $authenticated
publish: $authenticated
unpublish: $authenticated
proxy: npmjs
'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
#
# you can specify usernames/groupnames (depending on your auth plugin)
# and three keywords: "$all", "$anonymous", "$authenticated"
# access: $all
access: $authenticated
# allow all known users to publish/publish packages
# (anyone can register by default, remember?)
publish: $authenticated
unpublish: $authenticated
# if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs
# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough.
server:
keepAliveTimeout: 60
middlewares:
audit:
enabled: true
# log settings
logs:
#- { type: stdout, format: pretty, level: http }
- {type: file, path: ./verdaccio.log, level: info}
#experiments:
# # support for npm token command
# token: false
server {
listen 80;
server_name npm.**********.com;
location / {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:4873$request_uri;
proxy_redirect off;
}
}
npm i -g nrm
查看當前全部npm的鏡像源
nrm ls
使用淘寶源
1 |
nrm use taobao |
添加咱們自定義的私有倉庫的源
1 |
nrm add ******** http://npm.*****.com |
使用自定義的源
1 |
nrm use ******** |
添加錯誤後,可刪除源
1 |
nrm del ***** |
切換到自定義npm源後,使用npm登陸
1 |
nrm use ****** |
1 |
npm init |
最終詳細配置,仍是得看官網,雖然官網的描述很很差懂,並且不全,可是比本篇記錄要全,畢竟這個只是小哥哥看完文檔,實際操做後的隨筆而已
TODO: 待對接npm的用戶信息到https://gitlab.*****.com