-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* AG-11304 - Reduce html size by fetching resolved interfaces instead of injecting onto page Get `resolved-interfaces.json` on client side instead of injecting it from the astro file into the react component. This caused the html to be very large. * AG-11304 - Move doc interface patching to the generation step * AG-11304 - Move docs-interfaces-patched to docs-interfaces task
- Loading branch information
Showing
19 changed files
with
229 additions
and
164 deletions.
There are no files selected for viewing
7 changes: 1 addition & 6 deletions
7
packages/ag-charts-website/src/features/api-documentation/ApiReference.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
--- | ||
import { patchAgChartOptionsReference } from '@features/api-documentation/apiReferenceHelpers'; | ||
import { ApiReferenceWithContext } from './components/ApiReference'; | ||
import { getInterfacesReference } from '@utils/devFiles'; | ||
const reference = getInterfacesReference(); | ||
patchAgChartOptionsReference(reference); | ||
--- | ||
|
||
<ApiReferenceWithContext client:load {...Astro.props} reference={reference} /> | ||
<ApiReferenceWithContext client:load {...Astro.props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/ag-charts-website/src/features/api-documentation/components/ApiReferencePage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
packages/ag-charts-website/src/features/api-documentation/components/OptionsNavigation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
packages/ag-charts-website/src/pages/options/[memberName]/[type].astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/ag-charts-website/src/utils/client/fetchInterfacesReference.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { ApiReferenceType } from '@generate-code-reference-plugin/doc-interfaces/types'; | ||
import { getDevFileUrl } from '@utils/devFileUrl'; | ||
|
||
/** | ||
* Get interfaces reference by fetching from the dev files url | ||
*/ | ||
export async function fetchInterfacesReference(): Promise<ApiReferenceType> { | ||
const contents = await fetch( | ||
getDevFileUrl({ | ||
filePath: '/resolved-interfaces.json', | ||
}) | ||
).then((res) => res.json()); | ||
|
||
return new Map(Object.entries(contents)); | ||
} |
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
packages/ag-charts-website/src/utils/hidden-api-options.json
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
packages/ag-charts-website/src/utils/server/getInterfacesReference.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { ApiReferenceType } from '@generate-code-reference-plugin/doc-interfaces/types'; | ||
import { DEV_FILE_PATH_MAP, getRootUrl } from '@utils/pages'; | ||
import { pathJoin } from '@utils/pathJoin'; | ||
import { readFileSync } from 'node:fs'; | ||
|
||
type DevFileKey = keyof typeof DEV_FILE_PATH_MAP; | ||
|
||
function getJsonFromDevFile(devFileKey: DevFileKey) { | ||
const file = pathJoin(getRootUrl().pathname, DEV_FILE_PATH_MAP[devFileKey]); | ||
const fileContents = readFileSync(file).toString(); | ||
return fileContents ? JSON.parse(fileContents) : null; | ||
} | ||
|
||
/** | ||
* Get interfaces reference from the file system | ||
* | ||
* For static site generation | ||
*/ | ||
export function getInterfacesReference(): ApiReferenceType { | ||
const jsonContent = getJsonFromDevFile('resolved-interfaces.json'); | ||
return new Map(Object.entries(jsonContent)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
plugins/ag-charts-generate-code-reference-files/src/doc-interfaces/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const HIDDEN_API_OPTIONS = { | ||
AgGradientLegendOptions: ['stop'], | ||
AgHeatmapSeriesOptions: ['showInLegend'], | ||
AgSunburstSeriesHighlightStyle: ['item', 'series'], | ||
AgSunburstSeriesOptions: ['showInLegend'], | ||
AgTreemapSeriesHighlightStyle: ['item', 'series'], | ||
AgTreemapSeriesOptions: ['showInLegend'], | ||
AgAngleCategoryAxisOptions: ['keys'], | ||
AgAngleNumberAxisOptions: ['keys'], | ||
AgRadiusCategoryAxisOptions: ['keys'], | ||
AgRadiusNumberAxisOptions: ['keys'], | ||
}; |
Oops, something went wrong.