@clerk/upgrade 2.0.0-snapshot.v20251204175016 → 2.0.0-snapshot.v20251211120550
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 +35 -5
- package/dist/__tests__/fixtures/expo-old-package/package-lock.json +5 -0
- package/dist/__tests__/fixtures/expo-old-package/package.json +10 -0
- package/dist/__tests__/fixtures/expo-old-package/src/App.tsx +14 -0
- package/dist/__tests__/fixtures/nextjs-v6/package.json +9 -0
- package/dist/__tests__/fixtures/nextjs-v6/pnpm-lock.yaml +2 -0
- package/dist/__tests__/fixtures/nextjs-v6/src/app.tsx +17 -0
- package/dist/__tests__/fixtures/nextjs-v7/package.json +9 -0
- package/dist/__tests__/fixtures/nextjs-v7/pnpm-lock.yaml +2 -0
- package/dist/__tests__/fixtures/nextjs-v7/src/app.tsx +16 -0
- package/dist/__tests__/fixtures/no-clerk/package.json +7 -0
- package/dist/__tests__/fixtures/react-v6/package.json +8 -0
- package/dist/__tests__/fixtures/react-v6/src/App.tsx +19 -0
- package/dist/__tests__/fixtures/react-v6/yarn.lock +2 -0
- package/dist/__tests__/helpers/create-fixture.js +56 -0
- package/dist/__tests__/integration/cli.test.js +275 -0
- package/dist/__tests__/integration/config.test.js +97 -0
- package/dist/__tests__/integration/detect-sdk.test.js +100 -0
- package/dist/__tests__/integration/runner.test.js +58 -0
- package/dist/cli.js +172 -44
- package/dist/codemods/__tests__/__fixtures__/transform-align-experimental-unstable-prefixes.fixtures.js +92 -0
- package/dist/codemods/__tests__/__fixtures__/transform-appearance-layout-to-options.fixtures.js +9 -0
- package/dist/codemods/__tests__/__fixtures__/transform-clerk-react-v6.fixtures.js +13 -0
- package/dist/codemods/__tests__/__fixtures__/transform-remove-deprecated-appearance-props.fixtures.js +63 -0
- package/dist/codemods/__tests__/__fixtures__/transform-themes-to-ui-themes.fixtures.js +41 -0
- package/dist/codemods/__tests__/transform-align-experimental-unstable-prefixes.test.js +15 -0
- package/dist/codemods/__tests__/transform-appearance-layout-to-options.test.js +15 -0
- package/dist/codemods/__tests__/transform-remove-deprecated-appearance-props.test.js +15 -0
- package/dist/codemods/__tests__/transform-themes-to-ui-themes.test.js +15 -0
- package/dist/codemods/index.js +67 -13
- package/dist/codemods/transform-align-experimental-unstable-prefixes.cjs +412 -0
- package/dist/codemods/transform-appearance-layout-to-options.cjs +65 -0
- package/dist/codemods/transform-clerk-react-v6.cjs +15 -7
- package/dist/codemods/transform-remove-deprecated-appearance-props.cjs +109 -0
- package/dist/codemods/transform-remove-deprecated-props.cjs +11 -32
- package/dist/codemods/transform-themes-to-ui-themes.cjs +65 -0
- package/dist/config.js +145 -0
- package/dist/render.js +170 -0
- package/dist/runner.js +98 -0
- package/dist/util/detect-sdk.js +125 -0
- package/dist/util/package-manager.js +94 -0
- package/dist/versions/core-3/changes/clerk-expo-package-rename.md +23 -0
- package/dist/versions/core-3/changes/clerk-react-package-rename.md +22 -0
- package/dist/versions/core-3/index.js +40 -0
- package/package.json +2 -8
- package/dist/app.js +0 -177
- package/dist/components/Codemod.js +0 -149
- package/dist/components/Command.js +0 -56
- package/dist/components/Header.js +0 -11
- package/dist/components/SDKWorkflow.js +0 -278
- package/dist/components/Scan.js +0 -180
- package/dist/components/UpgradeSDK.js +0 -116
- package/dist/util/expandable-list.js +0 -173
- package/dist/util/get-clerk-version.js +0 -22
- package/dist/util/guess-framework.js +0 -69
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import Markdown from '@jescalan/ink-markdown';
|
|
2
|
-
import { Box, Newline, Text, useInput } from 'ink';
|
|
3
|
-
import React, { useReducer } from 'react';
|
|
4
|
-
|
|
5
|
-
// A listing of items which can be navigated with arrow keys and expanded/contracted
|
|
6
|
-
// with space bar. Limits the number visible at a time to prevent rendering issues with
|
|
7
|
-
// super long lists
|
|
8
|
-
export default function ExpandableList({
|
|
9
|
-
items,
|
|
10
|
-
numberVisible = 10
|
|
11
|
-
}) {
|
|
12
|
-
// set up our little state machine
|
|
13
|
-
const [state, dispatch] = useReducer(reducer, items, items => {
|
|
14
|
-
// add focused/expanded state on the set of items
|
|
15
|
-
const all = items.map((i, idx) => {
|
|
16
|
-
i.focused = idx === 0 ? true : false;
|
|
17
|
-
i.expanded = false;
|
|
18
|
-
return i;
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// start idx, end idx
|
|
22
|
-
const visible = [0, numberVisible];
|
|
23
|
-
return {
|
|
24
|
-
numberVisible,
|
|
25
|
-
all,
|
|
26
|
-
visible
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// this is what lets us respond to keyboard input
|
|
31
|
-
useInput((input, key) => {
|
|
32
|
-
if (key.downArrow) {
|
|
33
|
-
dispatch({
|
|
34
|
-
type: 'focus-next-option'
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (key.upArrow) {
|
|
38
|
-
dispatch({
|
|
39
|
-
type: 'focus-previous-option'
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
if (input === ' ') {
|
|
43
|
-
dispatch({
|
|
44
|
-
type: 'toggle-focused-option'
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// and here's the actual markup we render for each list item!
|
|
50
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
51
|
-
color: "blue"
|
|
52
|
-
}, "Navigation Instructions:"), /*#__PURE__*/React.createElement(Text, null, "Navigate through items with \u2191 and \u2193 arrow keys. Expand the details of any item with space bar. \u2193 key on the last item goes to the next page, \u2191 on the first item goes to the previous page. To exit this interface, use \"control + c\"."), /*#__PURE__*/React.createElement(Newline, null), state.all.reduce((memo, item, idx) => {
|
|
53
|
-
if (idx < state.visible[0] || idx >= state.visible[1]) {
|
|
54
|
-
return memo;
|
|
55
|
-
}
|
|
56
|
-
const locations = item.instances.map(instance => `${instance.file}:${instance.position.line}:${instance.position.column}`);
|
|
57
|
-
const singleBorderStyle = {
|
|
58
|
-
topLeft: ' ',
|
|
59
|
-
top: '─',
|
|
60
|
-
topRight: ' ',
|
|
61
|
-
left: '',
|
|
62
|
-
bottomLeft: ' ',
|
|
63
|
-
bottom: '─',
|
|
64
|
-
bottomRight: ' ',
|
|
65
|
-
right: ''
|
|
66
|
-
};
|
|
67
|
-
const doubleBorderStyle = {
|
|
68
|
-
topLeft: ' ',
|
|
69
|
-
top: '═',
|
|
70
|
-
topRight: ' ',
|
|
71
|
-
left: '',
|
|
72
|
-
bottomLeft: ' ',
|
|
73
|
-
bottom: '═',
|
|
74
|
-
bottomRight: ' ',
|
|
75
|
-
right: ''
|
|
76
|
-
};
|
|
77
|
-
memo.push(/*#__PURE__*/React.createElement(Box, {
|
|
78
|
-
borderStyle: item.focused ? doubleBorderStyle : singleBorderStyle,
|
|
79
|
-
flexDirection: "column",
|
|
80
|
-
borderColor: item.focused ? 'blue' : 'white',
|
|
81
|
-
paddingX: 1,
|
|
82
|
-
key: item.title
|
|
83
|
-
}, /*#__PURE__*/React.createElement(Markdown, null, item.title), locations.length > 1 ? /*#__PURE__*/React.createElement(Text, null, "Found ", locations.length, " instances, expand for detail") : /*#__PURE__*/React.createElement(Text, null, "Location: ", locations[0]), item.expanded && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line, null), locations.length > 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, "Locations:"), locations.map(loc => /*#__PURE__*/React.createElement(Text, {
|
|
84
|
-
key: loc
|
|
85
|
-
}, ' ', "- ", loc)), /*#__PURE__*/React.createElement(Line, null)), item.warning && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
86
|
-
color: "yellow"
|
|
87
|
-
}, "\u26A0\uFE0F This is a WARNING and will still match even if you corrected the issue or if no correction is necessary. To dismiss warnings, pass the `--noWarnings` flag to the CLI when running."), /*#__PURE__*/React.createElement(Line, null)), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Markdown, null, item.content))));
|
|
88
|
-
return memo;
|
|
89
|
-
}, []), state.all.length > state.numberVisible && /*#__PURE__*/React.createElement(Text, null, "Showing ", state.visible[0] + 1, " - ", Math.min(state.visible[1], state.all.length), " of ", state.all.length));
|
|
90
|
-
}
|
|
91
|
-
const Line = () => /*#__PURE__*/React.createElement(Box, {
|
|
92
|
-
borderStyle: "single",
|
|
93
|
-
borderRight: false,
|
|
94
|
-
borderLeft: false,
|
|
95
|
-
borderBottom: false
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// I'd like to recognize that this logic is kinda crazy, but it works 💖
|
|
99
|
-
function reducer(state, action) {
|
|
100
|
-
if (action.type === 'focus-next-option') {
|
|
101
|
-
let nextIdx;
|
|
102
|
-
|
|
103
|
-
// if the current item is focused and a next item exists
|
|
104
|
-
// un-focus it and tee up the next one to be focused
|
|
105
|
-
const all = state.all.map((item, idx) => {
|
|
106
|
-
if (item.focused && state.all[idx + 1]) {
|
|
107
|
-
nextIdx = idx + 1;
|
|
108
|
-
item.focused = false;
|
|
109
|
-
return item;
|
|
110
|
-
}
|
|
111
|
-
if (idx === nextIdx) {
|
|
112
|
-
item.focused = true;
|
|
113
|
-
return item;
|
|
114
|
-
}
|
|
115
|
-
return item;
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// if we're scrolling past the last item in the list, shift the visible window
|
|
119
|
-
let visible = state.visible;
|
|
120
|
-
if (nextIdx >= state.visible[1]) {
|
|
121
|
-
visible = [state.visible[0] + state.numberVisible, state.visible[1] + state.numberVisible];
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
all,
|
|
125
|
-
visible,
|
|
126
|
-
numberVisible: state.numberVisible
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
if (action.type === 'focus-previous-option') {
|
|
130
|
-
let nextIdx;
|
|
131
|
-
|
|
132
|
-
// if the next item is focused, focus this one and tee up the next one to be un-focused
|
|
133
|
-
const all = state.all.map((item, idx) => {
|
|
134
|
-
if (state.all[idx + 1]?.focused) {
|
|
135
|
-
item.focused = true;
|
|
136
|
-
nextIdx = idx + 1;
|
|
137
|
-
return item;
|
|
138
|
-
}
|
|
139
|
-
if (idx === nextIdx) {
|
|
140
|
-
item.focused = false;
|
|
141
|
-
return item;
|
|
142
|
-
}
|
|
143
|
-
return item;
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// if we're scrolling to before the first item in the list, shift the visible window
|
|
147
|
-
let visible = state.visible;
|
|
148
|
-
if (nextIdx - 1 < state.visible[0]) {
|
|
149
|
-
visible = [state.visible[0] - state.numberVisible, state.visible[1] - state.numberVisible];
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
all,
|
|
153
|
-
visible,
|
|
154
|
-
numberVisible: state.numberVisible
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// if the space bar is hit, toggle expand/contract on the currently focused item
|
|
159
|
-
if (action.type === 'toggle-focused-option') {
|
|
160
|
-
const all = state.all.map(item => {
|
|
161
|
-
if (item.focused) {
|
|
162
|
-
item.expanded = !item.expanded;
|
|
163
|
-
}
|
|
164
|
-
return item;
|
|
165
|
-
});
|
|
166
|
-
console.log(''); // this is strange but seems to solve a rendering bug
|
|
167
|
-
return {
|
|
168
|
-
all,
|
|
169
|
-
visible: state.visible,
|
|
170
|
-
numberVisible: state.numberVisible
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { readPackageSync } from 'read-pkg';
|
|
2
|
-
import semverRegex from 'semver-regex';
|
|
3
|
-
export function getClerkSdkVersion(sdk) {
|
|
4
|
-
const pkg = readPackageSync();
|
|
5
|
-
const clerkSdk = pkg.dependencies[`@clerk/${sdk}`];
|
|
6
|
-
if (!clerkSdk) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
return getMajorVersion(clerkSdk.replace('^', '').replace('~', ''));
|
|
11
|
-
} catch {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function getMajorVersion(semver) {
|
|
16
|
-
const match = semver.match(semverRegex());
|
|
17
|
-
if (match) {
|
|
18
|
-
const [major] = match[0].split('.');
|
|
19
|
-
return parseInt(major, 10); // Return as an integer
|
|
20
|
-
}
|
|
21
|
-
throw new Error('Invalid semver string');
|
|
22
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { createHash, randomUUID } from 'crypto';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { readPackageSync } from 'read-pkg';
|
|
5
|
-
import tempDir from 'temp-dir';
|
|
6
|
-
import SDKS from '../constants/sdks.js';
|
|
7
|
-
function md5(data) {
|
|
8
|
-
return createHash('md5').update(data).digest('hex');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Telemetry Note
|
|
12
|
-
// --------------
|
|
13
|
-
// We collect fully anonymous telemetry as part of this tool. The only data we send is which
|
|
14
|
-
// breaking changes were detected in your app scan. This data helps us to know what the most often
|
|
15
|
-
// encountered issues are so that we can prioritize documentation and support for these areas.
|
|
16
|
-
// We do not send any information from your source code or any PII as part of the telemetry.
|
|
17
|
-
|
|
18
|
-
export default function guessFrameworks(dir, disableTelemetry) {
|
|
19
|
-
let pkg;
|
|
20
|
-
try {
|
|
21
|
-
pkg = readPackageSync({
|
|
22
|
-
cwd: dir
|
|
23
|
-
});
|
|
24
|
-
} catch {
|
|
25
|
-
const tmpPath = path.join(tempDir, 'clerk-upgrade-uuid');
|
|
26
|
-
let uuid;
|
|
27
|
-
if (!disableTelemetry) {
|
|
28
|
-
// if there's no package.json, create a uuid in tempfile so that multiple runs on the same app can be consolidated
|
|
29
|
-
if (fs.existsSync(tmpPath)) {
|
|
30
|
-
uuid = fs.readFileSync(tmpPath, 'utf8');
|
|
31
|
-
} else {
|
|
32
|
-
uuid = randomUUID();
|
|
33
|
-
fs.writeFileSync(tmpPath, uuid);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
guesses: [],
|
|
38
|
-
_uuid: uuid
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// if there is a package.json
|
|
43
|
-
const _uuid = md5(JSON.stringify(pkg));
|
|
44
|
-
|
|
45
|
-
// no guessing if there are no deps
|
|
46
|
-
if (!pkg.dependencies && !pkg.devDependencies) {
|
|
47
|
-
return {
|
|
48
|
-
guesses: [],
|
|
49
|
-
_uuid
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
const deps = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
|
|
53
|
-
const devDeps = pkg.devDependencies ? Object.keys(pkg.devDependencies) : [];
|
|
54
|
-
return {
|
|
55
|
-
_uuid,
|
|
56
|
-
guesses: SDKS.reduce((m, {
|
|
57
|
-
label,
|
|
58
|
-
value
|
|
59
|
-
}) => {
|
|
60
|
-
if (deps.includes(label) || devDeps.includes(label)) {
|
|
61
|
-
m.push({
|
|
62
|
-
label,
|
|
63
|
-
value
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return m;
|
|
67
|
-
}, [])
|
|
68
|
-
};
|
|
69
|
-
}
|