V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
steins2628
V2EX  ›  Vue.js

vue-ts 文档生成工具有没有推荐的? typedoc 不太好用

  •  
  •   steins2628 · 9 天前 · 491 次点击

    如题,vite 创建的 vue3 typescript 工程,注释什么的都写好了,想要用工具直接生成对应 md 文档文件。

    尝试过 typedoc ,对单一 .ts 文件支持不错,对 .vue 文件就不太行,即使加上了 typedoc-plugin-vue 插件也不太行,因为是用 <script setup> 写的,插件只支持 definecomponent 定义出来的组件。

    也想过写个脚本遍历工程,提取 <script> 标签下的内容写个临时的 .ts 文件,生成完文档直接删,但是 typedoc 好像命令行没有什么设置能一次仅处理一个文件。

    所以有没有什么好用的工具能直接生成对应文档的?求推荐

    # typedoc.json
    {
        "$schema": "https://typedoc.org/schema.json",
        "entryPoints": ["../src/App.vue"],
        "out": "./docs",
        "plugin": [
            "typedoc-plugin-vue",
            "typedoc-plugin-markdown"
        ]
    }
    
    # 项目结构示意
    # {project}
    - public
    - typedoc
      - docs
      - package.json
      - typedoc.json
    - src
      - components
        - Title
          - Title.vue
          - type.ts
      - router
        - index.ts
        - type.ts
      - store
        - index.ts
        - type.ts
      - views
        - Home
          - Home.vue
          - type.ts
        - Config
          - Config.vue
          - type.ts
      - App.vue
      - main.ts
      - types.ts
    - index.html
    - tsconfig.json
    - vite.config.ts
    - package.json
    
    3 条回复    2024-06-19 22:04:00 +08:00
    hengshenyu
        1
    hengshenyu  
       9 天前
    vue-component-meta
    rookie2luochao
        2
    rookie2luochao  
       9 天前
    你可以试试 vite-plugin-dts 看看能不能达到你想要的效果
    rookie2luochao
        3
    rookie2luochao  
       9 天前
    @rookie2luochao 看错了,不好意思,我以为生成 dts 呢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2374 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 10:22 · PVG 18:22 · LAX 03:22 · JFK 06:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.