's'
This commit is contained in:
29
scripts/next-build.cjs
Normal file
29
scripts/next-build.cjs
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
const { spawnSync } = require("child_process");
|
||||
const path = require("path");
|
||||
const { getBuildProfile } = require("./build-resource-profile.cjs");
|
||||
|
||||
const profile = getBuildProfile();
|
||||
const memHuman = `${profile.memMB}MB`;
|
||||
const totalHuman = `${Math.round(profile.totalBytes / 1024 / 1024)}MB`;
|
||||
console.log(
|
||||
`[navsphere] build: heap=${profile.heapMB}MB parallelism=${profile.parallelism} cpus=${profile.cpus} mem≈${totalHuman} (${memHuman} effective)`
|
||||
);
|
||||
|
||||
const nextBin = path.join(__dirname, "..", "node_modules", "next", "dist", "bin", "next");
|
||||
const env = {
|
||||
...process.env,
|
||||
NAVSPHERE_WEBPACK_PARALLELISM: String(profile.parallelism),
|
||||
};
|
||||
|
||||
const r = spawnSync(
|
||||
process.execPath,
|
||||
[`--max-old-space-size=${profile.heapMB}`, nextBin, "build"],
|
||||
{
|
||||
stdio: "inherit",
|
||||
env,
|
||||
cwd: path.join(__dirname, ".."),
|
||||
}
|
||||
);
|
||||
|
||||
process.exit(r.status ?? 1);
|
||||
Reference in New Issue
Block a user