mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-21 22:32:22 +03:00
build: omit the standalone output target for contributor builds (#12204)
Completes the contributor profile: #12198 stopped OmniRoute from assembling the standalone bundle, but Next was still asked to emit one. Making output: "standalone" conditional on OMNIROUTE_BUILD_PROFILE=contributor removes the standalone tracing pass itself, which is where the remaining time went. Default builds are unaffected — the flag is read from the env at config load and is false everywhere except the contributor profile, so tests/unit/next-config.test.ts still observes output === "standalone" (18/18 green across contributor-build-script, next-config and build-profile-stubs). Reconciled on merge: CONTRIBUTING.md and scripts/build/backendOnlyPages.mjs already carried this stack's earlier steps on the tip, so both took the tip's side; only the next.config.mjs conditional and its test are this step's delta. Thanks @rafacpti23 for splitting this into four reviewable steps — it made the whole stack easy to reason about.
This commit is contained in:
@@ -109,6 +109,8 @@ function filterKnownInfrastructureWarnings(baseConsole) {
|
||||
// The resulting artifact is intended to be published as `omniroute-secure`
|
||||
// for security-sensitive environments. See docs/security/SOCKET_DEV_FINDINGS.md.
|
||||
const isMinimalBuild = process.env.OMNIROUTE_BUILD_PROFILE === "minimal";
|
||||
// Contributor builds validate compilation only and do not need a shippable standalone bundle.
|
||||
const isContributorBuild = process.env.OMNIROUTE_BUILD_PROFILE === "contributor";
|
||||
|
||||
// #10273: `null` unless the operator opts in with DASHBOARD_ALLOW_EMBED=vscode. Read at build
|
||||
// time like every other knob in this file (OMNIROUTE_BASE_PATH, OMNIROUTE_BUILD_PROFILE, …),
|
||||
@@ -218,7 +220,7 @@ const nextConfig = {
|
||||
},
|
||||
],
|
||||
},
|
||||
output: "standalone",
|
||||
...(isContributorBuild ? {} : { output: "standalone" }),
|
||||
compress: true,
|
||||
productionBrowserSourceMaps: false,
|
||||
// OmniRoute is a proxy for AI APIs — request bodies routinely include
|
||||
|
||||
@@ -7,6 +7,8 @@ import {
|
||||
stubContributorInstrumentation,
|
||||
} from "../../../scripts/build/backendOnlyPages.mjs";
|
||||
|
||||
const nextConfigSource = fs.readFileSync(path.join(process.cwd(), "next.config.mjs"), "utf8");
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf8"));
|
||||
|
||||
test("contributor build profile selects the webpack fallback", () => {
|
||||
@@ -48,3 +50,11 @@ test("contributor instrumentation stubs are reversible", async () => {
|
||||
for (const [target, source] of originals) assert.equal(await fs.readFile(target, "utf8"), source);
|
||||
await fs.rm(tempRoot, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
test("contributor profile disables standalone output while default keeps it", () => {
|
||||
assert.match(nextConfigSource, /isContributorBuild/);
|
||||
assert.match(
|
||||
nextConfigSource,
|
||||
/\.\.\.\(isContributorBuild \? \{\} : \{ output: "standalone" \}\)/
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user