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

Add keycodes package #7577

Merged
merged 6 commits into from
Jun 27, 2018
Merged

Add keycodes package #7577

merged 6 commits into from
Jun 27, 2018

Conversation

youknowriad
Copy link
Contributor

@youknowriad youknowriad commented Jun 27, 2018

In our effort to split '@wordpress/utils' to smaller targeted packages, I'm extracting "keycodes" to their own package. This would allow us to move forward with the refactoring of the "components" module as a npm ready package.

Tesing instructions

  • Ensure that wp.keycodes == wp.utils.keycodes on the console
  • The differences between the two are the extra warnings triggered by the wp.utils.keycodes utils.

@youknowriad youknowriad added the npm Packages Related to npm packages label Jun 27, 2018
@youknowriad youknowriad self-assigned this Jun 27, 2018
@youknowriad youknowriad requested review from gziolo and a team June 27, 2018 16:52
Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

Looks great to me but I'd like to tweak the package README if that's okay… mind if I sneak a quick commit in? After that I'll approve.


## Installation

Install the module
Copy link
Member

Choose a reason for hiding this comment

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

I've seen this in a few other packages and it seems so blunt and unhelpful 😉

Can we say "Install with npm:"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should do this in a separate PR to keep consistency between the packages. and yes feel free to add some docs :)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, fair point. I'll do that separately, but I'd like to add usage docs to this one 😄

Copy link
Member

Choose a reason for hiding this comment

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

Filed #7579, thanks!

Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

Actually, looks like we need to change the deprecation version.

// keycodes
const wrapKeycodeFunction = ( source, functionName ) => ( ...args ) => {
originalDeprecated( `wp.utils.keycodes.${ functionName }`, {
version: '3.3',
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be 3.4? This will be out in 3.2, so we should deprecate after two versions.

@@ -0,0 +1,13 @@
# @wordpress/keycodes

Keycodes utilities for WordPress.
Copy link
Member

Choose a reason for hiding this comment

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

Can we say what it's used for, in case someone reading this isn't familiar with what "key codes" means? I have some thoughts… I'll just add them in a commit 😄

@tofumatt
Copy link
Member

Docs added 😄

}
```

## Installation
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I'd prefer if we keep the "installation" section before the "usage". It's fine to discuss these but it's important to keep our packages consistent.

Copy link
Member

Choose a reason for hiding this comment

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

Totally right, good call. I moved it under "installation"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the change 👍

@youknowriad youknowriad merged commit 6d0fc3b into master Jun 27, 2018
@youknowriad youknowriad deleted the add/keycodes-packages branch June 27, 2018 17:32
@aduth aduth mentioned this pull request Jul 2, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm Packages Related to npm packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants