npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@microsoft/tsdoc-config

v0.17.1

Published

A loader for the tsdoc.json file

Downloads

7,825,830

Readme

@microsoft/tsdoc-config

TSDoc is a proposal to standardize the doc comments used in TypeScript source files. The main package @microsoft/tsdoc implements the TSDoc parser. The @microsoft/tsdoc-config package is an optional add-on for loading the tsdoc.json file format that enables users to define custom TSDoc tags. (This functionality was moved to its own package because it requires external dependencies such as NodeJS and ajv, whereas the main package is fully self-contained.)

For more information about TSDoc, please visit the project website:

https://tsdoc.org

Creating config files

The tsdoc.json file is optional. When used, it is expected to be found in the same folder as the tsconfig.json file for a project. The loader looks for it by walking upwards in the directory tree until it finds a folder containing tsconfig.json or package.json, and then it attempts to load tsdoc.json from that location.

The tsdoc.json file conforms to the tsdoc.schema.json JSON schema. It defines tags using similar fields as the TSDocTagDefinition API used by TSDocParser from @microsoft/tsdoc.

Here's a simple example:

tsdoc.json

{
  "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
  "tagDefinitions": [
    {
      "tagName": "@myTag",
      "syntaxKind": "modifier"
    }
  ]
}

If you want to define custom tags in one place and share them across multiple projects, the extends field specifies a list of paths that will be mixed in with the current file:

tsdoc.json

{
  "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
  "extends": [
    "my-package/dist/tsdoc-base.json",
    "./path/to/local/file/tsdoc-local.json"
  ]
}

NOTE: The extends paths are resolved using NodeJS module resolution, so local paths must begin with ./ to avoid being interpreted as an NPM package name.

API Usage

The code sample below illustrates how to invoke the @microsoft/tsdoc-config API to load a tsdoc.json file:

import * as path from 'path';
import { TSDocParser, TSDocConfiguration } from '@microsoft/tsdoc';
import { TSDocConfigFile } from '@microsoft/tsdoc-config';

// Sample source file to be parsed
const mySourceFile: string = 'my-project/src/example.ts';

// Load the nearest config file, for example `my-project/tsdoc.json`
const tsdocConfigFile: TSDocConfigFile = TSDocConfigFile.loadForFolder(path.dirname(mySourceFile));
if (tsdocConfigFile.hasErrors) {
  // Report any errors
  console.log(tsdocConfigFile.getErrorSummary());
}

// Use the TSDocConfigFile to configure the parser
const tsdocConfiguration: TSDocConfiguration = new TSDocConfiguration();
tsdocConfigFile.configureParser(tsdocConfiguration);
const tsdocParser: TSDocParser = new TSDocParser(tsdocConfiguration);