Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

compable

用于管理组件模板的 CLI,工作流参考 chezmoi(有 cd / git 命令),但目标是前端组件。

存储目录(可读)

所有数据都放在:

~/.local/share/compable

组件按 framework + name 分目录,内容直接可读:

~/.local/share/compable/components/<framework>/<name>/...

元数据:

~/.local/share/compable/components/<framework>/<name>/component.json

支持框架

  • vue
  • react
  • nuxt
  • next

用法

compable add [--name <name>] [--force] <file...>
compable use <name> [--framework <framework>] [--force]
compable cd [--print]
compable git <git-args...>

说明

  • add 会自动识别当前项目 framework(优先读 package.json 依赖,再根据文件后缀推断)。
  • add --name 可选;不传时会自动推断:
    • vue/nuxt:优先取第一个 .vue 文件名
    • react/next:优先取第一个 .tsx/.jsx 文件名
  • use 默认按当前项目 framework 取组件;重名跨 framework 时可用 --framework 指定。
  • cd 会直接进入 compable 存储目录的子 shell;脚本场景可用 compable cd --print
  • git 在 compable 存储目录内执行 git(例如 compable git status)。
  • --force 用于覆盖:add 会覆盖同名组件,use 会覆盖项目中已存在文件。

示例

compable add src/components/Button.vue src/components/Button.css src/components/Button.ts
compable use Button
compable git status
compable cd

如果目标文件已存在,需要加 --force 覆盖。

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages