@clerk/upgrade 2.0.0-snapshot.v20251203152900 → 2.0.0-snapshot.v20251204143242
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/codemods/index.js +9 -2
- package/dist/codemods/transform-remove-deprecated-props.cjs +10 -7
- package/dist/components/Codemod.js +36 -5
- package/dist/components/Command.js +1 -1
- package/dist/components/SDKWorkflow.js +68 -24
- package/dist/components/Scan.js +8 -8
- package/dist/components/UpgradeSDK.js +1 -1
- package/dist/guide-generators/core-2/backend/index.js +1 -1
- package/dist/guide-generators/core-2/chrome-extension/index.js +1 -1
- package/dist/guide-generators/core-2/expo/index.js +1 -1
- package/dist/guide-generators/core-2/fastify/index.js +1 -1
- package/dist/guide-generators/core-2/js/index.js +1 -1
- package/dist/guide-generators/core-2/nextjs/index.js +1 -1
- package/dist/guide-generators/core-2/node/index.js +1 -1
- package/dist/guide-generators/core-2/overview/index.js +2 -2
- package/dist/guide-generators/core-2/react/index.js +1 -1
- package/dist/guide-generators/core-2/remix/index.js +1 -1
- package/dist/guide-generators/core-2/retheme/index.js +1 -1
- package/dist/util/generate-changelog.js +1 -1
- package/package.json +1 -1
package/dist/codemods/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
3
3
|
import { globby } from 'globby';
|
|
4
4
|
import { run } from 'jscodeshift/src/Runner.js';
|
|
5
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
export async function runCodemod(transform = 'transform-async-request', glob, options) {
|
|
6
|
+
export async function runCodemod(transform = 'transform-async-request', glob, options = {}) {
|
|
7
7
|
if (!transform) {
|
|
8
8
|
throw new Error('No transform provided');
|
|
9
9
|
}
|
|
@@ -16,10 +16,17 @@ export async function runCodemod(transform = 'transform-async-request', glob, op
|
|
|
16
16
|
'**/*.(css|scss|sass|less|styl)+' // common style files
|
|
17
17
|
]
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
const clerkUpgradeStats = options.clerkUpgradeStats ?? {};
|
|
20
|
+
const result = await run(resolvedPath, paths ?? [], {
|
|
20
21
|
dry: false,
|
|
21
22
|
...options,
|
|
23
|
+
// expose a mutable stats bag so individual transforms can record structured information
|
|
24
|
+
clerkUpgradeStats,
|
|
22
25
|
// we must silence stdout to prevent output from interfering with ink CLI
|
|
23
26
|
silent: true
|
|
24
27
|
});
|
|
28
|
+
return {
|
|
29
|
+
...result,
|
|
30
|
+
clerkUpgradeStats
|
|
31
|
+
};
|
|
25
32
|
}
|
|
@@ -23,7 +23,7 @@ module.exports = function transformDeprecatedProps({
|
|
|
23
23
|
source
|
|
24
24
|
}, {
|
|
25
25
|
jscodeshift: j
|
|
26
|
-
}) {
|
|
26
|
+
}, options = {}) {
|
|
27
27
|
const root = j(source);
|
|
28
28
|
let dirty = false;
|
|
29
29
|
const {
|
|
@@ -42,11 +42,16 @@ module.exports = function transformDeprecatedProps({
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
if (COMPONENTS_WITH_USER_BUTTON_REMOVALS.has(canonicalName)) {
|
|
45
|
+
let removedCount = 0;
|
|
45
46
|
for (const attrName of COMPONENTS_WITH_USER_BUTTON_REMOVALS.get(canonicalName)) {
|
|
46
47
|
if (removeJsxAttribute(j, jsxNode, attrName)) {
|
|
47
48
|
dirty = true;
|
|
49
|
+
removedCount += 1;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
52
|
+
if (removedCount > 0 && options.clerkUpgradeStats) {
|
|
53
|
+
options.clerkUpgradeStats.userbuttonAfterSignOutPropsRemoved = (options.clerkUpgradeStats.userbuttonAfterSignOutPropsRemoved || 0) + removedCount;
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
if (COMPONENT_RENAMES.has(canonicalName)) {
|
|
52
57
|
const renameMap = COMPONENT_RENAMES.get(canonicalName);
|
|
@@ -215,8 +220,6 @@ function renameObjectProperties(root, j, oldName, newName) {
|
|
|
215
220
|
if (!isPropertyKeyNamed(path.node.key, oldName)) {
|
|
216
221
|
return;
|
|
217
222
|
}
|
|
218
|
-
const parent = path.parentPath && path.parentPath.node;
|
|
219
|
-
const isPattern = parent && parent.type === 'ObjectPattern';
|
|
220
223
|
const originalLocalName = getLocalIdentifierName(path.node);
|
|
221
224
|
if (path.node.shorthand) {
|
|
222
225
|
path.node.shorthand = false;
|
|
@@ -323,7 +326,7 @@ function renameTSPropertySignatures(root, j, oldName, newName) {
|
|
|
323
326
|
}
|
|
324
327
|
function transformSetActiveBeforeEmit(root, j) {
|
|
325
328
|
let changed = false;
|
|
326
|
-
root.find(j.CallExpression).filter(path => isSetActiveCall(path.node.callee
|
|
329
|
+
root.find(j.CallExpression).filter(path => isSetActiveCall(path.node.callee)).forEach(path => {
|
|
327
330
|
const [args0] = path.node.arguments;
|
|
328
331
|
if (!args0 || args0.type !== 'ObjectExpression') {
|
|
329
332
|
return;
|
|
@@ -336,7 +339,7 @@ function transformSetActiveBeforeEmit(root, j) {
|
|
|
336
339
|
if (!beforeEmitProp || beforeEmitProp.type !== 'ObjectProperty') {
|
|
337
340
|
return;
|
|
338
341
|
}
|
|
339
|
-
const originalValue = getPropertyValueExpression(beforeEmitProp.value
|
|
342
|
+
const originalValue = getPropertyValueExpression(beforeEmitProp.value);
|
|
340
343
|
if (!originalValue) {
|
|
341
344
|
args0.properties.splice(beforeEmitIndex, 1);
|
|
342
345
|
changed = true;
|
|
@@ -348,7 +351,7 @@ function transformSetActiveBeforeEmit(root, j) {
|
|
|
348
351
|
});
|
|
349
352
|
return changed;
|
|
350
353
|
}
|
|
351
|
-
function isSetActiveCall(callee
|
|
354
|
+
function isSetActiveCall(callee) {
|
|
352
355
|
if (!callee) {
|
|
353
356
|
return false;
|
|
354
357
|
}
|
|
@@ -364,7 +367,7 @@ function isSetActiveCall(callee, j) {
|
|
|
364
367
|
function isPropertyNamed(prop, name) {
|
|
365
368
|
return prop && prop.type === 'ObjectProperty' && isPropertyKeyNamed(prop.key, name);
|
|
366
369
|
}
|
|
367
|
-
function getPropertyValueExpression(valueNode
|
|
370
|
+
function getPropertyValueExpression(valueNode) {
|
|
368
371
|
if (!valueNode) {
|
|
369
372
|
return null;
|
|
370
373
|
}
|
|
@@ -8,7 +8,10 @@ import { runCodemod } from '../codemods/index.js';
|
|
|
8
8
|
*
|
|
9
9
|
* @param {Object} props
|
|
10
10
|
* @param {Function} props.callback - The callback function to be called after the codemod is run.
|
|
11
|
-
* @param {string} props.glob -
|
|
11
|
+
* @param {string|string[]} [props.glob] - Optional glob(s) to scan for files. When provided, the
|
|
12
|
+
* codemod will use this glob directly instead of prompting.
|
|
13
|
+
* @param {Function} [props.onGlobResolved] - Optional callback invoked with the resolved glob array
|
|
14
|
+
* when the user provides it via the prompt.
|
|
12
15
|
* @param {string} props.sdk - The SDK name to be used in the codemod.
|
|
13
16
|
* @param {string} props.transform - The transformation to be applied by the codemod.
|
|
14
17
|
*
|
|
@@ -18,11 +21,21 @@ export function Codemod(props) {
|
|
|
18
21
|
const {
|
|
19
22
|
callback,
|
|
20
23
|
sdk,
|
|
21
|
-
transform
|
|
24
|
+
transform,
|
|
25
|
+
glob: initialGlob,
|
|
26
|
+
onGlobResolved
|
|
22
27
|
} = props;
|
|
23
28
|
const [error, setError] = useState();
|
|
24
|
-
const [glob, setGlob] = useState(
|
|
29
|
+
const [glob, setGlob] = useState(initialGlob);
|
|
25
30
|
const [result, setResult] = useState();
|
|
31
|
+
|
|
32
|
+
// If a glob is later provided via props (e.g. from a previous codemod run),
|
|
33
|
+
// adopt it so we can run without re-prompting.
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (initialGlob && !glob) {
|
|
36
|
+
setGlob(initialGlob);
|
|
37
|
+
}
|
|
38
|
+
}, [initialGlob, glob]);
|
|
26
39
|
useEffect(() => {
|
|
27
40
|
if (!glob) {
|
|
28
41
|
return;
|
|
@@ -42,7 +55,11 @@ export function Codemod(props) {
|
|
|
42
55
|
}, "(globstar syntax supported)"), glob ? /*#__PURE__*/React.createElement(Text, null, glob.toString()) : /*#__PURE__*/React.createElement(TextInput, {
|
|
43
56
|
defaultValue: "**/*.(js|jsx|ts|tsx|mjs|cjs)",
|
|
44
57
|
onSubmit: val => {
|
|
45
|
-
|
|
58
|
+
const parsed = val.split(/[ ,]/).filter(Boolean);
|
|
59
|
+
setGlob(parsed);
|
|
60
|
+
if (onGlobResolved) {
|
|
61
|
+
onGlobResolved(parsed);
|
|
62
|
+
}
|
|
46
63
|
}
|
|
47
64
|
})), !result && !error && glob && /*#__PURE__*/React.createElement(Spinner, {
|
|
48
65
|
label: `Running @clerk/${sdk} codemod... ${transform}`
|
|
@@ -60,7 +77,21 @@ export function Codemod(props) {
|
|
|
60
77
|
color: "yellow"
|
|
61
78
|
}, result.skip ?? 0, " skipped"), /*#__PURE__*/React.createElement(Text, {
|
|
62
79
|
color: "gray"
|
|
63
|
-
}, result.nochange ?? 0, " unmodified"), result.timeElapsed && /*#__PURE__*/React.createElement(Text, null, "Time elapsed: ", result.timeElapsed), /*#__PURE__*/React.createElement(Newline, null)
|
|
80
|
+
}, result.nochange ?? 0, " unmodified"), result.timeElapsed && /*#__PURE__*/React.createElement(Text, null, "Time elapsed: ", result.timeElapsed), transform === 'transform-remove-deprecated-props' && result.clerkUpgradeStats?.userbuttonAfterSignOutPropsRemoved > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, {
|
|
81
|
+
color: "yellow"
|
|
82
|
+
}, "Found and removed ", result.clerkUpgradeStats.userbuttonAfterSignOutPropsRemoved, " usage(s) of", /*#__PURE__*/React.createElement(Text, {
|
|
83
|
+
bold: true
|
|
84
|
+
}, " UserButton"), " sign-out redirect props (", /*#__PURE__*/React.createElement(Text, {
|
|
85
|
+
italic: true
|
|
86
|
+
}, "afterSignOutUrl"), " /", ' ', /*#__PURE__*/React.createElement(Text, {
|
|
87
|
+
italic: true
|
|
88
|
+
}, "afterMultiSessionSingleSignOutUrl"), ")."), /*#__PURE__*/React.createElement(Text, {
|
|
89
|
+
color: "gray"
|
|
90
|
+
}, "In Core 3, these props have been removed. Configure sign-out redirects globally via", /*#__PURE__*/React.createElement(Text, {
|
|
91
|
+
italic: true
|
|
92
|
+
}, " ClerkProvider afterSignOutUrl"), " (or the corresponding environment variable) or use", /*#__PURE__*/React.createElement(Text, {
|
|
93
|
+
italic: true
|
|
94
|
+
}, " SignOutButton redirectUrl"), " for one-off flows.")), /*#__PURE__*/React.createElement(Newline, null)), error && /*#__PURE__*/React.createElement(Text, {
|
|
64
95
|
color: "red"
|
|
65
96
|
}, error.message));
|
|
66
97
|
}
|
|
@@ -43,10 +43,12 @@ export function SDKWorkflow(props) {
|
|
|
43
43
|
const {
|
|
44
44
|
sdk
|
|
45
45
|
} = props;
|
|
46
|
+
const detectedVersion = getClerkSdkVersion(sdk);
|
|
46
47
|
const [done, setDone] = useState(false);
|
|
47
48
|
const [runCodemod, setRunCodemod] = useState(false);
|
|
48
49
|
const [upgradeComplete, setUpgradeComplete] = useState(false);
|
|
49
|
-
const [version] = useState(
|
|
50
|
+
const [version, setVersion] = useState(detectedVersion);
|
|
51
|
+
const [versionConfirmed, setVersionConfirmed] = useState(Boolean(detectedVersion));
|
|
50
52
|
if (!['nextjs', 'clerk-react', 'clerk-expo', 'react-router', 'tanstack-react-start'].includes(sdk)) {
|
|
51
53
|
return /*#__PURE__*/React.createElement(StatusMessage, {
|
|
52
54
|
variant: "error"
|
|
@@ -54,6 +56,33 @@ export function SDKWorkflow(props) {
|
|
|
54
56
|
bold: true
|
|
55
57
|
}, "@clerk/", sdk), " at the moment.");
|
|
56
58
|
}
|
|
59
|
+
|
|
60
|
+
// If we cannot automatically determine the installed version, let the user
|
|
61
|
+
// pick the major version they are on so we can still run the appropriate
|
|
62
|
+
// upgrade / codemods instead of silently doing nothing.
|
|
63
|
+
if (!versionConfirmed) {
|
|
64
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Text, null, "We couldn't automatically detect which major version of ", /*#__PURE__*/React.createElement(Text, {
|
|
65
|
+
bold: true
|
|
66
|
+
}, "@clerk/", sdk), " you're using."), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(StatusMessage, {
|
|
67
|
+
variant: "warning"
|
|
68
|
+
}, "Please select the major version below. If you're not sure, picking v7 (Core 3) will run the latest codemods and is generally safe to re-run."), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, null, "Please select your current @clerk/", sdk, " major version:"), /*#__PURE__*/React.createElement(Select, {
|
|
69
|
+
options: [{
|
|
70
|
+
label: 'v5 (upgrade to v6)',
|
|
71
|
+
value: 5
|
|
72
|
+
}, {
|
|
73
|
+
label: 'v6 (upgrade to v7 / Core 3)',
|
|
74
|
+
value: 6
|
|
75
|
+
}, {
|
|
76
|
+
label: 'v7 (already on Core 3, just run codemods)',
|
|
77
|
+
value: 7
|
|
78
|
+
}],
|
|
79
|
+
onChange: value => {
|
|
80
|
+
const numeric = typeof value === 'number' ? value : Number(value);
|
|
81
|
+
setVersion(Number.isNaN(numeric) ? 7 : numeric);
|
|
82
|
+
setVersionConfirmed(true);
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
57
86
|
if (sdk === 'nextjs') {
|
|
58
87
|
return /*#__PURE__*/React.createElement(NextjsWorkflow, {
|
|
59
88
|
done: done,
|
|
@@ -90,6 +119,7 @@ function NextjsWorkflow({
|
|
|
90
119
|
version
|
|
91
120
|
}) {
|
|
92
121
|
const [v6CodemodComplete, setV6CodemodComplete] = useState(false);
|
|
122
|
+
const [glob, setGlob] = useState();
|
|
93
123
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Text, null, "Clerk SDK used: ", /*#__PURE__*/React.createElement(Text, {
|
|
94
124
|
color: "green"
|
|
95
125
|
}, "@clerk/", sdk)), /*#__PURE__*/React.createElement(Text, null, "Migrating from version: ", /*#__PURE__*/React.createElement(Text, {
|
|
@@ -102,30 +132,36 @@ function NextjsWorkflow({
|
|
|
102
132
|
}), upgradeComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
103
133
|
callback: setV6CodemodComplete,
|
|
104
134
|
sdk: sdk,
|
|
105
|
-
transform: CODEMODS.ASYNC_REQUEST
|
|
135
|
+
transform: CODEMODS.ASYNC_REQUEST,
|
|
136
|
+
onGlobResolved: setGlob
|
|
106
137
|
}) : null, v6CodemodComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
107
138
|
callback: setDone,
|
|
108
139
|
sdk: sdk,
|
|
109
|
-
transform: CODEMODS.REMOVE_DEPRECATED_PROPS
|
|
140
|
+
transform: CODEMODS.REMOVE_DEPRECATED_PROPS,
|
|
141
|
+
glob: glob
|
|
110
142
|
}) : null), version === 6 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UpgradeSDK, {
|
|
111
143
|
callback: setUpgradeComplete,
|
|
112
144
|
sdk: sdk
|
|
113
145
|
}), upgradeComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
114
146
|
callback: setV6CodemodComplete,
|
|
115
147
|
sdk: sdk,
|
|
116
|
-
transform: CODEMODS.CLERK_REACT_V6
|
|
148
|
+
transform: CODEMODS.CLERK_REACT_V6,
|
|
149
|
+
onGlobResolved: setGlob
|
|
117
150
|
}) : null, v6CodemodComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
118
151
|
callback: setDone,
|
|
119
152
|
sdk: sdk,
|
|
120
|
-
transform: CODEMODS.REMOVE_DEPRECATED_PROPS
|
|
153
|
+
transform: CODEMODS.REMOVE_DEPRECATED_PROPS,
|
|
154
|
+
glob: glob
|
|
121
155
|
}) : null), version === 7 && /*#__PURE__*/React.createElement(React.Fragment, null, runCodemod ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Codemod, {
|
|
122
156
|
callback: setV6CodemodComplete,
|
|
123
157
|
sdk: sdk,
|
|
124
|
-
transform: CODEMODS.CLERK_REACT_V6
|
|
158
|
+
transform: CODEMODS.CLERK_REACT_V6,
|
|
159
|
+
onGlobResolved: setGlob
|
|
125
160
|
}), v6CodemodComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
126
161
|
callback: setDone,
|
|
127
162
|
sdk: sdk,
|
|
128
|
-
transform: CODEMODS.REMOVE_DEPRECATED_PROPS
|
|
163
|
+
transform: CODEMODS.REMOVE_DEPRECATED_PROPS,
|
|
164
|
+
glob: glob
|
|
129
165
|
}) : null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, "Looks like you are already on the latest version of ", /*#__PURE__*/React.createElement(Text, {
|
|
130
166
|
bold: true
|
|
131
167
|
}, "@clerk/", sdk), ". Would you like to run the associated codemods?"), /*#__PURE__*/React.createElement(Select, {
|
|
@@ -153,21 +189,24 @@ function NextjsWorkflow({
|
|
|
153
189
|
label: 'Checking for `useAuth` usage in your project...'
|
|
154
190
|
}),
|
|
155
191
|
onError: () => null,
|
|
156
|
-
onSuccess:
|
|
157
|
-
variant: "warning"
|
|
158
|
-
}, /*#__PURE__*/React.createElement(Text, null, "We have detected that your application might be using the ", /*#__PURE__*/React.createElement(Text, {
|
|
159
|
-
bold: true
|
|
160
|
-
}, "useAuth"), " hook from", ' ', /*#__PURE__*/React.createElement(Text, {
|
|
161
|
-
bold: true
|
|
162
|
-
}, "@clerk/nextjs"), "."), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, null, "If usages of this hook are server-side rendered, you might need to add the ", /*#__PURE__*/React.createElement(Text, {
|
|
163
|
-
bold: true
|
|
164
|
-
}, "dynamic"), ' ', "prop to your application's root ", /*#__PURE__*/React.createElement(Text, {
|
|
165
|
-
bold: true
|
|
166
|
-
}, "ClerkProvider"), "."), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, null, "You can find more information about this change in the Clerk documentation at", ' ', /*#__PURE__*/React.createElement(Link, {
|
|
167
|
-
url: "https://clerk.com/docs/references/nextjs/rendering-modes"
|
|
168
|
-
}, "https://clerk.com/docs/references/nextjs/rendering-modes"), "."))
|
|
192
|
+
onSuccess: NextjsUseAuthWarning
|
|
169
193
|
})));
|
|
170
194
|
}
|
|
195
|
+
function NextjsUseAuthWarning() {
|
|
196
|
+
return /*#__PURE__*/React.createElement(StatusMessage, {
|
|
197
|
+
variant: "warning"
|
|
198
|
+
}, /*#__PURE__*/React.createElement(Text, null, "We have detected that your application might be using the ", /*#__PURE__*/React.createElement(Text, {
|
|
199
|
+
bold: true
|
|
200
|
+
}, "useAuth"), " hook from", ' ', /*#__PURE__*/React.createElement(Text, {
|
|
201
|
+
bold: true
|
|
202
|
+
}, "@clerk/nextjs"), "."), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, null, "If usages of this hook are server-side rendered, you might need to add the ", /*#__PURE__*/React.createElement(Text, {
|
|
203
|
+
bold: true
|
|
204
|
+
}, "dynamic"), " prop to your application's root ", /*#__PURE__*/React.createElement(Text, {
|
|
205
|
+
bold: true
|
|
206
|
+
}, "ClerkProvider"), "."), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, null, "You can find more information about this change in the Clerk documentation at", ' ', /*#__PURE__*/React.createElement(Link, {
|
|
207
|
+
url: "https://clerk.com/docs/references/nextjs/rendering-modes"
|
|
208
|
+
}, "https://clerk.com/docs/references/nextjs/rendering-modes"), "."));
|
|
209
|
+
}
|
|
171
210
|
function ReactSdkWorkflow({
|
|
172
211
|
done,
|
|
173
212
|
runCodemod,
|
|
@@ -179,6 +218,7 @@ function ReactSdkWorkflow({
|
|
|
179
218
|
version
|
|
180
219
|
}) {
|
|
181
220
|
const [v6CodemodComplete, setV6CodemodComplete] = useState(false);
|
|
221
|
+
const [glob, setGlob] = useState();
|
|
182
222
|
const replacePackage = sdk === 'clerk-react' || sdk === 'clerk-expo';
|
|
183
223
|
const needsUpgrade = versionNeedsUpgrade(sdk, version);
|
|
184
224
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Text, null, "Clerk SDK used: ", /*#__PURE__*/React.createElement(Text, {
|
|
@@ -194,19 +234,23 @@ function ReactSdkWorkflow({
|
|
|
194
234
|
}), upgradeComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
195
235
|
callback: setV6CodemodComplete,
|
|
196
236
|
sdk: sdk,
|
|
197
|
-
transform: CODEMODS.CLERK_REACT_V6
|
|
237
|
+
transform: CODEMODS.CLERK_REACT_V6,
|
|
238
|
+
onGlobResolved: setGlob
|
|
198
239
|
}) : null, v6CodemodComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
199
240
|
callback: setDone,
|
|
200
241
|
sdk: sdk,
|
|
201
|
-
transform: CODEMODS.REMOVE_DEPRECATED_PROPS
|
|
242
|
+
transform: CODEMODS.REMOVE_DEPRECATED_PROPS,
|
|
243
|
+
glob: glob
|
|
202
244
|
}) : null), !needsUpgrade && /*#__PURE__*/React.createElement(React.Fragment, null, runCodemod ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Codemod, {
|
|
203
245
|
callback: setV6CodemodComplete,
|
|
204
246
|
sdk: sdk,
|
|
205
|
-
transform: CODEMODS.CLERK_REACT_V6
|
|
247
|
+
transform: CODEMODS.CLERK_REACT_V6,
|
|
248
|
+
onGlobResolved: setGlob
|
|
206
249
|
}), v6CodemodComplete ? /*#__PURE__*/React.createElement(Codemod, {
|
|
207
250
|
callback: setDone,
|
|
208
251
|
sdk: sdk,
|
|
209
|
-
transform: CODEMODS.REMOVE_DEPRECATED_PROPS
|
|
252
|
+
transform: CODEMODS.REMOVE_DEPRECATED_PROPS,
|
|
253
|
+
glob: glob
|
|
210
254
|
}) : null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, "Looks like you are already on the latest version of ", /*#__PURE__*/React.createElement(Text, {
|
|
211
255
|
bold: true
|
|
212
256
|
}, "@clerk/", sdk), ". Would you like to run the associated codemods?"), /*#__PURE__*/React.createElement(Select, {
|
package/dist/components/Scan.js
CHANGED
|
@@ -37,7 +37,7 @@ export function Scan(props) {
|
|
|
37
37
|
// { sdkName: [{ title: 'x', matcher: /x/, slug: 'x', ... }] }
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
setStatus(`Loading data for ${toVersion} migration`);
|
|
40
|
-
import(`../versions/${toVersion}/index.js`).then(version => {
|
|
40
|
+
void import(`../versions/${toVersion}/index.js`).then(version => {
|
|
41
41
|
setMatchers(sdks.reduce((m, sdk) => {
|
|
42
42
|
m[sdk] = version.default[sdk];
|
|
43
43
|
return m;
|
|
@@ -51,7 +51,7 @@ export function Scan(props) {
|
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
setStatus('Collecting files to scan');
|
|
53
53
|
const pattern = convertPathToPattern(path.resolve(dir));
|
|
54
|
-
globby(pattern, {
|
|
54
|
+
void globby(pattern, {
|
|
55
55
|
ignore: ['node_modules/**', '**/node_modules/**', '.git/**', 'package.json', '**/package.json', 'package-lock.json', '**/package-lock.json', 'yarn.lock', '**/yarn.lock', 'pnpm-lock.yaml', '**/pnpm-lock.yaml', '**/*.(png|webp|svg|gif|jpg|jpeg)+', '**/*.(mp4|mkv|wmv|m4v|mov|avi|flv|webm|flac|mka|m4a|aac|ogg)+', ...ignore].filter(Boolean)
|
|
56
56
|
}).then(files => {
|
|
57
57
|
setFiles(files);
|
|
@@ -66,7 +66,7 @@ export function Scan(props) {
|
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
const allResults = {};
|
|
69
|
-
Promise.all(
|
|
69
|
+
void Promise.all(
|
|
70
70
|
// first we read all the files
|
|
71
71
|
files.map(async (file, idx) => {
|
|
72
72
|
const content = await fs.readFile(file, 'utf8');
|
|
@@ -124,8 +124,8 @@ export function Scan(props) {
|
|
|
124
124
|
setStatus(`Scanning ${file}`);
|
|
125
125
|
setProgress(Math.ceil(idx / files.length * 100));
|
|
126
126
|
})).then(() => {
|
|
127
|
-
const
|
|
128
|
-
setResults(
|
|
127
|
+
const aggregatedResults = Object.keys(allResults).map(k => allResults[k]);
|
|
128
|
+
setResults(prevResults => [...prevResults, ...aggregatedResults]);
|
|
129
129
|
|
|
130
130
|
// Anonymously track how many instances of each breaking change item were encountered.
|
|
131
131
|
// This only tracks the name of the breaking change found, and how many instances of it
|
|
@@ -133,14 +133,14 @@ export function Scan(props) {
|
|
|
133
133
|
// It is used internally to help us understand what the most common sticking points are
|
|
134
134
|
// for our users so we can appropriate prioritize support/guidance/docs around them.
|
|
135
135
|
if (!disableTelemetry) {
|
|
136
|
-
fetch('https://api.segment.io/v1/batch', {
|
|
136
|
+
void fetch('https://api.segment.io/v1/batch', {
|
|
137
137
|
method: 'POST',
|
|
138
138
|
headers: {
|
|
139
139
|
Authorization: `Basic ${Buffer.from('5TkC1SM87VX2JRJcIGBBmL7sHLRWaIvc:').toString('base64')}`,
|
|
140
140
|
'Content-Type': 'application/json'
|
|
141
141
|
},
|
|
142
142
|
body: JSON.stringify({
|
|
143
|
-
batch:
|
|
143
|
+
batch: aggregatedResults.map(item => {
|
|
144
144
|
return {
|
|
145
145
|
type: 'track',
|
|
146
146
|
userId: 'clerk-upgrade-tool',
|
|
@@ -169,7 +169,7 @@ export function Scan(props) {
|
|
|
169
169
|
}).catch(err => {
|
|
170
170
|
console.error(err);
|
|
171
171
|
});
|
|
172
|
-
}, [matchers, files, noWarnings, disableTelemetry]);
|
|
172
|
+
}, [matchers, files, noWarnings, disableTelemetry, fromVersion, toVersion, uuid]);
|
|
173
173
|
return complete ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
174
174
|
color: "green"
|
|
175
175
|
}, "\u2713 ", status), /*#__PURE__*/React.createElement(Newline, null), !!results.length && /*#__PURE__*/React.createElement(ExpandableList, {
|
|
@@ -80,7 +80,7 @@ export function UpgradeSDK({
|
|
|
80
80
|
}).finally(() => {
|
|
81
81
|
callback(true);
|
|
82
82
|
});
|
|
83
|
-
}, [command, packageManager, sdk]);
|
|
83
|
+
}, [callback, command, packageManager, replacePackage, sdk]);
|
|
84
84
|
return /*#__PURE__*/React.createElement(React.Fragment, null, packageManager ? null : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, "We could not detect the package manager used in your project. Please select the package manager you are using"), /*#__PURE__*/React.createElement(Select, {
|
|
85
85
|
options: [{
|
|
86
86
|
label: 'npm',
|
|
@@ -19,4 +19,4 @@ async function generate() {
|
|
|
19
19
|
packageName
|
|
20
20
|
}), markdown('cli'), '## Breaking Changes', singleItem('authenticaterequest-params-change'), singleItem('clockskewinseconds'), markdown('import-paths'), accordionForCategory('import-paths'), singleItem('httpoptions-removed'), markdown('orgs-claim'), markdown('pagination-args'), accordionForCategory('pagination-args'), markdown('pagination-return'), accordionForCategory('pagination-return'), markdown('image-url'), accordionForCategory(['image-url', 'image-url-backend']), deprecationRemovalsAndHousekeeping()]);
|
|
21
21
|
}
|
|
22
|
-
generate().then(writeToFile(cwd));
|
|
22
|
+
void generate().then(writeToFile(cwd));
|
|
@@ -21,4 +21,4 @@ async function generate() {
|
|
|
21
21
|
packageName
|
|
22
22
|
}), markdown('image-url'), accordionForCategory('image-url'), deprecationRemovalsAndHousekeeping(['hof-removal', 'pagination-return', 'pagination-args', 'error-imports'])]);
|
|
23
23
|
}
|
|
24
|
-
generate().then(writeToFile(cwd));
|
|
24
|
+
void generate().then(writeToFile(cwd));
|
|
@@ -22,4 +22,4 @@ async function generate() {
|
|
|
22
22
|
packageName
|
|
23
23
|
}), markdown('image-url'), accordionForCategory('image-url'), deprecationRemovalsAndHousekeeping(['hof-removal', 'pagination-return', 'pagination-args', 'error-imports'])]);
|
|
24
24
|
}
|
|
25
|
-
generate().then(writeToFile(cwd));
|
|
25
|
+
void generate().then(writeToFile(cwd));
|
|
@@ -20,4 +20,4 @@ async function generate() {
|
|
|
20
20
|
packageName
|
|
21
21
|
}), markdown('cli'), '## Breaking Changes', markdown('orgs-claim'), markdown('image-url'), accordionForCategory('image-url'), deprecationRemovalsAndHousekeeping(['hof-removal', 'pagination-return', 'pagination-args', 'error-imports'])]);
|
|
22
22
|
}
|
|
23
|
-
generate().then(writeToFile(cwd));
|
|
23
|
+
void generate().then(writeToFile(cwd));
|
|
@@ -22,4 +22,4 @@ async function generate() {
|
|
|
22
22
|
packageName
|
|
23
23
|
}), markdown('image-url'), accordionForCategory('image-url'), deprecationRemovalsAndHousekeeping(['hof-removal', 'pagination-return', 'pagination-args', 'error-imports'])]);
|
|
24
24
|
}
|
|
25
|
-
generate().then(writeToFile(cwd));
|
|
25
|
+
void generate().then(writeToFile(cwd));
|
|
@@ -20,4 +20,4 @@ async function generate() {
|
|
|
20
20
|
packageName
|
|
21
21
|
}), markdown('cli'), '## Breaking Changes', singleItem('cjs-esm-instance'), markdown('node-setters-removals'), markdown('orgs-claim'), markdown('image-url'), accordionForCategory('image-url'), deprecationRemovalsAndHousekeeping(['pagination-return', 'pagination-args', 'error-imports'])]);
|
|
22
22
|
}
|
|
23
|
-
generate().then(writeToFile(cwd));
|
|
23
|
+
void generate().then(writeToFile(cwd));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assembleContent, frontmatter, markdown, writeToFile } from '../../text-generation.js';
|
|
2
2
|
const cwd = 'core-2/overview';
|
|
3
3
|
async function generate() {
|
|
4
|
-
return assembleContent({
|
|
4
|
+
return await assembleContent({
|
|
5
5
|
data: {},
|
|
6
6
|
cwd
|
|
7
7
|
}, [frontmatter({
|
|
@@ -9,4 +9,4 @@ async function generate() {
|
|
|
9
9
|
description: `Learn how to upgrade to the latest version of Clerk's SDKs`
|
|
10
10
|
}), markdown('intro')]);
|
|
11
11
|
}
|
|
12
|
-
generate().then(writeToFile(cwd));
|
|
12
|
+
void generate().then(writeToFile(cwd));
|
|
@@ -22,4 +22,4 @@ async function generate() {
|
|
|
22
22
|
packageName
|
|
23
23
|
}), markdown('image-url'), accordionForCategory('image-url'), deprecationRemovalsAndHousekeeping(['hof-removal', 'pagination-return', 'pagination-args', 'error-imports'])]);
|
|
24
24
|
}
|
|
25
|
-
generate().then(writeToFile(cwd));
|
|
25
|
+
void generate().then(writeToFile(cwd));
|