@clerk/upgrade 2.0.0-canary.v20251215124459 → 2.0.0-canary.v20251215165139
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/render.js +31 -1
- package/package.json +1 -1
package/dist/render.js
CHANGED
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
import * as readline from 'node:readline';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
+
const gradientColors = ['#5ee7df', '#b490ca'];
|
|
4
|
+
const hexToRgb = hex => {
|
|
5
|
+
const value = hex.replace('#', '');
|
|
6
|
+
const chunk = value.length === 3 ? value.split('').map(char => char + char) : value.match(/.{2}/g);
|
|
7
|
+
return chunk.map(part => parseInt(part, 16));
|
|
8
|
+
};
|
|
9
|
+
const interpolate = (start, end, t) => Math.round(start + (end - start) * t);
|
|
10
|
+
const applyGradient = text => {
|
|
11
|
+
if (!text) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
const rgb = gradientColors.map(hexToRgb);
|
|
15
|
+
const maxIndex = text.length - 1 || 1;
|
|
16
|
+
const segmentCount = rgb.length - 1;
|
|
17
|
+
return text.split('').map((char, index) => {
|
|
18
|
+
const progress = index / maxIndex;
|
|
19
|
+
const segment = Math.min(Math.floor(progress * segmentCount), segmentCount - 1);
|
|
20
|
+
const localT = segmentCount === 0 ? 0 : progress * segmentCount - segment;
|
|
21
|
+
const [r1, g1, b1] = rgb[segment];
|
|
22
|
+
const [r2, g2, b2] = rgb[segment + 1] || rgb[segment];
|
|
23
|
+
const r = interpolate(r1, r2, localT);
|
|
24
|
+
const g = interpolate(g1, g2, localT);
|
|
25
|
+
const b = interpolate(b1, b2, localT);
|
|
26
|
+
return chalk.rgb(r, g, b)(char);
|
|
27
|
+
}).join('');
|
|
28
|
+
};
|
|
3
29
|
export function renderHeader() {
|
|
4
30
|
console.log('');
|
|
5
|
-
|
|
31
|
+
const heading = [' █▀▀ █ █▀▀ █▀█ █▄▀ █ █ █▀█ █▀▀ █▀█ ▄▀█ █▀▄ █▀▀', ' █▄▄ █▄▄ ██▄ █▀▄ █ █ █▄█ █▀▀ █▄█ █▀▄ █▀█ █▄▀ ██▄'];
|
|
32
|
+
heading.forEach(line => console.log(applyGradient(line)));
|
|
33
|
+
console.log('');
|
|
34
|
+
console.log("Hello friend! We're excited to help you upgrade Clerk modules. Before we get started, a couple");
|
|
35
|
+
console.log('questions...');
|
|
6
36
|
console.log('');
|
|
7
37
|
}
|
|
8
38
|
export function renderText(message, color) {
|