Skip to content

fix(clerk-react): Fix build process not catching type errors [SDK-1065] #2312

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

Closed
wants to merge 4 commits into from

Conversation

tmilewski
Copy link
Member

Description

tsup doesn't reliably handle type-checking, thus we must continue to rely on tsc.

SDK-1065

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

@tmilewski tmilewski self-assigned this Dec 11, 2023
Copy link

changeset-bot bot commented Dec 11, 2023

🦋 Changeset detected

Latest commit: 0cdc277

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

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

@tmilewski tmilewski force-pushed the sdk-1065-fix-tsup-build-process branch from 10f6151 to 6d2d4a9 Compare December 11, 2023 19:59
@tmilewski tmilewski enabled auto-merge December 11, 2023 19:59
@tmilewski tmilewski added this pull request to the merge queue Dec 11, 2023
@dimkl dimkl removed this pull request from the merge queue due to a manual request Dec 11, 2023
@dimkl
Copy link
Contributor

dimkl commented Dec 11, 2023

@tmilewski We should probably do this for the rest of the packages:

  • expo
  • remix
  • nextjs
  • types
  • shared
  • backend
    ....
    Could you take a look before proceeding with only this one? Also i would suggest we use tsc on Success and put emitDeclarationsOnly: true in tsconfig.json.
    Also there is a run helper runAfterLast from scripts/utils.

Copy link
Contributor

⚠️ Changes detected under the ClerkJS ui directory!

Don't forget to apply the same changes under the /ui.retheme directory:
packages/clerk-js/src/ui/** ➡️ packages/clerk-js/src/ui.retheme/**

Also, you may need to update the following files:

  • packages/localizations/src/en-US.retheme.ts
  • packages/localizations/src/index.retheme.ts
  • packages/types/src/appearance.retheme.ts
  • packages/types/src/clerk.retheme.ts
  • packages/types/src/index.retheme.ts
  • packages/types/src/localization.retheme.ts

Copy link
Contributor

Choose a reason for hiding this comment

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

🔧 I think that those keys are dropped in Retheme project as part of #2290
Is there an error somewhere that indicated to make these changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it was giving me errors when running tsc. If they're supposed to be dropped then I can look into it more.

permission: unknown;
role: unknown;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

❓ isn't this change added in #2314 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is, it was the only way I could get this to build and test, as it wasn't available at the time. My plan was to rebase everything and weed it out once it came time.

Copy link
Contributor

Choose a reason for hiding this comment

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

🔧 Those keys are only added in Retheme project and they are supposed to exist in packages/types/src/localization.retheme.ts and not here. We should remove them from this file.

@@ -70,5 +70,6 @@ export default defineConfig(_overrideOptions => {
sourcemap: true,
dts: true,
splitting: false,
onSuccess: 'tsc',
Copy link
Member

Choose a reason for hiding this comment

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

Why not set dts: false then? Then we'd do double the work

@tmilewski tmilewski force-pushed the sdk-1065-fix-tsup-build-process branch from 6767273 to 0cdc277 Compare December 12, 2023 15:02
Copy link
Member

@nikosdouvlis nikosdouvlis left a comment

Choose a reason for hiding this comment

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

Folks, are we sure this is the case? Are there any open issues I can read for more context?

I tested tsup locally with a few isolated scenarios and the build fails as expected.

In any case, let's wait before we consider merging this as we are making too many build-related changes across the codebase for v5.

@nikosdouvlis nikosdouvlis marked this pull request as draft December 15, 2023 08:44
@tmilewski
Copy link
Member Author

@nikosdouvlis I was able to get it to consistently succeed/fail in various scenarios. That said, I agree that we should hold, and I'm going to close for the time being.

@tmilewski tmilewski closed this Dec 15, 2023
@tmilewski tmilewski deleted the sdk-1065-fix-tsup-build-process branch March 29, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants