Skip to content

Commit

Permalink
Add docs action (#360)
Browse files Browse the repository at this point in the history
* feature(docs): add action to build docs for github pages
  • Loading branch information
trxcllnt authored Dec 29, 2023
1 parent 2fcd440 commit d6591ee
Show file tree
Hide file tree
Showing 120 changed files with 216 additions and 14 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: docs

on:
push:
branches:
- master
paths:
- 'LICENSE'
- 'README.md'
- 'typedoc.js'
- '.github/workflows/**'
- 'src/**/*.ts'

jobs:
update:
name: Update Docs
runs-on: ubuntu-20.04
container: node:16.15.1-bullseye
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
path: main
- name: Checkout gh-pages
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
- name: Build Docs
working-directory: main
run: |
set -x
yarn --ignore-optional --ignore-engines --non-interactive
yarn doc
- name: Copy Docs to gh-pages
run: |
rm -rf gh-pages/docs
cp -r main/doc gh-pages/docs
- name: Commit new docs
working-directory: gh-pages
run: |
COMMIT_SHA=$(echo "${COMMIT_SHA}" | cut -c 1-7)
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add --all
git commit --allow-empty -m "update docs from ${COMMIT_SHA}"
git push
env:
COMMIT_SHA: ${{ github.sha }}
2 changes: 1 addition & 1 deletion .github/workflows/main.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Install dependencies
if: ${{ steps.test_files_changed.outputs.any_changed == 'true' || steps.test_files_changed.outputs.any_deleted == 'true' || steps.source_files_changed.outputs.any_changed == 'true' || steps.source_files_changed.outputs.any_deleted == 'true' }}
run: |
yarn
yarn --ignore-optional --ignore-engines --non-interactive
- name: Build package
if: ${{ steps.source_files_changed.outputs.any_changed == 'true' || steps.source_files_changed.outputs.any_deleted == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"terser-webpack-plugin": "2.3.5",
"ts-jest": "28.0.7",
"ts-node": "8.6.2",
"typedoc": "0.16.10",
"typedoc": "0.25.4",
"typescript": "5.3.3",
"validate-commit-msg": "2.14.0",
"web-stream-tools": "0.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/Ix.dom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Manually re-export because closure-compiler doesn't support `export * from X` syntax yet
/** @ignore */
export * from './Ix';
export { default } from './Ix';
export { symbolObservable } from './Ix';
Expand Down
2 changes: 2 additions & 0 deletions src/Ix.node.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/** @ignore */
export * from './Ix';

export { IterableReadable } from './iterable/tonodestream';
export { AsyncIterableReadable } from './asynciterable/tonodestream';
/** @ignore */
export { asAsyncIterable, AsyncIterableTransform } from './asynciterable/asasynciterable';
export { fromNodeStream, ReadableStreamAsyncIterable } from './asynciterable/fromnodestream';

Expand Down
3 changes: 3 additions & 0 deletions src/Ix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export { observable as symbolObservable };
export { AbortError, AsyncSink, IterableX as Iterable, AsyncIterableX as AsyncIterable };

// Also export default to accommodate quirks of node's `--experimental-modules` mode
/** @ignore */
export default {
AbortError,
AsyncSink,
Expand All @@ -22,7 +23,9 @@ export default {
'symbolObservable': observable
};

/** @ignore */
export type GroupedIterable<TKey, TValue> = ImportedGroupedIterable<TKey, TValue>;
/** @ignore */
export type GroupedAsyncIterable<TKey, TValue> = ImportedGroupedAsyncIterable<TKey, TValue>;

declare global {
Expand Down
1 change: 1 addition & 0 deletions src/aborterror.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { isObject } from './util/isiterable';

/** @ignore */
export class AbortError extends Error {
constructor(message = 'The operation has been aborted') {
super(message);
Expand Down
3 changes: 3 additions & 0 deletions src/asynciterable/asasynciterable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AsyncIterableX } from './asynciterablex';
import { OperatorAsyncFunction, UnaryFunction } from '../interfaces';
import { Transform, TransformCallback, TransformOptions } from 'stream';

/** @ignore */
export interface AsyncIterableTransform<T>
extends AsyncIterableX<T>,
NodeJS.ReadableStream,
Expand All @@ -15,6 +16,7 @@ export interface AsyncIterableTransform<T>

const asyncIterableMixin = Symbol('asyncIterableMixin');

/** @ignore */
export function AsyncIterableTransform<T>(
this: AsyncIterableTransform<T>,
options?: TransformOptions
Expand Down Expand Up @@ -48,6 +50,7 @@ AsyncIterableTransform.prototype._transform = function (
callback(null, chunk);
};

/** @ignore */
export function asAsyncIterable<T>(options: TransformOptions = {}) {
return Reflect.construct(AsyncIterableTransform, [options]) as AsyncIterableTransform<T>;
}
7 changes: 7 additions & 0 deletions src/asynciterable/asynciterablex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ interface AsyncResolver<T> {
reject: (reason?: any) => void;
}

/** @ignore */
/** @ignore */
export class AsyncSink<TSource> implements AsyncIterableIterator<TSource> {
private _ended: boolean;
private _values: AsyncSinkItem<TSource>[];
Expand Down Expand Up @@ -218,6 +220,7 @@ export class AsyncSink<TSource> implements AsyncIterableIterator<TSource> {
}
}

/** @ignore */
export class FromArrayIterable<TSource, TResult = TSource> extends AsyncIterableX<TResult> {
private _source: ArrayLike<TSource>;
private _selector: (value: TSource, index: number) => TResult | Promise<TResult>;
Expand All @@ -240,6 +243,7 @@ export class FromArrayIterable<TSource, TResult = TSource> extends AsyncIterable
}
}

/** @ignore */
export class FromAsyncIterable<TSource, TResult = TSource> extends AsyncIterableX<TResult> {
private _source: Iterable<TSource | PromiseLike<TSource>> | AsyncIterable<TSource>;
private _selector: (value: TSource, index: number) => TResult | Promise<TResult>;
Expand All @@ -261,6 +265,7 @@ export class FromAsyncIterable<TSource, TResult = TSource> extends AsyncIterable
}
}

/** @ignore */
export class FromPromiseIterable<TSource, TResult = TSource> extends AsyncIterableX<TResult> {
private _source: PromiseLike<TSource>;
private _selector: (value: TSource, index: number) => TResult | Promise<TResult>;
Expand All @@ -280,6 +285,7 @@ export class FromPromiseIterable<TSource, TResult = TSource> extends AsyncIterab
}
}

/** @ignore */
export class FromObservableAsyncIterable<TSource, TResult = TSource> extends AsyncIterableX<
TResult
> {
Expand Down Expand Up @@ -350,6 +356,7 @@ class WithAbortAsyncIterable<TSource> implements AsyncIterable<TSource> {
}
}

/** @ignore */
export type AsyncIterableInput<TSource> =
| AsyncIterable<TSource>
| AsyncIterator<TSource>
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/asyncsink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface AsyncResolver<T> {
reject: (reason?: any) => void;
}

/** @ignore */
export class AsyncSink<TSource> implements AsyncIterableIterator<TSource> {
private _ended: boolean;
private _values: AsyncSinkItem<TSource>[];
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/catcherror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { returnAsyncIterator } from '../util/returniterator';
import { wrapWithAbort } from './operators/withabort';
import { throwIfAborted } from '../aborterror';

/** @ignore */
export class CatchAllAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: Iterable<AsyncIterable<TSource>>;

Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/combinelatest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function wrapPromiseWithIndex<T>(promise: Promise<T>, index: number) {
return promise.then((value) => ({ value, index })) as Promise<MergeResult<T>>;
}

/** @ignore */
export class CombineLatestAsyncIterable<TSource> extends AsyncIterableX<TSource[]> {
private _sources: AsyncIterable<TSource>[];

Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AsyncIterableX } from './asynciterablex';
import { wrapWithAbort } from './operators/withabort';
import { throwIfAborted } from '../aborterror';

/** @ignore */
export class ConcatAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: Iterable<AsyncIterable<TSource>>;

Expand Down
4 changes: 4 additions & 0 deletions src/asynciterable/fromdomstream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { AsyncIterableX } from './asynciterablex';
/** @ignore */
const SharedArrayBuf = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : ArrayBuffer;

/** @ignore */
/** @ignore */
export class AsyncIterableReadableStream<T> extends AsyncIterableX<T | undefined> {
constructor(protected _stream: ReadableStream<T>) {
super();
Expand All @@ -14,6 +16,8 @@ export class AsyncIterableReadableStream<T> extends AsyncIterableX<T | undefined
}
}

/** @ignore */
/** @ignore */
export class AsyncIterableReadableByteStream extends AsyncIterableReadableStream<Uint8Array> {
[Symbol.asyncIterator]() {
const stream = this._stream;
Expand Down
4 changes: 4 additions & 0 deletions src/asynciterable/fromevent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ import { isFunction } from '../util/isiterable';

type CommonEventHandler = (...args: any[]) => void;

/** @ignore */
export interface OnOffEventEmitter {
on(event: string | symbol, listener: CommonEventHandler): this;
off(event: string | symbol, listener: CommonEventHandler): this;
}

/** @ignore */
export interface NodeEventEmitter {
addListener(event: string | symbol, listener: CommonEventHandler): this;
removeListener(event: string | symbol, listener: CommonEventHandler): this;
}

/** @ignore */
export type EventListenerOptions =
| {
capture?: boolean;
Expand All @@ -22,6 +25,7 @@ export type EventListenerOptions =
}
| boolean;

/** @ignore */
export type EventedTarget = EventTarget | OnOffEventEmitter | NodeEventEmitter;

function isMessagePortEventEmitter(obj: any): obj is OnOffEventEmitter {
Expand Down
2 changes: 2 additions & 0 deletions src/asynciterable/fromnodestream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const READABLE = 1;
const ENDED = 2;
const ERRORED = 3;

/** @ignore */
/** @ignore */
export class ReadableStreamAsyncIterable extends AsyncIterableX<string | Buffer>
implements AsyncIterator<string | Buffer> {
private _stream: NodeJS.ReadableStream;
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function wrapPromiseWithIndex<T>(promise: Promise<T>, index: number) {
return promise.then((value) => ({ value, index })) as Promise<MergeResult<T>>;
}

/** @ignore */
export class MergeAsyncIterable<T> extends AsyncIterableX<T> {
private _source: AsyncIterable<T>[];

Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/never.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AsyncIterableX } from './asynciterablex';
import { throwIfAborted, AbortError } from '../aborterror';

/** @ignore */
export class NeverAsyncIterable extends AsyncIterableX<never> {
constructor() {
super();
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/of.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AsyncIterableX } from './asynciterablex';
import { throwIfAborted } from '../aborterror';

/** @ignore */
export class OfAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _args: TSource[];

Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/onerrorresumenext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AsyncIterableX } from './asynciterablex';
import { wrapWithAbort } from './operators/withabort';
import { throwIfAborted } from '../aborterror';

/** @ignore */
export class OnErrorResumeNextAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: Iterable<AsyncIterable<TSource>>;

Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/_flatten.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function* wrapIterator<TValue, TType extends Type>(
return { type, index, value: undefined };
}

/** @ignore */
export class FlattenConcurrentAsyncIterable<TSource, TResult> extends AsyncIterableX<TResult> {
constructor(
private _source: AsyncIterable<TSource>,
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/batch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function assertNever(value: never): never {
throw new Error(`Unhandled discriminated union member ${value}`);
}

/** @ignore */
export class BatchAsyncIterable<TSource> extends AsyncIterableX<TSource[]> {
private _source: AsyncIterable<TSource>;

Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { OperatorAsyncFunction } from '../../interfaces';
import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';

/** @ignore */
export class BufferAsyncIterable<TSource> extends AsyncIterableX<TSource[]> {
private _source: AsyncIterable<TSource>;
private _count: number;
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/catcherror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { returnAsyncIterator } from '../../util/returniterator';
import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';

/** @ignore */
export class CatchWithAsyncIterable<TSource, TResult> extends AsyncIterableX<TSource | TResult> {
private _source: AsyncIterable<TSource>;
private _handler: (
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/concatall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { OperatorAsyncFunction } from '../../interfaces';
import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';

/** @ignore */
export class ConcatAllAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<AsyncIterable<TSource>>;

Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AsyncIterableX } from '../asynciterablex';
import { MonoTypeOperatorAsyncFunction } from '../../interfaces';
import { AbortError, throwIfAborted } from '../../aborterror';

/** @ignore */
export class DebounceAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<TSource>;
private _time: number;
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/defaultifempty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MonoTypeOperatorAsyncFunction } from '../../interfaces';
import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';

/** @ignore */
export class DefaultIfEmptyAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<TSource>;
private _defaultValue: TSource;
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { sleep } from '../_sleep';
import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';

/** @ignore */
export class DelayAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<TSource>;
private _dueTime: number;
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/delayeach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { sleep } from '../_sleep';
import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';

/** @ignore */
export class DelayEachAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<TSource>;
private _dueTime: number;
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/distinct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';
import { DistinctOptions } from './distinctoptions';

/** @ignore */
export class DistinctAsyncIterable<TSource, TKey = TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<TSource>;
private _keySelector: (value: TSource, signal?: AbortSignal) => TKey | Promise<TKey>;
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/distinctuntilchanged.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';
import { DistinctOptions } from './distinctoptions';

/** @ignore */
export class DistinctUntilChangedAsyncIterable<TSource, TKey = TSource> extends AsyncIterableX<
TSource
> {
Expand Down
1 change: 1 addition & 0 deletions src/asynciterable/operators/endwith.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MonoTypeOperatorAsyncFunction } from '../../interfaces';
import { wrapWithAbort } from './withabort';
import { throwIfAborted } from '../../aborterror';

/** @ignore */
export class EndWithAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<TSource>;
private _args: TSource[];
Expand Down
Loading

0 comments on commit d6591ee

Please sign in to comment.