clerk / javascript

Official Javascript repository for Clerk authentication
https://clerk.com
MIT License
981 stars 221 forks source link

chore(astro,shared): Move functions that can be reused by different SDKs #3681

Closed wobsoriano closed 1 week ago

wobsoriano commented 2 weeks ago

Description

This PR tackles ECO-4 and aims to share functions that are currently being duplicated by official and community SDKs.

The ff. functions in the PR are present in the React SDK:

  1. loadClerkJsScript - Duplicated by the ff. community SDKs:

Our work-in-progress Clerk SDK approach and requirements requires Clerk to be hotloaded and having this function shared is a no brainer.

  1. deriveState - While different frameworks have different approaches to SSR, this function is also duplicated across SDKs (Vue, SvelteKit, Astro) and is used to set initial value of a user (data coming from server) even when Clerk is not yet loaded in the client.

All the shared functions above will initially be used by the Astro integration and adopted by different SDKs later.

Checklist

Type of change

changeset-bot[bot] commented 2 weeks ago

šŸ¦‹ Changeset detected

Latest commit: 1235e8d345d5f9926c2fed0c39179f40d2724c6c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages | Name | Type | | ----------------------- | ----- | | @clerk/astro | Patch | | @clerk/shared | Patch | | @clerk/backend | Patch | | @clerk/chrome-extension | Patch | | @clerk/clerk-js | Patch | | @clerk/elements | Patch | | @clerk/clerk-expo | Patch | | @clerk/express | Patch | | @clerk/fastify | Patch | | @clerk/nextjs | Patch | | @clerk/clerk-react | Patch | | @clerk/remix | Patch | | @clerk/clerk-sdk-node | Patch | | @clerk/tanstack-start | Patch | | @clerk/testing | Patch |

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

wobsoriano commented 1 week ago

Closing this but it will be tackled in the future at a more relaxing pace.