Skip to content

upgrade to dndkit v6 #11

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

Merged
merged 5 commits into from
Oct 9, 2024
Merged

upgrade to dndkit v6 #11

merged 5 commits into from
Oct 9, 2024

Conversation

ThaddeusJiang
Copy link
Owner

@ThaddeusJiang ThaddeusJiang commented Oct 9, 2024

fixed #6 by upgrade to dndkit v6

CleanShot.0006-10-09.at.15.05.15.mp4

Copy link

coderabbitai bot commented Oct 9, 2024

Walkthrough

The pull request introduces several changes across multiple files, primarily involving the removal of GitHub Actions workflows for Chromatic and size checks. The installation commands have been standardized to use npm instead of yarn. Additionally, Storybook configuration files have been modified to include new addons and properties, and the README has been updated to reflect these changes. New examples have been added to the Storybook stories, enhancing the documentation and usability of the components.

Changes

File Change Summary
.github/workflows/chromatic.yml Entire workflow configuration removed.
.github/workflows/size.yml Entire workflow configuration removed.
.storybook/main.js Reformatted addons array, added @storybook/addon-webpack5-compiler-swc and @chromatic-com/storybook, updated typescript section, added framework and docs sections.
.storybook/preview.js Added new exported constant tags with value ['autodocs'].
README.md Updated installation instructions to use npm install, enhanced usage examples with new features, and modified development instructions for consistency.
package.json Updated scripts for Storybook commands, modified devDependencies and dependencies with several version upgrades and new additions.
stories/SortableList.stories.tsx Added new example DraggingScrollingExample and adjusted the export structure, while existing examples remain unchanged.

Poem

🐰 In the garden of code, we hop and play,
With npm now leading the way!
New addons sprout, like flowers in bloom,
Enhancing our stories, dispelling the gloom.
So let’s celebrate with a joyful cheer,
For our project’s growth, we hold dear! 🎉


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a3b82be and 1a5e57f.

