Skip to content

chore(*): Improve @clerk/backend DX [Part 1 - Refactoring] - #2360

Merged
dimkl merged 5 commits into
mainfrom
sdk-974-improve-dx-backend-p1-refactors
Dec 15, 2023
Merged

chore(*): Improve @clerk/backend DX [Part 1 - Refactoring]#2360
dimkl merged 5 commits into
mainfrom
sdk-974-improve-dx-backend-p1-refactors

Conversation

@dimkl

Copy link
Copy Markdown
Contributor

Description

Apply some internal refactoring and restructuring to @clerk/backend.
Review it per commit for more information.

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

@dimkldimkl self-assigned this Dec 14, 2023
@changeset-bot

changeset-botBot commented Dec 14, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3eb7f72

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

This PR includes changesets to release 6 packages
NameType
@clerk/backendMinor
@clerk/fastifyPatch
gatsby-plugin-clerkPatch
@clerk/nextjsPatch
@clerk/remixPatch
@clerk/clerk-sdk-nodePatch

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

@dimkldimkl mentioned this pull request Dec 14, 2023
24 tasks
@dimkl
dimklforce-pushed the sdk-974-improve-dx-backend-p1-refactors branch from d941960 to 88fab3aCompareDecember 14, 2023 23:56

@nikosdouvlisnikosdouvlis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense to me, one minor comment about the crypto imports

Comment thread.changeset/mean-numbers-grin.md Outdated
Comment threadpackages/backend/src/runtime.ts Outdated

// @ts-ignore - These are package subpaths
import crypto from '#crypto';
let webcrypto;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you remove the subpath import here? Are you trying to make Jest work without configuring a moduleMapper? If so, Jest claims that that subpath imports work since this release: https://github.com/jestjs/jest/releases/tag/v29.4.0 :) #til

I haven't tested the following, but this is what I had in mind for #crypto:

node/crypto.mjs:

export { webcrypto } from 'node:crypto';

node/crypto.js:

module.exports.webcrypto = require('node:crypto').webcrypto;

package.json:

 "imports": {
"#crypto": {
"edge-light": "./dist/runtime/browser/crypto.mjs",
"worker": "./dist/runtime/browser/crypto.mjs",
"browser": "./dist/runtime/browser/crypto.mjs",
"node": {
"require": "./dist/runtime/node/crypto.js",
"import": "./dist/runtime/node/crypto.mjs"
},
"default": "./dist/runtime/browser/crypto.mjs"
}
},

runtime.ts:

import { webcrypto } from '#crypto';
...

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Change reverted and suggestion applied.

@dimkl
dimklforce-pushed the sdk-974-improve-dx-backend-p1-refactors branch from 88fab3a to 98dae0dCompareDecember 15, 2023 10:02
@dimkl
dimklforce-pushed the sdk-974-improve-dx-backend-p1-refactors branch from 98dae0d to 3eb7f72CompareDecember 15, 2023 10:16
@dimkl
dimkl enabled auto-merge December 15, 2023 10:17
@dimkl
dimkl added this pull request to the merge queue Dec 15, 2023
@dimkl
dimkl removed this pull request from the merge queue due to a manual request Dec 15, 2023
@dimkl
dimkl added this pull request to the merge queue Dec 15, 2023
Merged via the queue into main with commit d08ec6dDec 15, 2023
@dimkl
dimkl deleted the sdk-974-improve-dx-backend-p1-refactors branch December 15, 2023 10:39
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@dimkl@nikosdouvlis@clerk-cookie