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

feat: moving icons to ui-icons #359

Merged
merged 4 commits into from
Feb 26, 2024
Merged

feat: moving icons to ui-icons #359

merged 4 commits into from
Feb 26, 2024

Conversation

aversini
Copy link
Collaborator

@aversini aversini commented Feb 26, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new package @versini/ui-icons for managing icons across the application.
    • Added support for @versini/ui-icons in various components and documentation.
  • Documentation

    • Updated documentation to reflect the use of @versini/ui-icons.
    • Added a README for setting up React with TypeScript in Vite for ui-icons.
  • Refactor

    • Reorganized imports across documentation and UI components to use @versini/ui-icons.
    • Removed duplicate icon imports and updated dependencies accordingly.
  • Chores

    • Updated project configurations to include @versini/ui-icons.
    • Enhanced testing configurations and error handling for ui-icons.

Copy link

coderabbitai bot commented Feb 26, 2024

Walkthrough

The update introduces a new package @versini/ui-icons and redistributes icon-related responsibilities across the ecosystem. It removes icons from @versini/ui-components and centralizes them within the newly created ui-icons package. This shift necessitates updates across various packages to adjust dependencies and import paths accordingly. Additionally, the introduction of this package brings along configuration for TypeScript, Vite, PostCSS, and Vitest, indicating a setup for development, build, and testing processes focused on the icon components.

Changes

Files Change Summary
.release-please-manifest.json Added ui-icons package; updated other package versions.
packages/.../package.json Added @versini/ui-icons to dependencies; updated scripts and dependencies.
packages/documentation/... Updated import paths for icons; added @versini/ui-icons as a dependency.
packages/ui-components/... Removed icon imports and build scripts; updated dependencies and import paths.
packages/ui-icons/... Introduced new package setup including README, configuration files for TypeScript, Vite, PostCSS, Vitest, and component exports.
pnpm-lock.yaml, release-please-config.json Updated with @versini/ui-icons dependencies and release configuration.

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 5

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 3b577a6 and 616823f.
Files selected for processing (37)
  • .release-please-manifest.json (1 hunks)
  • packages/bundlesize/package.json (1 hunks)
  • packages/bundlesize/src/components/src/main.tsx (2 hunks)
  • packages/documentation/.ladle/components.tsx (1 hunks)
  • packages/documentation/package.json (1 hunks)
  • packages/documentation/src/Components/ButtonIcon.stories.tsx (1 hunks)
  • packages/documentation/src/Components/Menu.stories.tsx (1 hunks)
  • packages/documentation/src/Components/Table.stories.tsx (1 hunks)
  • packages/documentation/src/GettingStarted/1-overview.stories.tsx (1 hunks)
  • packages/documentation/src/GettingStarted/2-Installation.stories.tsx (1 hunks)
  • packages/documentation/src/GettingStarted/3-configuration.stories.tsx (1 hunks)
  • packages/documentation/src/GettingStarted/4-usage.stories.mdx (1 hunks)
  • packages/documentation/src/GettingStarted/5-alpha-beta.stories.tsx (1 hunks)
  • packages/documentation/src/System/DarkMode.stories.tsx (3 hunks)
  • packages/documentation/src/System/Icons.stories.tsx (2 hunks)
  • packages/ui-components/package.json (2 hunks)
  • packages/ui-components/src/components/Bubble/Bubble.tsx (1 hunks)
  • packages/ui-components/src/components/Button/tests/ButtonIcon.test.tsx (1 hunks)
  • packages/ui-components/src/components/Panel/Panel.tsx (2 hunks)
  • packages/ui-components/src/components/TextInput/TextInputMask.tsx (1 hunks)
  • packages/ui-components/src/components/index.ts (2 hunks)
  • packages/ui-icons/README.md (1 hunks)
  • packages/ui-icons/package.json (1 hunks)
  • packages/ui-icons/postcss.config.cjs (1 hunks)
  • packages/ui-icons/src/components/index.ts (1 hunks)
  • packages/ui-icons/src/index.css (1 hunks)
  • packages/ui-icons/src/style.ts (1 hunks)
  • packages/ui-icons/src/vite-env.d.ts (1 hunks)
  • packages/ui-icons/tailwind.config.js (1 hunks)
  • packages/ui-icons/tsconfig.json (1 hunks)
  • packages/ui-icons/tsconfig.node.json (1 hunks)
  • packages/ui-icons/tsup.config.ts (1 hunks)
  • packages/ui-icons/vite.config.ts (1 hunks)
  • packages/ui-icons/vitest.config.ts (1 hunks)
  • packages/ui-icons/vitest.setup.ts (1 hunks)
  • pnpm-lock.yaml (4 hunks)
  • release-please-config.json (1 hunks)
