Skip to content

fix(shared): Improve expo compat#1950

Merged
nikosdouvlis merged 8 commits into
main-v4from
fix/shared-separate-exports
Oct 26, 2023
Merged

fix(shared): Improve expo compat#1950
nikosdouvlis merged 8 commits into
main-v4from
fix/shared-separate-exports

Conversation

@LekoArts

@LekoArts LekoArts commented Oct 26, 2023

Copy link
Copy Markdown
Contributor

Description

The goal of this PR is improve the compat of our @clerk/shared package with Expo. Unfortunately Expo has limited support with the exports map (https://reactnative.dev/blog/2023/06/21/package-exports-support) and in addition, it doesn't support .mjs files by default (see expo/expo#23180) 🤷
We don't want to give up the proper exports syntax as a workaround for now we can generate folders with package.json files before publishing and add them to the files key.

For this the @clerk/shared package now has a postbuild script to generate this. The information for it is hardcoded as it's easier than trying to write a "smart" script to handle all the cases. This also means that if we add a new subpath, we should add the name to the subpaths.mjs file and to the files array inside package.json.

The result is this output: https://unpkg.com/browse/@clerk/shared@1.0.1-snapshot.vceb8c8a/

Now when Expo tries to reach @clerk/shared/deprecated it'll use the folder.
I also removed the "type": "module" as modern solutions should use exports map anyways and Expo won't try to use a file that uses .mjs

Fixes SDK-857

Checklist

  • npm test runs as expected.
  • 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
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

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

@changeset-bot

changeset-bot Bot commented Oct 26, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5b6ea23

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

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

@LekoArts

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArts

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArts

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArts

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

Copy link
Copy Markdown
Collaborator

Hey @LekoArts - the snapshot version command generated the following package versions:

Package Version
@clerk/backend 0.31.4-snapshot.vceb8c8a
@clerk/chrome-extension 0.4.11-snapshot.vceb8c8a
@clerk/clerk-js 4.64.0-snapshot.vceb8c8a
@clerk/clerk-expo 0.19.13-snapshot.vceb8c8a
@clerk/fastify 0.6.18-snapshot.vceb8c8a
gatsby-plugin-clerk 4.4.19-snapshot.vceb8c8a
@clerk/nextjs 4.25.8-snapshot.vceb8c8a
@clerk/clerk-react 4.27.1-snapshot.vceb8c8a
@clerk/remix 3.1.1-snapshot.vceb8c8a
@clerk/clerk-sdk-node 4.12.17-snapshot.vceb8c8a
@clerk/shared 1.0.1-snapshot.vceb8c8a

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/backend

npm i @clerk/backend@0.31.4-snapshot.vceb8c8a --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@0.4.11-snapshot.vceb8c8a --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@4.64.0-snapshot.vceb8c8a --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@0.19.13-snapshot.vceb8c8a --save-exact

@clerk/fastify

npm i @clerk/fastify@0.6.18-snapshot.vceb8c8a --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@4.4.19-snapshot.vceb8c8a --save-exact

@clerk/nextjs

npm i @clerk/nextjs@4.25.8-snapshot.vceb8c8a --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@4.27.1-snapshot.vceb8c8a --save-exact

@clerk/remix

npm i @clerk/remix@3.1.1-snapshot.vceb8c8a --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@4.12.17-snapshot.vceb8c8a --save-exact

@clerk/shared

npm i @clerk/shared@1.0.1-snapshot.vceb8c8a --save-exact

@LekoArts
LekoArts force-pushed the fix/shared-separate-exports branch from b62de4c to 5b6ea23 Compare October 26, 2023 22:08
@nikosdouvlis
nikosdouvlis merged commit 29a5f56 into main-v4 Oct 26, 2023
@nikosdouvlis
nikosdouvlis deleted the fix/shared-separate-exports branch October 26, 2023 22:21
LekoArts added a commit that referenced this pull request Oct 30, 2023
* fix(shared): Remove "module" from package.json

* chore(repo): Add subpath workaround script

* chore(shared): Add script to shared

* Create wise-houses-shop.md

* chore(*): Fix stuff

* chore(repo): Improve script

* chore(repo): Scripting

* Update wise-houses-shop.md

(cherry picked from commit 29a5f56)
github-merge-queue Bot pushed a commit that referenced this pull request Oct 30, 2023
* fix(shared): Remove "module" from package.json

* chore(repo): Add subpath workaround script

* chore(shared): Add script to shared

* Create wise-houses-shop.md

* chore(*): Fix stuff

* chore(repo): Improve script

* chore(repo): Scripting

* Update wise-houses-shop.md

(cherry picked from commit 29a5f56)

Co-authored-by: Lennart <lekoarts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants