-
Notifications
You must be signed in to change notification settings - Fork 616
Docs: change import to lib-esm for drafts #1778
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
Conversation
|
size-limit report 📦
|
``` | ||
|
||
## Examples | ||
|
||
### Minimal example | ||
|
||
```javascript live noinline | ||
// import {ActionList} from '@primer/react/drafts' | ||
// import {ActionList} from '@primer/react/lib-esm/drafts' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove these lines altogether, as it's duplicated in the Installation section at the top of this page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've kept them around for now because the next line isn't how you would import in the application, but that's how we do it in the docs.
const {ActionList} = drafts // ignore docs silliness; import like that ↑
I'd like to hide that implementation detail silliness altogether. Don't know how to do it yet, would work on it on another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove both those lines, it picks Button v1 from @primer/components
, not the one from drafts 😅, that's we import from drafts.
This PR would help remove the lines though - #1785 :)
@@ -129,6 +129,18 @@ | |||
url: /Truncate | |||
- title: UnderlineNav | |||
url: /UnderlineNav | |||
- title: Drafts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you feel about the IA here @siddharthkp? For easier discovery, would it make sense to co-locate it to the original component docs page under an experimental tab/panel/label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it a bit more and decided that we should put all the drafts together. When a draft component is ready to be used in production (design and a11y reviewed, then we should move it out of drafts and deprecate the previous one.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Only other question I have is what the plan is for the CommonJS version? Your docs only cover lib-esm
import methods now, which may be most popular mechanism but raises others concerns.
The DX is quite poor if we need to ask user to add lib-esm
to path each time. If we don't export these components in CJS, or if we have low utilisation, shouldn't we scrap the CommonJS folder or flip them so that lib-esm
is the default format.
We do have it export it as commonjs as well (package on unpkg), but we don't have that in the docs. I think we can add it to the top in the first import? |
Closed in favor of #1785 |
Fix import path in docs/examples. draft components cannot be imported from
@primer/react/drafts
, you have to mention the format as well:@primer/react/lib-esm/drafts
or@primer/react/lib/drafts
.More context: #1768