-
Notifications
You must be signed in to change notification settings - Fork 327
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
feat(elements): Update exports and prep for public builds #2676
Conversation
🦋 Changeset detectedLatest commit: 30f98f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -49,6 +61,8 @@ | |||
"app:e2e": "(cd examples/nextjs && npm run e2e)", | |||
"app:lint": "(cd examples/nextjs && npm run lint)", | |||
"build": "tsup", | |||
"build:analyze": "tsup --metafile; open https://esbuild.github.io/analyze/", |
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.
Enables easy analysis of generated packages.
packages/elements/src/index.ts
Outdated
export { useSignUpFlow, useSignUpFlowSelector } from '~/internals/machines/sign-up/sign-up.context'; | ||
export { useSignInFlow, useSignInFlowSelector } from '~/internals/machines/sign-in/sign-in.context'; | ||
export { useNextRouter }; | ||
throw new Error('Please import specific subpaths instead. See documentation for more details: https://clerk.com/docs/'); // TODO: Add link to docs |
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.
As-is, we don't need to make anything available at the top-level of the package.
@@ -17,6 +17,9 @@ export default defineConfig(overrideOptions => { | |||
dts: true, | |||
entry: { | |||
index: 'src/index.ts', | |||
'react/common/index': 'src/react/common/index.ts', | |||
'react/sign-in/index': 'src/react/sign-in/index.ts', | |||
'react/sign-up/index': 'src/react/sign-up/index.ts', |
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.
Create specific entrypoints
@@ -26,6 +26,16 @@ | |||
"author": "Clerk", | |||
"sideEffects": false, | |||
"exports": { | |||
"./*": { |
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.
All React-specific code is contained within dist/react
but available at the top-level by default, per previous conversations.
@@ -43,6 +43,7 @@ export const CustomField = forwardRef<Input, { name: string; label: string }>(fu | |||
} | |||
: { | |||
className: 'bg-tertiary rounded-sm px-2 py-1 border border-foreground data-[invalid]:border-red-500', | |||
ref: forwardedRef, |
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.
forwardedRef
only applies to the non-otp
input at this point.
"@radix-ui/react-form": "^0.0.3", | ||
"@radix-ui/react-slot": "^1.0.2", | ||
"@statelyai/inspect": "^0.1.0", | ||
"@xstate/react": "^4.0.2", | ||
"clsx": "^2.1.0", |
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.
Wasn't used.
cf43412
to
e81605b
Compare
!snapshot |
Hey @tmilewski - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/backend@1.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/chrome-extension@1.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/clerk-js@5.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/elements@0.0.2-snapshot.v59b1e3b --save-exact
npm i @clerk/clerk-expo@1.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/fastify@1.0.1-snapshot.v59b1e3b --save-exact
npm i gatsby-plugin-clerk@5.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/localizations@2.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/nextjs@5.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/clerk-react@5.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/remix@4.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/clerk-sdk-node@5.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/shared@2.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/themes@2.0.1-snapshot.v59b1e3b --save-exact
npm i @clerk/types@4.0.1-snapshot.v59b1e3b --save-exact |
packages/elements/package.json
Outdated
@@ -40,7 +49,9 @@ | |||
"main": "./dist/index.js", | |||
"types": "./dist/index.d.ts", | |||
"files": [ | |||
"dist" | |||
"dist", | |||
"!dist/metafile-*.json", |
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.
Generated for bundle analysis and unable to configure where they're generated. This ensures we don't include them in the resulting package.
@@ -33,11 +33,13 @@ export function SocialProvider({ asChild, provider, ...rest }: SocialProviderPro | |||
} | |||
|
|||
const Comp = asChild ? Slot : 'button'; | |||
const defaultProps = asChild ? {} : { type: 'button' as const }; |
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.
When encapsulated in form elements, buttons without a type default to submit
causing issues when hitting enter.
…map, adjust scripts
Description
95% of this PR is simply moving components out of single
index.tsx
files and updating imports and the specific imported component names.Adding comments to call-out specific points of interest.
index.tsx
./common
/sign-in
/sign-up
import * as ___ from ___
npm run build:analyze
Components can now be imported into applications using the following structures:
Note:
Root
also maps toSignIn
allowing forSignIn.Root
rather thanSignIn.SignIn
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/clerk-expo
@clerk/fastify
gatsby-plugin-clerk
@clerk/localizations
@clerk/nextjs
@clerk/clerk-react
@clerk/remix
@clerk/clerk-sdk-node
@clerk/shared
@clerk/themes
@clerk/types
build/tooling/chore