mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Run library build one at a time to avoid OOM on Netlify
This commit is contained in:
parent
224b4b8058
commit
cb651adfaf
2 changed files with 25 additions and 4 deletions
|
|
@ -16,6 +16,7 @@
|
|||
"lint": "eslint . --ext ts,tsx,js,jsx --rulesdir=packages/webamp-modern/tools/eslint-rules",
|
||||
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter skin-database type-check && pnpm --filter webamp-docs type-check && pnpm --filter winamp-eqf type-check",
|
||||
"deploy": "npx turbo webamp#build webamp-modern#build --concurrency 1 && mv packages/webamp-modern/build packages/webamp/dist/demo-site/modern",
|
||||
"deploy-docs": "npx turbo webamp-docs#build",
|
||||
"format": "prettier --write '**/*.{js,ts,tsx}'"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -88,12 +88,32 @@ const BUNDLES = [
|
|||
},
|
||||
];
|
||||
|
||||
const PARALLEL_LIMIT = 1;
|
||||
|
||||
build();
|
||||
|
||||
async function build() {
|
||||
console.log(`🚀 Building ${BUNDLES.length} bundles in parallel...`);
|
||||
console.log(
|
||||
`🚀 Building ${BUNDLES.length} bundles in parallel (limit: ${PARALLEL_LIMIT})...`
|
||||
);
|
||||
|
||||
const buildPromises = BUNDLES.map(async (bundleDesc) => {
|
||||
let index = 0;
|
||||
async function nextBatch() {
|
||||
const batch = [];
|
||||
for (
|
||||
let i = 0;
|
||||
i < PARALLEL_LIMIT && index < BUNDLES.length;
|
||||
i++, index++
|
||||
) {
|
||||
batch.push(runBundle(BUNDLES[index]));
|
||||
}
|
||||
await Promise.all(batch);
|
||||
if (index < BUNDLES.length) {
|
||||
await nextBatch();
|
||||
}
|
||||
}
|
||||
|
||||
async function runBundle(bundleDesc) {
|
||||
console.log(`📦 Building ${bundleDesc.name}...`);
|
||||
const plugins = getPlugins({
|
||||
outputFile: bundleDesc.output.file,
|
||||
|
|
@ -136,8 +156,8 @@ async function build() {
|
|||
...bundleDesc.output,
|
||||
});
|
||||
console.log(`✅ Completed ${bundleDesc.name}`);
|
||||
});
|
||||
}
|
||||
|
||||
await Promise.all(buildPromises);
|
||||
await nextBatch();
|
||||
console.log(`🎉 All ${BUNDLES.length} bundles built successfully!`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue