bit 环境安装教程
检测安装是否成功
bit --version
image.png
bit --help
image.png
本地环境部署
以本地服务localhost为例
# 初始化workspace
bit init --bare
#启动 bit服务
bit start(本地启动默认为3000端口)
// 创建的文件夹的name 就是scope的名字,例如我创建的文件夹名为 scopeshop,服务启动后如下
image.png
在本地项目内提交组件到本地私有bit
cd 到项目文件夹下
bit init --harmony
然后文件下会生成一个配置文件workspace.jsonc,比较重要的参数(teambit.workspace/workspace下的defaultScope)设置到对应的bit服务的名称,否则之后会出现提交不上去的问题
image.png
(teambit.workspace/variants)下 可以根据匹配规则自定义设置对应的处理
bit remote add http://localhost:3000
bit add src/components/* //(执行添加组件操作)
bit status //(查看当前组件状态,会有下一步操作提示)
bit complite
bit tag --all --message "message"//(信息会在服务中显示)
bit status
bit export
bit import scopeshop/button
使用bit组件
import ButtonBit from '@scopeshop/button'
image.png