assistant-ui 0.0.49 → 0.0.50
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/utils/createTransformer.d.ts +15 -0
- package/dist/codemods/utils/createTransformer.d.ts.map +1 -0
- package/dist/codemods/v0-8/ui-package-split.d.ts +3 -0
- package/dist/codemods/v0-8/ui-package-split.d.ts.map +1 -0
- package/dist/codemods/v0-9/edge-package-split.d.ts +3 -0
- package/dist/codemods/v0-9/edge-package-split.d.ts.map +1 -0
- package/dist/commands/add.d.ts +3 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/upgrade.d.ts +10 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/install-ai-sdk-lib.d.ts +2 -0
- package/dist/lib/install-ai-sdk-lib.d.ts.map +1 -0
- package/dist/lib/install-edge-lib.d.ts +2 -0
- package/dist/lib/install-edge-lib.d.ts.map +1 -0
- package/dist/lib/install-ui-lib.d.ts +2 -0
- package/dist/lib/install-ui-lib.d.ts.map +1 -0
- package/dist/lib/transform-options.d.ts +7 -0
- package/dist/lib/transform-options.d.ts.map +1 -0
- package/dist/lib/transform.d.ts +21 -0
- package/dist/lib/transform.d.ts.map +1 -0
- package/dist/lib/upgrade.d.ts +9 -0
- package/dist/lib/upgrade.d.ts.map +1 -0
- package/package.json +3 -5
- package/src/codemods/utils/createTransformer.ts +41 -0
- package/src/codemods/v0-8/ui-package-split.ts +203 -0
- package/src/codemods/v0-9/edge-package-split.ts +226 -0
- package/src/commands/add.ts +47 -0
- package/src/commands/create.ts +92 -0
- package/src/commands/init.ts +50 -0
- package/src/commands/update.ts +60 -0
- package/src/commands/upgrade.ts +55 -0
- package/src/index.ts +28 -0
- package/src/lib/install-ai-sdk-lib.ts +92 -0
- package/src/lib/install-edge-lib.ts +92 -0
- package/src/lib/install-ui-lib.ts +92 -0
- package/src/lib/transform-options.ts +6 -0
- package/src/lib/transform.ts +177 -0
- package/src/lib/upgrade.ts +83 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { sync as globSync } from "glob";
|
|
5
|
+
import * as readline from "readline";
|
|
6
|
+
import { detect } from "detect-package-manager";
|
|
7
|
+
|
|
8
|
+
function askQuestion(query: string): Promise<string> {
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
const rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
});
|
|
14
|
+
rl.question(query, (answer) => {
|
|
15
|
+
rl.close();
|
|
16
|
+
resolve(answer);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isPackageInstalled(pkg: string): boolean {
|
|
22
|
+
const cwd = process.cwd();
|
|
23
|
+
try {
|
|
24
|
+
const pkgJsonPath = path.join(cwd, "package.json");
|
|
25
|
+
if (fs.existsSync(pkgJsonPath)) {
|
|
26
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
27
|
+
const deps = pkgJson.dependencies || {};
|
|
28
|
+
const devDeps = pkgJson.devDependencies || {};
|
|
29
|
+
if (deps[pkg] || devDeps[pkg]) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Fall back to node_modules check below.
|
|
35
|
+
}
|
|
36
|
+
const modulePath = path.join(cwd, "node_modules", ...pkg.split("/"));
|
|
37
|
+
return fs.existsSync(modulePath);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default async function installEdgeLib(): Promise<void> {
|
|
41
|
+
const cwd = process.cwd();
|
|
42
|
+
const pattern = "**/*.{js,jsx,ts,tsx}";
|
|
43
|
+
const files = globSync(pattern, {
|
|
44
|
+
cwd,
|
|
45
|
+
ignore: ["**/node_modules/**", "**/dist/**", "**/build/**"],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
let found = false;
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
const fullPath = path.join(cwd, file);
|
|
51
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
52
|
+
if (content.includes("@assistant-ui/react-edge")) {
|
|
53
|
+
found = true;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (found) {
|
|
59
|
+
if (isPackageInstalled("@assistant-ui/react-edge")) {
|
|
60
|
+
console.log(
|
|
61
|
+
"@assistant-ui/react-edge is already installed. Skipping installation.",
|
|
62
|
+
);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const answer = await askQuestion(
|
|
67
|
+
"Edge Runtime imports were added but @assistant-ui/react-edge is not installed. Do you want to install it? (Y/n) ",
|
|
68
|
+
);
|
|
69
|
+
if (answer === "" || answer.toLowerCase().startsWith("y")) {
|
|
70
|
+
const pm = await detect();
|
|
71
|
+
let cmd = "";
|
|
72
|
+
if (pm === "yarn") {
|
|
73
|
+
cmd = "yarn add @assistant-ui/react-edge";
|
|
74
|
+
} else if (pm === "pnpm") {
|
|
75
|
+
cmd = "pnpm add @assistant-ui/react-edge";
|
|
76
|
+
} else if (pm === "bun") {
|
|
77
|
+
cmd = "bun add @assistant-ui/react-edge";
|
|
78
|
+
} else {
|
|
79
|
+
cmd = "npm install @assistant-ui/react-edge";
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
execSync(cmd, { stdio: "inherit" });
|
|
83
|
+
} catch (e) {
|
|
84
|
+
console.error("Installation failed:", e);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
console.log("Skipping installation.");
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
console.log("No Edge Runtime imports found; skipping installation.");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { sync as globSync } from "glob";
|
|
5
|
+
import * as readline from "readline";
|
|
6
|
+
import { detect } from "detect-package-manager";
|
|
7
|
+
|
|
8
|
+
function askQuestion(query: string): Promise<string> {
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
const rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
});
|
|
14
|
+
rl.question(query, (answer) => {
|
|
15
|
+
rl.close();
|
|
16
|
+
resolve(answer);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isPackageInstalled(pkg: string): boolean {
|
|
22
|
+
const cwd = process.cwd();
|
|
23
|
+
try {
|
|
24
|
+
const pkgJsonPath = path.join(cwd, "package.json");
|
|
25
|
+
if (fs.existsSync(pkgJsonPath)) {
|
|
26
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
27
|
+
const deps = pkgJson.dependencies || {};
|
|
28
|
+
const devDeps = pkgJson.devDependencies || {};
|
|
29
|
+
if (deps[pkg] || devDeps[pkg]) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Fall back to node_modules check below.
|
|
35
|
+
}
|
|
36
|
+
const modulePath = path.join(cwd, "node_modules", ...pkg.split("/"));
|
|
37
|
+
return fs.existsSync(modulePath);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default async function installReactUILib(): Promise<void> {
|
|
41
|
+
const cwd = process.cwd();
|
|
42
|
+
const pattern = "**/*.{js,jsx,ts,tsx}";
|
|
43
|
+
const files = globSync(pattern, {
|
|
44
|
+
cwd,
|
|
45
|
+
ignore: ["**/node_modules/**", "**/dist/**", "**/build/**"],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
let found = false;
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
const fullPath = path.join(cwd, file);
|
|
51
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
52
|
+
if (content.includes("@assistant-ui/react-ui")) {
|
|
53
|
+
found = true;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (found) {
|
|
59
|
+
if (isPackageInstalled("@assistant-ui/react-ui")) {
|
|
60
|
+
console.log(
|
|
61
|
+
"@assistant-ui/react-ui is already installed. Skipping installation.",
|
|
62
|
+
);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const answer = await askQuestion(
|
|
67
|
+
"React UI imports were added but @assistant-ui/react-ui is not installed. Do you want to install it? (Y/n) ",
|
|
68
|
+
);
|
|
69
|
+
if (answer === "" || answer.toLowerCase().startsWith("y")) {
|
|
70
|
+
const pm = await detect();
|
|
71
|
+
let cmd = "";
|
|
72
|
+
if (pm === "yarn") {
|
|
73
|
+
cmd = "yarn add @assistant-ui/react-ui";
|
|
74
|
+
} else if (pm === "pnpm") {
|
|
75
|
+
cmd = "pnpm add @assistant-ui/react-ui";
|
|
76
|
+
} else if (pm === "bun") {
|
|
77
|
+
cmd = "bun add @assistant-ui/react-ui";
|
|
78
|
+
} else {
|
|
79
|
+
cmd = "npm install @assistant-ui/react-ui";
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
execSync(cmd, { stdio: "inherit" });
|
|
83
|
+
} catch (e) {
|
|
84
|
+
console.error("Installation failed:", e);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
console.log("Skipping installation.");
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
console.log("No React UI imports found; skipping installation.");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { execFileSync, spawnSync } from "child_process";
|
|
2
|
+
import debug from "debug";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { TransformOptions } from "./transform-options";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import { sync as globSync } from "glob";
|
|
8
|
+
|
|
9
|
+
const log = debug("codemod:transform");
|
|
10
|
+
const error = debug("codemod:transform:error");
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = path.dirname(__filename);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Gets the list of files that need to be processed in the codebase
|
|
17
|
+
* Only includes files that contain "assistant-ui" to optimize performance
|
|
18
|
+
*/
|
|
19
|
+
export function getRelevantFiles(cwd: string): string[] {
|
|
20
|
+
const pattern = "**/*.{js,jsx,ts,tsx}";
|
|
21
|
+
const files = globSync(pattern, {
|
|
22
|
+
cwd,
|
|
23
|
+
ignore: [
|
|
24
|
+
"**/node_modules/**",
|
|
25
|
+
"**/dist/**",
|
|
26
|
+
"**/build/**",
|
|
27
|
+
"**/*.min.js",
|
|
28
|
+
"**/*.bundle.js",
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Filter files to only include those containing "assistant-ui"
|
|
33
|
+
const relevantFiles = files.filter((file) => {
|
|
34
|
+
try {
|
|
35
|
+
const content = fs.readFileSync(path.join(cwd, file), "utf8");
|
|
36
|
+
return content.includes("assistant-ui");
|
|
37
|
+
} catch (err) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return relevantFiles.map((file) => path.join(cwd, file));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Counts the number of files that need to be processed
|
|
47
|
+
*/
|
|
48
|
+
export function countFilesToProcess(cwd: string): number {
|
|
49
|
+
return getRelevantFiles(cwd).length;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function buildCommand(
|
|
53
|
+
codemodPath: string,
|
|
54
|
+
targetFiles: string[],
|
|
55
|
+
options: TransformOptions,
|
|
56
|
+
): string[] {
|
|
57
|
+
const command = [
|
|
58
|
+
"npx",
|
|
59
|
+
"jscodeshift",
|
|
60
|
+
"-t",
|
|
61
|
+
codemodPath,
|
|
62
|
+
...targetFiles,
|
|
63
|
+
"--parser",
|
|
64
|
+
"tsx",
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
if (options.dry) {
|
|
68
|
+
command.push("--dry");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (options.print) {
|
|
72
|
+
command.push("--print");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (options.verbose) {
|
|
76
|
+
command.push("--verbose");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (options.jscodeshift) {
|
|
80
|
+
command.push(options.jscodeshift);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return command;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type TransformErrors = {
|
|
87
|
+
transform: string;
|
|
88
|
+
filename: string;
|
|
89
|
+
summary: string;
|
|
90
|
+
}[];
|
|
91
|
+
|
|
92
|
+
function parseErrors(transform: string, output: string): TransformErrors {
|
|
93
|
+
const errors: TransformErrors = [];
|
|
94
|
+
const errorRegex = /ERR (.+) Transformation error/g;
|
|
95
|
+
const syntaxErrorRegex = /SyntaxError: .+/g;
|
|
96
|
+
|
|
97
|
+
let match;
|
|
98
|
+
while ((match = errorRegex.exec(output)) !== null) {
|
|
99
|
+
const filename = match[1]!;
|
|
100
|
+
const syntaxErrorMatch = syntaxErrorRegex.exec(output);
|
|
101
|
+
if (syntaxErrorMatch) {
|
|
102
|
+
const summary = syntaxErrorMatch[0];
|
|
103
|
+
errors.push({ transform, filename, summary });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return errors;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function transform(
|
|
111
|
+
codemod: string,
|
|
112
|
+
source: string,
|
|
113
|
+
transformOptions: TransformOptions,
|
|
114
|
+
options: {
|
|
115
|
+
logStatus: boolean;
|
|
116
|
+
onProgress?: (processedFiles: number) => void;
|
|
117
|
+
relevantFiles?: string[];
|
|
118
|
+
} = { logStatus: true },
|
|
119
|
+
): TransformErrors {
|
|
120
|
+
if (options.logStatus) {
|
|
121
|
+
log(`Applying codemod '${codemod}': ${source}`);
|
|
122
|
+
}
|
|
123
|
+
const codemodPath = path.resolve(__dirname, `../codemods/${codemod}.js`);
|
|
124
|
+
|
|
125
|
+
// Use pre-computed relevant files if provided, otherwise get them
|
|
126
|
+
const targetFiles = options.relevantFiles || getRelevantFiles(source);
|
|
127
|
+
|
|
128
|
+
if (targetFiles.length === 0) {
|
|
129
|
+
log(`No relevant files found for codemod '${codemod}'`);
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
log(`Found ${targetFiles.length} relevant files for codemod '${codemod}'`);
|
|
134
|
+
|
|
135
|
+
const command = buildCommand(codemodPath, targetFiles, transformOptions);
|
|
136
|
+
|
|
137
|
+
// Use spawn instead of execFileSync to capture output in real-time
|
|
138
|
+
if (options.onProgress) {
|
|
139
|
+
const result = spawnSync(command[0]!, command.slice(1), {
|
|
140
|
+
encoding: "utf8",
|
|
141
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const stdout = result.stdout || "";
|
|
145
|
+
|
|
146
|
+
// Count the number of processed files from the output
|
|
147
|
+
const processedFiles = (stdout.match(/Processing file/g) || []).length;
|
|
148
|
+
if (options.onProgress) {
|
|
149
|
+
options.onProgress(processedFiles);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const errors = parseErrors(codemod, stdout);
|
|
153
|
+
if (options.logStatus && errors.length > 0) {
|
|
154
|
+
errors.forEach(({ transform, filename, summary }) => {
|
|
155
|
+
error(
|
|
156
|
+
`Error applying codemod [codemod=${transform}, path=${filename}, summary=${summary}]`,
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return errors;
|
|
161
|
+
} else {
|
|
162
|
+
// Use the original synchronous approach if no progress callback
|
|
163
|
+
const stdout = execFileSync(command[0]!, command.slice(1), {
|
|
164
|
+
encoding: "utf8",
|
|
165
|
+
stdio: "pipe",
|
|
166
|
+
});
|
|
167
|
+
const errors = parseErrors(codemod, stdout);
|
|
168
|
+
if (options.logStatus && errors.length > 0) {
|
|
169
|
+
errors.forEach(({ transform, filename, summary }) => {
|
|
170
|
+
error(
|
|
171
|
+
`Error applying codemod [codemod=${transform}, path=${filename}, summary=${summary}]`,
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return errors;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import debug from "debug";
|
|
2
|
+
import { transform, TransformErrors, getRelevantFiles } from "./transform";
|
|
3
|
+
import { TransformOptions } from "./transform-options";
|
|
4
|
+
import { SingleBar, Presets } from "cli-progress";
|
|
5
|
+
import installReactUILib from "./install-ui-lib";
|
|
6
|
+
import installEdgeLib from "./install-edge-lib";
|
|
7
|
+
import installAiSdkLib from "./install-ai-sdk-lib";
|
|
8
|
+
|
|
9
|
+
const bundle = ["v0-8/ui-package-split", "v0-9/edge-package-split"];
|
|
10
|
+
|
|
11
|
+
const log = debug("codemod:upgrade");
|
|
12
|
+
const error = debug("codemod:upgrade:error");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Runs the upgrade cycle:
|
|
16
|
+
* - Runs each codemod in the bundle.
|
|
17
|
+
* - Displays progress using cli-progress.
|
|
18
|
+
* - After codemods run, checks if any file now imports from the new packages and prompts for install.
|
|
19
|
+
*/
|
|
20
|
+
export async function upgrade(options: TransformOptions) {
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
log("Starting upgrade...");
|
|
23
|
+
|
|
24
|
+
// Find relevant files once to avoid duplicate work
|
|
25
|
+
console.log("Analyzing codebase...");
|
|
26
|
+
const relevantFiles = getRelevantFiles(cwd);
|
|
27
|
+
const fileCount = relevantFiles.length;
|
|
28
|
+
console.log(`Found ${fileCount} files to process.`);
|
|
29
|
+
|
|
30
|
+
// Calculate total work units (files × codemods)
|
|
31
|
+
const totalWork = fileCount * bundle.length;
|
|
32
|
+
let completedWork = 0;
|
|
33
|
+
|
|
34
|
+
const bar = new SingleBar(
|
|
35
|
+
{
|
|
36
|
+
format: "Progress |{bar}| {percentage}% | ETA: {eta}s || {status}",
|
|
37
|
+
hideCursor: true,
|
|
38
|
+
},
|
|
39
|
+
Presets.shades_classic,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
bar.start(totalWork, 0, { status: "Starting..." });
|
|
43
|
+
const allErrors: TransformErrors = [];
|
|
44
|
+
|
|
45
|
+
for (const codemod of bundle) {
|
|
46
|
+
bar.update(completedWork, { status: `Running ${codemod}...` });
|
|
47
|
+
|
|
48
|
+
// Use a custom progress callback to update the progress bar
|
|
49
|
+
const errors = transform(codemod, cwd, options, {
|
|
50
|
+
logStatus: false,
|
|
51
|
+
onProgress: (processedFiles: number) => {
|
|
52
|
+
completedWork = bundle.indexOf(codemod) * fileCount + processedFiles;
|
|
53
|
+
bar.update(Math.min(completedWork, totalWork), {
|
|
54
|
+
status: `Running ${codemod} (${processedFiles}/${fileCount} files)`,
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
relevantFiles, // Pass the pre-computed relevant files
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
allErrors.push(...errors);
|
|
61
|
+
completedWork = (bundle.indexOf(codemod) + 1) * fileCount;
|
|
62
|
+
bar.update(completedWork, { status: `Completed ${codemod}` });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
bar.update(totalWork, { status: "Checking dependencies..." });
|
|
66
|
+
bar.stop();
|
|
67
|
+
|
|
68
|
+
if (allErrors.length > 0) {
|
|
69
|
+
log("Some codemods did not apply successfully to all files. Details:");
|
|
70
|
+
allErrors.forEach(({ transform, filename, summary }) => {
|
|
71
|
+
error(`codemod=${transform}, path=${filename}, summary=${summary}`);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// After codemods run, check if files import from the new packages and prompt for install.
|
|
76
|
+
console.log("Checking for package dependencies...");
|
|
77
|
+
await installReactUILib();
|
|
78
|
+
await installEdgeLib();
|
|
79
|
+
await installAiSdkLib();
|
|
80
|
+
|
|
81
|
+
log("Upgrade complete.");
|
|
82
|
+
console.log("✅ Upgrade complete!");
|
|
83
|
+
}
|