Skip to content

refactor: remove colorette dependency#21

Merged
chenjiahan merged 1 commit intomainfrom
remove_color_0315
Mar 15, 2026
Merged

refactor: remove colorette dependency#21
chenjiahan merged 1 commit intomainfrom
remove_color_0315

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

The colorette package was removed as it's no longer needed for color support in stats output. Also cleaned up the unused stats normalization logic in setupHooks.js.

Copilot AI review requested due to automatic review settings March 15, 2026 01:11
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on optimizing the project by eliminating the colorette dependency, which is no longer required for stats output color support. Concurrently, it cleans up associated dead code, specifically the normalizeStatsOptions function and its calls within setupHooks.js. This change reduces the project's dependency footprint and improves code clarity and maintainability.

Highlights

  • Dependency Removal: The colorette package was removed from the project dependencies.
  • Code Cleanup: Unused stats normalization logic and related colorette usage were removed from src/utils/setupHooks.js.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • package.json
    • Removed the colorette package from the dependencies list.
  • pnpm-lock.yaml
    • Removed colorette and its associated entries from the lockfile.
  • src/utils/setupHooks.js
    • Removed the normalizeStatsOptions utility function.
    • Removed the logic that normalized stats options and checked for colorette color support.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the colorette dependency and cleans up related unused stats normalization logic. The changes are straightforward and correctly implement the described refactoring. I've found a minor issue where a JSDoc type cast in src/utils/setupHooks.js is no longer accurate after the changes, and I've provided a suggestion to fix it.

@chenjiahan chenjiahan merged commit 832c0a4 into main Mar 15, 2026
7 checks passed
@chenjiahan chenjiahan deleted the remove_color_0315 branch March 15, 2026 01:14
Copy link
Copy Markdown

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 removes the colorette dependency and simplifies stats handling in setupHooks by deleting the previous stats-options normalization and color-detection logic.

Changes:

  • Remove colorette from runtime dependencies and lockfile.
  • Delete stats-options normalization logic (including colors defaulting) in src/utils/setupHooks.js.

Reviewed changes

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

File Description
src/utils/setupHooks.js Removes stats option normalization and colorette-based color support fallback before calling stats.toString().
package.json Drops colorette from dependencies.
pnpm-lock.yaml Removes colorette entries from importer/packages/snapshots.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

src/utils/setupHooks.js:86

  • The setupHooks tests don’t cover options.stats values of true/false/string/undefined or multi-compiler children stats options. Since this change alters how those values are forwarded into stats.toString(), add/adjust tests to lock in expected behavior (e.g., stats: false produces no output and doesn’t throw).
      const printedStats = stats.toString(
        /** @type {StatsObjectOptions} */
        (statsOptions),
      );

src/utils/setupHooks.js:86

  • statsOptions can be boolean | string | undefined (per Configuration["stats"] and README), but it’s now passed directly into stats.toString() while being cast to StatsObjectOptions (which excludes those types). This risks runtime errors or incorrect stats output for configs like stats: true, stats: false, or stats: "none" (and similarly for multi-compiler children). Consider reintroducing lightweight normalization (boolean/string/undefined -> object preset) or otherwise ensuring the value passed to toString matches what Stats/MultiStats#toString expects.
      const printedStats = stats.toString(
        /** @type {StatsObjectOptions} */
        (statsOptions),
      );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants