From 422fa6dcc9649a53d1a3dd577624c3399cc65f0c Mon Sep 17 00:00:00 2001 From: entrywayaudibly <71117336+entrywayaudibly@users.noreply.github.com> Date: Sat, 17 Oct 2020 00:07:50 +0000 Subject: [PATCH 1/3] Docs: simplify api/registry.md It's easier to read short lines. Hence, some lines were broken and formatted properly. --- docs/api/registry.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/api/registry.md b/docs/api/registry.md index c25198a3d..dc24563e7 100644 --- a/docs/api/registry.md +++ b/docs/api/registry.md @@ -7,7 +7,6 @@ sidebar_label: registry() # registry() - Allows custom registries to be plugged into the task system, which can provide shared tasks or augmented functionality. **Note:** Only tasks registered with `task()` will be provided to the custom registry. The task functions passed directly to `series()` or `parallel()` will not be provided - if you need to customize the registry behavior, compose tasks with string references. @@ -50,14 +49,24 @@ If a `registryInstance` is passed, nothing will be returned. If no arguments are ### Errors -When a constructor (instead of an instance) is passed as `registryInstance`, throws an error with the message, "Custom registries must be instantiated, but it looks like you passed a constructor". +When a constructor (instead of an instance) is passed as `registryInstance`, throws an error with the message: + +> Custom registries must be instantiated, but it looks like you passed a constructor. + +When a registry without a `get` method is passed as `registryInstance`, throws an error with the message: + +> Custom registry must have `get` function. + +When a registry without a `set` method is passed as `registryInstance`, throws an error with the message: + +> Custom registry must have `set` function. -When a registry without a `get` method is passed as `registryInstance`, throws an error with the message, "Custom registry must have `get` function". +When a registry without an `init` method is passed as `registryInstance`, throws an error with the message: -When a registry without a `set` method is passed as `registryInstance`, throws an error with the message, "Custom registry must have `set` function". +> Custom registry must have `init` function" -When a registry without an `init` method is passed as `registryInstance`, throws an error with the message, "Custom registry must have `init` function" +When a registry without a `tasks` method is passed as `registryInstance`, throws an error with the message: -When a registry without a `tasks` method is passed as `registryInstance`, throws an error with the message, "Custom registry must have `tasks` function". +> Custom registry must have `tasks` function. [creating-custom-registries]: ../advanced/creating-custom-registries.md From 27ab12d440419b055ea09d969e6842f852dc3ac0 Mon Sep 17 00:00:00 2001 From: entrywayaudibly <71117336+entrywayaudibly@users.noreply.github.com> Date: Sat, 17 Oct 2020 00:17:11 +0000 Subject: [PATCH 2/3] Docs: add subtitles to api/registry.md add subtitles to Errors section, in order to improve readability. --- docs/api/registry.md | 136 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/docs/api/registry.md b/docs/api/registry.md index dc24563e7..e558d1f4e 100644 --- a/docs/api/registry.md +++ b/docs/api/registry.md @@ -53,18 +53,154 @@ When a constructor (instead of an instance) is passed as `registryInstance`, thr > Custom registries must be instantiated, but it looks like you passed a constructor. +When a registry without a `get` method is passed as `registryInstance`, throws an error with the message: + + +# registry() + +Allows custom registries to be plugged into the task system, which can provide shared tasks or augmented functionality. + +**Note:** Only tasks registered with `task()` will be provided to the custom registry. The task functions passed directly to `series()` or `parallel()` will not be provided - if you need to customize the registry behavior, compose tasks with string references. + +When assigning a new registry, each task from the current registry will be transferred and the current registry will be replaced with the new one. This allows for adding multiple custom registries in sequential order. + +See [Creating Custom Registries][creating-custom-registries] for details. + +## Usage + +```js +const { registry, task, series } = require('gulp'); +const FwdRef = require('undertaker-forward-reference'); + +registry(FwdRef()); + +task('default', series('forward-ref')); + +task('forward-ref', function(cb) { + // body omitted + cb(); +}); +``` + +## Signature + + + +# registry() + +Allows custom registries to be plugged into the task system, which can provide shared tasks or augmented functionality. + +**Note:** Only tasks registered with `task()` will be provided to the custom registry. The task functions passed directly to `series()` or `parallel()` will not be provided - if you need to customize the registry behavior, compose tasks with string references. + +When assigning a new registry, each task from the current registry will be transferred and the current registry will be replaced with the new one. This allows for adding multiple custom registries in sequential order. + +See [Creating Custom Registries][creating-custom-registries] for details. + +## Usage + +```js +const { registry, task, series } = require('gulp'); +const FwdRef = require('undertaker-forward-reference'); + +registry(FwdRef()); + +task('default', series('forward-ref')); + +task('forward-ref', function(cb) { + // body omitted + cb(); +}); +``` + +## Signature + + + +# registry() + +Allows custom registries to be plugged into the task system, which can provide shared tasks or augmented functionality. + +**Note:** Only tasks registered with `task()` will be provided to the custom registry. The task functions passed directly to `series()` or `parallel()` will not be provided - if you need to customize the registry behavior, compose tasks with string references. + +When assigning a new registry, each task from the current registry will be transferred and the current registry will be replaced with the new one. This allows for adding multiple custom registries in sequential order. + +See [Creating Custom Registries][creating-custom-registries] for details. + +## Usage + +```js +const { registry, task, series } = require('gulp'); +const FwdRef = require('undertaker-forward-reference'); + +registry(FwdRef()); + +task('default', series('forward-ref')); + +task('forward-ref', function(cb) { + // body omitted + cb(); +}); +``` + +## Signature + +```js +registry([registryInstance]) +``` + +### Parameters + +| parameter | type | note | +|:--------------:|:-----:|--------| +| registryInstance | object | An instance - not the class - of a custom registry. | + +### Returns + +If a `registryInstance` is passed, nothing will be returned. If no arguments are passed, returns the current registry instance. + +### Errors + +#### Incorrect Parameter + +When a constructor (instead of an instance) is passed as `registryInstance`, throws an error with the message: + +> Custom registries must be instantiated, but it looks like you passed a constructor. + +#### Missing get Method + When a registry without a `get` method is passed as `registryInstance`, throws an error with the message: > Custom registry must have `get` function. +#### Missing set Method + When a registry without a `set` method is passed as `registryInstance`, throws an error with the message: > Custom registry must have `set` function. +#### Missing init Method + When a registry without an `init` method is passed as `registryInstance`, throws an error with the message: > Custom registry must have `init` function" +#### Missing tasks Method + When a registry without a `tasks` method is passed as `registryInstance`, throws an error with the message: > Custom registry must have `tasks` function. From 8b105429823cb94b18c11ecfa55184fd458cff84 Mon Sep 17 00:00:00 2001 From: entrywayaudibly <71117336+entrywayaudibly@users.noreply.github.com> Date: Mon, 19 Oct 2020 22:39:25 -0300 Subject: [PATCH 3/3] fix: remove duplicated text for some reason, GitHub had duplicated some parts of the file (27ab12d). --- docs/api/registry.md | 126 ------------------------------------------- 1 file changed, 126 deletions(-) diff --git a/docs/api/registry.md b/docs/api/registry.md index e558d1f4e..008c959f8 100644 --- a/docs/api/registry.md +++ b/docs/api/registry.md @@ -49,132 +49,6 @@ If a `registryInstance` is passed, nothing will be returned. If no arguments are ### Errors -When a constructor (instead of an instance) is passed as `registryInstance`, throws an error with the message: - -> Custom registries must be instantiated, but it looks like you passed a constructor. - -When a registry without a `get` method is passed as `registryInstance`, throws an error with the message: - - -# registry() - -Allows custom registries to be plugged into the task system, which can provide shared tasks or augmented functionality. - -**Note:** Only tasks registered with `task()` will be provided to the custom registry. The task functions passed directly to `series()` or `parallel()` will not be provided - if you need to customize the registry behavior, compose tasks with string references. - -When assigning a new registry, each task from the current registry will be transferred and the current registry will be replaced with the new one. This allows for adding multiple custom registries in sequential order. - -See [Creating Custom Registries][creating-custom-registries] for details. - -## Usage - -```js -const { registry, task, series } = require('gulp'); -const FwdRef = require('undertaker-forward-reference'); - -registry(FwdRef()); - -task('default', series('forward-ref')); - -task('forward-ref', function(cb) { - // body omitted - cb(); -}); -``` - -## Signature - - - -# registry() - -Allows custom registries to be plugged into the task system, which can provide shared tasks or augmented functionality. - -**Note:** Only tasks registered with `task()` will be provided to the custom registry. The task functions passed directly to `series()` or `parallel()` will not be provided - if you need to customize the registry behavior, compose tasks with string references. - -When assigning a new registry, each task from the current registry will be transferred and the current registry will be replaced with the new one. This allows for adding multiple custom registries in sequential order. - -See [Creating Custom Registries][creating-custom-registries] for details. - -## Usage - -```js -const { registry, task, series } = require('gulp'); -const FwdRef = require('undertaker-forward-reference'); - -registry(FwdRef()); - -task('default', series('forward-ref')); - -task('forward-ref', function(cb) { - // body omitted - cb(); -}); -``` - -## Signature - - - -# registry() - -Allows custom registries to be plugged into the task system, which can provide shared tasks or augmented functionality. - -**Note:** Only tasks registered with `task()` will be provided to the custom registry. The task functions passed directly to `series()` or `parallel()` will not be provided - if you need to customize the registry behavior, compose tasks with string references. - -When assigning a new registry, each task from the current registry will be transferred and the current registry will be replaced with the new one. This allows for adding multiple custom registries in sequential order. - -See [Creating Custom Registries][creating-custom-registries] for details. - -## Usage - -```js -const { registry, task, series } = require('gulp'); -const FwdRef = require('undertaker-forward-reference'); - -registry(FwdRef()); - -task('default', series('forward-ref')); - -task('forward-ref', function(cb) { - // body omitted - cb(); -}); -``` - -## Signature - -```js -registry([registryInstance]) -``` - -### Parameters - -| parameter | type | note | -|:--------------:|:-----:|--------| -| registryInstance | object | An instance - not the class - of a custom registry. | - -### Returns - -If a `registryInstance` is passed, nothing will be returned. If no arguments are passed, returns the current registry instance. - -### Errors - #### Incorrect Parameter When a constructor (instead of an instance) is passed as `registryInstance`, throws an error with the message: