-
Notifications
You must be signed in to change notification settings - Fork 433
chore(astro,clerk-react,shared,nextjs): Migrate functions that can be reused across JavaScript SDKs #3849
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
chore(astro,clerk-react,shared,nextjs): Migrate functions that can be reused across JavaScript SDKs #3849
Conversation
🦋 Changeset detectedLatest commit: 090f0e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
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 |
| scriptHost = parsePublishableKey(publishableKey)?.frontendApi || ''; | ||
| } | ||
|
|
||
| const variant = clerkJSVariant ? `${clerkJSVariant.replace(/\.+$/, '')}.` : ''; |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data
d0eebdd to
2ef2052
Compare
panteliselef
left a comment
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 this is not urgent, I can review early next week 😊
Definitely not urgent, and thanks! |
@panteliselef that'd be awesome if that's the case. So we can just set the default |
LekoArts
left a comment
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! Some smaller requests
a313653 to
2fab204
Compare
| const errorThrower = buildErrorThrower({ packageName: '@clerk/shared' }); | ||
|
|
||
| /** | ||
| * Sets the package name for error messages during ClerkJS script loading. | ||
| * | ||
| * @example | ||
| * setClerkJsLoadingErrorPackage('@clerk/clerk-react'); | ||
| */ | ||
| export function setClerkJsLoadingErrorPackageName(packageName: string) { | ||
| errorThrower.setPackageName({ packageName }); | ||
| } |
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.
This one is only used inside loadClerkJsScript. I named it like that and not export another setErrorThrowerOptions to avoid confusion. We might also need to add this to frontend SDK spec @LekoArts
I also thought of sharing this errorThrower across SDKs but that would mess with existing error throwers in next and react.
chore(shared): Add deriveState to published files chore(shared): Add deriveState to published files
test(astro): Test script loader version test(astro): Add main script loader test
…f clerk-js script attribute is undefined
…rkJS script loading fails
b09d148 to
33c28b6
Compare
|
!snapshot |
|
Hey @wobsoriano - 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/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact |
Description
See previous PR here.
This PR aims to migrate ClerkJS script loader functions to the shared package so it can be reused across official and community SDKs.
New functions exported in
@clerk/shared:loadClerkJsScript- Hotloads the Clerk JS script.deriveState- Renders initial auth state from SSR if availableversionSelectorCloses ECO-4
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change