Skip to content

RC #210#213

Merged
rmenner merged 4 commits into
mainfrom
rc/210.1
Oct 23, 2025
Merged

RC #210#213
rmenner merged 4 commits into
mainfrom
rc/210.1

Conversation

@rmenner

@rmenner rmenner commented Oct 23, 2025

Copy link
Copy Markdown
Collaborator

Alaska Airlines Pull Request

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

Summary by Sourcery

Refactor the documentation generator to improve markdown rendering and type handling, add a manifest configuration for custom-elements-analyzer, and streamline path utilities

New Features:

  • Introduce custom-elements-manifest.config.mjs with cemSorterPlugin to sort manifest entries
  • Add escapeMarkdown and getType utilities for consistent type extraction and markdown escaping

Enhancements:

  • Refactor docs-generator to build element documentation sections dynamically and adopt markdown-table for table rendering
  • Filter out private and underscore-prefixed fields from the properties & attributes table
  • Simplify CLI path resolution in pathUtils using fs.realpathSync and expose configPath helper
  • Update the analyzer invocation to use the new manifest config file
  • Enhance capitalize method to insert spaces before camelCase and uppercase the first character

Chores:

  • Remove obsolete src/utils/path.ts

@rmenner
rmenner requested a review from a team as a code owner October 23, 2025 18:02
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2025

Copy link
Copy Markdown

Reviewer's Guide

This PR overhauls the documentation generator by refactoring markdown rendering into modular sections, replacing manual tables with the markdown-table utility, and introducing helper methods for escaping and type extraction. It also updates path utilities for locating config files, updates the CLI invocation to use a custom CEM config, and adds necessary dependencies and configuration files.

Class diagram for updated Docs documentation generator

classDiagram
  class Docs {
    +static renderAllElements(elements: CustomElementDeclaration[]): string
    +static renderElement(element: CustomElementDeclaration, includeTitle = true): string
    +static renderPropertiesAttributesTable(element: CustomElementDeclaration): string
    +static renderParameters(parameters: Parameter[]): string
    +static renderTable(name: string, properties: string[], data: Record<string, unknown>[]): string
    +static escapeMarkdown(text: string): string
    +static getType(obj: any): string
    +static get(obj: any, path: string): any
    +static capitalize(s: string): string
  }

  Docs --> CustomElementDeclaration
  Docs --> ClassMember
  Docs --> Parameter
  Docs --> MergedTableData
Loading

Class diagram for updated path utilities

classDiagram
  class pathUtils {
    +getAuroHomeDir(): string
    +withHomeDir(...args): string
    +fromCliRoot(...relativePath): string
    +configPath(file): string
  }

  pathUtils --> os
  pathUtils --> path
  pathUtils --> process
  pathUtils --> fs
Loading

File-Level Changes

Change Details Files
Refactor renderElement to build Markdown sections dynamically
  • Replace inline template with sections array
  • Push title, description, properties, methods, events, slots, CSS parts and properties conditionally
  • Join sections with double newlines
src/scripts/docs/docs-generator.ts
Swap manual table string assembly for markdown-table utility
  • Define headers and assemble row arrays
  • Use markdownTable() to generate tables
  • Remove manual separator and pipe escaping logic
src/scripts/docs/docs-generator.ts
Add escapeMarkdown and getType helper methods
  • Implement escapeMarkdown to sanitize text
  • Create getType for handling various type schemas
  • Update renderParameters and table rendering to use these helpers
src/scripts/docs/docs-generator.ts
Filter out private/internal fields from properties table
  • Exclude members with privacy='private'
  • Omit members prefixed with underscore
  • Adjust filter predicate in renderPropertiesAttributesTable
src/scripts/docs/docs-generator.ts
Enhance pathUtils to resolve CLI config path
  • Import fs and use realpathSync on process.argv[1]
  • Remove fileURLToPath usage
  • Add configPath helper
src/utils/pathUtils.js
Update docs index to use custom CEM config
  • Import and invoke configPath for custom-elements-manifest.config.mjs
  • Modify npx command to pass --config argument
src/scripts/docs/index.ts
Add new dependencies and config file
  • Add markdown-table and @wc-toolkit/cem-sorter to package.json
  • Create src/configs/custom-elements-manifest.config.mjs
  • Delete obsolete src/utils/path.ts
package.json
src/configs/custom-elements-manifest.config.mjs
src/utils/path.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@rmenner rmenner linked an issue Oct 23, 2025 that may be closed by this pull request

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • It looks like you’re using markdownTable in docs-generator.ts but didn’t import it—add import markdownTable from 'markdown-table'; at the top of the file.
  • The renderElement method has a lot of repeated table-pushing logic for Methods, Events, Slots, etc.—consider abstracting that into a loop or helper to reduce boilerplate.
  • docs-generator.ts is missing a trailing newline at the end of the file; adding it can help avoid lint or build warnings.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- It looks like you’re using markdownTable in docs-generator.ts but didn’t import it—add `import markdownTable from 'markdown-table';` at the top of the file.
- The renderElement method has a lot of repeated table-pushing logic for Methods, Events, Slots, etc.—consider abstracting that into a loop or helper to reduce boilerplate.
- docs-generator.ts is missing a trailing newline at the end of the file; adding it can help avoid lint or build warnings.

## Individual Comments

### Comment 1
<location> `src/scripts/docs/docs-generator.ts:340` </location>
<code_context>
    const type = obj.type;

</code_context>

<issue_to_address>
**suggestion (code-quality):** Prefer object destructuring when accessing and using properties. ([`use-object-destructuring`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/TypeScript/Default-Rules/use-object-destructuring))

```suggestion
    const {type} = obj;
```

<br/><details><summary>Explanation</summary>Object destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.

From the [Airbnb Javascript Style Guide](https://airbnb.io/javascript/#destructuring--object)
</details>
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@rmenner
rmenner merged commit 51e0658 into main Oct 23, 2025
15 checks passed
@rmenner
rmenner deleted the rc/210.1 branch October 23, 2025 18:19
@jason-capsule42

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jason-capsule42 jason-capsule42 added the released Completed work has been released label Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Completed work has been released semantic-status: fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RC 2025-10-23

3 participants