tg-commons
TG Vue2/3共用工具类
发布
1. 登录
transcode-group帐号
``
sh
pnpm login
`
2. 在根项目中执行:
`
sh
pnpm publish:tg
`
使用
`
sh
pnpm add tg-commons
`
在VSCode中跳转到源码
项目中默认引用的是生成的js+d.ts, 若需要在VSCode跳转到源码, 需要做如下配置
1. 在tsconfig.json
中, 将tg-commons指向源码:
`
json
{
"compilerOptions": {
"paths": {
"tg-commons": ["./node_modules/tg-commons/src/index"]
}
}
}
`
2. 源码中使用了vitest的内联代码测试功能, 主项目也要开启才不会报错. 若主项目没有开启内联代码测试, 或者没有使用vitest, 需要添加全局类型声明, 防止类型检查错误:
`
ts
declare global {
interface ImportMeta {
readonly vitest: any
}
}
``