Files skipped from review due to trivial changes (5)
  • packages/ui-icons/postcss.config.cjs
  • packages/ui-icons/src/components/index.ts
  • packages/ui-icons/src/index.css
  • packages/ui-icons/src/style.ts
  • packages/ui-icons/src/vite-env.d.ts
Additional comments: 39
release-please-config.json (1)
  • 8-8: The addition of "packages/ui-icons": {} to the release-please-config.json file is correctly implemented. This change ensures that the new ui-icons package will be included in the automated release process, which is crucial for version management and publishing.
packages/ui-icons/tailwind.config.js (2)
  • 3-3: The import statement for twPlugin from ../../lib/tailwindPlugin is correctly structured. However, ensure that the relative path is accurate and that the tailwindPlugin module exports a merge method as used here.
  • 5-7: The configuration for Tailwind CSS, specifying content sources, is correctly set up. This setup ensures that Tailwind correctly purges unused styles in production builds, optimizing the final bundle size.
.release-please-manifest.json (1)
  • 7-7: Adding the ui-icons package with version 0.0.0 to the .release-please-manifest.json file is a necessary step for initializing the version tracking of this new package. This inclusion is crucial for the automated release process to recognize and manage the ui-icons package correctly.
packages/ui-icons/tsup.config.ts (1)
  • 1-12: The configuration for tsup is correctly defined, specifying the format, entry point, output directory, and TypeScript declaration files generation. This setup ensures that the build process for the ui-icons package will produce the expected JavaScript modules and type definitions, facilitating its consumption in TypeScript projects.
packages/ui-icons/tsconfig.node.json (1)
  • 1-9: The TypeScript configuration for Node.js-specific files (tsconfig.node.json) is correctly set up with appropriate compiler options. This configuration ensures that TypeScript files related to Node.js, such as configuration and setup files, are correctly handled during the development process.
packages/ui-icons/vitest.setup.ts (1)
  • 3-3: The import of @testing-library/jest-dom/vitest is correctly implemented, ensuring that Jest DOM custom matchers are available in Vitest tests. This import enhances the testing capabilities for DOM elements.
packages/ui-icons/vitest.config.ts (1)
  • 3-28: The Vitest configuration is correctly set up, merging the base Vite configuration with specific test settings. This setup includes global test settings, setup files, the test environment, and coverage configuration. The coverage thresholds are set to 100%, which enforces a high standard for test coverage. Ensure that this strict requirement aligns with the project's testing goals.
packages/ui-icons/tsconfig.json (1)
  • 1-25: The TypeScript configuration for the ui-icons package is correctly defined, including compiler options for strict type-checking, module resolution, and JSX support. This configuration ensures that the TypeScript compiler correctly handles the source files, enforcing type safety and compatibility with React.
packages/bundlesize/src/components/src/main.tsx (2)
  • 4-4: The import of UIicons from @versini/ui-icons is correctly implemented. This change aligns with the PR's objective to centralize icon components into the ui-icons package. Ensure that all references to icons in the project are updated to use this new import path.
  • 16-23: Looping through all components in UIicons to ensure bundling by Rollup is a clever workaround for tree-shaking optimization. This approach forces Rollup to include all icon components in the bundle, even if they are not explicitly used, which might be necessary for certain dynamic import scenarios.
packages/bundlesize/package.json (2)
  • 17-17: Adding @versini/ui-icons to devDependencies is appropriate for development and testing purposes. This ensures that the ui-icons package is available during the development process without being included in the production dependencies.
  • 23-23: Adding @versini/ui-icons to dependencies is necessary for production builds where icons are directly used. This change correctly reflects the dependency on the ui-icons package for the bundlesize package.
packages/documentation/package.json (1)
  • 25-25: Adding @versini/ui-icons as a dependency in the documentation package is correct, ensuring that icon components are available for documentation purposes. This change aligns with the PR's objective to centralize icon management.
packages/documentation/src/System/Icons.stories.tsx (2)
  • 21-21: Updating import paths for icons from @versini/ui-components to @versini/ui-icons in the Icons.stories.tsx file is correctly implemented. This change is necessary to reflect the new structure of managing icons within the project.
  • 32-32: The example import statement in the documentation correctly reflects the new import path for icons, providing clear guidance for developers on how to use the ui-icons package.
packages/documentation/src/GettingStarted/2-Installation.stories.tsx (1)
  • 2-3: The reorganization of imports, where ButtonIcon is imported from @versini/ui-components and IconNext, IconPrevious from @versini/ui-icons, is correctly implemented. This change aligns with the PR's objective and ensures that the icons are imported from their new centralized location.
