Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

typedoc-json-parser

RealShadowNova6kMIT10.2.0TypeScript support: included

A package to parse TypeDoc JSON output

readme

TypeDoc JSON Parser

A package to parse TypeDoc JSON output.

GitHub npm

Support Server


Description

When creating a library in TypeScript, you will often need to create documentation. Very commonly you'll find yourself using TypeDoc to generate documentation. However, TypeDoc's JSON output is not very useful for parsing. This package makes this entire process of utilizing the JSON output of TypeDoc a lot easier.

Installation

You can use the following command to install this package, or replace npm install -D with your package manager of choice.

npm install -D typedoc-json-parser typedoc

Prerequisites

Before using this package's CLI you'll need to have TypeDoc setup correctly.

Here is an example typedoc.json taken from our package's repository.

{
  "$schema": "https://typedoc.org/schema.json",
  "entryPoints": ["src/index.ts"],
  "json": "docs/api.json",
  "tsconfig": "src/tsconfig.json"
}

CLI Usage

You can provider all options through CLI flags.

Usage: typedoc-json-parser [options]

Options:
  --json [path]     Path to the TypeDoc JSON output file to parse
  --migrate [path]  Path to the directory containing TypeDoc JSON Parser output files to migrate
  -v, --verbose     Print verbose information (default: false)
  -h, --help        display help for command

You can also set these options through a configuration file. This file should be located at your current working directory. It should be named .typedoc-json-parserrc, optionally suffixed with .json, .yml, or .yaml.

When using .typedoc-json-parserrc or .typedoc-json-parserrc.json as your config file you can also use the JSON schema to get schema validation. To do so, add the following to your config file.

{
  "$schema": "https://raw.githubusercontent.com/RealShadowNova/typedoc-json-parser/main/assets/typedoc-json-parser.schema.json"
}

Example JSON file

{
  "$schema": "https://raw.githubusercontent.com/RealShadowNova/typedoc-json-parser/main/assets/typedoc-json-parser.schema.json",
  "json": "docs/api.json"
}

Example YAML file

json: 'docs/api.json'

Migrating JSON Files

If you need to migrate JSON files from a previous version of this package, you can use the migrate CLI flag. This will recursively search the provided directory for JSON files and migrate them to the latest version.

typedoc-json-parser --migrate docs

Node.js Usage

Once you have used the CLI to parse the TypeDoc JSON output, you'll want to use that data to create documentation. This package makes that extremely easy to do.

import { readFile } from 'node:fs';
import { resolve } from 'node:path';
import { ProjectParser } from 'typedoc-json-parser';

const data = JSON.parse(readFile(resolve(process.cwd(), 'docs', 'api.json'), 'utf8'));
const project = new ProjectParser({ data });

// Do something with the project

Documentation

While currently we do not have a dedicated way to view documentation for this package, you can still use the intellisense from your IDE and read our source code.

changelog

Changelog

All notable changes to this project will be documented in this file.

10.2.0 - (2024-11-02)

📝 Documentation

  • VariableParser: Update docs for generateFromTypeDoc (9f91975)
  • TypeParameterParser: Update docs for generateFromTypeDoc (556a42b)

🚀 Features

  • ClassParser: Update error messages to be more specific (e7c07ac)

10.1.6 - (2024-09-30)

