Skip to content

Commit

Permalink
Build Tools: docgen: Resolve source relative documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Mar 21, 2020
1 parent daa43c8 commit 37adca3
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 44 deletions.
6 changes: 2 additions & 4 deletions bin/api-docs/update-readmes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
const { join, relative, resolve, sep, basename } = require( 'path' );
const { join, relative, resolve, sep, basename, dirname } = require( 'path' );
const glob = require( 'fast-glob' );
const execa = require( 'execa' );
const { Transform } = require( 'stream' );
Expand Down Expand Up @@ -199,8 +199,6 @@ glob.stream( [
const [ file, tokens ] = data;
const output = relative( ROOT_DIR, file );

const packageName = getFilePackage( file );

// Each file can have more than one placeholder content to update, each
// represented by tokens. The docgen script updates one token at a time,
// so the tokens must be replaced in sequence to prevent the processes
Expand All @@ -217,7 +215,7 @@ glob.stream( [
'docgen'
).replace( / /g, '\\ ' ),
[
join( 'packages', packageName, path ),
relative( ROOT_DIR, resolve( dirname( file ), path ) ),
`--output ${ output }`,
'--to-token',
`--use-token "${ token }"`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Namespace: `core/annotations`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/annotations/src/store/selectors.js) -->

Nothing to document.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/annotations/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/annotations/src/store/actions.js) -->

Nothing to document.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/annotations/src/store/actions.js) -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/block-editor`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/block-editor/src/store/selectors.js) -->

<a name="canInsertBlockType" href="#canInsertBlockType">#</a> **canInsertBlockType**

Expand Down Expand Up @@ -894,11 +894,11 @@ _Returns_

- `?boolean`: Whether the template is valid or not.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/block-editor/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/block-editor/src/store/actions.js) -->

<a name="clearSelectedBlock" href="#clearSelectedBlock">#</a> **clearSelectedBlock**

Expand Down Expand Up @@ -1366,4 +1366,4 @@ _Returns_
Undocumented declaration.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/block-editor/src/store/actions.js) -->
8 changes: 4 additions & 4 deletions docs/designers-developers/developers/data/data-core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/blocks`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/blocks/src/store/selectors.js) -->

<a name="getBlockStyles" href="#getBlockStyles">#</a> **getBlockStyles**

Expand Down Expand Up @@ -231,11 +231,11 @@ _Returns_

- `Array<Object>`: Whether block type matches search term.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/blocks/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/blocks/src/store/actions.js) -->

<a name="addBlockCollection" href="#addBlockCollection">#</a> **addBlockCollection**

Expand Down Expand Up @@ -417,4 +417,4 @@ _Returns_
- `Object`: Action object.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/blocks/src/store/actions.js) -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/edit-post`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/edit-post/src/store/selectors.js) -->

<a name="getActiveGeneralSidebarName" href="#getActiveGeneralSidebarName">#</a> **getActiveGeneralSidebarName**

Expand Down Expand Up @@ -267,11 +267,11 @@ _Returns_

- `boolean`: Whether the metaboxes are being saved.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/edit-post/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/edit-post/src/store/actions.js) -->

<a name="closeGeneralSidebar" href="#closeGeneralSidebar">#</a> **closeGeneralSidebar**

Expand Down Expand Up @@ -472,4 +472,4 @@ _Returns_
- `Object`: Action object.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/edit-post/src/store/actions.js) -->
8 changes: 4 additions & 4 deletions docs/designers-developers/developers/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/editor`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/editor/src/store/selectors.js) -->

<a name="canInsertBlockType" href="#canInsertBlockType">#</a> **canInsertBlockType**

Expand Down Expand Up @@ -1060,11 +1060,11 @@ _Related_

- isValidTemplate in core/block-editor store.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/editor/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/editor/src/store/actions.js) -->

<a name="autosave" href="#autosave">#</a> **autosave**

Expand Down Expand Up @@ -1511,4 +1511,4 @@ _Returns_
- `Object`: Action object.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/editor/src/store/actions.js) -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/keyboard-shortcuts`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/keyboard-shortcuts/src/store/selectors.js) -->

<a name="getAllShortcutRawKeyCombinations" href="#getAllShortcutRawKeyCombinations">#</a> **getAllShortcutRawKeyCombinations**

Expand Down Expand Up @@ -85,11 +85,11 @@ _Returns_

- `?string`: Shortcut representation.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/keyboard-shortcuts/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/keyboard-shortcuts/src/store/actions.js) -->

<a name="registerShortcut" href="#registerShortcut">#</a> **registerShortcut**

Expand All @@ -116,4 +116,4 @@ _Returns_
- `Object`: action.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/keyboard-shortcuts/src/store/actions.js) -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/notices`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/notices/src/store/selectors.js) -->

<a name="getNotices" href="#getNotices">#</a> **getNotices**

Expand All @@ -20,11 +20,11 @@ _Returns_

- `Array<WPNotice>`: Array of notices.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/notices/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/notices/src/store/actions.js) -->

<a name="createErrorNotice" href="#createErrorNotice">#</a> **createErrorNotice**

Expand Down Expand Up @@ -132,4 +132,4 @@ _Returns_
- `Object`: Action object.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/notices/src/store/actions.js) -->
8 changes: 4 additions & 4 deletions docs/designers-developers/developers/data/data-core-nux.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/nux`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/nux/src/store/selectors.js) -->

<a name="areTipsEnabled" href="#areTipsEnabled">#</a> **areTipsEnabled**

Expand Down Expand Up @@ -47,11 +47,11 @@ _Returns_

- `boolean`: Whether or not the given tip is showing.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/nux/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/nux/src/store/actions.js) -->

<a name="disableTips" href="#disableTips">#</a> **disableTips**

Expand Down Expand Up @@ -97,4 +97,4 @@ _Returns_
- `Object`: Action object.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/nux/src/store/actions.js) -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core/viewport`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/viewport/src/store/selectors.js) -->

<a name="isViewportMatch" href="#isViewportMatch">#</a> **isViewportMatch**

Expand All @@ -26,11 +26,11 @@ _Returns_

- `boolean`: Whether viewport matches query.

<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/viewport/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/viewport/src/store/actions.js) -->

<a name="setIsMatching" href="#setIsMatching">#</a> **setIsMatching**

Expand All @@ -47,4 +47,4 @@ _Returns_
- `Object`: Action object.


<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/viewport/src/store/actions.js) -->
8 changes: 4 additions & 4 deletions docs/designers-developers/developers/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Namespace: `core`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|src/selectors.js) -->
<!-- START TOKEN(Autogenerated selectors|../../../../packages/core-data/src/selectors.js) -->

<a name="canUser" href="#canUser">#</a> **canUser**

Expand Down Expand Up @@ -441,11 +441,11 @@ _Returns_

- `boolean`: Whether the entity record is saving or not.

<!-- END TOKEN(Autogenerated selectors|src/selectors.js) -->
<!-- END TOKEN(Autogenerated selectors|../../../../packages/core-data/src/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|src/actions.js) -->
<!-- START TOKEN(Autogenerated actions|../../../../packages/core-data/src/actions.js) -->

<a name="addEntities" href="#addEntities">#</a> **addEntities**

Expand Down Expand Up @@ -617,4 +617,4 @@ Action triggered to undo the last edit to
an entity record, if any.


<!-- END TOKEN(Autogenerated actions|src/actions.js) -->
<!-- END TOKEN(Autogenerated actions|../../../../packages/core-data/src/actions.js) -->

0 comments on commit 37adca3

Please sign in to comment.