build(verify): close ralph-loop-1 gaps — align tests + fix stale .next/app refs

- tests/unit/build-next-isolated.test.ts: align to .build/next distDir + removed
  app-snapshot transient entry (was RED 4/7 -> 7/7); legitimate alignment to the
  intentional Layer-1 behavior change, not masking.
- scripts/dev/run-next-playwright.mjs: testDistDir() default .next -> .build/next
  (E2E start runner found the standalone at the wrong path).
- prepublish.ts: stale log 'app/docs/' -> 'dist/docs/'.
- electron/README.md: '.next/standalone' -> '.build/next/standalone'.
- remove dead scripts/build/paths.mjs (created in L1, imported by nothing).
Verified: build-next-isolated 7/7, run-next-playwright 3/3, assemble 1/1, lint clean.
This commit is contained in:
diegosouzapw
2026-06-03 16:06:59 -03:00
parent e390a8d633
commit 0231fbb335
5 changed files with 16 additions and 48 deletions

View File

@@ -229,7 +229,7 @@ Place your icons in `assets/`:
1. Check if port 20128 is available: `lsof -i :20128`
2. Check console logs for `[Electron]` prefix
3. Verify the build output exists in `.next/standalone`
3. Verify the build output exists in `.build/next/standalone`
### White Screen

View File

@@ -1,41 +0,0 @@
#!/usr/bin/env node
/**
* Shared build-path constants for OmniRoute build scripts.
*
* All build scripts that need to locate the Next.js distDir or the assembled
* standalone output dir should import from here so that the single source of
* truth (NEXT_DIST_DIR env + the ".build/next" default) is never scattered
* across multiple files.
*
* Layer 1 change: default distDir moved from ".next" to ".build/next".
* Consumers may still override via NEXT_DIST_DIR env var.
*/
import path from "node:path";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
/**
* Absolute path to the repository root.
* Derived from this file's location: scripts/build/paths.mjs → ../../
*/
export const ROOT = path.resolve(__dirname, "..", "..");
/**
* Next.js distDir (where `next build` writes its output).
* Defaults to ".build/next"; overridable via NEXT_DIST_DIR env var.
*
* @type {string} - absolute path
*/
export const DIST_DIR = path.resolve(ROOT, process.env.NEXT_DIST_DIR || ".build/next");
/**
* Absolute path to the Next.js standalone output directory inside distDir.
* This is the raw output of `next build --output=standalone` before assembly.
*
* @type {string} - absolute path
*/
export const STANDALONE_DIR = path.join(DIST_DIR, "standalone");

View File

@@ -296,7 +296,7 @@ if (existsSync(docsMarkdownSrc)) {
cpSync(join(docsMarkdownSrc, mdFile), join(docsDest, mdFile));
}
if (mdFiles.length > 0) {
console.log(`[prepublish] Copied ${mdFiles.length} docs markdown files to app/docs/`);
console.log(`[prepublish] Copied ${mdFiles.length} docs markdown files to dist/docs/`);
}
}

View File

@@ -34,7 +34,9 @@ const standalonePublicDir = join(cwd, testDistDir(), "standalone", "public");
let appDirMoved = false;
function testDistDir() {
return process.env.NEXT_DIST_DIR || ".next";
// Layer 1 moved the Next distDir default to .build/next; the Playwright
// `start` runner must resolve the standalone server under the same dir.
return process.env.NEXT_DIST_DIR || ".build/next";
}
function resolvePlaywrightDataDir({ cwd, env, pid = process.pid }) {

View File

@@ -110,9 +110,11 @@ test("resolveNextBuildEnv forces stable build worker mode unless already provide
test("getTransientBuildPaths leaves _tasks in place by default", () => {
const paths = getTransientBuildPaths("/repo", {});
// Layer 1 deleted the root-level `app/` move-out hack, so the only default
// transient path left is the Wine prefix. ("legacy app snapshot" is gone.)
assert.deepEqual(
paths.map((entry) => entry.label),
["legacy app snapshot", "local Wine prefix"]
["local Wine prefix"]
);
assert.equal(
paths.some((entry) => path.basename(entry.sourcePath) === "_tasks"),
@@ -131,13 +133,17 @@ test("getTransientBuildPaths only moves _tasks when explicitly enabled", () => {
test("pruneStandaloneArtifacts removes traced _tasks from standalone output", async () => {
await withTempDir(async (tempDir) => {
const tracedTaskFile = path.join(tempDir, ".next", "standalone", "_tasks", "plan.md");
// Layer 1 moved the Next distDir default to .build/next.
const tracedTaskFile = path.join(tempDir, ".build", "next", "standalone", "_tasks", "plan.md");
await fs.mkdir(path.dirname(tracedTaskFile), { recursive: true });
await fs.writeFile(tracedTaskFile, "transient planning artifact");
await pruneStandaloneArtifacts(tempDir);
assert.equal(fsSync.existsSync(path.join(tempDir, ".next", "standalone", "_tasks")), false);
assert.equal(
fsSync.existsSync(path.join(tempDir, ".build", "next", "standalone", "_tasks")),
false
);
});
});
@@ -152,7 +158,8 @@ test("syncStandaloneNativeAssets copies wreq-js native runtime into standalone o
);
const destinationNativeFile = path.join(
tempDir,
".next",
".build",
"next",
"standalone",
"node_modules",
"wreq-js",