Skip to content

Commit 70a25be

Browse files
docs: auto generate markdown files (#441)
This commit adds a new workflow, generate markdown files, which runs api-extractor and api-documenter in order to generate markdown files for all the @public functions in our src code. There is now a bot that auto runs tests after the generate markdown file workflow and check + update 3rd party notices workflow. How the bot works: The bot has write access to the repo, so it is like a regular user committed to the repo, rather than an automated commit. GH prevents automated commits from a workflow, which uses the GITHUB_TOKEN by default, from re-running checks (b/c it might cause an infinite loop of GH actions running), but commits from a workflow with a personal access token will trigger a re-run of tests. so, in a way we're bypassing some of the built-in GH protections, so we have to be careful to only use the bot token in a repo when we know for sure that it won't create an infinite loop of GH workflow triggering. --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 91d666a commit 70a25be

File tree

111 files changed

+1159
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1159
-174
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Generate markdown files
2+
3+
on: push
4+
5+
jobs:
6+
generate:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: "Checkout"
10+
uses: actions/checkout@v3
11+
with:
12+
ref: ${{ github.head_ref }}
13+
token: ${{ secrets.BOT_REPO_SCOPED_TOKEN }}
14+
- name: Install pnpm
15+
uses: pnpm/[email protected]
16+
- name: Install deps
17+
run: pnpm i
18+
- name: generate-docs
19+
run: pnpm run docs
20+
- name: Auto Generate Markdown Files
21+
id: generate-markdown
22+
uses: EndBug/add-and-commit@v9
23+
with:
24+
message: "Auto generated documentation"
25+
add: "*.md"
26+
push: true
27+
pull: --rebase --autostash
28+
default_author: github_actions
29+
- name: Fail on push
30+
run: |
31+
if [[ ${{ steps.generate-markdown.outputs.pushed }} == true ]]; then exit 1; else exit 0; fi

.github/workflows/third_party_notices_check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
- uses: actions/checkout@v3
1010
with:
1111
ref: ${{ github.head_ref }}
12+
token: ${{ secrets.BOT_REPO_SCOPED_TOKEN }}
1213
- uses: actions/setup-node@v3
1314
with:
1415
node-version: 18.x

packages/pages/api-extractor.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
},
1212
"dtsRollup": {
1313
"enabled": true,
14-
"untrimmedFilePath": "",
1514
"publicTrimmedFilePath": "<projectFolder>/dist/types/<unscopedPackageName>.d.ts"
1615
},
1716
"tsdocMetadata": {},
@@ -28,6 +27,10 @@
2827
"ae-unresolved-link": {
2928
"logLevel": "none",
3029
"addToApiReportFile": true
30+
},
31+
"ae-internal-missing-underscore": {
32+
"logLevel": "none",
33+
"addToApiReportFile": false
3134
}
3235
},
3336
"tsdocMessageReporting": {

packages/pages/docs/api/pages.attributes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
Custom type for specifying HTML element attributes in the [Tag](./pages.tag.md) interface.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
12-
export declare type Attributes = Record<string, string>;
12+
export type Attributes = Record<string, string>;
1313
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [FunctionModule](./pages.functionmodule.md) &gt; [default](./pages.functionmodule.default.md)
4+
5+
## FunctionModule.default property
6+
7+
The exported function
8+
9+
**Signature:**
10+
11+
```typescript
12+
default?: FunctionType;
13+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [FunctionModule](./pages.functionmodule.md)
4+
5+
## FunctionModule interface
6+
7+
Defines the functions and fields that are available to the serverless function.
8+
9+
**Signature:**
10+
11+
```typescript
12+
export interface FunctionModule
13+
```
14+
15+
## Properties
16+
17+
| Property | Modifiers | Type | Description |
18+
| --------------------------------------------- | --------- | --------------------------------------- | ---------------------------------- |
19+
| [default?](./pages.functionmodule.default.md) | | [FunctionType](./pages.functiontype.md) | _(Optional)_ The exported function |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [FunctionType](./pages.functiontype.md)
4+
5+
## FunctionType type
6+
7+
The valid Serverless Function types;
8+
9+
**Signature:**
10+
11+
```typescript
12+
export type FunctionType = HttpFunction | OnUrlChangeFunction;
13+
```
14+
15+
**References:** [HttpFunction](./pages.httpfunction.md)<!-- -->, [OnUrlChangeFunction](./pages.onurlchangefunction.md)

packages/pages/docs/api/pages.getheadconfig.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
The type definition for the template's getHeadConfig function. getHeadConfig takes in the provided data and will output a HeadConfig object which will be used to generate the tags inside the head tag of the generated HTML document.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
12-
export declare type GetHeadConfig<T extends TemplateRenderProps> = (
12+
export type GetHeadConfig<T extends TemplateRenderProps> = (
1313
props: T
1414
) => HeadConfig;
1515
```
1616

17-
<b>References:</b> [TemplateRenderProps](./pages.templaterenderprops.md)<!-- -->, [HeadConfig](./pages.headconfig.md)
17+
**References:** [TemplateRenderProps](./pages.templaterenderprops.md)<!-- -->, [HeadConfig](./pages.headconfig.md)

packages/pages/docs/api/pages.getlang.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
Function that takes in a [HeadConfig](./pages.headconfig.md) interface and a props, and returns the lang value that will be set on the HTML tag.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
12-
getLang: <T extends TemplateRenderProps>(
12+
getLang: <T extends TemplateRenderProps<any>>(
1313
headConfig: HeadConfig | undefined,
1414
props: T
1515
) => string;

packages/pages/docs/api/pages.getpath.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
The type definition for the template's getPath function.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
12-
export declare type GetPath<T extends TemplateProps> = (props: T) => string;
12+
export type GetPath<T extends TemplateProps> = (props: T) => string;
1313
```
1414

15-
<b>References:</b> [TemplateProps](./pages.templateprops.md)
15+
**References:** [TemplateProps](./pages.templateprops.md)

packages/pages/docs/api/pages.getredirects.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66

77
The type definiton for the template's getRedirects function.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
12-
export declare type GetRedirects<T extends TemplateProps> = (
13-
props: T
14-
) => string[];
12+
export type GetRedirects<T extends TemplateProps> = (props: T) => string[];
1513
```
1614

17-
<b>References:</b> [TemplateProps](./pages.templateprops.md)
15+
**References:** [TemplateProps](./pages.templateprops.md)

packages/pages/docs/api/pages.getrelativeprefixtorootfrompath.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Function that takes a path to a generated template and returns the relative path to the root of the site. Will return the empty string if already at the root level.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
getRelativePrefixToRootFromPath: (path: string) => string;

packages/pages/docs/api/pages.headconfig.charset.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Declares the document's encoding. Will default to 'UTF-8' if omitted.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
charset?: string;

packages/pages/docs/api/pages.headconfig.lang.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Lang of the page. Will be set to the document's locale if omitted.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
lang?: string;

packages/pages/docs/api/pages.headconfig.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66

77
The configuration that allows users to entirely arbitarily set the inner contents of the head element that will be prepended to the generated HTML document.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
export interface HeadConfig
1313
```
1414

1515
## Properties
1616

17-
| Property | Modifiers | Type | Description |
18-
| ------------------------------------------- | --------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19-
| [charset?](./pages.headconfig.charset.md) | | string | <i>(Optional)</i> Declares the document's encoding. Will default to 'UTF-8' if omitted. |
20-
| [lang?](./pages.headconfig.lang.md) | | string | <i>(Optional)</i> Lang of the page. Will be set to the document's locale if omitted. |
21-
| [other?](./pages.headconfig.other.md) | | string | <i>(Optional)</i> For any content that can't be fully encapsulted by our Tag interface, (i.e. template or style) an arbitrary, user-defined string can be provided. |
22-
| [tags?](./pages.headconfig.tags.md) | | [Tag](./pages.tag.md)<!-- -->\[\] | <i>(Optional)</i> Well-defined interface for adding HTML tags (such as meta tags) |
23-
| [title?](./pages.headconfig.title.md) | | string | <i>(Optional)</i> Title of the page. Will default to 'Yext Pages Site' if omitted. |
24-
| [viewport?](./pages.headconfig.viewport.md) | | string | <i>(Optional)</i> Declares the size and shape of the document's viewport. Will default to 'width=device-width, initial-scale=1' if omitted. |
17+
| Property | Modifiers | Type | Description |
18+
| ------------------------------------------- | --------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19+
| [charset?](./pages.headconfig.charset.md) | | string | _(Optional)_ Declares the document's encoding. Will default to 'UTF-8' if omitted. |
20+
| [lang?](./pages.headconfig.lang.md) | | string | _(Optional)_ Lang of the page. Will be set to the document's locale if omitted. |
21+
| [other?](./pages.headconfig.other.md) | | string | _(Optional)_ For any content that can't be fully encapsulted by our Tag interface, (i.e. template or style) an arbitrary, user-defined string can be provided. |
22+
| [tags?](./pages.headconfig.tags.md) | | [Tag](./pages.tag.md)<!-- -->\[\] | _(Optional)_ Well-defined interface for adding HTML tags (such as meta tags) |
23+
| [title?](./pages.headconfig.title.md) | | string | _(Optional)_ Title of the page. Will default to 'Yext Pages Site' if omitted. |
24+
| [viewport?](./pages.headconfig.viewport.md) | | string | _(Optional)_ Declares the size and shape of the document's viewport. Will default to 'width=device-width, initial-scale=1' if omitted. |

packages/pages/docs/api/pages.headconfig.other.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
For any content that can't be fully encapsulted by our Tag interface, (i.e. template or style) an arbitrary, user-defined string can be provided.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
other?: string;

packages/pages/docs/api/pages.headconfig.tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Well-defined interface for adding HTML tags (such as meta tags)
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
tags?: Tag[];

packages/pages/docs/api/pages.headconfig.title.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Title of the page. Will default to 'Yext Pages Site' if omitted.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
title?: string;

packages/pages/docs/api/pages.headconfig.viewport.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Declares the size and shape of the document's viewport. Will default to 'width=device-width, initial-scale=1' if omitted.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
1212
viewport?: string;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [HttpFunction](./pages.httpfunction.md)
4+
5+
## HttpFunction type
6+
7+
A function that runs when a specific path is visited on the site.
8+
9+
**Signature:**
10+
11+
```typescript
12+
export type HttpFunction = (arg: SitesHttpRequest) => SitesHttpResponse;
13+
```
14+
15+
**References:** [SitesHttpRequest](./pages.siteshttprequest.md)<!-- -->, [SitesHttpResponse](./pages.siteshttpresponse.md)

packages/pages/docs/api/pages.manifest.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66

77
A manifest of bundled files present during a production build.
88

9-
<b>Signature:</b>
9+
**Signature:**
1010

1111
```typescript
12-
export declare type Manifest = {
13-
bundlePaths: {
12+
export type Manifest = {
13+
serverPaths: {
1414
[key: string]: string;
1515
};
16-
projectFilepaths: {
17-
templatesRoot: string;
18-
distRoot: string;
19-
hydrationBundleOutputRoot: string;
20-
serverBundleOutputRoot: string;
16+
clientPaths: {
17+
[key: string]: string;
18+
};
19+
renderPaths: {
20+
[key: string]: string;
2121
};
22+
projectStructure: ProjectStructureConfig;
2223
bundlerManifest?: any;
2324
};
2425
```

0 commit comments

Comments
 (0)