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

Replace classnames with clsx #61138

Merged
merged 21 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d7f9139
Replace classnames with clsx.
DaniGuardiola Apr 25, 2024
7f8a794
Fix removeAspectRatioClasses.
DaniGuardiola Apr 25, 2024
201d0e3
Fix docs.
DaniGuardiola Apr 25, 2024
99d68c1
Fix test.
DaniGuardiola Apr 25, 2024
daac391
Merge branch 'trunk' into pr/DaniGuardiola/61091
DaniGuardiola Apr 25, 2024
b5d9cd8
Fix trunk changes.
DaniGuardiola Apr 25, 2024
30b3ce7
Fix removeAspectRatioClasses.
DaniGuardiola Apr 25, 2024
fb304a9
Undo unwanted PHP changes.
DaniGuardiola Apr 25, 2024
58aced0
Add restricted import rule.
DaniGuardiola Apr 25, 2024
1ac5eb2
dummy commit
DaniGuardiola Apr 26, 2024
0992768
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into i…
DaniGuardiola May 1, 2024
d52fb7a
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into i…
DaniGuardiola May 1, 2024
d4b415e
Update changelogs for all affected packages.
DaniGuardiola May 1, 2024
f85fa16
Remove test stuff 😅
DaniGuardiola May 1, 2024
e066ea2
Make changelog entries internal.
DaniGuardiola May 1, 2024
598b622
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into i…
DaniGuardiola May 1, 2024
5da1bfa
Try the force flag to fix CI flakiness on Windows.
DaniGuardiola May 1, 2024
c77e353
Add debug logs to CI task.
DaniGuardiola May 1, 2024
6afeda7
Try to log again.
DaniGuardiola May 1, 2024
e31734e
Attempt logging again.
DaniGuardiola May 1, 2024
200f7c7
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into i…
DaniGuardiola May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ const restrictedImports = [
message:
"edit-widgets is a WordPress top level package that shouldn't be imported into other packages",
},
{
name: 'classnames',
message:
"Please use `clsx` instead. It's a lighter and faster drop-in replacement for `classnames`.",
},
];

module.exports = {
Expand Down
9 changes: 8 additions & 1 deletion .github/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ runs:

- name: Install npm dependencies
if: ${{ steps.cache-node_modules.outputs.cache-hit != 'true' }}
run: npm ci
run: |
npm ci
shell: bash
- name: Upload npm logs as an artifact on failure
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: failure()
with:
name: npm-logs
DaniGuardiola marked this conversation as resolved.
Show resolved Hide resolved
path: C:\npm\cache\_logs

# On cache hit, we run the post-install script to match the native `npm ci` behavior.
# An example of this is to patch `node_modules` using patch-package.
Expand Down
6 changes: 3 additions & 3 deletions docs/contributors/code/coding-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ Components may be assigned with class names that indicate states (for example, a

**Example:**

Consider again the Notices example. We may want to apply specific styling for dismissible notices. The [`classnames` package](https://www.npmjs.com/package/classnames) can be a helpful utility for conditionally applying modifier class names.
Consider again the Notices example. We may want to apply specific styling for dismissible notices. The [`clsx` package](https://www.npmjs.com/package/clsx) can be a helpful utility for conditionally applying modifier class names.

```jsx
import classnames from 'classnames';
import clsx from 'clsx';

export default function Notice( { children, onRemove, isDismissible } ) {
const classes = classnames( 'components-notice', {
const classes = clsx( 'components-notice', {
'is-dismissible': isDismissible,
} );

Expand Down
79 changes: 41 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Internal

- Replaced `classnames` package with the faster and smaller `clsx` package ([#61138](https://github.com/WordPress/gutenberg/pull/61138)).

## 12.25.0 (2024-05-02)

## 12.24.0 (2024-04-19)
Expand All @@ -20,7 +24,7 @@

## 12.18.0 (2024-01-24)

- Deprecated `__experimentalRecursionProvider` and `__experimentalUseHasRecursion` in favor of their new stable counterparts `RecursionProvider` and `useHasRecursion`.
- Deprecated `__experimentalRecursionProvider` and `__experimentalUseHasRecursion` in favor of their new stable counterparts `RecursionProvider` and `useHasRecursion`.
DaniGuardiola marked this conversation as resolved.
Show resolved Hide resolved

## 12.17.0 (2024-01-10)

Expand Down Expand Up @@ -251,8 +255,8 @@

### Breaking Changes

- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/.
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at https://nodejs.org/en/about/releases/.
- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at <https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/>.
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at <https://nodejs.org/en/about/releases/>.

## 5.3.0 (2021-03-17)

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@wordpress/warning": "file:../warning",
"@wordpress/wordcount": "file:../wordcount",
"change-case": "^4.1.2",
"classnames": "^2.3.1",
"clsx": "^2.1.1",
"colord": "^2.7.0",
"deepmerge": "^4.3.0",
"diff": "^4.0.2",
Expand Down
Loading
Loading