Skip to content
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

refactor(api-markdown-documenter): Allow deeper customization of output folder structure #23366

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

Josmithr
Copy link
Contributor

@Josmithr Josmithr commented Dec 18, 2024

Primary functional changes:

  • Allow configuration of whether or not the document for an API item configured to yield folder hierarchy should be placed inside or outside of that hierarchy.

Required some substantial changes to the API shape.

Note: to keep things relatively simple, system defaults and test configurations have been intentionally made to preserve existing system default behaviors. As a result, you'll notice that none of the end-to-end tests have updated collateral. However, the intention is to update default behaviors, and to add more end-to-end test configurations. For now, I have left a handful of TODOs in configuration defaults and test configurations - I will address those in a follow-up PR.

@github-actions github-actions bot added public api change Changes to a public API base: main PRs targeted against main branch labels Dec 18, 2024
@Josmithr Josmithr force-pushed the api-markdown-documenter/hierarchy-config branch from a9d189d to 3071431 Compare December 18, 2024 23:35
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module is more or less the core of these changes. Control over the output suite hierarchy is unified here (in place of the old documentBoundaries and hierarchyBoundaries properties on DocumentationSuiteConfiguration.

The core goal of these changes is to allow configuring where an API item's document is placed relative to its directory (inside or outside), for items that yield folder hierarchy.

* @remarks Must be either a folder or document hierarchy configuration.
*
* @privateRemarks
* TODO: Allow all hierarchy configurations for packages.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future PR

* When a package only has a single entrypoint, this is skipped entirely and entrypoint children are rendered directly to the package document.
*
* @privateRemarks
* TODO: Allow all hierarchy configurations for packages.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future PR

@@ -0,0 +1,176 @@
/*!
Copy link
Contributor Author

@Josmithr Josmithr Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new type hierarchies make it more difficult to share tests directly. As a result, this module (previously EndtoEndTests.ts has been refactored to share common utilities, and the actual test definitions have been moved into the individual end-to-end test modules.

/**
* Test hierarchy configs
*
* @privateRemarks TODO: Formalize and export some of these as pre-canned solutions?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future PR

];
],

// TODO: deep config
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO before merging

];
],

// TODO: deep config
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO before merging

apiModel = await loadModel({ modelDirectoryPath });
});

describe("Ensure no duplicate document paths", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case was previously redundantly captured by both the Markdown and HTML end-to-end test suites. Extracted into a separate suite for just the API Model -> Document transformation.

type RenderDocumentAsHtmlConfiguration,
renderDocumentAsHtml,
} from "../renderers/index.js";
import { HtmlRenderer, loadModel } from "../index.js";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both HTML and Markdown end-to-end test suites have been updated to leverage the public API, rather than using internal implementation details.

@Josmithr Josmithr force-pushed the api-markdown-documenter/hierarchy-config branch from dba826a to ba59e5a Compare December 21, 2024 01:17
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  170142 links
    1596 destination URLs
    1825 URLs ignored
       0 warnings
       0 errors


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base: main PRs targeted against main branch public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant