mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
- scripts/build/prepublish.ts: APP_DIR -> DIST_DIR; remove Step 1 and Step 2.5 hack blocks; fix MCP esbuild outfile (app/ -> dist/); update all log messages - scripts/build/build-next-isolated.mjs: remove legacy-app-snapshot entry from getTransientBuildPaths() (App-Router collision hack deleted) - scripts/build/assembleStandalone.mjs: fix standalone package.json after copy — removes "type":"module" so Next.js standalone server.js (CJS) loads correctly; also adds .build/next/ to allowed staging prefixes so server bundles are kept - scripts/build/pack-artifact-policy.ts: app/ -> dist/ in all PACK_ARTIFACT_* paths; add ".build/next/" to APP_STAGING_ALLOWED_PATH_PREFIXES (Layer 1 distDir change) - scripts/build/validate-pack-artifact.ts: dist/ check instead of app/ - scripts/build/postinstall.mjs: all app/ paths -> dist/ - scripts/build/postinstallSupport.mjs: hasStandaloneAppBundle checks dist/server.js - bin/cli/commands/serve.mjs: APP_DIR -> dist/ - package.json: files[] "app/" -> "dist/" - .gitignore: remove both /app and /app/ entries (no longer needed) Smoke: NO_APP_DIR_OK; DIST_OK; check:pack-artifact PASS; health 200 from dist/
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { existsSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
|
|
/**
|
|
* Detect whether the current install tree contains the published standalone bundle.
|
|
* Checks for dist/server.js (Layer 1: renamed from app/server.js).
|
|
* Source checkouts will not have dist/ so postinstall skips platform-specific
|
|
* native repairs (which only apply to the shipped pre-built bundle).
|
|
*
|
|
* @param {string} rootDir
|
|
* @returns {boolean}
|
|
*/
|
|
export function hasStandaloneAppBundle(rootDir) {
|
|
return existsSync(join(rootDir, "dist", "server.js"));
|
|
}
|
|
|
|
/**
|
|
* Returns true when running inside a Termux environment on Android.
|
|
*
|
|
* Node.js on Termux reports process.platform === "linux" (not "android"),
|
|
* so OS-level platform checks are insufficient. Use Termux-specific signals:
|
|
* 1. TERMUX_VERSION env var (set by Termux bootstrap, most reliable)
|
|
* 2. PREFIX env var containing "com.termux"
|
|
* 3. Filesystem probe at /data/data/com.termux (last resort, no env needed)
|
|
*
|
|
* @param {object} [env] Override process.env for testing.
|
|
* @returns {boolean}
|
|
*/
|
|
export function isTermux(env = process.env) {
|
|
if (env.TERMUX_VERSION) return true;
|
|
if (typeof env.PREFIX === "string" && env.PREFIX.includes("com.termux")) return true;
|
|
try {
|
|
return existsSync("/data/data/com.termux");
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|