🐛 Bug Fixes

  • ProjectParser: Add module support (1c431b4) (#288 by @RealShadowNova)
  • deps: Update dependency typedoc to ^0.26.4 (b60f3e5) (#258 by @renovate[bot])

10.1.5 - (2024-07-02)

🐛 Bug Fixes

  • migrations: Migrate to latest when patch difference between versions (6fb8f7e)

10.1.4 - (2024-07-02)

🐛 Bug Fixes

  • migrations: Add migrations for v10.1.0 to latest... again (25683aa)
  • deps: Update all non-major dependencies (24e254f)

10.1.3 - (2024-07-02)

🐛 Bug Fixes

  • migrations: Exit with code 1 on migration fail (8d21232)

10.1.2 - (2024-07-02)

🐛 Bug Fixes

  • migrations: Add migrations for v10.1.0 to latest (264a694)

10.1.1 - (2024-07-02)

🏠 Refactor

10.1.0 - (2024-06-24)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (5885400)
  • deps: Update dependency tslib to ^2.6.3 (c9d6f53)
  • deps: Update dependency commander to ^12.1.0 (b5b0a41)

🚀 Features

  • ProjectParser: Add dependencies property (c42df89)

10.0.0 - (2024-04-23)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (665890e)
  • deps: Update dependency typescript to ^5.4.4 (adf100d)
  • deps: Update dependency commander to v12 (#203) (ecfbfe2)
  • deps: Update all non-major dependencies (#183) (e2901fe)

🚀 Features

  • Update Node to v20 (#218) (9ae756b)
    • 💥 BREAKING CHANGE: Drop support for Node.js v16 and v18

9.0.1 - (2023-09-28)

🐛 Bug Fixes

  • deps: Move typescript to dependencies from devDependencies (a2b6cda)

9.0.0 - (2023-09-10)

🐛 Bug Fixes

  • deps: Update dependency tslib to ^2.6.0 (04fbb70)

🚀 Features

  • Switch to esm only (#171) (4adc848)
    • 💥 BREAKING CHANGE: This package is now ESM only.
    • 💥 BREAKING CHANGE: This package now only supports Node.js v18 or higher.
  • deps: Update dependency typedoc to 0.25.1 (#170) (9412411)
    • 💥 BREAKING CHANGE: This package now depends on typedoc v0.25

8.2.0 - (2023-06-21)

🏠 Refactor

  • bin: Rewrite migrations (#138) (380e3c7)

🐛 Bug Fixes

  • deps: Update dependency commander to v11 (#145) (19777aa)
  • deps: Update dependency typedoc to ^0.24.8 (#141) (ba480bd)
  • deps: Update dependency tslib to ^2.5.3 (#136) (2728b53)

📝 Documentation

  • InterfacePropertyParser: Correct @since version (#147) (6a3b31c)

🚀 Features

  • PropertyParser: Add properties (#146) (d6fc2bd)
  • InterfacePropertyParser: Add optional property (#139) (24643a8)

8.1.2 - (2023-05-27)

🐛 Bug Fixes

  • bin: Add migrations for v7.3.2 (a2abeba)

8.1.1 - (2023-05-27)

🐛 Bug Fixes

  • bin: Add migrations for v8.1.1 (4a583d5)
  • deps: Update dependency tslib to ^2.5.2 (#131) (20daac8)

8.1.0 - (2023-05-14)

🐛 Bug Fixes

  • Add unique identifiers at the end of errors to help trace errors (ff5d483)

📝 Documentation

  • Change Json to json... again (af89478)

🚀 Features

  • ReflectionTypeParser: Add methods property (d6863b7)

8.0.1 - (2023-05-13)

🐛 Bug Fixes

  • SignatureParser: Accept ConstructorSignature and IndexSignature kinds (2735942)

8.0.0 - (2023-05-10)

🏠 Refactor

  • ReflectionTypeParser: Add properties & signatures properties (ef566a1)

🐛 Bug Fixes

  • deps: Update dependency typedoc to ^0.24.7 (#127) (b9112e7)

📝 Documentation

7.4.0 - (2023-05-02)

🚀 Features

  • NamespaceParser: Add children getter (0fcacbf)
  • ProjectParser: Add children getter (694f659)

7.3.2 - (2023-05-01)

🐛 Bug Fixes

  • type-parser: Add project parameter for all toString() instances (024fa76)

7.3.1 - (2023-04-25)

🐛 Bug Fixes

  • bin: Migrate namespaceParentId for older versions (23228a9)

7.3.0 - (2023-04-25)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (#120) (45ca09f)

🚀 Features

  • Add namespaceParentId property (#124) (7f6ff72)

7.2.0 - (2023-02-28)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (#112) (3f276ec)
  • deps: Update dependency typedoc to ^0.23.24 (#105) (0ebf801)
  • deps: Update dependency commander to v10 (#109) (5895395)

🚀 Features

  • ParameterParser: Add rest property (#114) (42e8648)

7.1.0 - (2023-01-06)

🐛 Bug Fixes

  • deps: Update dependency typedoc to ^0.23.23 (#100) (620f6c3)

🚀 Features

  • ParameterParser: Add optional property (#103) (d81536c)

7.0.2 - (2022-11-27)

🐛 Bug Fixes

  • bin: Migrations for 7.0.1+ (80e9f52)
  • deps: Update all non-major dependencies (#97) (67a1f54)
  • deps: Update dependency typedoc to ^0.23.19 (#95) (5f7154c)

7.0.1 - (2022-10-27)

🐛 Bug Fixes

  • bin: Parameter migrations for v6.0.0+ (a46263a)

7.0.0 - (2022-10-25)

🏠 Refactor

  • TypeParameterParser: Rename property type to constraint (#90) (93bedae)

    💥 Breaking Changes:

    • TypeParameterParser#type has been renamed to #constraint.
  • *: Rename from *JSON to *Json (#92) (730ac5a)

    💥 Breaking Changes:

    • *Parser.JSON has been renamed to *Parser.Json.
    • *Parser.generateFromJSON() has been renamed to *Parser.generateFromJson().

🐛 Bug Fixes

  • ReferenceTypeParser: Invalid return from the isPackage() validator method (3491f96)
  • ClassPropertyParser: The type property is no longer nullable (#89) (368ffe6)
  • deps: Update dependency typedoc to ^0.23.18 (#86) (0d39296)

🚀 Features

  • type-parsers: Add the project parameter to the toString() method (#93) (e6059d7)

    💥 Breaking Changes:

    • *TypeParser.formatToString() now accepts a single parameter of TypeParser.FormatToStringOptions<*TypeParser>.
  • class-parser: Add accessibility validator methods (bb02200)

  • ClassConstructorParser: Add accessibility property (c23ede8)
  • InterfaceParser: Add typeParameters property (#91) (51a8c6a)
  • *: Remove project property (#88) (eae3dc6)

    💥 Breaking Changes:

    • Parser#project has been removed along with all references in classes that extend this class.
    • TypeParser#project has been removed along with all references in classes that extend this interface.
    • CommentParser#project has been removed.
    • ParameterParser#project has been removed.
    • SignatureParser#project has been removed.
    • SourceParser#project has been removed.
    • TypeParameterParser#project has been removed.
    • ClassConstructorParser#parent has been removed.
    • ClassMethodParser#parent has been removed.
    • ClassPropertyParser#parent has been removed.
    • EnumMemberParser#parent has been removed.
    • InterfaceMethodParser#parent has been removed.
    • InterfacePropertyParser#parent has been removed.

6.0.2 - (2022-10-22)

🐛 Bug Fixes

  • bin: Warn instead of error on unsupported versions (bb0b075)

📝 Documentation

  • readme: Add migrating section (14294a9)

6.0.1 - (2022-10-18)

🐛 Bug Fixes

  • search: Query splitting (11da4f4)
  • deps: Update dependency typedoc to ^0.23.16 (#80) (e824f4b)

6.0.0 - (2022-10-14)

🏠 Refactor

  • EnumPropertyParser: Rename to EnumMemberParser (#74) (e4072c4)

    💥 Breaking Changes:

    • EnumPropertyParser has been renamed to EnumMemberParser
    • EnumMemberParser#properties has been renamed to EnumMemberParser#members
  • ConstantParser: Rename to VariableParser (#73) (0eb62ae)

    💥 Breaking Changes:

    • ConstantParser has been renamed to VariableParser
    • All instances of constant(s) have been changed to variable(s)

🚀 Features

  • bin: Add migrate option (#76) (34520dd)
  • ClassParser: Add typeParameters property (#77) (76997f0)
  • Parser: Remove comment property (#72) (09666a1)

    💥 Breaking Changes:

    • Parser#comment has been removed.
    • ClassMethodParser#comment has been removed.
    • InterfaceMethodParser#comment has been removed.
  • ParameterParser: Add comment property (#71) (04076c4)

5.2.0 - (2022-10-03)

🐛 Bug Fixes

  • ProjectParser: Add bold [WARNING] prefix to version mismatch warnings (ab6998d)

🚀 Features

  • ProjectParser: Add static version property (d88c4a0)

5.1.0 - (2022-10-03)

🚀 Features

  • ProjectParser: Warn when incoming and current typeDocJsonParserVersion mismatch (807cc8e)

5.0.1 - (2022-10-02)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (#65) (1c6f77a)

5.0.0 - (2022-09-19)

🏠 Refactor

  • formatToString: Switch to method from property (4d52f65)

🚀 Features

  • TypeParser: Add project property (#61) (c5afe84)

    💥 Breaking Changes

    • The constructor of ArrayTypeParser now takes 2 parameters of ArrayTypeParser.Data and ProjectParser
    • The constructor of ConditionalTypeParser now takes 2 parameters of ConditionalTypeParser.Data and ProjectParser
    • The constructor of IndexedAccessTypeParser now takes 2 parameters of IndexedAccessTypeParser.Data and ProjectParser
    • The constructor of InferredTypeParser now takes 2 parameters of InferredTypeParser.Data and ProjectParser
    • The constructor of IntersectionTypeParser now takes 2 parameters of IntersectionTypeParser.Data and ProjectParser
    • The constructor of IntrinsicTypeParser now takes 2 parameters of IntrinsicTypeParser.Data and ProjectParser
    • The constructor of LiteralTypeParser now takes 2 parameters of LiteralTypeParser.Data and ProjectParser
    • The constructor of MappedTypeParser now takes 2 parameters of MappedTypeParser.Data and ProjectParser
    • The constructor of NamedTupleMemberTypeParser now takes 2 parameters of NamedTupleMemberTypeParser.Data and ProjectParser
    • The constructor of OptionalTypeParser now takes 2 parameters of OptionalTypeParser.Data and ProjectParser
    • The constructor of PredicateTypeParser now takes 2 parameters of PredicateTypeParser.Data and ProjectParser
    • The constructor of QueryTypeParser now takes 2 parameters of QueryTypeParser.Data and ProjectParser
    • The constructor of ReferenceTypeParser now takes 2 parameters of ReferenceTypeParser.Data and ProjectParser
    • The constructor of ReflectionTypeParser now takes 2 parameters of ReflectionTypeParser.Data and ProjectParser
    • The constructor of RestTypeParser now takes 2 parameters of RestTypeParser.Data and ProjectParser
    • The constructor of TemplateLiteralTypeParser now takes 2 parameters of TemplateLiteralTypeParser.Data and ProjectParser
    • The constructor of TupleTypeParser now takes 2 parameters of TupleTypeParser.Data and ProjectParser
    • The constructor of TypeOperatorTypeParser now takes 2 parameters of TypeOperatorTypeParser.Data and ProjectParser
    • The constructor of UnionTypeParser now takes 2 parameters of UnionTypeParser.Data and ProjectParser
    • The constructor of UnknownTypeParser now takes 2 parameters of UnknownTypeParser.Data and ProjectParser

4.0.0 - (2022-09-16)

🚀 Features

  • ClassConstructorParser: Add toString method (#57) (3f3d08c)
  • interface-parser: Add parent getter (#55) (6b96fed)

    💥 Breaking Changes

    • InterfaceMethodParser.generateFromTypeDoc() now takes 3 parameters instead of 2.
    • InterfacePropertyParser.generateFromTypeDoc() now takes 3 parameters instead of 2.
  • class-parser: Add parent getter (#53) (0ad08e0)

    💥 Breaking Changes

    • ClassConstructorParser.generateFromTypeDoc() now takes 3 parameters instead of 2.
    • ClassMethodParser.generateFromTypeDoc() now takes 3 parameters instead of 2.
    • ClassPropertyParser.generateFromTypeDoc() now takes 3 parameters instead of 2.
  • EnumPropertyParser: Add toString method (#56) (defeb42)

  • enum-parser: Add parent getter (#54) (6a91232)

    💥 Breaking Changes

    • EnumPropertyParser.generateFromTypeDoc() now takes 3 parameters instead of 2.
  • type-parsers: Add static formatToString method (#48) (9a567e6)

🧪 Testing

3.2.0 - (2022-09-09)

🐛 Bug Fixes

  • deps: Update dependency typedoc to ^0.23.14 (#43) (1c5330b)

🚀 Features

  • ProjectParser: Add changelog property (#46) (c7b0ea3)

3.1.0 - (2022-09-03)

🚀 Features

  • InterfaceParser: Add methods property (#40) (325581c)

3.0.0 - (2022-09-02)

🏠 Refactor

  • CommentParser: Format inline-tag (#35) (ad9ee31)

    💥 Breaking Changes

    • CommentParser#description now formats inline-tag
    • CommentParser#blockTags now formats inline-tag

🐛 Bug Fixes

  • deps: Update dependency typedoc to ^0.23.11 (#31) (e8c8223)

🚀 Features

  • ProjectParser: Add readme property (#38) (09c8957)

    💥 Breaking Changes

    • The constructor of ProjectParser now only accepts a single parameter of ProjectParser.Options
  • ProjectParser: Add find method (#36) (adc3fd2)

  • ProjectParser: Add search method (#39) (3d87c32)
  • SourceParser: Add url property (#34) (af2a828)

2.3.2 - (2022-08-01)

🐛 Bug Fixes

  • ProjectParser: Set version when parsing typedoc output (cbaf62a)

2.3.1 - (2022-07-31)

🐛 Bug Fixes

2.3.0 - (2022-07-31)

🚀 Features

  • SignatureParser: Add the comment property (868db5c)

2.2.1 - (2022-07-30)

🐛 Bug Fixes

  • ProjectParser: Use data.version if version is not passed (e8aaf5c)

2.2.0 - (2022-07-30)

🚀 Features

  • ProjectParser: Add version property (edddca7)

2.1.0 - (2022-07-30)

🚀 Features

  • ProjectParser: Add typeDocJsonParserVersion property (901d9ec)

2.0.2 - (2022-07-27)

🐛 Bug Fixes

  • class-parser: Export ClassConstructorParser (9dd6dfd)

📝 Documentation

  • ProjectParser: Strip off external {@link } ref (ef624b7)

2.0.1 - (2022-07-27)

🐛 Bug Fixes

  • deps: Update dependency typedoc to 0.23.9 (a8f8307)

2.0.0 - (2022-07-27)

🚀 Features

  • deps: Update dependency typedoc to 0.23.8 (#19) (63d2b6f)

    💥 Breaking Changes

    • Updated dependency typedoc to 0.23.8
    • CommentParser#tags has been removed along with #tags in related interfaces. Use #blockTags and #modifierTags instead.
    • CommentParser#extendedDescription has been removed and merged with #description along with related interfaces.

1.0.0 - (2022-06-09)

🚀 Features

  • Implement typedoc-json-parser (#2) (c51d73f)