javascript icon indicating copy to clipboard operation
javascript copied to clipboard

chore(clerk-js,clerk-react,types): Expose environment for better inter-package development

Open tmilewski opened this issue 2 years ago • 5 comments

Description

We're utilizing __unstable__environment a bunch in elements and the current state doesn't enforce type safety and requires us to override types in our own package.

The better facilitate inter-package development, I've made the following changes to Clerk and IsomorphicClerk:

  • __unstable__environment is now exposed, typed, marked as deprecated, and commented on about its internal state. (To be removed in a future release.)
  • __internal_environment is exposed with the appropriate typing and comments about its internal state.

Notes:

  • I left __unstable__environment for now, until it's worked out of both elements and the accounts repo.

Checklist

  • [x] npm test runs as expected.
  • [x] npm run build runs as expected.
  • [ ] (If applicable) JSDoc comments have been added or updated for any package exports
  • [ ] (If applicable) Documentation has been updated

Type of change

  • [ ] 🐛 Bug fix
  • [ ] 🌟 New feature
  • [ ] 🔨 Breaking change
  • [x] 📖 Refactoring / dependency upgrade / documentation
  • [ ] other:

Packages affected

  • [ ] @clerk/backend
  • [ ] @clerk/chrome-extension
  • [x] @clerk/clerk-js
  • [ ] @clerk/clerk-expo
  • [ ] @clerk/fastify
  • [ ] gatsby-plugin-clerk
  • [ ] @clerk/localizations
  • [ ] @clerk/nextjs
  • [x] @clerk/clerk-react
  • [ ] @clerk/remix
  • [ ] @clerk/clerk-sdk-node
  • [ ] @clerk/shared
  • [ ] @clerk/themes
  • [x] @clerk/types
  • [ ] build/tooling/chore

tmilewski avatar Jan 11 '24 19:01 tmilewski

🦋 Changeset detected

Latest commit: 8ee6298bf19d0df5466dc28abad818d7f59efa5f

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

This PR includes changesets to release 12 packages
Name Type
@clerk/clerk-js Patch
@clerk/clerk-react Patch
@clerk/types Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/elements Patch
gatsby-plugin-clerk Patch
@clerk/nextjs Patch
@clerk/remix Patch
@clerk/backend Patch
@clerk/fastify Patch
@clerk/clerk-sdk-node 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

changeset-bot[bot] avatar Jan 11 '24 19:01 changeset-bot[bot]

@tmilewski With the current state of elements and given that we're going to be discussing architecture-level changes to the SDKs, do you believe this is still needed for now?

nikosdouvlis avatar Feb 15 '24 18:02 nikosdouvlis

@nikosdouvlis I'd say that I feel this is appropriate beyond the scope of those projects.

tmilewski avatar Feb 15 '24 19:02 tmilewski

@nikosdouvlis I'd say that I feel this is appropriate beyond the scope of those projects.

I'm worried that making accessing EnvironmentResource easier will lead to coupling the SDKs to the instance config more. Right now, we've only used it outside of clerk-js as an escape hatch as this needs to be designed properly. You mentioned typed safety, can we import EnvironmentResource from clerk/types for now?

Also, we can rename __unstable to __internal without keeping the other prop around as this is an internal and going in v5.

nikosdouvlis avatar Feb 15 '24 19:02 nikosdouvlis

Hey @tmilewski any updates on the above? It feels like we can import EnvironmentResource from clerk/types for now, close this one and re-iterate once the architecture project is over

nikosdouvlis avatar Mar 20 '24 12:03 nikosdouvlis