openmagic 0.35.0 → 0.35.1
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/cli.js +44 -7
- package/dist/cli.js.map +1 -1
- package/dist/toolbar/index.global.js +1 -1
- package/dist/toolbar/index.global.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2272,6 +2272,23 @@ function checkEnvPort(cwd = process.cwd()) {
|
|
|
2272
2272
|
}
|
|
2273
2273
|
return null;
|
|
2274
2274
|
}
|
|
2275
|
+
var LOCKFILE_NAMES = ["package-lock.json", "bun.lock", "bun.lockb", "yarn.lock", "pnpm-lock.yaml"];
|
|
2276
|
+
function scanParentLockfiles(projectDir) {
|
|
2277
|
+
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
2278
|
+
const project = resolve2(projectDir);
|
|
2279
|
+
const found = [];
|
|
2280
|
+
let dir = resolve2(project, "..");
|
|
2281
|
+
while (dir.length > 1 && dir.length >= home.length) {
|
|
2282
|
+
for (const lockfile of LOCKFILE_NAMES) {
|
|
2283
|
+
const p = join4(dir, lockfile);
|
|
2284
|
+
if (existsSync4(p)) found.push(p);
|
|
2285
|
+
}
|
|
2286
|
+
const parent = resolve2(dir, "..");
|
|
2287
|
+
if (parent === dir) break;
|
|
2288
|
+
dir = parent;
|
|
2289
|
+
}
|
|
2290
|
+
return found;
|
|
2291
|
+
}
|
|
2275
2292
|
function getProjectName(cwd = process.cwd()) {
|
|
2276
2293
|
const pkgPath = join4(cwd, "package.json");
|
|
2277
2294
|
if (!existsSync4(pkgPath)) return "this project";
|
|
@@ -2433,13 +2450,20 @@ async function validateAppHealth(targetHost, targetPort) {
|
|
|
2433
2450
|
console.log(chalk.dim(" The dev server is running, but no page matched."));
|
|
2434
2451
|
console.log("");
|
|
2435
2452
|
if (detectedFramework === "Next.js") {
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2453
|
+
const strayLockfiles = scanParentLockfiles(process.cwd());
|
|
2454
|
+
if (strayLockfiles.length > 0) {
|
|
2455
|
+
console.log(chalk.yellow(" Found lockfiles in parent directories that confuse Turbopack:"));
|
|
2456
|
+
for (const f of strayLockfiles) {
|
|
2457
|
+
console.log(chalk.dim(` \u2022 ${f}`));
|
|
2458
|
+
}
|
|
2459
|
+
console.log("");
|
|
2460
|
+
console.log(chalk.dim(" Fix: remove them, or add to your next.config:"));
|
|
2461
|
+
console.log(chalk.cyan(" turbopack: { root: __dirname }"));
|
|
2462
|
+
} else {
|
|
2463
|
+
console.log(chalk.dim(" Common Next.js causes:"));
|
|
2464
|
+
console.log(chalk.dim(" \u2022 Missing src/app/page.tsx (App Router) or pages/index.tsx"));
|
|
2465
|
+
console.log(chalk.dim(" \u2022 Middleware redirecting all routes to an auth provider"));
|
|
2466
|
+
}
|
|
2443
2467
|
} else if (detectedFramework === "Angular") {
|
|
2444
2468
|
console.log(chalk.dim(" Angular hint: ensure the base href matches the proxy path."));
|
|
2445
2469
|
} else if (detectedFramework === "Vite") {
|
|
@@ -2540,6 +2564,19 @@ program.name("openmagic").description("AI-powered coding toolbar for any web app
|
|
|
2540
2564
|
console.log(
|
|
2541
2565
|
chalk.green(` \u2713 Dev server running at ${targetHost}:${targetPort}`)
|
|
2542
2566
|
);
|
|
2567
|
+
if (detectedFramework === "Next.js") {
|
|
2568
|
+
const strayLockfiles = scanParentLockfiles(process.cwd());
|
|
2569
|
+
if (strayLockfiles.length > 0) {
|
|
2570
|
+
console.log("");
|
|
2571
|
+
console.log(chalk.yellow(" \u26A0 Lockfiles found in parent directories:"));
|
|
2572
|
+
for (const f of strayLockfiles) {
|
|
2573
|
+
console.log(chalk.dim(` \u2022 ${f}`));
|
|
2574
|
+
}
|
|
2575
|
+
console.log(chalk.dim(" Next.js Turbopack may use the wrong workspace root, causing 404s."));
|
|
2576
|
+
console.log(chalk.dim(" Fix: remove them, or add to next.config:"));
|
|
2577
|
+
console.log(chalk.cyan(" turbopack: { root: __dirname }"));
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2543
2580
|
const roots = (opts.root || [process.cwd()]).map(
|
|
2544
2581
|
(r) => resolve3(r)
|
|
2545
2582
|
);
|