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

@dimkl dimkl commented Dec 14, 2023

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

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

changeset-bot Bot 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
Name Type
@clerk/backend Minor
@clerk/fastify Patch
gatsby-plugin-clerk Patch
@clerk/nextjs Patch
@clerk/remix 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

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

@nikosdouvlis nikosdouvlis 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 thread packages/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
Contributor Author

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 dimkl force-pushed the sdk-974-improve-dx-backend-p1-refactors branch from 88fab3a to 98dae0d Compare December 15, 2023 10:02
@dimkl dimkl force-pushed the sdk-974-improve-dx-backend-p1-refactors branch from 98dae0d to 3eb7f72 Compare December 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 d08ec6d Dec 15, 2023
@dimkl dimkl deleted the sdk-974-improve-dx-backend-p1-refactors branch December 15, 2023 10:39
Sign up for free to 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