packages/ui-components/src/components/index.ts (1)
  • 13-18: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The removal of multiple icon imports from packages/ui-components/src/components/index.ts is in line with the PR's objective to centralize icon components into the ui-icons package. This change helps to declutter the ui-components package and focus it on providing UI components other than icons.

packages/documentation/src/GettingStarted/4-usage.stories.mdx (1)
  • 2-4: The reorganization of imports in the 4-usage.stories.mdx file, moving IconNext and IconPrevious from @versini/ui-components to @versini/ui-icons, is correctly implemented. This change reflects the new structure for managing icons and provides clear guidance for developers on how to use icons from the ui-icons package.
packages/ui-components/src/components/Panel/Panel.tsx (1)
  • 1-1: The addition of an import statement for IconClose from @versini/ui-icons in the Panel.tsx file is correctly implemented, aligning with the PR's objective to centralize icon components. This change ensures that the Panel component uses the IconClose from the new ui-icons package.
packages/ui-icons/package.json (1)
  • 1-50: The package.json for the ui-icons package is correctly set up with necessary metadata, scripts for building and testing, and dependencies. The inclusion of react and react-dom as peer dependencies ensures that consumers of the ui-icons package have the appropriate versions of these libraries installed. The build and test scripts are comprehensive, covering type checking, JavaScript building, type generation, and testing with coverage.
packages/documentation/.ladle/components.tsx (1)
  • 3-7: The update to import IconGitHub from @versini/ui-icons instead of @versini/ui-components in the .ladle/components.tsx file is correctly implemented. This change ensures that the documentation components use the centralized ui-icons package for icon components.
packages/ui-components/package.json (1)
  • 49-50: The update to dependencies in the ui-components package.json, including the addition of @versini/ui-icons as a workspace dependency, is correctly implemented. This change reflects the new dependency on the ui-icons package for icon components. Removing the "build:icons" script is appropriate given the shift of icon building responsibilities to the ui-icons package.
packages/documentation/src/GettingStarted/1-overview.stories.tsx (1)
  • 2-3: The changes to the import paths for ButtonIcon and IconNext correctly align with the PR's objective to centralize icon components into the ui-icons package. This reorganization should improve maintainability and streamline the development process.
packages/ui-components/src/components/Bubble/Bubble.tsx (1)
  • 1-1: The changes to the import paths for IconCopied and IconCopy, moving them to @versini/ui-icons, are correctly implemented. This centralization of icon components into a dedicated package is a positive step towards improving the project's structure and maintainability.
packages/documentation/src/GettingStarted/5-alpha-beta.stories.tsx (1)
  • 2-3: The changes to the import paths for ButtonIcon and IconPrevious, aligning them with the new ui-icons package, are correctly implemented. This reorganization supports the PR's goal of improving project structure and maintainability.
packages/documentation/src/Components/ButtonIcon.stories.tsx (1)
  • 2-8: The reorganization of imports for ButtonIcon, IconEdit, IconNext, IconPrevious, and IconSettings, moving the icon imports to @versini/ui-icons, is correctly implemented. This change enhances the project's structure by centralizing icon components into a dedicated package, thereby improving maintainability.
packages/documentation/src/GettingStarted/3-configuration.stories.tsx (1)
  • 2-3: The changes to the import paths for IconNext and IconPrevious, aligning them with the new ui-icons package, are correctly implemented. This reorganization supports the PR's goal of improving project structure and maintainability by centralizing icon components.
packages/ui-icons/vite.config.ts (1)
  • 1-113: The vite.config.ts setup for the ui-icons package is well-structured and aligns with the objectives of centralizing icon components and integrating modern development tools. The configuration settings, including library entry points, rollup options, and esbuild configurations, are appropriately tailored for the development, building, and testing of the ui-icons package.
packages/documentation/src/Components/Menu.stories.tsx (1)
  • 1-19: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [4-25]

The reorganization of imports for Menu, MenuItem, MenuSeparator, Panel, and various icons, moving the icon imports to @versini/ui-icons, is correctly implemented. This change enhances the project's structure by centralizing icon components into a dedicated package, thereby improving maintainability.

packages/documentation/src/System/DarkMode.stories.tsx (2)
  • 17-25: The reorganization of imports for various icons, moving them to @versini/ui-icons, and the addition of a name attribute to the TextInput component are correctly implemented. These changes support the PR's goal of improving project structure and maintainability by centralizing icon components and enhancing form element identification.
  • 106-106: The addition of the name attribute to the TextInput component is a good practice for form elements, ensuring they can be correctly identified and processed. This change enhances the usability and accessibility of the form component.
