@clerk/upgrade 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -1
- package/dist/cli.js +2 -0
- package/dist/guide-generators/core-2/overview/intro.mdx +11 -11
- package/dist/guide-generators/core-2/shared/prepare.mdx +0 -5
- package/dist/guide-generators/core-2/shared/update-version.mdx +5 -5
- package/dist/scan.js +3 -3
- package/dist/versions/core-2/backend/members-count.md +2 -2
- package/dist/versions/core-2/common/aftersignxurl-changes.md +2 -2
- package/dist/versions/core-2/index.js +1 -1
- package/dist/versions/core-2/nextjs/auth-middleware-deprecated.md +2 -2
- package/dist/versions/core-2/nextjs/authmiddleware-import-change.md +1 -1
- package/dist/versions/core-2/nextjs/with-clerk-middleware-removed.md +1 -1
- package/dist/versions/core-2/node/createclerkexpressrequireauth-public-key-required.md +2 -2
- package/dist/versions/core-2/node/createclerkexpresswithauth-publickey-required.md +7 -0
- package/package.json +1 -1
- /package/dist/versions/core-2/{js/supported-external-accounts-type-removed.md → common/supported-external-accounts-removed.md} +0 -0
package/dist/app.js
CHANGED
|
@@ -103,7 +103,7 @@ export default function App({
|
|
|
103
103
|
})), !isEmpty(sdks) && fromVersion && toVersion && dir && isEmpty(ignore) && !configComplete && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, "Are there any files or directories you'd like to ignore? If so, you can add them below, separated by commas. We ignore \"node_modules\" and \".git\" by default."), /*#__PURE__*/React.createElement(Text, {
|
|
104
104
|
color: "gray"
|
|
105
105
|
}, "(globstar syntax supported)"), /*#__PURE__*/React.createElement(TextInput, {
|
|
106
|
-
placeholder: "docs
|
|
106
|
+
placeholder: "**/public**, **/docs/**",
|
|
107
107
|
defaultValue: ignore,
|
|
108
108
|
onSubmit: val => {
|
|
109
109
|
setIgnore(val.includes(',') ? val.split(/\s*,\s*/) : [].concat(val));
|
package/dist/cli.js
CHANGED
|
@@ -19,6 +19,7 @@ const cli = meow(`
|
|
|
19
19
|
|
|
20
20
|
Examples
|
|
21
21
|
$ clerk-upgrade --sdk=nextjs --dir=src/**
|
|
22
|
+
$ clerk-upgrade --ignore=**/public/** --ignore=**/dist/**
|
|
22
23
|
`, {
|
|
23
24
|
importMeta: import.meta,
|
|
24
25
|
flags: {
|
|
@@ -57,6 +58,7 @@ render( /*#__PURE__*/React.createElement(App, {
|
|
|
57
58
|
_toVersion: cli.flags.to,
|
|
58
59
|
_sdk: cli.flags.sdk,
|
|
59
60
|
_dir: cli.flags.dir,
|
|
61
|
+
_ignore: cli.flags.ignore,
|
|
60
62
|
_yolo: cli.flags.yolo,
|
|
61
63
|
noWarnings: cli.flags.noWarnings,
|
|
62
64
|
disableTelemetry: cli.flags.disableTelemetry
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Upgrading to Clerk Core 2
|
|
2
2
|
|
|
3
|
-
In
|
|
3
|
+
In April 2024, we updated Clerk's SDKs to include Core 2. This new core includes:
|
|
4
4
|
|
|
5
5
|
- 💅 Redesigned and improved component UIs.
|
|
6
6
|
- 🔪 The 401 & "flash of white page" that was visible sometimes when syncing auth state was eliminated.
|
|
@@ -12,14 +12,14 @@ In Febrary 2024, [we updated](https://clerk.com/changelog/2024-01-16) Clerk's SD
|
|
|
12
12
|
Core 2 brings both UI changes and breaking code changes, so each SDK has been updated to a new major version.
|
|
13
13
|
We expect upgrades to take less than 30 minutes, and are providing a CLI tool to assist with the process. Please select your SDK below to get started:
|
|
14
14
|
|
|
15
|
-
- [Next.js](/nextjs)
|
|
16
|
-
- [Remix](/remix)
|
|
17
|
-
- [Expo](/expo)
|
|
18
|
-
- [Node](/node)
|
|
19
|
-
- [Fastify](/fastify)
|
|
20
|
-
- [React](/react)
|
|
21
|
-
- [Backend](/backend)
|
|
22
|
-
- [JS](/
|
|
23
|
-
- [Chrome Extension](/chrome-extension)
|
|
15
|
+
- [Next.js](/docs/upgrade-guides/core-2/nextjs)
|
|
16
|
+
- [Remix](/docs/upgrade-guides/core-2/remix)
|
|
17
|
+
- [Expo](/docs/upgrade-guides/core-2/expo)
|
|
18
|
+
- [Node](/docs/upgrade-guides/core-2/node)
|
|
19
|
+
- [Fastify](/docs/upgrade-guides/core-2/fastify)
|
|
20
|
+
- [React](/docs/upgrade-guides/core-2/react)
|
|
21
|
+
- [Backend](/docs/upgrade-guides/core-2/backend)
|
|
22
|
+
- [JS](/docs/upgrade-guides/core-2/javascript)
|
|
23
|
+
- [Chrome Extension](/docs/upgrade-guides/core-2/chrome-extension)
|
|
24
24
|
|
|
25
|
-
Note that the `
|
|
25
|
+
Note that the `Gatsby`, `Go`, and `Ruby` SDKs do not yet have a Core 2 release ready - if you are using any of these SDKs there is nothing actionable right now.
|
|
@@ -2,9 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Before uprading, it's highly recommended that you update your Clerk SDKs to the latest Core 1 version (`npm i <%= packageName %>@<%= parseInt(version.substring(1)) - 1 %>`). Some changes required for Core 2 SDKs can be applied incrementally to the <%= version %> release, which should contribute to a smoother upgrading experience. After updating, look out for deprecation messages in your terminal and browser console. By resolving these deprecations you'll be able to skip many breaking changes from Core 2.
|
|
4
4
|
|
|
5
|
-
<Callout>
|
|
6
|
-
Note that Core 2 is currently in beta, while we field feedback and ensure stability. Deploying beta versions to
|
|
7
|
-
production is not recommended and should be done at your own risk.
|
|
8
|
-
</Callout>
|
|
9
|
-
|
|
10
5
|
Additionally, some of the minumum version requirements for some base dependencies have been updated such that versions that are no longer supported or are at end-of-life are no longer guaranteed to work correctly with Clerk.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
## Updating to Core 2
|
|
1
|
+
## Updating to Core 2
|
|
2
2
|
|
|
3
|
-
Whenever you feel ready, go ahead and install the latest
|
|
3
|
+
Whenever you feel ready, go ahead and install the latest version of any Clerk SDKs you are using. Make sure that you are prepared to patch some breaking changes before your app will work properly, however. The commands below demonstrate how to install the latest version.
|
|
4
4
|
|
|
5
5
|
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
6
6
|
```bash filename="terminal"
|
|
7
|
-
npm install <%= packageName
|
|
7
|
+
npm install <%= packageName %>
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
```bash filename="terminal"
|
|
11
|
-
yarn add <%= packageName
|
|
11
|
+
yarn add <%= packageName %>
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
```bash filename="terminal"
|
|
15
|
-
pnpm add <%= packageName
|
|
15
|
+
pnpm add <%= packageName %>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
</CodeBlockTabs>
|
package/dist/scan.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProgressBar } from '@inkjs/ui';
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
|
-
import { globby } from 'globby';
|
|
3
|
+
import { convertPathToPattern, globby } from 'globby';
|
|
4
4
|
import indexToPosition from 'index-to-position';
|
|
5
5
|
import { Newline, Text } from 'ink';
|
|
6
6
|
import path from 'path';
|
|
@@ -54,8 +54,8 @@ export default function Scan({
|
|
|
54
54
|
'**/*.(mp4|mkv|wmv|m4v|mov|avi|flv|webm|flac|mka|m4a|aac|ogg)+' // common video files
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
globby(path.resolve(dir), {
|
|
58
|
-
ignore:
|
|
57
|
+
globby(convertPathToPattern(path.resolve(dir)), {
|
|
58
|
+
ignore: ignore.filter(Boolean)
|
|
59
59
|
}).then(files => {
|
|
60
60
|
setFiles(files);
|
|
61
61
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
matcher: "
|
|
2
|
+
title: '`Organization.members_count` -> `Organization.membersCount`'
|
|
3
|
+
matcher: "\\.members_count"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
The `members_count` attribute of the `Organization` resource has been renamed to `membersCount` to match the naming convention of other attributes.
|
|
@@ -30,6 +30,6 @@ All `afterSignXUrl` props and `CLERK_AFTER_SIGN_X_URL` environment variables hav
|
|
|
30
30
|
If neither value is set, Clerk will redirect to the `redirect_url` if present, otherwise it will redirect to `/`. If you'd like to retain the current behavior of your app without any changes, you can switch `afterSignXUrl` with `signXFallbackRedirectUrl` as such:
|
|
31
31
|
|
|
32
32
|
```diff
|
|
33
|
-
- <SignIn afterSignInUrl='/foo' />
|
|
34
|
-
+ <SignIn
|
|
33
|
+
- <SignIn afterSignInUrl='/foo' afterSignUpUrl='/bar' />
|
|
34
|
+
+ <SignIn fallbackRedirectUrl='/foo' signUpFallbackRedirectUrl='/bar' />
|
|
35
35
|
```
|
|
@@ -4,7 +4,7 @@ const load = createLoader({
|
|
|
4
4
|
baseUrl: 'https://clerk.com/docs/upgrade-guides/core-2'
|
|
5
5
|
});
|
|
6
6
|
const changesAffectingAll = ['organization-getroles-arguments-changed', 'organization-getmemberships-arguments-changed', 'organization-getdomains-arguments-change', 'organization-getinvitations-arguments-changed', 'organization-getmembershiprequests-arguments-changed', 'user-getorganizationinvitations-arguments-changed', 'user-getorganizationsuggestions-arguments-changed', 'user-getorganizationmemberships-arguments-changed', 'user-getorganizationmemberships-return-signature', 'getorganizationinvitationlist-return-signature', 'getorganizationinvitationlist-return-type-change', 'getorganizationmembershiplist-return-type-change', 'getorganizationlist-return-signature', 'getorganizationlist-return-type-change', 'getinvitationlist-return-signature', 'getsessionlist-return-signature', 'getuserlist-return-signature', 'getallowlistidentifierlist-return-signature', 'getclientlist-return-signature', 'getredirecturllist-return-signature', 'getuseroauthaccesstoken-return-signature', 'organization-logourl', 'user-profileimageurl', 'user-update-password'];
|
|
7
|
-
const jsChanges = ['setsession', 'organization-create-string', 'organization-getpendinginvitations', 'mfa-dropdown', 'appearance-variables-breaking-changes', 'aftersignxurl-changes', 'supported-external-accounts-
|
|
7
|
+
const jsChanges = ['setsession', 'organization-create-string', 'organization-getpendinginvitations', 'mfa-dropdown', 'appearance-variables-breaking-changes', 'aftersignxurl-changes', 'supported-external-accounts-removed'];
|
|
8
8
|
const reactChanges = ['magiclinkerrorcode', 'usemagiclink', 'ismagiclinkerror', 'magiclinkerror', 'handlemagiclinkverification', 'clerkprovider-frontendapi-2', 'navigate-to-routerpush-routerreplace', 'afterswitchorganizationurl', 'appearance-organizationpreview-organizationswitcher', 'useorganization-invitationlist', 'useorganization-membershiplist', 'useorganizations', 'userprofile-prop', 'organizationprofile-settings', 'userprofile-security', 'connected-accounts-dropdown', 'userbuttonpopoveractionbuttontext-removed', 'userbuttontrigger-userbuttonbox-invert', 'organizationswitcherpopoveractionbuttontext-removed', 'card-changes', 'alternativemethods-backlink', 'button-to-organizationlistcreateorganizationactionbutton', 'remove-socialbuttonsblockbuttonarrow', 'remove-identitypreview-avatar', 'withsession-removed', 'withclerk-removed', 'withuser-removed-2', 'withclerk-hof-removed', 'withsession-hof-removed', 'withuser-hof-removed', 'multisessionappsupport-import-change', 'clerkprovideroptionswrapper-dropped', 'new-localization-keys', 'removed-localization-keys', 'changed-localization-keys', 'signoutcallback-to-redirecturl', 'min-react-version', 'externalaccount-avatarurl', 'organizationmembershippublicuserdata-profileimageurl'];
|
|
9
9
|
export default {
|
|
10
10
|
nextjs: load('nextjs', dedupeMerge(changesAffectingAll, jsChanges, ['api-key-to-secret-key', 'frontend-api-to-publishable-key', 'with-clerk-middleware-removed', 'auth-middleware-deprecated', 'clerk-js-version-next-public', 'authmiddleware-apikey', 'authmiddleware-frontendapi', 'createclerkclient-apikey', 'createclerkclient-frontendapi', 'getauth-apikey', 'clerkprovider-frontendapi-2', 'import-nextjs-app-beta', 'import-nextjs-ssr', 'import-nextjs-edge-middleware', 'import-nextjs-edge-middlewarefiles', 'import-api-url', 'import-api-version', 'import-clerk-js-url', 'import-clerk-js-version', 'import-domain', 'import-is-satellite', 'import-proxy-url', 'import-publishable-key', 'import-secret-key', 'import-sign-in-url', 'import-sign-up-url', 'import-nextjs-api', 'api-url-value-change', 'ismagiclinkerror', 'usemagiclink', 'magiclinkerrorcode', 'organizationprofile-settings', 'userprofile-security', 'connected-accounts-dropdown', 'userbuttonpopoveractionbuttontext-removed', 'userbuttontrigger-userbuttonbox-invert', 'organizationswitcherpopoveractionbuttontext-removed', 'card-changes', 'alternativemethods-backlink', 'button-to-organizationlistcreateorganizationactionbutton', 'remove-socialbuttonsblockbuttonarrow', 'remove-identitypreview-avatar', 'multisessionappsupport-import-change', 'auth-import-change', 'currentuser-import-change', 'authmiddleware-import-change', 'buildclerkprops-import-change', 'verifytoken-import-change', 'verifyjwt-import-change', 'decodejwt-import-change', 'signjwt-import-change', 'constants-import-change', 'createauthenticaterequest-import-change', 'createisomorphicrequest-import-change', 'clerk-import-change', 'isclerkapiresponserror-import-change', 'isemaillinkerror-import-change', 'isknownerror-import-change', 'ismetamaskerror-import-change', 'withsession-removed', 'withclerk-removed', 'withuser-removed-2', 'withclerk-hof-removed', 'withsession-hof-removed', 'withuser-hof-removed', 'next-public-clerk-js-url', 'new-localization-keys', 'removed-localization-keys', 'changed-localization-keys', 'signoutcallback-to-redirecturl', 'min-nextjs-version', 'redirecttosignin-import-path', 'redirecttosignup-import-path', 'externalaccount-avatarurl', 'organizationmembershippublicuserdata-profileimageurl'])),
|
|
@@ -6,9 +6,9 @@ matcherFlags: 'm'
|
|
|
6
6
|
warning: true
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
The [`authMiddleware`](https://clerk.com/docs/references/nextjs/auth-middleware) API from `@clerk/nextjs` has been marked as deprecated. We highly recommend using [`clerkMiddleware`](https://
|
|
9
|
+
The [`authMiddleware`](https://clerk.com/docs/references/nextjs/auth-middleware) API from `@clerk/nextjs` has been marked as deprecated. We highly recommend using [`clerkMiddleware`](https://clerk.com/docs/references/nextjs/clerk-middleware) going forward. `clerkMiddleware` protects no routes by default and you need to add your individual routes you want to opt into protection. Here's an example of having all routes public except for everything under `/dashboard`.
|
|
10
10
|
|
|
11
|
-
For more documentation on the new `clerkMiddleware` function, check out [our official docs](https://
|
|
11
|
+
For more documentation on the new `clerkMiddleware` function, check out [our official docs](https://clerk.com/docs/references/nextjs/clerk-middleware)!
|
|
12
12
|
|
|
13
13
|
**Before:**
|
|
14
14
|
|
|
@@ -6,7 +6,7 @@ category: 'top-level-imports'
|
|
|
6
6
|
replaceWithString: 'nextjs/server'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
The `authMiddleware` import path has changed from `@clerk/nextjs` to `@clerk/nextjs/server`, as this is a helper that should be only used on the server side. You must update your import path in order for it to work correctly. Note as well that `authMiddleware` is deprecated as of this release, and we recommend [using `clerkMiddleware` instead](https://
|
|
9
|
+
The `authMiddleware` import path has changed from `@clerk/nextjs` to `@clerk/nextjs/server`, as this is a helper that should be only used on the server side. You must update your import path in order for it to work correctly. Note as well that `authMiddleware` is deprecated as of this release, and we recommend [using `clerkMiddleware` instead](https://clerk.com/docs/references/nextjs/clerk-middleware). Example below of the fix that needs to be made:
|
|
10
10
|
|
|
11
11
|
```diff
|
|
12
12
|
- import { authMiddleware } from "@clerk/nextjs"
|
|
@@ -4,7 +4,7 @@ category: 'middleware'
|
|
|
4
4
|
matcher: "withClerkMiddleware\\("
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
`withClerkMiddleware` has been deprecated and is now removed in v5. We recommend moving to `clerkMiddleware` instead. Please read the [clerkMiddleware guide](https://
|
|
7
|
+
`withClerkMiddleware` has been deprecated and is now removed in v5. We recommend moving to `clerkMiddleware` instead. Please read the [clerkMiddleware guide](https://clerk.com/docs/references/nextjs/clerk-middleware) for more details. Here’s an example of how a simple middleware setup might look before and after.
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
10
|
// Before: using withClerkMiddleware
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: '`createClerkExpressRequireAuth` requires publishable key'
|
|
3
|
+
matcher: 'createClerkExpressRequireAuth'
|
|
3
4
|
warning: true
|
|
4
|
-
matcher: `createClerkExpressRequireAuth`
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
The `createClerkExpressRequireAuth` method now requires a clerk public key in order to work correctly. It can be passed in as a parameter directly, or picked up via environment variable. An error will be thrown now if there's no public key provided, this was not previously the case.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: '`createClerkExpressWithAuth` requires publishable key'
|
|
3
|
+
warning: true
|
|
4
|
+
matcher: 'createClerkExpressWithAuth'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The `createClerkExpressWithAuth` method now requires a clerk public key in order to work correctly. It can be passed in as a parameter directly, or picked up via environment variable. An error will be thrown now if there's no public key provided, this was not previously the case.
|
package/package.json
CHANGED