Skip to content

Commit

Permalink
Rename tsdocconfig.json --> tsdoc.json based on community vote: https…
Browse files Browse the repository at this point in the history
  • Loading branch information
octogonz committed Nov 17, 2019
1 parent 0fd677c commit 4f46de1
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"changes": [
{
"packageName": "eslint-plugin-tsdoc",
"comment": "Add support for defining your own custom tags using tsdocconfig.json",
"comment": "Add support for defining your own custom tags using tsdoc.json",
"type": "minor"
}
],
Expand Down
26 changes: 13 additions & 13 deletions tsdoc-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**TSDoc** is a proposal to standardize the doc comments used in [TypeScript](http://www.typescriptlang.org/)
source files. The main package [`@microsoft/tsdoc`](https://www.npmjs.com/package/@microsoft/tsdoc) implements
the TSDoc parser. The `@microsoft/tsdoc-config` package is an optional add-on for loading the **tsdocconfig.json**
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.)

Expand All @@ -13,23 +13,23 @@ https://github.com/microsoft/tsdoc

## Creating config files

The **tsdocconfig.json** file is optional. When used, it is expected to be found in the same folder as
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
**tsdocconfig.json** from that location.
**tsdoc.json** from that location.

The **tsdocconfig.json** file conforms to the [tsdocconfig.schema.json](
https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json) JSON schema. It defines tags using
The **tsdoc.json** file conforms to the [tsdoc.schema.json](
https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json) JSON schema. It defines tags using
similar fields as the
[TSDocTagDefinition](https://github.com/microsoft/tsdoc/blob/master/tsdoc/src/configuration/TSDocTagDefinition.ts)
API used by `TSDocParser` from `@microsoft/tsdoc`.

Here's a simple example:

**tsdocconfig.json**
**tsdoc.json**
```js
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
"tagDefinitions": [
{
"tagName": "@myTag",
Expand All @@ -42,13 +42,13 @@ Here's a simple example:
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:

**tsdocconfig.json**
**tsdoc.json**
```js
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
"extends": [
"my-package/dist/tsdocconfig-base.json",
"./path/to/local/file/tsdocconfig-local.json"
"my-package/dist/tsdoc-base.json",
"./path/to/local/file/tsdoc-local.json"
]
}
```
Expand All @@ -60,7 +60,7 @@ a list of paths that will be mixed in with the current file:
## API Usage

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

```ts
import * as path from 'path';
Expand All @@ -70,7 +70,7 @@ 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/tsdocconfig.json`
// 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
Expand Down
2 changes: 1 addition & 1 deletion tsdoc-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/tsdoc-config",
"version": "0.12.15",
"description": "A loader for the tsdocconfig.json file",
"description": "A loader for the tsdoc.json file",
"keywords": [
"TypeScript",
"documentation",
Expand Down
16 changes: 8 additions & 8 deletions tsdoc-config/src/TSDocConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as Ajv from 'ajv';
const ajv: Ajv.Ajv = new Ajv({ verbose: true });

function initializeSchemaValidator(): Ajv.ValidateFunction {
const jsonSchemaPath: string = resolve.sync('@microsoft/tsdoc/schemas/tsdocconfig.schema.json', { basedir: __dirname });
const jsonSchemaPath: string = resolve.sync('@microsoft/tsdoc/schemas/tsdoc.schema.json', { basedir: __dirname });
const jsonSchemaContent: string = fs.readFileSync(jsonSchemaPath).toString();
const jsonSchema: object = JSON.parse(jsonSchemaContent);
return ajv.compile(jsonSchema);
Expand All @@ -41,14 +41,14 @@ interface IConfigJson {
}

/**
* Represents an individual `tsdocconfig.json` file.
* Represents an individual `tsdoc.json` file.
*
* @public
*/
export class TSDocConfigFile {
public static readonly FILENAME: string = 'tsdocconfig.json';
public static readonly FILENAME: string = 'tsdoc.json';
public static readonly CURRENT_SCHEMA_URL: string
= 'https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json';
= 'https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json';

/**
* A queryable log that reports warnings and error messages that occurred during parsing.
Expand Down Expand Up @@ -90,7 +90,7 @@ export class TSDocConfigFile {
}

/**
* If true, then the TSDocConfigFile object contains an empty state, because the `tsdocconfig.json` file could
* If true, then the TSDocConfigFile object contains an empty state, because the `tsdoc.json` file could
* not be found by the loader.
*/
public get fileNotFound(): boolean {
Expand All @@ -111,14 +111,14 @@ export class TSDocConfigFile {
}

/**
* The `$schema` field from the `tsdocconfig.json` file.
* The `$schema` field from the `tsdoc.json` file.
*/
public get tsdocSchema(): string {
return this._tsdocSchema;
}

/**
* The `extends` field from the `tsdocconfig.json` file. For the parsed file contents,
* The `extends` field from the `tsdoc.json` file. For the parsed file contents,
* use the `extendsFiles` property instead.
*/
public get extendsPaths(): ReadonlyArray<string> {
Expand Down Expand Up @@ -275,7 +275,7 @@ export class TSDocConfigFile {
}

/**
* For the given folder, discover the relevant tsdocconfig.json files (if any), and load them.
* For the given folder, discover the relevant tsdoc.json files (if any), and load them.
* @param folderPath - the path to a folder where the search should start
*/
public static loadForFolder(folderPath: string): TSDocConfigFile {
Expand Down
32 changes: 16 additions & 16 deletions tsdoc-config/src/__tests__/TSDocConfigFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ test('Load p1', () => {
"extendsFiles": Array [],
"extendsPaths": Array [],
"fileNotFound": false,
"filePath": "assets/p1/tsdocconfig.json",
"filePath": "assets/p1/tsdoc.json",
"messages": Array [],
"tagDefinitions": Array [],
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
}
`);
});
Expand All @@ -51,7 +51,7 @@ test('Load p2', () => {
"extendsFiles": Array [],
"extendsPaths": Array [],
"fileNotFound": true,
"filePath": "assets/p2/tsdocconfig.json",
"filePath": "assets/p2/tsdoc.json",
"messages": Array [
ParserMessage {
"_text": undefined,
Expand Down Expand Up @@ -79,7 +79,7 @@ test('Load p3', () => {
"extendsFiles": Array [],
"extendsPaths": Array [],
"fileNotFound": false,
"filePath": "assets/p3/base1/tsdocconfig-base1.json",
"filePath": "assets/p3/base1/tsdoc-base1.json",
"messages": Array [],
"tagDefinitions": Array [
TSDocTagDefinition {
Expand All @@ -90,13 +90,13 @@ test('Load p3', () => {
"tagNameWithUpperCase": "@BASE1",
},
],
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
},
Object {
"extendsFiles": Array [],
"extendsPaths": Array [],
"fileNotFound": false,
"filePath": "assets/p3/base2/tsdocconfig-base2.json",
"filePath": "assets/p3/base2/tsdoc-base2.json",
"messages": Array [],
"tagDefinitions": Array [
TSDocTagDefinition {
Expand All @@ -107,15 +107,15 @@ test('Load p3', () => {
"tagNameWithUpperCase": "@BASE2",
},
],
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
},
],
"extendsPaths": Array [
"./base1/tsdocconfig-base1.json",
"./base2/tsdocconfig-base2.json",
"./base1/tsdoc-base1.json",
"./base2/tsdoc-base2.json",
],
"fileNotFound": false,
"filePath": "assets/p3/tsdocconfig.json",
"filePath": "assets/p3/tsdoc.json",
"messages": Array [],
"tagDefinitions": Array [
TSDocTagDefinition {
Expand All @@ -126,7 +126,7 @@ test('Load p3', () => {
"tagNameWithUpperCase": "@ROOT",
},
],
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
}
`);
});
Expand All @@ -138,7 +138,7 @@ test('Load p4', () => {
"extendsFiles": Array [],
"extendsPaths": Array [],
"fileNotFound": false,
"filePath": "assets/p4/node_modules/example-lib/dist/tsdocconfig-example.json",
"filePath": "assets/p4/node_modules/example-lib/dist/tsdoc-example.json",
"messages": Array [],
"tagDefinitions": Array [
TSDocTagDefinition {
Expand All @@ -149,14 +149,14 @@ test('Load p4', () => {
"tagNameWithUpperCase": "@EXAMPLE",
},
],
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
},
],
"extendsPaths": Array [
"example-lib/dist/tsdocconfig-example.json",
"example-lib/dist/tsdoc-example.json",
],
"fileNotFound": false,
"filePath": "assets/p4/tsdocconfig.json",
"filePath": "assets/p4/tsdoc.json",
"messages": Array [],
"tagDefinitions": Array [
TSDocTagDefinition {
Expand All @@ -167,7 +167,7 @@ test('Load p4', () => {
"tagNameWithUpperCase": "@ROOT",
},
],
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"tsdocSchema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
}
`);
});
2 changes: 1 addition & 1 deletion tsdoc-config/src/__tests__/assets/p1/tsdoc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json"
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
"tagDefinitions": [
{
"tagName": "@base1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
"tagDefinitions": [
{
"tagName": "@base2",
Expand Down
6 changes: 3 additions & 3 deletions tsdoc-config/src/__tests__/assets/p3/tsdoc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
"extends": [
"./base1/tsdocconfig-base1.json",
"./base2/tsdocconfig-base2.json"
"./base1/tsdoc-base1.json",
"./base2/tsdoc-base2.json"
],
"tagDefinitions": [
{
Expand Down
4 changes: 2 additions & 2 deletions tsdoc-config/src/__tests__/assets/p4/tsdoc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdocconfig.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v1/tsdoc.schema.json",
"extends": [
"example-lib/dist/tsdocconfig-example.json"
"example-lib/dist/tsdoc-example.json"
],
"tagDefinitions": [
{
Expand Down
2 changes: 1 addition & 1 deletion tsdoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The [api-demo](https://github.com/microsoft/tsdoc/tree/master/api-demo) folder o
to invoke the TSDoc parser.

A separate NPM package [`@microsoft/tsdoc-config`](https://www.npmjs.com/package/@microsoft/tsdoc)
is used for loading the **tsdocconfig.json** file.
is used for loading the **tsdoc.json** file.


## Get involved
Expand Down
2 changes: 1 addition & 1 deletion tsdoc/src/parser/TSDocMessageId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const enum TSDocMessageId {
/**
* File not found
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when it failed to find a `tsdocconfig.json` file.
* Reported by the `@microsoft/tsdoc-config` package when it failed to find a `tsdoc.json` file.
*/
ConfigFileNotFound = 'tsdoc-config-file-not-found',

Expand Down

0 comments on commit 4f46de1

Please sign in to comment.