Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented May 12, 2025

Summary by CodeRabbit

  • Documentation

    • Added multiple status badges and new sections for Changelog and License in the README.
    • Updated documentation URL and clarified license as MIT.
    • Added a LICENSE file with the MIT License.
    • Introduced a changeset file describing a PDF download link fix.
  • Chores

    • Enhanced workflow automation for building, linting, type coverage, and deployment.
    • Improved npm scripts and package metadata, including keywords and type coverage configuration.
    • Updated Prettier configuration for Markdown files in changeset directories.
  • Bug Fixes

    • Improved handling of null values in OpenAPI components to prevent runtime errors.
    • Enhanced navigation menu update detection for better theme change handling.
  • Style

    • Added type annotations and comments to support type coverage tooling.

@JounQin JounQin requested a review from Copilot May 12, 2025 06:28
@JounQin JounQin self-assigned this May 12, 2025
@JounQin JounQin added bug Something isn't working documentation Improvements or additions to documentation labels May 12, 2025
@changeset-bot
Copy link

changeset-bot bot commented May 12, 2025

🦋 Changeset detected

Latest commit: 5c82e54

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alauda/doom Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented May 12, 2025

Walkthrough

This update introduces workflow enhancements, documentation improvements, type coverage tooling, and minor code adjustments. Workflow YAML files are updated for parallelization, PDF handling, and compact publishing. The README gains badges and license details, while the MIT license is formally added. Code changes focus on type coverage directives and type safety improvements, with no public API modifications.

Changes

Files/Paths Change Summary
.github/workflows/ci.yml, .github/workflows/gh-pages.yml, .github/workflows/pkg-pr-new.yml Updated CI workflows: parallelized build/lint/type coverage, revised PDF build/export steps, enabled compact mode for publishing, added custom domain for deployment.
README.md, LICENSE, package.json, .changeset/weak-actors-attend.md Enhanced documentation: added badges, changelog/license sections, MIT license file, license field, keywords, new npm scripts for docs/type coverage, type-coverage config, and patch changeset.
src/cli/merge-pdfs/index.ts, src/plugins/replace/index.ts Added // type-coverage:ignore-line comments to instruct type coverage tool to ignore specific lines.
src/plugins/replace/resolve-reference.ts Added explicit string type annotation to a local variable for clarity.
src/plugins/replace/resolve-release.ts Introduced a typed local constant for error handling, improving type safety in logging.
src/global/VersionsNav/index.tsx Refined effect logic for nav menu recreation, improving mutation observer setup and DOM element checks.
src/runtime/components/OpenAPIPath.tsx, src/runtime/components/OpenAPIRef.tsx Improved type safety in recursive schema traversal: added null checks and explicit array typing to prevent runtime errors.
.prettierrc.json Added overrides for Markdown files in .changeset folders to disable singleQuote option.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant GitHub Actions
  participant Docs Builder
  participant PDF Exporter
  participant Deploy Step

  User->>GitHub Actions: Push/PR triggers workflow
  GitHub Actions->>Docs Builder: yarn docs:build -e -p doom
  Docs Builder-->>GitHub Actions: Build docs as PDFs
  GitHub Actions->>PDF Exporter: yarn docs:export -p doom
  PDF Exporter-->>GitHub Actions: Export PDFs to temp
  GitHub Actions->>Docs Builder: yarn docs:build -d -p doom
  GitHub Actions->>PDF Exporter: Copy PDFs to dist
  GitHub Actions->>Deploy Step: Deploy with CNAME doom.js.org
Loading

Poem

In the warren, code hops anew,
With badges bright and license true.
Workflows leap in parallel stride,
Docs and PDFs side by side.
Type checks burrow, errors flee—
All is tidy, as it should be!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2de6ad and 5c82e54.

