-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(*): Improve @clerk/backend DX [Part 1 - Refactoring] (#2360)
* chore(backend): Sort imports in edge-runtime runner * chore(backend): Move tests & convert runtime folder to module * chore(backend): Merge test utils to util/testUtils.ts module * fix(backend): Improve node esm support * chore(repo): Add changeset
- Loading branch information
Showing
28 changed files
with
111 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@clerk/backend': minor | ||
--- | ||
|
||
Improve ESM support in `@clerk/backend` for Node by using .mjs for #crypto subpath import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/backend/src/exports.test.ts → ...ges/backend/src/__tests__/exports.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/backend/src/redirections.test.ts → ...ackend/src/__tests__/redirections.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/backend/src/utils.test.ts → packages/backend/src/__tests__/utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 14 additions & 6 deletions
20
packages/backend/src/api/factory.test.ts → ...backend/src/api/__tests__/factory.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { webcrypto } from 'node:crypto'; |
2 changes: 1 addition & 1 deletion
2
...es/backend/src/tokens/authObjects.test.ts → .../src/tokens/__tests__/authObjects.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/backend/src/tokens/factory.test.ts → ...kend/src/tokens/__tests__/factory.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 13 additions & 5 deletions
18
packages/backend/src/tokens/keys.test.ts → ...backend/src/tokens/__tests__/keys.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
packages/backend/src/tokens/verify.test.ts → ...ckend/src/tokens/__tests__/verify.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...backend/src/tokens/jwt/cryptoKeys.test.ts → ...c/tokens/jwt/__tests__/cryptoKeys.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/backend/src/util/path.test.ts → ...s/backend/src/util/__tests__/path.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/backend/src/util/request.test.ts → ...ackend/src/util/__tests__/request.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
packages/backend/src/util/mockFetch.ts → packages/backend/src/util/testUtils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
// Import all suites | ||
// TODO: Automate this step using dynamic imports | ||
import factoryTest from './dist/api/factory.test.js'; | ||
import exportsTest from './dist/exports.test.js'; | ||
import redirectTest from './dist/redirections.test.js'; | ||
import authObjectsTest from './dist/tokens/authObjects.test.js'; | ||
import tokenFactoryTest from './dist/tokens/factory.test.js'; | ||
import jwtAssertionsTest from './dist/tokens/jwt/assertions.test.js'; | ||
import cryptoKeysTest from './dist/tokens/jwt/cryptoKeys.test.js'; | ||
import signJwtTest from './dist/tokens/jwt/signJwt.test.js'; | ||
import verifyJwtTest from './dist/tokens/jwt/verifyJwt.test.js'; | ||
import keysTest from './dist/tokens/keys.test.js'; | ||
import requestTest from './dist/tokens/request.test.js'; | ||
import verifyTest from './dist/tokens/verify.test.js'; | ||
import pathTest from './dist/util/path.test.js'; | ||
import utilRequestTest from './dist/util/request.test.js'; | ||
import utilsTest from './dist/utils.test.js'; | ||
|
||
import authObjectsTest from './dist/tokens/__tests__/authObjects.test.js'; | ||
import cryptoKeysTest from './dist/tokens/jwt/__tests__/cryptoKeys.test.js'; | ||
import exportsTest from './dist/__tests__/exports.test.js'; | ||
import factoryTest from './dist/api/__tests__/factory.test.js'; | ||
import jwtAssertionsTest from './dist/tokens/jwt/__tests__/assertions.test.js'; | ||
import keysTest from './dist/tokens/__tests__/keys.test.js'; | ||
import pathTest from './dist/util/__tests__/path.test.js'; | ||
import redirectTest from './dist/__tests__/redirections.test.js'; | ||
import requestTest from './dist/tokens/__tests__/request.test.js'; | ||
import signJwtTest from './dist/tokens/jwt/__tests__/signJwt.test.js'; | ||
import tokenFactoryTest from './dist/tokens/__tests__/factory.test.js'; | ||
import utilRequestTest from './dist/util/__tests__/request.test.js'; | ||
import utilsTest from './dist/__tests__/utils.test.js'; | ||
import verifyJwtTest from './dist/tokens/jwt/__tests__/verifyJwt.test.js'; | ||
import verifyTest from './dist/tokens/__tests__/verify.test.js'; | ||
|
||
// Add them to the suite array | ||
const suites = [ | ||
authObjectsTest, | ||
cryptoKeysTest, | ||
exportsTest, | ||
factoryTest, | ||
jwtAssertionsTest, | ||
requestTest, | ||
utilRequestTest, | ||
keysTest, | ||
verifyTest, | ||
pathTest, | ||
verifyJwtTest, | ||
signJwtTest, | ||
cryptoKeysTest, | ||
factoryTest, | ||
redirectTest, | ||
utilsTest, | ||
requestTest, | ||
signJwtTest, | ||
tokenFactoryTest, | ||
utilRequestTest, | ||
utilsTest, | ||
verifyJwtTest, | ||
verifyTest, | ||
]; | ||
|
||
export default suites; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters