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 |
| "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.
Enables easy analysis of generated packages.
| 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.
As-is, we don't need to make anything available at the top-level of the package.
| 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.
Create specific entrypoints
| "author": "Clerk", | ||
| "sideEffects": false, | ||
| "exports": { | ||
| "./*": { |
There was a problem hiding this comment.
All React-specific code is contained within dist/react but available at the top-level by default, per previous conversations.
| } | ||
| : { | ||
| 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.
forwardedRef only applies to the non-otp input at this point.
| "@radix-ui/react-slot": "^1.0.2", | ||
| "@statelyai/inspect": "^0.1.0", | ||
| "@xstate/react": "^4.0.2", | ||
| "clsx": "^2.1.0", |
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 |
| "files": [ | ||
| "dist" | ||
| "dist", | ||
| "!dist/metafile-*.json", |
There was a problem hiding this comment.
Generated for bundle analysis and unable to configure where they're generated. This ensures we don't include them in the resulting package.
| } | ||
|
|
||
| const Comp = asChild ? Slot : 'button'; | ||
| const defaultProps = asChild ? {} : { type: 'button' as const }; |
There was a problem hiding this comment.
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.tsxfiles and updating imports and the specific imported component names.Adding comments to call-out specific points of interest.
index.tsx./common/sign-in/sign-upimport * as ___ from ___npm run build:analyzeComponents can now be imported into applications using the following structures:
Note:
Rootalso maps toSignInallowing forSignIn.Rootrather thanSignIn.SignInChecklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/backend@clerk/chrome-extension@clerk/clerk-js@clerk/clerk-expo@clerk/fastifygatsby-plugin-clerk@clerk/localizations@clerk/nextjs@clerk/clerk-react@clerk/remix@clerk/clerk-sdk-node@clerk/shared@clerk/themes@clerk/typesbuild/tooling/chore