Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typescript documentation #28

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ npm test -- --watch

The main source files are found under `src/`. You can read the [architecture notes](#architeture) below, to learn more about where everything goes.

### Generating documentation

This project utilizes JSDOC/TSDOC to self-document the code. You can find generated documentation under [/docs](/docs/README.md) directory.

As for now the documentation needs to be manually generated by running `npm run docs-build` script.
In the future it would be nice to set up CI stage for docs generation.

## Architecture

### CLI
Expand Down Expand Up @@ -177,21 +184,23 @@ async function runCore(
state: State;
}>;

type Options = {
/* The maximum number of pages to visit */
interface Options {
/** The maximum number of pages to visit **/
pageLimit: number;
/* The maximum number of retries for a failing page */
/** The maximum number of retries for a failing page */
maxRetries?: number;
/* Whether to ignore links of the shape https://example.com#my-id */
/** Whether to ignore links of the shape https://example.com#my-id */
ignoreFragmentLinks?: boolean;
/* A list of extensions to ignore, skipping pages */
/** A list of extensions to ignore, skipping pages */
ignoreExtensions?: Array<string>;
/* Wheter to ignore links of the shape https://example.com/?a=b */
/** Wheter to ignore links of the shape https://example.com/?a=b */
ignoreQueryParams?: boolean;
/* A path to a route manifest file, used to de-duplicate visited pages and routes */
/** A path to a route manifest file, used to de-duplicate visited pages and routes */
routeManifestPath?: string;
/* Whether to expose the streaming logging API, used for advanced, "live" reporters */
/** Whether to expose the streaming logging API, used for advanced, "live" reporters */
streaming?: boolean;
/** List of Chromium flags for Puppeteer launch */
puppeteerChromeLaunchArgs?: puppeteer.LaunchOptions['args'];
};
```

Expand Down
15 changes: 15 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[accessible-pipeline](README.md)

# Type-related documentation

This is automatically generated JSDOC/TSDOC documentation using [TypeDoc](https://github.com/TypeStrong/typedoc) and [typedoc-plugin-markdown](https://github.com/tom-grey/typedoc-plugin-markdown).
TypeDoc options are set in `typedocOptions` property of `tsconfig.json`'.

### Files

* ["cli"](modules/_cli_.md)
* ["src/core"](modules/_src_core_.md)
* ["src/logger"](modules/_src_logger_.md)
* ["src/report"](modules/_src_report_.md)
* ["src/run"](modules/_src_run_.md)
* ["src/streaming"](modules/_src_streaming_.md)
101 changes: 101 additions & 0 deletions docs/interfaces/_src_core_.options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[accessible-pipeline](../README.md) › ["src/core"](../modules/_src_core_.md) › [Options](_src_core_.options.md)

# Interface: Options

Common options for excluding links to visit.
For example *.pdf and #heading-link came up often in early iterations

## Hierarchy

* **Options**

### Properties

* [ignoreExtensions](_src_core_.options.md#optional-ignoreextensions)
* [ignoreFragmentLinks](_src_core_.options.md#optional-ignorefragmentlinks)
* [ignoreQueryParams](_src_core_.options.md#optional-ignorequeryparams)
* [maxRetries](_src_core_.options.md#optional-maxretries)
* [pageLimit](_src_core_.options.md#pagelimit)
* [puppeteerChromeLaunchArgs](_src_core_.options.md#optional-puppeteerchromelaunchargs)
* [routeManifestPath](_src_core_.options.md#optional-routemanifestpath)
* [streaming](_src_core_.options.md#optional-streaming)

## Properties

### `Optional` ignoreExtensions

• **ignoreExtensions**? : *Array‹string›*

*Defined in [src/core.ts:41](/src/core.ts#L41)*

A list of extensions to ignore, skipping pages

___

### `Optional` ignoreFragmentLinks

• **ignoreFragmentLinks**? : *undefined | false | true*

*Defined in [src/core.ts:39](/src/core.ts#L39)*

Whether to ignore links of the shape https://example.com#my-id

___

### `Optional` ignoreQueryParams

• **ignoreQueryParams**? : *undefined | false | true*

*Defined in [src/core.ts:43](/src/core.ts#L43)*

Wheter to ignore links of the shape https://example.com/?a=b

___

### `Optional` maxRetries

• **maxRetries**? : *undefined | number*

*Defined in [src/core.ts:37](/src/core.ts#L37)*

The maximum number of retries for a failing page

___

### pageLimit

• **pageLimit**: *number*

*Defined in [src/core.ts:35](/src/core.ts#L35)*

The maximum number of pages to visit

___

### `Optional` puppeteerChromeLaunchArgs

• **puppeteerChromeLaunchArgs**? : *undefined | string[]*

*Defined in [src/core.ts:49](/src/core.ts#L49)*

List of Chromium flags for Puppeteer launch

___

### `Optional` routeManifestPath

• **routeManifestPath**? : *undefined | string*

*Defined in [src/core.ts:45](/src/core.ts#L45)*

A path to a route manifest file, used to de-duplicate visited pages and routes

___

### `Optional` streaming

• **streaming**? : *undefined | false | true*

*Defined in [src/core.ts:47](/src/core.ts#L47)*

Whether to expose the streaming logging API, used for advanced, "live" reporters
5 changes: 5 additions & 0 deletions docs/modules/_cli_.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[accessible-pipeline](../README.md) › ["cli"](_cli_.md)

# "cli"


66 changes: 66 additions & 0 deletions docs/modules/_src_core_.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[accessible-pipeline](../README.md) › ["src/core"](_src_core_.md)

# "src/core"

### Interfaces

* [Options](../interfaces/_src_core_.options.md)

### Functions

* [runCore](_src_core_.md#runcore)
* [runCoreStreaming](_src_core_.md#runcorestreaming)

## Functions

### runCore

▸ **runCore**(`rootURL`: URL, `opts`: [Options](../interfaces/_src_core_.options.md)): *Promise‹object›*

*Defined in [src/core.ts:79](/src/core.ts#L79)*

Runs the assertions at the URL with options, and returns them all at once.

This version is simpler to use (you await it), but it might have memory
pressure issues.

An alternative is runCoreStreaming, which returns results one-at-a-time.

**Parameters:**

Name | Type |
------ | ------ |
`rootURL` | URL |
`opts` | [Options](../interfaces/_src_core_.options.md) |

**Returns:** *Promise‹object›*

___

### runCoreStreaming

▸ **runCoreStreaming**(`rootURL`: URL, `opts`: [Options](../interfaces/_src_core_.options.md)): *object*

*Defined in [src/core.ts:108](/src/core.ts#L108)*

Runs the assertions at the URL with options, and returns them one-at-a-time,
as an async iterable.

This version allows you to process results at your own pace, which can be
good for memory pressure, as well as implementing other streaming interfaces
on top.

An alternative is runCore, which buffers / collects the results instead.

**`see`** https://2ality.com/2016/10/asynchronous-iteration.html

**`see`** http://javascript.info/async-iterators-generators

**Parameters:**

Name | Type |
------ | ------ |
`rootURL` | URL |
`opts` | [Options](../interfaces/_src_core_.options.md) |

**Returns:** *object*
18 changes: 18 additions & 0 deletions docs/modules/_src_logger_.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[accessible-pipeline](../README.md) › ["src/logger"](_src_logger_.md)

# "src/logger"

### Variables

* [logger](_src_logger_.md#const-logger)

## Variables

### `Const` logger

• **logger**: *BaseLogger & object* = createLogger({
prettyPrint: DEBUG_LOG_PRETTY,
level: LOG_LEVEL,
})

*Defined in [src/logger.ts:6](/src/logger.ts#L6)*
37 changes: 37 additions & 0 deletions docs/modules/_src_report_.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[accessible-pipeline](../README.md) › ["src/report"](_src_report_.md)

# "src/report"

### Type aliases

* [CLIOptions](_src_report_.md#clioptions)

### Functions

* [cliEntry](_src_report_.md#clientry)

## Type aliases

### CLIOptions

Ƭ **CLIOptions**: *object*

*Defined in [src/report.tsx:300](/src/report.tsx#L300)*

#### Type declaration:

## Functions

### cliEntry

▸ **cliEntry**(`opts`: [CLIOptions](_src_report_.md#clioptions)): *void*

*Defined in [src/report.tsx:306](/src/report.tsx#L306)*

**Parameters:**

Name | Type |
------ | ------ |
`opts` | [CLIOptions](_src_report_.md#clioptions) |

**Returns:** *void*
36 changes: 36 additions & 0 deletions docs/modules/_src_run_.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[accessible-pipeline](../README.md) › ["src/run"](_src_run_.md)

# "src/run"

### Type aliases

* [CLIOptions](_src_run_.md#clioptions)

### Functions

* [cliEntry](_src_run_.md#clientry)

## Type aliases

### CLIOptions

Ƭ **CLIOptions**: *[Options](../interfaces/_src_core_.options.md) & object*

*Defined in [src/run.ts:38](/src/run.ts#L38)*

## Functions

### cliEntry

▸ **cliEntry**(`rootHref`: string, `opts`: [CLIOptions](_src_run_.md#clioptions)): *void*

*Defined in [src/run.ts:44](/src/run.ts#L44)*

**Parameters:**

Name | Type |
------ | ------ |
`rootHref` | string |
`opts` | [CLIOptions](_src_run_.md#clioptions) |

**Returns:** *void*
Loading