chenjiezi / fe-selfchecklist Goto Github PK
View Code? Open in Web Editor NEW前端自检清单 - 记录前端工程师的知识储备。(JAVASCRIPT、HTML、CSS、数据结构与算法、网络协议、设计模式、操作系统)前端面试题
前端自检清单 - 记录前端工程师的知识储备。(JAVASCRIPT、HTML、CSS、数据结构与算法、网络协议、设计模式、操作系统)前端面试题
为了在公司内部多个前端项目之间共享和管理内部封装的功能模块,决定将功能模块作为插件发布到npm上;但由于内部产出的代码算是公司资产(垃圾代码发出去怕被人笑话),所以只能发布到npm私有仓库。
Verdaccio 是一个用于搭建私有 npm 仓库的开源工具。它可以帮助开发人员在本地网络中搭建一个 npm registry 并在其中存储和共享自己的 JavaScript 包,从而加强项目管理和团队协作。
使用 Verdaccio 可以快速创建一个本地 npm 代理服务器,并将所有本地依赖项缓存在本地,这样可以显著提高构建和部署速度。此外,Verdaccio 还提供了一些功能,如权限管理、Web UI 界面、安全扫描、插件支持等,方便管理和掌控包的发布、更新和访问权限。
Verdaccio 的设计理念是轻量级、易于配置和扩展。它不需要任何数据库或其他复杂的环境,只需要简单的配置就能够开始运行。因此,对于小型前端项目或者公司内部开发来说,Verdaccio 是一个非常适合的解决方案。
需要注意的是,虽然 Verdaccio 能够搭建私有 npm 仓库,但是仍然需要遵循 npm 官方的发布规范,例如使用正确的版本号、填写包的元数据信息、避免依赖锁定等,以确保包的质量和稳定性。
docker pull verdaccio/verdaccio:latest
mkdir /opt/verdaccio && cd /opt/verdaccio
mkdir conf && mkdir storage && mkdir plugins
cd ./storage && mkdir data && touch htpasswd
cd ../conf && touch config.yaml
vim config.yaml
# config.yaml
# 存放软件所有软件包的目录
storage: /verdaccio/storage/data
# 存放所有插件的目录
plugins: /verdaccio/plugins
web:
# 网站Title
title: Verdaccio
# 禁用Gravatar头像
# gravatar: false
# 排序方式 asc|desc
# sort_packages: asc
# 是否启用暗黑模式
# darkMode: true
# logo地址
# logo: http://somedomain/somelogo.png
# favicon地址
# favicon: http://somedomain/favicon.ico | /path/favicon.ico
# i18n翻译配置
# i18n:
# 可用列表见:https://github.com/verdaccio/ui/tree/master/i18n/translations
# web: en-US
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
# 最大注册用户数,默认为 "+inf".
# 可用通过设置为-1禁止注册
# max_users: 1000
# 上游npm库,可以设置多个
uplinks:
npmjs:
url: https://registry.npmjs.org/
taobao:
url: https://registry.npmmirror.com/
packages:
# 作用域包
'@*/*':
# 允许所有人访问
access: $all
# 注册用户可访问
publish: $authenticated
# 注册用户可访问
unpublish: $authenticated
proxy: npmjs
'**':
# 默认情况下所有用户 (包括未授权用户) 都可以查看和发布任意包
# 你可以指定 用户名/分组名 (取决于你使用什么授权插件,默认的授权插件是内置的 htpasswd)
# 访问权限有三个关键词: "$all", "$anonymous", "$authenticated"
# $all 表示不限制,任何人可访问;
# $anonymous 表示未注册用户可访问;
# $authenticated 表示只有注册用户可访问
access: $all
# 允许所有注册用户发布/撤销已发布的软件包
# (注意:默认情况下任何人都可以注册)
publish: $authenticated
unpublish: $authenticated
# 如果私有包服务不可用在本地,则会代理请求到'npmjs'
# proxy 可以有多个值,多个值用空格分开
proxy: taobao npmjs
# 您可以指定传入连接的HTTP /1.1服务器保持活动超时(以秒为单位)。
# 值为0会使http服务器的行为类似于8.0.0之前的Node.js版本,后者没有保持活动超时。
# 解决方法:通过给定的配置可以解决以下问题
server:
keepAliveTimeout: 60
# 中间件
middlewares:
audit:
enabled: true
# 日志设置
logs: { type: stdout, format: pretty, level: http }
# 开放远程访问,允许所有IP
listen:
- 0.0.0.0:4873
docker run -it --name verdaccio \
-p 4873:4873 \
-v /opt/verdaccio/conf:/verdaccio/conf \
-v /opt/verdaccio/storage:/verdaccio/storage \
-v /opt/verdaccio/plugins:/verdaccio/plugins \
verdaccio/verdaccio
# 验证是否搭建成功,在浏览器访问 http://{服务器ip}.4873,能访问此页面,说明verdaccio搭建成功!!!
error--- unexpected error: EACCES: permission denied, open '/verdaccio/storage/htpasswd'
在/verdaccio/storage文件夹下,执行命令: sudo chown 10001:65533 htpasswd
详细信息:verdaccio/verdaccio#1379
ps: 凡是"error--- unexpected error: EACCES: permission denied"的报错,都是需要开权限的
fatal--- cannot open config file /verdaccio/conf/config.yaml: Error: CONFIG: it does not look like a valid config file
docker ps 查看运行中的容器
docker ps -a 查看所有容器(包括已经停止的)
docker exec -it <容器 ID> /bin/bash 进入容器
docker start <容器 ID> 启动容器
docker restart <容器 ID> 重启容器
docker stop <容器 ID> 停止容器
docker rm -f <容器 ID> 删除容器
exit 退出容器
docker image ls 看到所有docker镜像
docker image rm <镜像ID>/<仓库名>:<标签> 删除镜像(镜像ID可以只写前三位)
docker container logs [container ID or NAMES] 查看容器运行日志
https://www.cnblogs.com/guojikun/p/16662627.html
https://juejin.cn/post/7134621230031700005
鄙人决定正式入驻github,为世界开源代码库贡献力量
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.