docs-ts:我的TypeScript项目的零配置文档工具

  • k8_869223
    了解作者
  • 107.2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 11:55
    上传日期
目录 一个简单,自以为是的零配置工具,用于为TypeScript项目创建漂亮的文档。 安装: 通过npm npm install -D docs-ts 通yarn yarn add -D docs-ts 通过npx (按需) npx docs-ts 为什么 为任何规模的TypeScript项目创建和维护文档都会很快成为一项艰巨的任务。 docs-ts通过允许您将文档及其关联的代码放在一起来简化此过程。 您只需用JSDoc注释注释代码,然后CLI就会生成漂亮的markdown文档,其中包含与代码关联的所有文档和示例。 另外,生成的docs-ts输出可以用作GitHub上存储库文档的。 用法 使用docs-ts就像用JSDoc注释注释代码一样简单。 docs-ts支持指定@category JSDoc标记以在生成的文档中对关联的模块导出进行分组。 您还可以使用@example JSDoc
docs-ts-master.zip
  • docs-ts-master
  • .gitignore
    36B
  • package.json
    2KB
  • tslint.json
    359B
  • package-lock.json
    213.3KB
  • src
  • FileSystem.ts
    3.9KB
  • Core.ts
    17.1KB
  • Logger.ts
    3.5KB
  • Config.ts
    6.1KB
  • index.ts
    1.4KB
  • Parser.ts
    25.8KB
  • bin.ts
    222B
  • Markdown.ts
    15.1KB
  • Module.ts
    5.3KB
  • Example.ts
    1.5KB
  • jest.config.js
    519B
  • LICENSE
    1KB
  • CHANGELOG.md
    3.6KB
  • tsconfig.json
    447B
  • .github
  • PULL_REQUEST_TEMPLATE.md
    337B
  • ISSUE_TEMPLATE.md
    424B
  • workflows
  • main.yml
    557B
  • README.md
    6.1KB
  • docs.ts
    19B
  • .vscode
  • settings.json
    57B
  • docs
  • index.md
    33B
  • _config.yml
    217B
  • modules
  • Module.ts.md
    5.4KB
  • Core.ts.md
    1.2KB
  • Config.ts.md
    3.6KB
  • index.md
    79B
  • Parser.ts.md
    2.2KB
  • Logger.ts.md
    1.8KB
  • index.ts.md
    436B
  • bin.ts.md
    147B
  • FileSystem.ts.md
    2.7KB
  • Markdown.ts.md
    5.6KB
  • Example.ts.md
    929B
  • test
  • FileSystem.ts
    4.8KB
  • Core.ts
    10.8KB
  • Logger.ts
    2.7KB
  • tsconfig.json
    423B
  • Config.ts
    4.8KB
  • index.ts
    1.2KB
  • Parser.ts
    35.6KB
  • utils.ts
    610B
  • Markdown.ts
    11KB
  • Module.ts
    3.7KB
  • fixtures
  • file1.ts
    86B
  • Example.ts
    1.3KB
  • .prettierrc
    64B
