Skip to content
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

fix(shared): Remove "sideEffects" and fix postbuild script #1974

Merged
merged 6 commits into from
Oct 31, 2023

Conversation

LekoArts
Copy link
Member

@LekoArts LekoArts commented Oct 30, 2023

Description

In the first commit I tried to bundle @clerk/shared into Expo but that didn't completely work as we'd also need to bundle React or Clerk JS -- ugh :/

So this PR adds the files and adjusts the subpaths script.

I also removed the sideEffects: false since tsup/esbuild complained that this package is not side-effects free. Which is true since some packages import shared chunks.

This is a follow-up to #1950

Fixes SDK-884

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/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2023

🦋 Changeset detected

Latest commit: 26d72e7

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
Member Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArts LekoArts changed the title fix(clerk-expo,shared): Bundle shared in expo fix(shared): Remove "sideEffects" and fix postbuild script Oct 30, 2023
@clerk-cookie clerk-cookie removed the expo label Oct 30, 2023
Comment on lines +7 to +25
"browser",
"callWithRetry",
"color",
"cookie",
"date",
"deprecated",
"error",
"file",
"globs",
"handleValueOrFn",
"isomorphicAtob",
"keys",
"loadScript",
"localStorageBroadcastChannel",
"poller",
"proxy",
"underscore",
"url",
"react"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts why are these added at top level ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@panteliselef Please see #1950

Copy link
Member

@tmilewski tmilewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I was wondering the same thing as @panteliselef. Are we able to nest them?

We'll need to define these additional directories in two places and a nested approach will make it more manageable.

  • NPM Script: clean will need to account for these generated files.
  • Turborepo: The generated files/dirs will also need to be listed in the build task outputs.

As-is, they both only account for ./dist.

Thanks!

@LekoArts
Copy link
Member Author

This is a follow-up to #1950 so the functionality is not new and Turborepo does not need to be considered here as these are only package.json files for compat reasons

@nikosdouvlis
Copy link
Member

❓ I was wondering the same thing as @panteliselef. Are we able to nest them?

We'll need to define these additional directories in two places and a nested approach will make it more manageable.

  • NPM Script: clean will need to account for these generated files.
  • Turborepo: The generated files/dirs will also need to be listed in the build task outputs.

As-is, they both only account for ./dist.

Thanks!

We're not able to nest them as we've found that Expo does not respect the exports field. Please see #1950 for more details.

@@ -2,9 +2,27 @@
"name": "@clerk/shared",
"version": "1.0.0",
"description": "Internal package utils used by the Clerk SDKs",
"sideEffects": false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you notice any side-effects (pun intended) in regards to code pruning when removing this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still all worked fine during bundling :)

@LekoArts LekoArts added this pull request to the merge queue Oct 31, 2023
Merged via the queue into main with commit a68eb30 Oct 31, 2023
7 checks passed
@LekoArts LekoArts deleted the fix/bundle-shared-in-expo branch October 31, 2023 06:55
LekoArts added a commit that referenced this pull request Oct 31, 2023
* fix(clerk-expo,shared): Bundle shared in expo

* Revert "fix(clerk-expo,shared): Bundle shared in expo"

This reverts commit c1e0279.

* fix(shared): Add files key and fix script

* chore(repo): Linting

* fix(shared): Add package.json to exports

(cherry picked from commit a68eb30)
github-merge-queue bot pushed a commit that referenced this pull request Oct 31, 2023
…1983)

* fix(clerk-expo,shared): Bundle shared in expo

* Revert "fix(clerk-expo,shared): Bundle shared in expo"

This reverts commit c1e0279.

* fix(shared): Add files key and fix script

* chore(repo): Linting

* fix(shared): Add package.json to exports

(cherry picked from commit a68eb30)

Co-authored-by: Lennart <lekoarts@gmail.com>
@LekoArts LekoArts mentioned this pull request Nov 3, 2023
24 tasks
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.

5 participants