@clerk/upgrade 1.0.8 → 1.0.9
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/README.md +11 -13
- package/dist/constants/sdks.js +1 -3
- package/dist/guide-generators/core-2/generate-all.sh +0 -1
- package/dist/guide-generators/core-2/overview/intro.mdx +1 -1
- package/dist/versions/core-2/index.js +0 -3
- package/package.json +1 -1
- package/dist/guide-generators/core-2/gatsby/index.js +0 -25
- package/dist/guide-generators/core-2/gatsby/intro.mdx +0 -3
- package/dist/versions/core-2/gatsby/api-url-value-change.md +0 -8
- package/dist/versions/core-2/gatsby/apikey-to-publishable-key.md +0 -7
- package/dist/versions/core-2/gatsby/clerk-import-change.md +0 -12
- package/dist/versions/core-2/gatsby/createclerkclient-apikey.md +0 -15
- package/dist/versions/core-2/gatsby/createclerkclient-frontendapi.md +0 -15
- package/dist/versions/core-2/gatsby/withserverauth-return-type.md +0 -35
package/README.md
CHANGED
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
</picture>
|
|
7
7
|
</a>
|
|
8
8
|
<br />
|
|
9
|
+
<h1 align="center">@clerk/upgrade</h1>
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
|
-
# @clerk/upgrade
|
|
12
|
-
|
|
13
12
|
<div align="center">
|
|
14
13
|
|
|
15
14
|
[](https://clerk.com/discord)
|
|
@@ -22,29 +21,29 @@
|
|
|
22
21
|
·
|
|
23
22
|
[Request a Feature](https://feedback.clerk.com/roadmap)
|
|
24
23
|
·
|
|
25
|
-
[
|
|
24
|
+
[Get help](https://clerk.com/contact/support?utm_source=github&utm_medium=clerk_upgrade)
|
|
26
25
|
|
|
27
26
|
</div>
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## Overview
|
|
28
|
+
## Getting Started
|
|
32
29
|
|
|
33
30
|
A tool that helps with upgrading major versions of Clerk's SDKs.
|
|
34
31
|
|
|
35
|
-
## Getting Started
|
|
36
|
-
|
|
37
32
|
### Prerequisites
|
|
38
33
|
|
|
39
34
|
- Node.js `>=18.17.0` or later
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
Navigate to the application you want to upgrade and run the following in your terminal:
|
|
42
39
|
|
|
43
40
|
```sh
|
|
44
41
|
npx @clerk/upgrade
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
Fill out the questionnaire and the CLI will show you the required changes.
|
|
45
|
+
|
|
46
|
+
### Caveats
|
|
48
47
|
|
|
49
48
|
This tool uses regular expressions to scan for patterns that match breaking changes. This makes it run substantially faster and makes it more accessible for us at Clerk to author matchers for each breaking change, however it means that _we cannot gurarantee 100% accuracy of the results_. As such, it's important to treat this as a tool that can help you to complete your major version upgrades, rather than an automatic fix to all issues.
|
|
50
49
|
|
|
@@ -65,12 +64,11 @@ Overall, there's a very good chance that this tool catches everything, but it's
|
|
|
65
64
|
You can get in touch with us in any of the following ways:
|
|
66
65
|
|
|
67
66
|
- Join our official community [Discord server](https://clerk.com/discord)
|
|
68
|
-
-
|
|
69
|
-
- Contact options listed on [our Support page](https://clerk.com/support?utm_source=github&utm_medium=clerk_upgrade)
|
|
67
|
+
- On [our support page](https://clerk.com/contact/support?utm_source=github&utm_medium=clerk_upgrade)
|
|
70
68
|
|
|
71
69
|
## Contributing
|
|
72
70
|
|
|
73
|
-
We're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](https://github.com/clerk/javascript/blob/main/docs/CONTRIBUTING.md).
|
|
71
|
+
We're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](https://github.com/clerk/javascript/blob/main/docs/CONTRIBUTING.md) and [code of conduct](https://github.com/clerk/javascript/blob/main/docs/CODE_OF_CONDUCT.md).
|
|
74
72
|
|
|
75
73
|
## Security
|
|
76
74
|
|
package/dist/constants/sdks.js
CHANGED
|
@@ -7,7 +7,6 @@ node $SCRIPT_DIR/backend/index.js
|
|
|
7
7
|
node $SCRIPT_DIR/chrome-extension/index.js
|
|
8
8
|
node $SCRIPT_DIR/expo/index.js
|
|
9
9
|
node $SCRIPT_DIR/fastify/index.js
|
|
10
|
-
node $SCRIPT_DIR/gatsby/index.js
|
|
11
10
|
node $SCRIPT_DIR/js/index.js
|
|
12
11
|
node $SCRIPT_DIR/nextjs/index.js
|
|
13
12
|
node $SCRIPT_DIR/node/index.js
|
|
@@ -22,4 +22,4 @@ We expect upgrades to take less than 30 minutes, and are providing a CLI tool to
|
|
|
22
22
|
- [JS](/docs/upgrade-guides/core-2/javascript)
|
|
23
23
|
- [Chrome Extension](/docs/upgrade-guides/core-2/chrome-extension)
|
|
24
24
|
|
|
25
|
-
Note that the `
|
|
25
|
+
Note that the `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.
|
|
@@ -8,9 +8,6 @@ const jsChanges = ['setsession', 'organization-create-string', 'organization-get
|
|
|
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'])),
|
|
11
|
-
// since we export clerk-react at the top level from the gatsby plugin
|
|
12
|
-
// if you're using gatsby, we also need to scan for the react changes
|
|
13
|
-
gatsby: load('gatsby', dedupeMerge(changesAffectingAll, reactChanges, jsChanges, ['api-key-to-secret-key', 'createclerkclient-apikey', 'apikey-to-publishable-key', 'createclerkclient-frontendapi', 'ismagiclinkerror', 'usemagiclink', 'magiclinkerrorcode', 'api-url-value-change', 'withserverauth-return-type', 'clerk-import-change'])),
|
|
14
11
|
remix: load('remix', dedupeMerge(changesAffectingAll, jsChanges, ['clerkerrorboundary-removed', 'createclerkclient-apikey', 'rootauthloader-apikey', 'getauth-apikey', 'clerkprovider-frontendapi-2', 'rootauthloader-frontendapi', 'frontend-api-to-publishable-key', 'api-key-to-secret-key', 'ismagiclinkerror', 'magiclinkerrorcode', 'usemagiclink', 'new-localization-keys', 'removed-localization-keys', 'changed-localization-keys', 'signoutcallback-to-redirecturl', 'clerk-import-change', 'externalaccount-avatarurl', 'organizationmembershippublicuserdata-profileimageurl'])),
|
|
15
12
|
expo: load('expo', dedupeMerge(changesAffectingAll, jsChanges, ['apikey-to-publishable-key', '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', 'new-localization-keys', 'removed-localization-keys', 'changed-localization-keys', 'signoutcallback-to-redirecturl', 'externalaccount-avatarurl', 'organizationmembershippublicuserdata-profileimageurl'])),
|
|
16
13
|
fastify: load('fastify', dedupeMerge(changesAffectingAll, ['api-key-to-secret-key', 'api-url-value-change', 'frontend-api-to-publishable-key', 'createclerkclient-apikey', 'createclerkclient-frontendapi', 'clerkplugin-frontendapi', 'clerk-import-change', 'externalaccount-avatarurl', 'organizationmembershippublicuserdata-profileimageurl'])),
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { accordionForCategory, assembleContent, deprecationRemovalsAndHousekeeping, frontmatter, loadVersionChangeData, markdown, markdownTemplate, singleItem, writeToFile } from '../../text-generation.js';
|
|
2
|
-
const version = 'core-2';
|
|
3
|
-
const semverVersion = 'v5';
|
|
4
|
-
const name = 'gatsby';
|
|
5
|
-
const properName = 'Gatsby';
|
|
6
|
-
const packageName = 'gatsby-plugin-clerk';
|
|
7
|
-
const cwd = `${version}/${name}`;
|
|
8
|
-
async function generate() {
|
|
9
|
-
const data = await loadVersionChangeData(version, name);
|
|
10
|
-
return assembleContent({
|
|
11
|
-
data,
|
|
12
|
-
cwd
|
|
13
|
-
}, [frontmatter({
|
|
14
|
-
title: `Upgrading ${properName} to Core 2`,
|
|
15
|
-
description: `Learn how to upgrade Clerk's ${properName} SDK to the latest version`
|
|
16
|
-
}), `# Upgrading \`${packageName}\` to Core 2`, markdown('intro'), markdownTemplate('prepare', {
|
|
17
|
-
version: semverVersion,
|
|
18
|
-
packageName
|
|
19
|
-
}), markdown('node-version'), markdown('react-version'), markdownTemplate('update-version', {
|
|
20
|
-
packageName: 'gatsby-plugin-clerk'
|
|
21
|
-
}), markdown('cli'), '## Breaking Changes', markdown('redesign-preview'), markdown('after-sign-x-handling'), singleItem('aftersignxurl-changes'), markdown('orgs-claim'), markdownTemplate('path-routing', {
|
|
22
|
-
packageName
|
|
23
|
-
}), markdown('image-url'), accordionForCategory('image-url'), deprecationRemovalsAndHousekeeping()]);
|
|
24
|
-
}
|
|
25
|
-
generate().then(writeToFile(cwd));
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
Core 2 is included in the Gatsby SDK starting with version 5. This new version ships with an improved design and UX for its built-in components, no "flash of white page" when authenticating, and a variety of smaller DX improvements and housekeeping items. Each of the potentially breaking changes are detailed in this guide, below.
|
|
2
|
-
|
|
3
|
-
By the end of this guide, you’ll have successfully upgraded your Gatsby project to use `gatsby-plugin-clerk` v5. You’ll learn how to update your dependencies, resolve breaking changes, and find deprecations. Step-by-step instructions will lead you through the process.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: '`API_URL` value has changed'
|
|
3
|
-
matcher: "import\\s+{[^}]*?[,\\s]API_URL[,\\s][\\s\\S]*?from\\s+['\"]gatsby-plugin-clerk\\/constants[\\s\\S]*?['\"]"
|
|
4
|
-
matcherFlags: 'm'
|
|
5
|
-
warning: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
The value of this export has changed from `https://api.clerk.dev` to `https://api.clerk.com`. If you were relying on the text content of this value not changing, you may need to make adjustments.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: '`GATSBY_CLERK_FRONTEND_API` replaced by `GATSBY_CLERK_PUBLISHABLE_KEY`'
|
|
3
|
-
category: 'deprecation-removal'
|
|
4
|
-
matcher: 'GATSBY_CLERK_FRONTEND_API'
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
If you are using a `GATSBY_CLERK_FRONTEND_API` environment variable, the name must be changed to `GATSBY_CLERK_PUBLISHABLE_KEY` instead. Note that the values are different as well, so this is not just a key replacement. You can find the publishable key in your Clerk dashboard. Make sure you do this in both your dev and production environments.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: '`Clerk` -> `{ createClerkClient }`'
|
|
3
|
-
matcher: "import\\s+{[^}]*?[,\\s]Clerk[,\\s][\\s\\S]*?from\\s+['\"]gatsby-plugin-clerk[\\s\\S]*?['\"]"
|
|
4
|
-
matcherFlags: 'm'
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
The `Clerk` default import has changed to `createClerkClient` and been moved to a named import rather than default. You must update your import path in order for it to work correctly. Example below of the fix that needs to be made:
|
|
8
|
-
|
|
9
|
-
```diff
|
|
10
|
-
- import Clerk from "gatsby-plugin-clerk"
|
|
11
|
-
+ import { createClerkClient } from "gatsby-plugin-clerk"
|
|
12
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: '`apiKey` -> `secretKey` as param to createClerkClient'
|
|
3
|
-
matcher: "createClerkClient\\([\\s\\S]*?apiKey:[\\s\\S]*?\\)"
|
|
4
|
-
category: 'deprecation-removal'
|
|
5
|
-
matcherFlags: 'm'
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
The `apiKey` argument passed to `createClerkClient` must be changed to `secretKey`.
|
|
9
|
-
|
|
10
|
-
```diff
|
|
11
|
-
import { createClerkClient } from 'gatsby-plugin-clerk/api';
|
|
12
|
-
|
|
13
|
-
- createClerkClient({ apiKey: '...' });
|
|
14
|
-
+ createClerkClient({ secretKey: '...' });
|
|
15
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: '`frontendApi` -> `publishableKey` as param to createClerkClient'
|
|
3
|
-
matcher: "createClerkClient\\([\\s\\S]*?frontendApi:[\\s\\S]*?\\)"
|
|
4
|
-
category: 'deprecation-removal'
|
|
5
|
-
matcherFlags: 'm'
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
The `frontendApi` argument passed to `createClerkClient` must be changed to `publishableKey`. Note that the values of the two keys are different, so both keys and values need to be changed. You can find your application's publishable key in the Clerk dashboard.
|
|
9
|
-
|
|
10
|
-
```diff
|
|
11
|
-
import { createClerkClient } from 'gatsby-plugin-clerk/api';
|
|
12
|
-
|
|
13
|
-
- createClerkClient({ frontendApi: '...' });
|
|
14
|
-
+ createClerkClient({ publishableKey: '...' });
|
|
15
|
-
```
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: '`withServerAuth` props.auth return type changed'
|
|
3
|
-
matcher: "withServerAuth\\("
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
When utilizing the `withServerAuth` helper in Gatsby, it expects a callback function that is called with props from Clerk internals. The `.auth` property on the returned object from the callback has seen a substantial change in its return type. Below is a code example of where the `auth` prop might be found:
|
|
7
|
-
|
|
8
|
-
```js
|
|
9
|
-
import { withServerAuth } from 'gatsby-plugin-clerk/ssr';
|
|
10
|
-
|
|
11
|
-
export const getServerData: GetServerData<any> = withServerAuth(async props => {
|
|
12
|
-
return { props: { data: '...', auth: props.auth } };
|
|
13
|
-
});
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
And here's a diff of the changes in the return type. The breaking change here specifically is that the property `auth.claims` was changed to `auth.sessionClaims`. Additionally, there is more information on the response that can be utilized if helpful.
|
|
17
|
-
|
|
18
|
-
```diff
|
|
19
|
-
// return type diff
|
|
20
|
-
{
|
|
21
|
-
sessionId: string | null;
|
|
22
|
-
userId: string | null;
|
|
23
|
-
actor: ActJWTClaim | null;
|
|
24
|
-
getToken: ServerGetToken;
|
|
25
|
-
- claims: ClerkJWTClaims | null;
|
|
26
|
-
+ sessionClaims: JwtPayload;
|
|
27
|
-
+ session: Session | undefined | null;
|
|
28
|
-
+ user: User | undefined | null;
|
|
29
|
-
+ orgId: string | undefined | null;
|
|
30
|
-
+ orgRole: string | undefined | null;
|
|
31
|
-
+ orgSlug: string | undefined | null;
|
|
32
|
-
+ organization: Organization | undefined | null;
|
|
33
|
-
+ debug: AuthObjectDebug;
|
|
34
|
-
};
|
|
35
|
-
```
|