📒 Files selected for processing (2)
  • .prettierrc.json (1 hunks)
  • package.json (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .prettierrc.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the PDF download link not displaying correctly while adding several type improvements and workflow updates, as well as updating documentation and license information.

  • Refactors ref-collection loops with explicit type casts and null checks.
  • Updates error handling in release note fetching and refines nav menu logic in the version selector.
  • Enhances CI/CD workflows and updates package metadata and documentation.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/runtime/components/OpenAPIRef.tsx Added type casts and null checks in the recursive ref collection logic.
src/runtime/components/OpenAPIPath.tsx Similar type refinements as in OpenAPIRef for safe object iteration.
src/plugins/replace/resolve-release.ts Cast error to typed variable for clarity, though a potential undefined variable is still referenced.
src/plugins/replace/resolve-reference.ts Introduced explicit type annotation for variable "publicBase".
src/plugins/replace/index.ts Added an inline ignore comment for type-coverage on logging errors.
src/global/VersionsNav/index.tsx Revised the nav menu update logic to better handle theme changes and PDF download link display.
src/cli/merge-pdfs/index.ts Added an inline ignore comment to control type-coverage checks for NODEFS usage.
package.json Added MIT license and introduced type-coverage configuration with additional scripts.
README.md Updated documentation links and added new badges for build status, type coverage, and more.
LICENSE Added the MIT License file.
.github/workflows/pkg-pr-new.yml Updated Publish job command with the "--compact" flag.
.github/workflows/gh-pages.yml Revised docs build/export process to handle PDFs and set a custom domain.
.github/workflows/ci.yml Consolidated build, lint, and type coverage checks into a single run command.
Comments suppressed due to low confidence (1)

src/plugins/replace/resolve-release.ts:124

  • The variable 'data' is not defined in this scope. Consider replacing 'data' with 'error.data', making sure the intended error payload is correctly logged.
`${error.data ? `data ${JSON.stringify(data, null, 2)}` : `message `${error.message}`}`

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 12, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@alauda/doom@5

commit: 5c82e54

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/plugins/replace/resolve-reference.ts (1)

39-53: Suggest optional refactor: collapse publicBase initialization
You’ve added a let publicBase: string for clarity. You could simplify by using a single const publicBase = source.repo ? ... : ... expression to reduce mutable bindings:

-  let publicBase: string
+  const publicBase =
     source.repo
       ? path.resolve(repoFolder, source.publicBase ?? 'docs/public')
       : localPublicBase

This eliminates the separate declaration and improves readability.

package.json (1)

127-141: Type coverage configuration
The typeCoverage block enforces 100% coverage with strict rules. Consider removing "update": true from the CI configuration to avoid unintended baseline updates—run updates manually when thresholds legitimately change.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa1ce43 and a2de6ad.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • .changeset/weak-actors-attend.md (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/gh-pages.yml (1 hunks)
  • .github/workflows/pkg-pr-new.yml (1 hunks)
  • LICENSE (1 hunks)
  • README.md (1 hunks)
  • package.json (4 hunks)
  • src/cli/merge-pdfs/index.ts (1 hunks)
  • src/global/VersionsNav/index.tsx (1 hunks)
  • src/plugins/replace/index.ts (1 hunks)
  • src/plugins/replace/resolve-reference.ts (1 hunks)
  • src/plugins/replace/resolve-release.ts (1 hunks)
  • src/runtime/components/OpenAPIPath.tsx (1 hunks)
  • src/runtime/components/OpenAPIRef.tsx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~9-~9: Using many exclamation marks might seem excessive (in this case: 6 exclamation marks for a text that’s 1060 characters long)
Context: ....svg)](https://conventionalcommits.org) Renovate enabled JavaScript Style Guide [![Code Style: Prettier](https://img.shiel...

(EN_EXCESSIVE_EXCLAMATION)

🔇 Additional comments (19)
src/runtime/components/OpenAPIRef.tsx (1)

138-140: Good defensive programming improvement!

The additional nullish check and type assertion enhance robustness when processing OpenAPI schemas. This prevents potential runtime errors when encountering null or undefined values in the schema object.

src/runtime/components/OpenAPIPath.tsx (1)

149-151: Great consistency in applying the fix!

This change correctly adds the same defensive programming pattern as in the OpenAPIRef component. The type assertion to unknown[] and nullish check ensure safe traversal of the schema object, preventing errors when processing undefined or null values.

src/plugins/replace/index.ts (1)

101-101: Appropriate use of type coverage ignore directive.

The added directive helps maintain type coverage reporting without altering runtime behavior. This is a reasonable approach for this error handling case where the error type might be unpredictable.

src/plugins/replace/resolve-release.ts (1)

122-124: Good type safety improvement.

Creating a properly typed error variable improves type safety when accessing properties like response.status, data, and message. This change makes the code more robust from a static analysis perspective without changing runtime behavior.

.changeset/weak-actors-attend.md (1)

1-5: Appropriate changeset for the fix.

The changeset correctly documents this as a patch-level update addressing the PDF download link display issue, which aligns with the changes in the VersionsNav component.

src/cli/merge-pdfs/index.ts (1)

33-39: Approve type-coverage ignore directive
The // type-coverage:ignore-line comment on the pyodide.FS.filesystems.NODEFS mount is consistent with other ignores in the repo and avoids noise from this untyped API.

.github/workflows/pkg-pr-new.yml (1)

35-35: Activate compact publishing flag
Enabling --compact on yarn dlx pkg-pr-new publish streamlines the output as intended. Ensure downstream consumers aren’t relying on the previous verbose output format.

.github/workflows/ci.yml (1)

39-39: Consolidate build, docs, lint, and type coverage
Combining tasks in one step (yarn run-p build docs lint typecov) reduces step overhead. This change aligns with new npm scripts and keeps the CI concise.

LICENSE (1)

1-22: Add MIT License
Including the full MIT License file and matching the license: MIT field in package.json correctly formalizes the project’s licensing terms.

README.md (3)

3-13: Badges addition is clear and informative
The new CI, type coverage, CodeRabbit, npm, and other badges improve project visibility and status tracking.

🧰 Tools
🪛 LanguageTool

[style] ~9-~9: Using many exclamation marks might seem excessive (in this case: 6 exclamation marks for a text that’s 1060 characters long)
Context: ....svg)](https://conventionalcommits.org) Renovate enabled JavaScript Style Guide [![Code Style: Prettier](https://img.shiel...

(EN_EXCESSIVE_EXCLAMATION)


19-29: Changelog and License sections added
Introducing the “Changelog” and “License” sections with links to CHANGELOG.md and the MIT license ensures better transparency and compliance.


17-17:

Details

✅ Verification successful

Docs URL updated
The link to https://doom.js.org/ replaces the old domain. Please verify that the custom domain is correctly configured and accessible.

You can run:

to confirm an HTTP 200 response.


🏁 Script executed:

curl -Is https://doom.js.org/ | head -n 1

Length of output: 55


Docs URL verified and accessible
Ran curl -Is https://doom.js.org/ | head -n1HTTP/2 200, confirming the custom domain is correctly configured and the link is live.

.github/workflows/gh-pages.yml (2)

31-44: Multi-step documentation build & PDF export
The workflow now exports the PDFs, rebuilds the docs with download links, and reinserts them into dist. The ordering and temporary storage steps are correct and robust.


51-51: Custom domain (cname) configured
Specifying cname: doom.js.org ensures the site is served under the correct custom domain.

package.json (5)

29-36: Keywords updated
The new keywords related to documentation and plugins enhance discoverability on npm.


41-44: Documentation scripts introduced
The docs, docs:build, and docs:export scripts align with CI workflows and replace the old export command.


55-55: Type coverage script added
Introducing the typecov script (type-coverage) integrates type coverage checks into your CI pipeline.


119-119: type-coverage devDependency added
Locking type-coverage in devDependencies ensures reproducible type coverage runs.


9-9:

Details

✅ Verification successful

License field added
Adding "license": "MIT" is essential for clarity. Please ensure a LICENSE file exists at the project root.

You can verify with:


🏁 Script executed:

test -f LICENSE || echo "LICENSE file missing"

Length of output: 17


License file verified
The LICENSE file is present at the project root, so adding "license": "MIT" in package.json is correct. No further action needed.

@JounQin JounQin merged commit 3885f28 into main May 12, 2025
10 checks passed
@JounQin JounQin deleted the fix/download branch May 12, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants