Files
OmniRoute/scripts/build/paths.mjs
diegosouzapw 5b484737bb build(layer1): isolate Next output to .build/next; gitignore .build/ dist/ .next/
- next.config.mjs: distDir default ".next" → ".build/next" (NEXT_DIST_DIR override kept)
- .gitignore: add /.build/, /dist/, /.next/; remove loose dist/ under #dependencies
- scripts/build/paths.mjs: new shared module exporting ROOT, DIST_DIR, STANDALONE_DIR
- scripts/build/build-next-isolated.mjs: default ".next" → ".build/next" in distDir,
  resetStandaloneOutput fallback, and pruneStandaloneArtifacts
- scripts/build/prepublish.ts: NEXT_DIST default ".next" → ".build/next"
- scripts/build/assembleStandalone.mjs: legacy syncStandalone* helpers updated
  to resolve distDir via NEXT_DIST_DIR || ".build/next"
- tsconfig.json: Next.js auto-added .build/next/types includes (generated on build)

Smoke: .build/next/standalone/server.js exists; BUNDLE_OK confirmed;
no .next directory created.
2026-06-03 14:04:30 -03:00

42 lines
1.3 KiB
JavaScript

#!/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");