Skip to content

Commit c97bdc6

Browse files
authored
Add typedoc docs (open-telemetry#56)
* Add typedoc docs * oops, yarn run docs -> yarn docs * Fix review comments - Rename docs to documentation - Add lerna run docs * set out to docs/out * Change out path
1 parent 969925d commit c97bdc6

File tree

8 files changed

+26
-16
lines changed

8 files changed

+26
-16
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ yarn.lock
6666
package-lock.json
6767
packages/**/yarn.lock
6868
packages/**/package-lock.json
69+
70+
# docs files
71+
docs

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ The `opentelemetry-js` project is written in TypeScript.
5151
- `yarn bootstrap` or `npm run bootstrap` Bootstrap the packages in the current Lerna repo. Installs all of their dependencies and links any cross-dependencies.
5252
- `yarn test` or `npm test` tests code the same way that our CI will test it.
5353
- `yarn fix` or `npm run fix` lint (and maybe fix) any changes.
54+
- `yarn docs` or `npm run docs` to generate API documentation.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"bootstrap": "lerna bootstrap",
1313
"bump": "lerna publish",
1414
"codecov": "lerna run codecov",
15-
"check": "lerna run check"
15+
"check": "lerna run check",
16+
"docs": "lerna run docs"
1617
},
1718
"repository": "open-telemetry/opentelemetry-js",
1819
"keywords": [

packages/opentelemetry-types/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"check": "gts check",
1111
"compile": "tsc -p .",
1212
"fix": "gts fix",
13-
"test": "npm run compile && npm run check"
13+
"test": "npm run compile && npm run check",
14+
"docs": "typedoc --tsconfig tsconfig.json"
1415
},
1516
"keywords": [
1617
"opentelemetry",
@@ -38,6 +39,7 @@
3839
},
3940
"devDependencies": {
4041
"gts": "^1.0.0",
42+
"typedoc": "^0.14.2",
4143
"typescript": "^3.4.5"
4244
}
4345
}

packages/opentelemetry-types/src/trace/link.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import { Attributes } from './attributes';
1818
import { SpanContext } from './span_context';
1919

2020
/**
21-
* A pointer from the current span to another span in the same trace or in a
22-
* different trace.
21+
* A pointer from the current {@link Span} to another span in the same trace or
22+
* in a different trace.
2323
*/
2424
export interface Link {
25-
/** The SpanContext of a linked span. */
25+
/** The {@link SpanContext} of a linked span. */
2626
spanContext: SpanContext;
27-
/** A set of attributes on the link. */
27+
/** A set of {@link Attributes} on the link. */
2828
attributes?: Attributes;
2929
}

packages/opentelemetry-types/src/trace/span.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { Attributes } from './attributes';
2727
*/
2828
export interface Span {
2929
/**
30-
* Returns the SpanContext object associated with this Span.
30+
* Returns the {@link SpanContext} object associated with this Span.
3131
*
3232
* @returns the SpanContext object associated with this Span.
3333
*/
@@ -62,7 +62,7 @@ export interface Span {
6262
* @param [attributes] the attributes that will be added; these are
6363
* associated with this event.
6464
*/
65-
addEvent(name: string, attributes?: { [key: string]: unknown }): this;
65+
addEvent(name: string, attributes?: Attributes): this;
6666

6767
/**
6868
* Adds a link to the Span.
@@ -71,14 +71,11 @@ export interface Span {
7171
* @param [attributes] the attributes that will be added; these are
7272
* associated with this link.
7373
*/
74-
addLink(
75-
spanContext: SpanContext,
76-
attributes?: { [key: string]: unknown }
77-
): this;
74+
addLink(spanContext: SpanContext, attributes?: Attributes): this;
7875

7976
/**
8077
* Sets a status to the span. If used, this will override the default Span
81-
* status. Default is 'OK'.
78+
* status. Default is {@link CanonicalCode.OK}.
8279
*
8380
* @param status the Status to set.
8481
*/

packages/opentelemetry-types/src/trace/span_context.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { TraceState } from './trace_state';
1818
import { TraceOptions } from './trace_options';
1919

2020
/**
21-
* A SpanContext represents the portion of a Span which must be serialized and
22-
* propagated along side of a distributed context.
21+
* A SpanContext represents the portion of a {@link Span} which must be
22+
* serialized and propagated along side of a distributed context.
2323
*/
2424
export interface SpanContext {
2525
/**

packages/opentelemetry-types/tsconfig.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@
66
},
77
"include": [
88
"src/**/*.ts"
9-
]
9+
],
10+
"typedocOptions": {
11+
"name": "OpenTelemetry Documentation",
12+
"out": "docs/out",
13+
"mode": "file",
14+
"hideGenerator": true
15+
}
1016
}

0 commit comments

Comments
 (0)