Tdesign-vue-next Chat 源码阅读(1) 本地启动

介绍

TDesign是腾讯开源的适配移动端的组件库,适合在 vue 3 技术栈项目中使用。本篇主要探讨聊天组件 TD Chat for AI。

pnpm install

bash 复制代码
git clone https://github.com/Tencent/tdesign-vue-next.git --depth=1

pnpm:devPreinstall脚本

通过指令更新了git submodule,此项目关联了tdesign-common(TDesign 公共库)

js 复制代码
child_process.execSync('git submodule update --init', { stdio: 'inherit' });
bash 复制代码
cat ./.gitmodules # 查看submodule

# [submodule "tdesign-common"]
#        path = packages/common
#        url = https://github.com/Tencent/tdesign-common.git

monorepo关联了submodule的包

js 复制代码
// pnpm-workspace.yaml 
packages:
  - 'packages/**'
  - 'internal/**'
  - 'site'

postinstall脚本

调用internal/utils/package.json中的scripts,执行rollup构建internal/utils中的ts代码为js代码

json 复制代码
  "scripts": {
    "prebuild": "rollup -c rollup.config.ts"
  },

dev:chat

运行pnpm dev:chat时启动了dev服务,测试服务代码在packages/tdesign-vue-next-chat目录下,启动时执行packages/tdesign-vue-next-chat/site下的devscripts

site承载了文档功能,文档中引入了开发时tdesign-vue-next-chat组件用于开发环境调试

dev site服务使用了marked、highlight.js、marked-highlight等组件

packages/tdesign-vue-next-chat/site/src/routes.js定义了site文档的路由文件,由此可找到packages/pro-components/chat/chat.tsx为示例代码、packages/pro-components/chat/chat.md为API文档

build:chat

cross-env NODE_ENV=production tsx ./vue-next-chat/index.ts执行internal/builds/vue-next-chat/index.ts构建到dist目录后,将构建物复制到了packages/tdesign-vue-next-chat/es

tdesign-publish-cli

顾名思义,发布npm包的工具,并没发现代码

tip

tdesign-vue-next Button 测试用例对比element-plus Button 测试用例

pnpm -C 是 pnpm (Performant NPM) 的一个命令行参数,用于在指定目录下执行命令,而不必先切换到该目录。 这个参数非常有用,可以让你在不离开当前工作目录的情况下,操作其他目录中的 Node.js 项目。

相关推荐
粥里有勺糖3 小时前
视野修炼第136期 | 前端小恐龙"Deno"被收购
前端·github·ai编程
怕浪猫4 小时前
Agent 工程化面试:从开发到部署的 5 个关键问题
面试·架构·github
高频因子挖掘机4 小时前
历史 K 线突然少一天?用交易日历、停牌信息和数据校验逐步排查
后端·github·api
miofly4 小时前
claude-sonnet-5 降价 90% 并支持推理调节
开源·github
用户74638129504814 小时前
我测了5个边缘AI平台,最后选了最“寒酸”的那个
github
miofly4 小时前
GitHub 周榜趋势速报 | 2026-10-11
开源·github
miofly4 小时前
GitHub 日榜趋势速报 | 2026-10-11
开源·github
高频因子挖掘机5 小时前
股票池一大就请求缓慢?量化系统批量获取行情的设计与优化
后端·github·api
高频因子挖掘机7 小时前
量化回测前的数据审计:如何判断股票历史行情是否缺失、重复或存在偏差
后端·github·api
亿道电子Emdoor7 小时前
【Perforce】Klocwork-kwgcheck图形化界面无法打开如何解决
git·python·github