packages/ui-components/src/components/TextInput/TextInputMask.tsx (1)
  • 1-1: The import of IconHide and IconShow from @versini/ui-icons is correctly implemented, aligning with the PR's objective to centralize icon management. This change should streamline the development process and improve maintainability.
packages/documentation/src/Components/Table.stories.tsx (1)
  • 10-10: The import of IconDelete and IconRestore from @versini/ui-icons is correctly implemented, supporting the PR's goal of centralizing icon components. This change enhances the modularity and maintainability of the codebase.
packages/ui-components/src/components/Button/__tests__/ButtonIcon.test.tsx (1)
  • 2-2: The import of IconSettings from @versini/ui-icons is correctly implemented, aligning with the PR's objective to centralize icon management. This change ensures that the tests are up-to-date with the new structure, promoting consistency across the codebase.
pnpm-lock.yaml (4)
  • 32-34: The addition of @versini/ui-icons as a dependency for @versini/ui-hooks is correctly formatted, using the workspace protocol to link to the local package. This ensures that local changes to ui-icons are immediately available to ui-hooks, facilitating a smoother development workflow.
  • 57-59: Similarly, the inclusion of @versini/ui-icons in the dependencies for @versini/ui-components is properly formatted and follows the same workspace linking pattern. This change is essential for maintaining the integrity of the project's dependency graph and reflects the PR's objective to centralize icon management.
  • 97-99: The addition of @versini/ui-icons to the dependencies of @versini/ui-private is also correctly implemented. Using the workspace protocol here ensures that ui-private can directly access the ui-icons package, which is crucial for any private components that might rely on icons.
  • 131-153: The packages/ui-icons section correctly specifies its dependencies, including @tailwindcss/typography, @versini/ui-hooks, @versini/ui-private, clsx, react, react-dom, and tailwindcss. Each dependency is correctly formatted with both specifier and version fields. This comprehensive setup is crucial for the ui-icons package to function correctly within the project's ecosystem, ensuring it has all necessary tools and libraries for development and testing.

However, it's important to ensure that the specified versions of these dependencies align with the project's overall dependency management strategy to avoid potential conflicts or compatibility issues.

Verification successful

Based on the provided context from the shell scripts, it's clear that the dependencies specified in the packages/ui-icons section of the pnpm-lock.yaml file are consistent across the project. The versions of @tailwindcss/typography, @versini/ui-hooks, @versini/ui-private, clsx, react, react-dom, and tailwindcss specified in the ui-icons package align with those used in other parts of the project, as evidenced by their presence in various package.json files and the pnpm-lock.yaml itself.

This consistency is crucial for maintaining compatibility and avoiding version conflicts within the project. The review comment highlighting the importance of ensuring that the specified versions of these dependencies align with the project's overall dependency management strategy is verified to be accurate, as the project demonstrates a coherent approach to dependency management.

Given the evidence from the script outputs, the dependencies and their versions in the ui-icons package are indeed aligned with the project's overall dependency management strategy, confirming the correctness of the review comment.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the specified dependency versions in the `ui-icons` package align with the project's overall dependency management strategy.
# This script is a placeholder for manual verification steps that should be taken.
echo "Manual verification needed to ensure dependency versions align with the project's strategy."

Length of output: 195



Script:

#!/bin/bash
# Extract specified dependency versions for the `ui-icons` package from the `pnpm-lock.yaml` file.
grep -A 7 "packages/ui-icons:" pnpm-lock.yaml

# Search for occurrences of these dependencies throughout the project to compare versions.
echo "Searching for dependencies in the project..."
grep -r "@tailwindcss/typography" .
grep -r "@versini/ui-hooks" .
grep -r "@versini/ui-private" .
grep -r "clsx" .
grep -r "react" .
grep -r "react-dom" .
grep -r "tailwindcss" .

Length of output: 48876

Copy link

Bundle Size (components)

Status File Size (Gzip) Limits
style.css 6.89 KB (-9 B -0.13%) 8 KB
index.js 15.96 KB (-2.74 KB -14.67%) 20 KB
vendor.js 65.07 KB 67 KB

Overall bundle size: 87.92 KB (-2.75 KB -3.04%)
Overall status: ✅

Bundle Size (system)

Status File Size (Gzip) Limits
style.css 2.83 KB 4 KB
index.js 1.74 KB 3 KB
vendor.js 44.49 KB 46 KB

Overall bundle size: 49.06 KB
Overall status: ✅

@aversini aversini merged commit df63fe6 into main Feb 26, 2024
6 checks passed
@aversini aversini deleted the ui-icons branch February 26, 2024 21:39
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.

1 participant