📒 Files selected for processing (2)
  • .github/workflows/chromatic.yml (0 hunks)
  • .github/workflows/size.yml (0 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/chromatic.yml
  • .github/workflows/size.yml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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.

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 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.

@ThaddeusJiang ThaddeusJiang changed the title upgrade upgrade to dndkit v6 Oct 9, 2024
Copy link

github-actions bot commented Oct 9, 2024

size-limit report 📦

Path Size
dist/react-sortable-list.cjs.production.min.js 59.91 KB (+3.98% 🔺)
dist/react-sortable-list.esm.js 57.41 KB (+3.45% 🔺)

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

🧹 Outside diff range and nitpick comments (7)
.storybook/main.js (2)

7-14: LGTM! Consider updating documentation.

The changes to the addons array improve readability and align with the PR objectives. The addition of @storybook/addon-webpack5-compiler-swc can potentially improve build performance, which is great.

Consider updating the project's documentation (e.g., README.md) to mention these new addons and their benefits, especially the integration with Chromatic for visual testing via @chromatic-com/storybook.


29-29: Clarify the purpose of the empty docs object.

An empty docs object has been added to the configuration. While this doesn't cause any issues, it also doesn't serve any purpose in its current state.

Is this intended as a placeholder for future documentation configuration? If so, consider adding a TODO comment to explain its future use. If not, it might be better to remove it to keep the configuration clean.

package.json (1)

52-52: LGTM! Storybook dependencies successfully updated.

The Storybook-related dependencies have been updated to their latest versions, which aligns with the PR objective of upgrading Storybook. The addition of @storybook/addon-webpack5-compiler-swc suggests a move to use SWC for faster compilation, which is a good optimization.

Consider updating the README.md file if there are any changes in how to run or build Storybook with these new versions.

Also applies to: 54-54, 56-59

stories/SortableList.stories.tsx (1)

88-97: LGTM: New example demonstrates scrolling behavior.

The DraggingScrollingExample is a valuable addition to the Storybook stories. It effectively demonstrates the SortableList component's ability to handle a larger number of items, which is crucial for testing scrolling behavior.

Consider adding a brief comment above the example to explain its purpose, e.g.:

// Demonstrates SortableList behavior with a large number of items to showcase scrolling
export const DraggingScrollingExample: React.VFC = () => {
  // ... (rest of the code)
}

This would help other developers quickly understand the example's intent.

README.md (3)

Line range hint 41-54: LGTM: Added Tailwind CSS configuration

The addition of Tailwind CSS configuration is a good improvement for users of the library. It ensures that Tailwind styles are properly applied to the components.

Consider adding a brief comment explaining why this configuration is necessary, e.g.:

// Ensure Tailwind CSS styles are applied to the react-sortable-list components

Line range hint 214-241: LGTM: Enhanced ComplexComponentExample with new functionalities

The addition of input field editing and a delete button functionality in the ComplexComponentExample is a valuable improvement. It demonstrates more advanced usage of the library.

Consider adding a brief comment explaining the purpose of the new functionalities, e.g.:

// Demonstrate editable fields and item deletion within a sortable list

Also, the delete button's onClick handler currently only shows an alert. Consider updating it to actually remove the item from the list for a more complete example.


Line range hint 262-280: LGTM: Added example for disabling drag and drop

The new example demonstrating the disabled prop is a valuable addition to the README. It clearly shows users how to disable the drag and drop functionality when needed.

Consider adding a brief explanation of when or why a user might want to disable drag and drop. For example:

// Use the `disabled` prop to temporarily or conditionally disable drag and drop functionality
// This can be useful for read-only views or when you want to prevent sorting under certain conditions
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9463a64 and 00cf41d.

⛔ Files ignored due to path filters (3)
  • example/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .github/workflows/chromatic.yml (1 hunks)
  • .storybook/main.js (1 hunks)
  • .storybook/preview.js (1 hunks)
  • README.md (2 hunks)
  • package.json (3 hunks)
  • stories/SortableList.stories.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (12)
.storybook/preview.js (1)

8-8: Excellent addition of autodocs tag!

The addition of export const tags = ['autodocs']; is a great improvement to the Storybook configuration. This enables automatic documentation generation for all stories by default, which aligns well with the PR objective of upgrading Storybook.

Benefits of this change include:

  1. Improved documentation: Autodocs will automatically generate comprehensive documentation for your components.
  2. Consistency: Ensures a standardized approach to documentation across all stories.
  3. Time-saving: Reduces the manual effort required to create and maintain component documentation.

This change will significantly enhance the project's documentation capabilities and improve the developer experience.

.storybook/main.js (2)

24-27: LGTM! Explicit framework configuration.

The addition of the framework object explicitly defining @storybook/react-webpack5 is a good practice. This aligns with modern Storybook configuration and can prevent potential issues by clearly specifying the framework being used.


18-22: LGTM! Verify documentation generation.

The addition of reactDocgen: 'react-docgen-typescript' is a good improvement. This will enable automatic prop type documentation for your React components.

Please verify that the prop type documentation is being generated correctly for your components. You can do this by checking the Storybook UI for your components. Run the following command to start Storybook and manually verify:

.github/workflows/chromatic.yml (1)

29-29: LGTM: Package manager change

Changing from yarn to npm install aligns with the PR objective of transitioning from Yarn to NPM for package management. This change is consistent with the project's goals.

To ensure consistency across the project, let's verify that we've updated all references to Yarn:

Please ensure that all Yarn references are updated to NPM throughout the project for consistency.

✅ Verification successful

All Yarn references have been successfully updated to NPM, ensuring consistency with the project goals.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to Yarn in the project
echo "Checking for Yarn references in package.json scripts:"
jq '.scripts | to_entries[] | select(.value | contains("yarn"))' package.json

echo -e "\nChecking for Yarn references in README.md:"
grep -n "yarn" README.md

echo -e "\nChecking for Yarn references in other workflow files:"
grep -r "yarn" .github/workflows/ --exclude="chromatic.yml"

echo -e "\nChecking for yarn.lock file:"
ls yarn.lock 2>/dev/null && echo "yarn.lock file still exists" || echo "No yarn.lock file found (good)"

Length of output: 662

package.json (4)

50-50: Please clarify the purpose of adding @chromatic-com/storybook.

I noticed the addition of @chromatic-com/storybook as a dev dependency. While this could potentially enhance our Storybook setup with visual testing capabilities, it wasn't mentioned in the PR objectives.

Could you please provide more context on why this dependency was added and how it will be used in the project?


97-97: LGTM! Minor formatting fix.

The addition of the closing bracket for the keywords array ensures proper JSON syntax.


99-100: LGTM! @dnd-kit dependencies updated as per PR objective.

The updates to @dnd-kit/core (^6.1.0) and @dnd-kit/sortable (^8.0.0) align with the PR objective of upgrading @dnd-kit/core to version 6 or higher.

However, given the major version bump for @dnd-kit/sortable (from 6 to 8), please ensure that:

  1. All breaking changes have been addressed in the codebase.
  2. The project's functionality remains intact after these updates.

You can use the following command to check for any usage of potentially changed APIs:

#!/bin/bash
# Search for @dnd-kit usage in the codebase
grep -R --include="*.{js,jsx,ts,tsx}" "@dnd-kit" src/

18-19: LGTM! Script updates align with project goals.

The changes to the scripts section are consistent with the PR objectives:

  1. Transitioning from Yarn to NPM (lines 21-22).
  2. Updating Storybook commands to the latest syntax (lines 18-19).

These updates should improve consistency and keep the project up-to-date with the latest Storybook features.

To ensure the Storybook upgrade was successful, let's verify the installed version:

Also applies to: 21-22

✅ Verification successful

Verified Storybook upgrade

The @storybook/react dependency has been successfully upgraded to version ^8.3.5 in package.json.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify Storybook version
npm list @storybook/react | grep @storybook/react

Length of output: 53


Script:

#!/bin/bash
# Verify Storybook version in package.json
grep '"@storybook/react"' package.json

Length of output: 74

stories/SortableList.stories.tsx (1)

83-86: LGTM: Efficient data generation for the new example.

The data constant is well-implemented using Array.from() with a mapping function. This approach efficiently generates a suitable dataset for demonstrating scrolling behavior in the new example.

README.md (3)

23-23: LGTM: Updated installation command to use npm

The change from yarn add to npm install is consistent with the PR objective of transitioning from Yarn to npm for package management.


276-276: LGTM: Updated development commands to use npm

The development commands have been consistently updated from yarn to npm, aligning with the PR objective of transitioning to npm for package management.

Also applies to: 284-284, 287-289, 295-295


Line range hint 1-315: Overall LGTM: README updates are comprehensive and valuable

The changes to the README are well-executed and align with the PR objectives. Key improvements include:

  1. Updated installation and development commands to use npm instead of Yarn.
  2. Added Tailwind CSS configuration instructions.
  3. Enhanced examples, including the ComplexComponentExample with new functionalities.
  4. Added a new example for the disabled prop.

These updates provide clear and up-to-date documentation for users of the library.

@@ -24,9 +24,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '12.x'
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Update Node.js version in chromatic.yml to a supported LTS

The node-version in .github/workflows/chromatic.yml is set to '12.x', which is no longer supported and may introduce security vulnerabilities and compatibility issues. To ensure consistency and maintain security across all workflows, update the Node.js version to a supported LTS version, such as '20.x'. Here's the recommended change:

- node-version: '12.x'
+ node-version: '20.x'
🔗 Analysis chain

Reconsider downgrading Node.js version

The change from Node.js 16.x to 12.x is concerning. Node.js 12.x reached end-of-life in April 2022, which means it no longer receives security updates or bug fixes. This downgrade could introduce security vulnerabilities and compatibility issues with modern dependencies.

I strongly recommend using a more recent LTS version of Node.js. As of October 2024, consider using Node.js 20.x or the latest LTS version available. Here's a suggested change:

- node-version: '12.x'
+ node-version: '20.x'

To ensure we're using an appropriate Node.js version across the project, let's check for any other Node.js version specifications:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for Node.js version specifications in package.json, .nvmrc, and other workflow files
echo "Checking package.json for engine specification:"
jq '.engines.node' package.json 2>/dev/null || echo "No Node.js version specified in package.json"

echo -e "\nChecking .nvmrc file:"
cat .nvmrc 2>/dev/null || echo "No .nvmrc file found"

echo -e "\nChecking other workflow files for Node.js version specifications:"
grep -r "node-version:" .github/workflows/ --exclude="chromatic.yml"

Length of output: 536

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: 0

🧹 Outside diff range and nitpick comments (1)
example/package.json (1)

Line range hint 1-24: Consider updating other dependencies

While updating the project, it might be beneficial to also update other dependencies to their latest compatible versions, especially dev dependencies like TypeScript and Parcel.

Would you like assistance in generating an updated list of dependencies with their latest compatible versions?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 00cf41d and a3b82be.

⛔ Files ignored due to path filters (1)
  • example/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • example/package.json (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
example/package.json (3)

12-12: ⚠️ Potential issue

Incorrect React version specified

The specified React version "^18.3.1" does not exist. The latest stable version of React is 18.2.0 as of my last update.

Please update the React version to a valid, stable release. Here's a suggested fix:

-    "react": "^18.3.1",
+    "react": "^18.2.0",

Let's verify the latest stable version of React:

#!/bin/bash
# Check the latest stable version of React
npm view react version

11-12: Potential conflict with aliased React version

Adding React as a direct dependency might conflict with the existing alias configuration that points to "../node_modules/react".

We should verify if this new direct dependency is necessary and if it might cause any issues with the existing alias. Could you clarify the intention behind adding React as a direct dependency?

#!/bin/bash
# Check if React is also listed in the parent package.json
if grep -q '"react":' ../package.json; then
  echo "React is also listed in the parent package.json"
  grep '"react":' ../package.json
else
  echo "React is not listed in the parent package.json"
fi

11-11: Verify the necessity and version of @thaddeusjiang/react-sortable-list

The addition of "@thaddeusjiang/react-sortable-list": "^0.1.1" seems appropriate for an example project demonstrating this library. However, the version number (0.1.1) suggests it's in an early stage of development.

Please confirm if this is the intended version and if there are any stability concerns we should be aware of. Also, could you clarify if this package incorporates the dndkit v6 upgrade mentioned in the PR objectives?

@ThaddeusJiang ThaddeusJiang self-assigned this Oct 9, 2024
@ThaddeusJiang ThaddeusJiang merged commit 2980a58 into main Oct 9, 2024
@ThaddeusJiang ThaddeusJiang deleted the upgrade branch October 9, 2024 06:07
@ThaddeusJiang ThaddeusJiang mentioned this pull request Oct 9, 2024
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.

Doesnt seem working when dragging + scrolling
1 participant