内容介绍
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> **Table of contents** - [Installation:](#installation) - [Via `npm`](#via-npm) - [Via `yarn`](#via-yarn) - [Via `npx` (on-demand)](#via-npx-on-demand) - [Why](#why) - [Usage](#usage) - [Example](#example) - [Configuration](#configuration) - [Documentation](#documentation) - [License](#license) <!-- END doctoc generated TOC please keep comment here to allow auto update --> > A simple, opinionated, zero-configuration tool for creating beautiful documentation for TypeScript projects. ## Installation: #### Via `npm` ``` npm install -D docs-ts ``` #### Via `yarn` ``` yarn add -D docs-ts ``` #### Via `npx` (on-demand) ``` npx docs-ts ``` ## Why Creating and maintaing documentation for a TypeScript project of any size can quickly become a herculean task. `docs-ts` simplifies this process by allowing you to co-locate your documentation with its associated code. You simply annotate your code with JSDoc comments, and then the CLI will generate beautiful markdown documents containing all of the documentation and examples you associated with your code. In addition, the generated output of `docs-ts` can be used as a [publishing source](https://docs.github.com/en/free-pro-team@latest/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#choosing-a-publishing-source) for your repository's documentation on GitHub. ## Usage Using `docs-ts` is as simple as annotating your code with a JSDoc comment. `docs-ts` supports specifying an `@category` JSDoc tag to group associated module exports in the generated documentation. You can also provide examples for your code using an `@example` JSDoc tag. `docs-ts` will also type-check all code annotated with `@example` tags to ensure that you have not made any errors in your sample code. All sample code is also run using `ts-node`, and the NodeJS [assert](https://nodejs.org/api/assert.html) module can be used for on-the-fly testing. By default, `docs-ts` will search for files in the `src` directory and will output generated files into a `docs` directory. For information on how to configure `docs-ts`, see the [Configuration](#configuration) section below. ### Example To illustrate the power of `doc-ts`, here is a small example. Running `npm run docs-ts` (or `yarn docs-ts`) in the root directory of a project containing the following file in the `src` directory... ```ts /** * @since 0.2.0 */ import { log } from 'fp-ts/Console' import { IO } from 'fp-ts/IO' /** * Greets a person by name. * * @example * import { sayHello } from 'docs-ts/lib/greetings' * * assert.strictEqual(sayHello('Test')(), 'Hello, Test!') * // => This assert statement will be run by docs-ts so you can test your code on-the-fly. * * @category greetings * @since 0.6.0 */ export const sayHello = (name: string): IO<void> => log(`Hello, ${name}!`) ``` ...will, by default, produce a `docs` directory containing the following markdown document in the `modules` subfolder. ````md --- title: greetings.ts nav_order: 0 parent: Modules --- ## greetings overview Added in v0.2.0 --- <h2 class="text-delta">Table of contents</h2> - [greetings](#greetings) - [sayHello](#sayhello) --- # greetings ## sayHello Greets a person by name. **Signature** ```ts export declare const sayHello: (name: string) => IO<void> ``` **Example** ```ts import { sayHello } from 'docs-ts/lib/greetings' sayHello('Test')() // => Hello, Test! ``` Added in v0.6.0 ```` ## Configuration `docs-ts` is meant to be a zero-configuration command-line tool for generating documentation for your TypeScript projects. However, there are several configuration settings that can be specified for `docs-ts`. To customize the configuration of `docs-ts`, create a `docs-ts.json` file in the root directory of your project and indicate the custom configuration parameters that the tool should use when generating documentation. The `docs-ts.json` configuration file adheres to the following interface: ```ts interface Config { readonly srcDir?: string readonly outDir?: string readonly theme?: string readonly enableSearch?: boolean readonly enforceDescriptions?: boolean readonly enforceExamples?: boolean readonly enforceVersion?: boolean readonly exclude?: ReadonlyArray<string> } ``` The following table describes each configuration parameter, its purpose, and its default value. | Parameter | Description | Default Value | |:--------------------|:----------------------------------------------------------------------------------------------------------|:-----------------------------| | srcDir | The directory in which `docs-ts` will search for TypeScript files to parse. | `'src'` | | outDir | The directory to which `docs-ts` will generate its output markdown documents. | `'docs'` | | theme | The theme that `docs-ts` will specify should be used for GitHub Docs in the generated `_config.yml` file. | `'pmarsceill/just-the-docs'` | | enableSearch | Whether or search should be enabled for GitHub Docs in the generated `_config.yml` file. | `true` | | enforceDescriptions | Whether or not descriptions for each module export should be required. | `false` | | enforceExamples | Whether or not `@example` tags for each module export should be required. | `false` | | enforceVersion | Whether or not `@since` tags for each module export should be required. | `true` | | exclude | An array of glob strings specifying files that should be excluded from the documentation. | `[]` | ## Documentation - [Docs](https://gcanti.github.io/docs-ts) ## License The MIT License (MIT)
评论
    相关推荐
    • typescript-githubpage
      模组 模块分辨率 命名空间 命名空间和模块 符号 三斜杠指令 类型相容性 类型推断 变量声明 类型检查javascript文件 教程 角2 天冬氨酸 天冬氨酸 吞咽 昏死 从JavaScript迁移 React-and-Webpack ... 打字稿2
    • tsghc:TypeScript GitHub Clone Cli
      tsghc是一个CLI模块,可快速克隆由TypeScript组成的GitHub Repository。 :rocket: 快速开始 使用npm全局软件包安装 $ npm install -g tsghc CLI tsghc $ tsghc :joystick: 它支持各种框架。 :folded_hands: ...
    • typescript-action:type在打字稿中构建示例GitHub动作
      :high_voltage: 打字动作 示例GitHub动作内置于打字稿中。 :rocket: 用法 使用它的模板。 :page_facing_up: 执照
    • GitHub Code-blocks to TypeScript Playground-crx插件
      语言:English (UK) 在浏览GitHub时,此扩展从每个带有TypeScript的代码块链接到TypeScript游乐场 该扩展将链接添加到整个GitHubTypeScript游乐场。 它的工作量非常小,因此不会降低您的浏览速度。
    • github动作
      github动作
    • gostack.github-explorer:Github Explorer-ReactJS> TypeScript
      gostack.github-explorer:Github Explorer-ReactJS> TypeScript
    • TypeScript-wiki:在GitHub上对TypeScript Wiki进行更改的存储库
      TypeScript Wiki 此存储库是GitHub Wiki真实性的来源,此存储库的PR会自动合并到的自动生成的GitHub存储。 这是在中的GitHub Action中 。 Wiki根目录为 如果您通过以下方式安装了ruby,则可以在本地运行: # ...
    • .github
      .github
    • ts-githubTypeScript GitHub适配器
      ts-github 适用于GithubTypeScript适配器(octokit)
    • typescript_test
      使用TypeScript的主干Todo 我通过在上制作todoMVC-lie app来尝试使用Backbone.js 。 之后,为了熟悉它,我用TypeScript覆盖了它。 该应用程序正在。 我有关此应用程序的博客文章。