-
Notifications
You must be signed in to change notification settings - Fork 431
[POC] Lightweight version pinning packages - Do not merge #7689
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
base: main
Are you sure you want to change the base?
Conversation
Introduces @clerk/clerk-js-pinned and @clerk/ui-pinned packages for dependency-managed version pinning without heavy transitive dependencies. - Add @clerk/clerk-js-pinned: exports clerkJs branded object and version - Add @clerk/ui-pinned: exports ui branded object with full Appearance types - Add ClerkJs and Ui branded types to @clerk/shared - Add clerkJs prop to IsomorphicClerkOptions - Update loadClerkJsScript to handle clerkJs object - Use dts-bundle-generator to bundle all types inline (zero type deps) Both packages are <1KB gzipped with zero runtime dependencies.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis change introduces two new pinned packages, 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/ui/src/internal/index.ts (1)
1-1: Add a localUitype import to fix the TypeScript compile error.
Uiis re-exported on line 7 but not imported into local scope, causing a compilation error when used in thelocalUiForTestingcast on line 68.🐛 Fix required
import type { Appearance } from './appearance'; +import type { Ui } from '@clerk/shared/types';
Caution
This is a proof of concept / exploration - NOT intended for full review or merge.
This PR demonstrates a potential approach to lightweight version pinning. It is meant to gather feedback on the direction, not to be production-ready code.
Summary
Explores
@clerk/clerk-js-pinnedand@clerk/ui-pinnedpackages for dependency-managed version pinning without heavy transitive dependencies.Problem
Today, users can pin:
@clerk/clerk-jsvia a string prop likeclerkJsVersion="x.y.z"@clerk/uivia importing auiobject from@clerk/uiThis is inconsistent and confusing. The naive "make them install @clerk/ui to pin it" approach forces large transitive dependency graphs onto apps that otherwise rely on hot-loaded runtime code.
Proposed Solution
Create lightweight packages that:
dts-bundle-generator(no external type dependencies)New Packages (POC)
@clerk/clerk-js-pinned(~0.34KB gzipped)versionstring constantclerkJsbranded object for use with newclerkJsprop@clerk/ui-pinned(~0.41KB gzipped)versionstring constantuibranded object with fullAppearancetype supportUsage
Changes
@clerk/clerk-js-pinnedpackage@clerk/ui-pinnedpackageClerkJsandUibranded types to@clerk/shared/typesclerkJsprop toIsomorphicClerkOptionsloadClerkJsScriptto handleclerkJsobjectOpen Questions
1. Lock-step Versioning
How do we keep these packages in sync with their parent packages?
Proposed approach: Use changesets
fixedgroups in.changeset/config.json:This ensures when
@clerk/clerk-jsbumps to5.115.0,@clerk/clerk-js-pinnedautomatically gets the same version.Alternative: CI automation that bumps pinned packages when parent packages bump.
2. Migration Strategy (Backward Compatibility)
The POC maintains the old string-based props for easier migration:
For clerk-js (coexistence):
clerkJSVersion?: string- existing string-based approach (kept)clerkJs?: { version: string }- new branded object approach (added)The implementation shows precedence:
clerkJs?.version ?? clerkJSVersionFor UI:
ui?: { version: string }- new branded object approach (added)Questions:
clerkJSVersioneventually?3. Other Open Questions
*-pinnedvs something else?