-
Notifications
You must be signed in to change notification settings - Fork 95
docs: improve typedocs — clean rebase of #2563 #2957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Chase Poirier (chasepoirier)
wants to merge
44
commits into
master
Choose a base branch
from
refactor/docs-rebase
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
1a1abec
feat: clean up code structure for better docs (#2827)
axe312ger 4c82dba
refactor: remove entities barrels file to improve import structure an…
axe312ger 2286d72
refactor: rename plain/common-types to actually describe what the fil…
axe312ger 454867f
refactor: rename params to clientOptions in createClient function to …
axe312ger ae70881
refactor: rename DefaultParams to PlainClientDefaultParams to avoid c…
axe312ger bc52127
refactor: standardize API type naming (Api -> API) and fix duplicate …
axe312ger c4c85e0
refactor: remove entities barrels file to improve import structure an…
axe312ger ede82de
fix: upgrade typedoc, include missing types and plenty of tsdoc fixes
axe312ger b4568a1
dx: simplify doc scripts to essentials
axe312ger b7ea4fd
refactor: further improving and cleaning up typedocs config
axe312ger 91db901
build: update package-lock.json
axe312ger 27a0989
fix: make docs build again
axe312ger 1903417
refactor: clean up createClient overloads, add examples for each way …
axe312ger 75ee147
docs: categorise code files for typedoc
axe312ger bcb6b44
docs: improve typedocs config to finally make some sense
axe312ger 1c8976b
fix: declare __VERSION__ variable as global
axe312ger 9603bd2
fix: resolve post-rebase issues in createClient overloads and __VERSI…
axe312ger d1d9763
docs: enable excludePrivate/excludeInternal, fix docs:publish script,…
axe312ger 0958828
docs: simplify typedoc config with glob pattern for entity entry points
axe312ger 2e34856
docs: fix all 36 TypeDoc warnings — unused tags, mismatched params, b…
axe312ger 1390cd7
docs: add @module and @category tags to 10 missing entity files
axe312ger 20f4e54
docs: add JSDoc descriptions to public types in common-types.ts
axe312ger 4fe1def
docs: add JSDoc descriptions to all entity Props interfaces and types
axe312ger 3c9ae48
docs: add and fix @example blocks on key API methods
axe312ger 416b373
docs: add JSDoc descriptions to 124 PlainClientAPI inline methods
axe312ger 52fe1b9
fix: correct JSDoc inaccuracies found during verification rounds
axe312ger 1716bce
refactor: fix @internal contradictions and improve typedoc config for…
axe312ger acfb91a
docs: enhance typedoc config with search boosts, navigation links, st…
axe312ger 6b551a1
docs: plain-client and legacy API are now fully reachable and clickab…
axe312ger d35914f
docs: add Getting Started project document and restructure typedoc na…
axe312ger 9ef1dc8
refactor: convert typedoc config from JSON to ESM and derive sidebar …
axe312ger 2048793
fix: resolve 76 TypeDoc warnings from mismatched and malformed @param…
axe312ger de0c78b
fix: add missing internal flags from rebase
axe312ger 01f04e1
fix: fill other missing gaps, especially wrapper funcs
axe312ger 42179be
fix: found more
axe312ger 3a18224
feat: upgrade typedoc and github theme to latest versions
axe312ger a8fb035
docs: improve and fix contributing
axe312ger c9c60f6
fix: missing import
axe312ger 50566db
feat: add version switcher and upgrade deps
axe312ger 7d8e04f
fix: restore AgentResumeRunPayload lost during rebase conflict resolu…
chasepoirier c225b6c
fix: restore missing wrapAgentGenerateResponse import
chasepoirier fc25c97
fix: remove duplicate import block in create-organization-api
chasepoirier a64a39a
fix: restore missing space-add-on import
chasepoirier dee6beb
style: fix prettier formatting in component-type.ts
chasepoirier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ dist | |
| gh-pages | ||
| webpack-build-log.json | ||
|
|
||
| # Esdoc dirs | ||
| # TypeDoc output | ||
| out | ||
| gh-pages | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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,34 @@ | ||
| --- | ||
| title: Getting Started | ||
| category: Core | ||
| --- | ||
|
|
||
| # Getting Started | ||
|
|
||
| ## Plain Client (Recommended) | ||
|
|
||
| The plain client provides flat, Promise-based access to all CMA endpoints: | ||
|
|
||
| ```typescript | ||
| import { createClient } from 'contentful-management' | ||
|
|
||
| const client = createClient({ accessToken: 'YOUR_ACCESS_TOKEN' }) | ||
|
|
||
| const entries = await client.entry.getMany({ | ||
| spaceId: '<space_id>', | ||
| environmentId: '<environment_id>', | ||
| }) | ||
| ``` | ||
|
|
||
| See {@link plain/plain-client-types!PlainClientAPI | PlainClientAPI} for the full API reference. | ||
|
|
||
| ## Legacy Client (Deprecated) | ||
|
|
||
| The legacy client uses a nested, chained interface: | ||
|
|
||
| ```typescript | ||
| const client = createClient({ accessToken: 'YOUR_ACCESS_TOKEN' }, { type: 'plain' }) | ||
| // This returns a ClientAPI instance — see createClientApi | ||
| ``` | ||
|
|
||
| See [createClientApi](../create-contentful-api/default) for the full legacy API reference. |
30 changes: 30 additions & 0 deletions
30
docs/plugins/version-selector/typedoc-version-selector.mjs
This file contains hidden or 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,30 @@ | ||
| import { readFileSync } from 'node:fs' | ||
| import { resolve, dirname } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { JSX } from 'typedoc' | ||
|
|
||
| const __dirname = dirname(fileURLToPath(import.meta.url)) | ||
| const css = readFileSync(resolve(__dirname, 'version-selector.css'), 'utf-8') | ||
| const js = readFileSync(resolve(__dirname, 'version-selector.js'), 'utf-8') | ||
|
|
||
| /** | ||
| * TypeDoc plugin that injects a version selector dropdown at the top of the | ||
| * left sidebar. | ||
| * | ||
| * At runtime in the browser, the dropdown fetches `versions.json` from the docs | ||
| * root (generated by the CI deploy workflow) and lets users switch between | ||
| * published documentation versions. | ||
| * | ||
| * The CSS and JS are kept in separate files (`version-selector.css` and | ||
| * `version-selector.js`) for readability, and read at build time. | ||
| * | ||
| * @param {import('typedoc').Application} app | ||
| */ | ||
| export function load(app) { | ||
| app.renderer.hooks.on('head.end', () => { | ||
| return JSX.createElement(JSX.Fragment, null, [ | ||
| JSX.createElement('style', null, [JSX.createElement(JSX.Raw, { html: css })]), | ||
| JSX.createElement('script', null, [JSX.createElement(JSX.Raw, { html: js })]), | ||
| ]) | ||
| }) | ||
| } |
This file contains hidden or 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,47 @@ | ||
| .tsd-version-selector { | ||
| display: block; | ||
| padding: 0.5rem 0.75rem 0.75rem; | ||
| border-bottom: 1px solid var(--color-accent, #ccc); | ||
| margin-bottom: 0.5rem; | ||
| } | ||
| .tsd-version-selector label { | ||
| display: block; | ||
| font-size: 0.75rem; | ||
| font-weight: 600; | ||
| text-transform: uppercase; | ||
| letter-spacing: 0.05em; | ||
| color: var(--color-text-aside, #666); | ||
| margin-bottom: 0.25rem; | ||
| } | ||
| .tsd-version-selector select { | ||
| appearance: none; | ||
| -webkit-appearance: none; | ||
| width: 100%; | ||
| background: var(--color-background-secondary, #f5f5f5); | ||
| color: var(--color-text, #222); | ||
| border: 1px solid var(--color-accent, #ccc); | ||
| border-radius: 4px; | ||
| padding: 0.35rem 1.75rem 0.35rem 0.5rem; | ||
| font-size: 0.85rem; | ||
| font-family: inherit; | ||
| cursor: pointer; | ||
| line-height: 1.4; | ||
| } | ||
| .tsd-version-selector select:hover { | ||
| border-color: var(--color-ts-function, #6f42c1); | ||
| } | ||
| .tsd-version-selector .tsd-version-select-wrap { | ||
| position: relative; | ||
| display: block; | ||
| } | ||
| .tsd-version-selector .tsd-version-select-wrap::after { | ||
| content: ''; | ||
| position: absolute; | ||
| right: 0.5rem; | ||
| top: 50%; | ||
| transform: translateY(-50%); | ||
| border-left: 4px solid transparent; | ||
| border-right: 4px solid transparent; | ||
| border-top: 5px solid var(--color-text, #222); | ||
| pointer-events: none; | ||
| } |
This file contains hidden or 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,79 @@ | ||
| ;(function () { | ||
| function initVersionSelector() { | ||
| // Target: top of the left sidebar (.site-menu) | ||
| var sidebar = document.querySelector('.site-menu') | ||
| if (!sidebar) return | ||
|
|
||
| // Determine the base path for versioned docs | ||
| // Expected URL structure: .../contentful-management/<VERSION>/... | ||
| var pathSegments = window.location.pathname.split('/') | ||
| var cmIdx = pathSegments.indexOf('contentful-management') | ||
| if (cmIdx === -1) return | ||
|
|
||
| var currentVersion = pathSegments[cmIdx + 1] | ||
| if (!currentVersion) return | ||
|
|
||
| var docsBase = pathSegments.slice(0, cmIdx + 1).join('/') | ||
| var versionsUrl = docsBase + '/versions.json' | ||
|
|
||
| fetch(versionsUrl) | ||
| .then(function (r) { | ||
| return r.ok ? r.json() : Promise.reject('not found') | ||
| }) | ||
| .then(function (versions) { | ||
| if (!versions || !versions.length) return | ||
|
|
||
| var wrapper = document.createElement('div') | ||
| wrapper.className = 'tsd-version-selector' | ||
|
|
||
| var label = document.createElement('label') | ||
| label.setAttribute('for', 'tsd-version-select') | ||
| label.textContent = 'Version' | ||
| wrapper.appendChild(label) | ||
|
|
||
| var selectWrap = document.createElement('div') | ||
| selectWrap.className = 'tsd-version-select-wrap' | ||
|
|
||
| var select = document.createElement('select') | ||
| select.id = 'tsd-version-select' | ||
| select.setAttribute('aria-label', 'Documentation version') | ||
|
|
||
| versions.forEach(function (v) { | ||
| var opt = document.createElement('option') | ||
| opt.value = v | ||
| opt.textContent = v === 'latest' ? v : 'v' + v | ||
| if (v === currentVersion) opt.selected = true | ||
| select.appendChild(opt) | ||
| }) | ||
|
|
||
| // If current version isn't in the list, add it | ||
| if (!versions.includes(currentVersion)) { | ||
| var opt = document.createElement('option') | ||
| opt.value = currentVersion | ||
| opt.textContent = currentVersion === 'latest' ? currentVersion : 'v' + currentVersion | ||
| opt.selected = true | ||
| select.insertBefore(opt, select.firstChild) | ||
| } | ||
|
|
||
| select.addEventListener('change', function () { | ||
| var newVersion = select.value | ||
| var subPath = pathSegments.slice(cmIdx + 2).join('/') | ||
| var newUrl = docsBase + '/' + newVersion + '/' + subPath | ||
| window.location.href = newUrl | ||
| }) | ||
|
|
||
| selectWrap.appendChild(select) | ||
| wrapper.appendChild(selectWrap) | ||
| sidebar.insertBefore(wrapper, sidebar.firstChild) | ||
| }) | ||
| .catch(function () { | ||
| // versions.json not available — skip selector (e.g. local dev) | ||
| }) | ||
| } | ||
|
|
||
| if (document.readyState === 'loading') { | ||
| document.addEventListener('DOMContentLoaded', initVersionSelector) | ||
| } else { | ||
| initVersionSelector() | ||
| } | ||
| })() | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / CodeQL
DOM text reinterpreted as HTML High documentation
Copilot Autofix
AI about 1 month ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.