Skip to content

perf: migrate to tinyclip from clipboardy#21975

Merged
devadula-nandan merged 6 commits into
carbon-design-system:mainfrom
florian-lefebvre:feat/tinyclip
May 13, 2026
Merged

perf: migrate to tinyclip from clipboardy#21975
devadula-nandan merged 6 commits into
carbon-design-system:mainfrom
florian-lefebvre:feat/tinyclip

Conversation

@florian-lefebvre

Copy link
Copy Markdown
Contributor

Tinyclip is really lighter than clipboardy. This PR was made as part of the e18e initiative.

Changelog

Changed

  • Swapped the clipboardy dependency for tinyclip

Testing / Reviewing

Run the changelog command and the build-test-rtl task.

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@florian-lefebvre florian-lefebvre requested a review from a team as a code owner April 7, 2026 15:15
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the DCO.
Posted by the DCO Assistant Lite bot.

Comment thread packages/react/tasks/build-test-rtl.js Outdated
@florian-lefebvre

Copy link
Copy Markdown
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@netlify

netlify Bot commented Apr 7, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit dfb5c1f
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/69fb778c0309e90007aee733
😎 Deploy Preview https://deploy-preview-21975--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Apr 7, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit dfb5c1f
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/69fb778ca83ede000957c21b
😎 Deploy Preview https://deploy-preview-21975--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.11%. Comparing base (13c5c42) to head (dfb5c1f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #21975   +/-   ##
=======================================
  Coverage   95.11%   95.11%           
=======================================
  Files         549      549           
  Lines       45644    45644           
  Branches     6528     6524    -4     
=======================================
  Hits        43413    43413           
  Misses       2101     2101           
  Partials      130      130           
Flag Coverage Δ
main-packages 89.16% <ø> (ø)
web-components 97.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread packages/cli/src/commands/changelog.js Outdated
*/

import clipboard from 'clipboardy';
import * as clipboard from 'tinyclip';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking at the following code, tinyclip only shells out to wl-copy, xsel, or xclip: https://github.com/tinylibs/tinyclip/blob/23e04472d30b7040c7a43fcd0caa64d8a93ad748/src/index.ts#L72-L96

clipboardy bundled an xsel fallback binary: https://github.com/sindresorhus/clipboardy/blob/003856640e971c53d0ce7731d0dd9baca9131ce4/readme.md?plain=1#L142

Will carbon-cli changelog with tinyclip fail in a minimal Linux or CI environment that does not already have a clipboard util installed?

@florian-lefebvre florian-lefebvre Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes that is one of the reasons why tinyclip is so much lighter, we think it's not the responsibility of such library to bundle this kind of fallback (that means as a windows user, you have to download 1MB of fallback you will never need). So in a minimal env it may indeed fail.

I understand if you don't want the change because of that, it's fair! That would require installing xclip first for example (which IMO is better): sudo apt-get install -y xclip && carbon-cli changelog

@tay1orjones tay1orjones left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this! Looks good to me.

Comment thread packages/cli/src/commands/changelog.js Outdated

if (response?.copy) {
clipboard.writeSync(changelog);
await clipboard.writeText(changelog);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is guarded by noPrompt, so no risk here really.

Comment thread packages/react/tasks/build-test-rtl.js Outdated

if (copy) {
clipboard.writeSync(testFile);
await clipboard.writeText(testFile);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is an old test generation script that was primarily used when we were migrating from enzyme to react-testing-library (rtl). I don't think it's used much anymore, and if it is, it's a local dev environment where there's no risk.

@adamalston adamalston left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you address the merge conflicts?

Comment thread packages/cli/src/commands/changelog.js Outdated
@netlify

netlify Bot commented May 6, 2026

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 2163461
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/69fae714704e770009e4815d
😎 Deploy Preview https://deploy-preview-21975--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented May 6, 2026

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit dfb5c1f
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/69fb778c41b5830008f2aebe
😎 Deploy Preview https://deploy-preview-21975--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@maradwan26 maradwan26 enabled auto-merge May 6, 2026 17:17
@maradwan26 maradwan26 added this pull request to the merge queue May 6, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 6, 2026
@devadula-nandan devadula-nandan added this pull request to the merge queue May 13, 2026
Merged via the queue into carbon-design-system:main with commit e21e19a May 13, 2026
39 of 40 checks passed
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.

5 participants