diff --git a/package.json b/package.json index 13ae6f080f..ded6ef972d 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "docusaurus": "docusaurus", "start": "npm run generate-icon-types && docusaurus start --no-minify", "start:current": "npm run generate-icon-types && cross-env DOCUSAURUS_VERSIONS='current' docusaurus start --no-minify", - "build": "npm run generate-icon-types && docusaurus build && tsx scripts/split-sitemap.ts && node scripts/generate-robots.js", - "build:current": "npm run generate-icon-types && cross-env DOCUSAURUS_VERSIONS='current' docusaurus build && tsx scripts/split-sitemap.ts && node scripts/generate-robots.js", + "build": "npm run generate-icon-types && node --max-old-space-size=8192 --require ./scripts/patch-fs.cjs ./node_modules/@docusaurus/core/bin/docusaurus.mjs build && tsx scripts/split-sitemap.ts && node scripts/generate-robots.js", + "build:current": "npm run generate-icon-types && cross-env DOCUSAURUS_VERSIONS='current' node --max-old-space-size=8192 --require ./scripts/patch-fs.cjs ./node_modules/@docusaurus/core/bin/docusaurus.mjs build && tsx scripts/split-sitemap.ts && node scripts/generate-robots.js", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", diff --git a/scripts/deploy.ps1 b/scripts/deploy.ps1 index 04e5f949ea..6109b72941 100644 --- a/scripts/deploy.ps1 +++ b/scripts/deploy.ps1 @@ -185,10 +185,10 @@ if ($LASTEXITCODE) { throw 'Docusaurus build failed' } $BuildDir = [IO.Path]::Combine($PSScriptRoot, '..', 'build') if (-not (Test-Path $BuildDir)) { throw "Build folder not produced ($BuildDir)" } -# Warn (don't block) if the build emitted any empty (0-byte) asset. -$empty = Get-ChildItem $BuildDir -Recurse -File | Where-Object { $_.Length -eq 0 -and $_.Name -ne '.nojekyll' } +# Warn on empty (0-byte) assets under build/assets/ (static/ files may be 0 bytes on purpose). +$empty = Get-ChildItem (Join-Path $BuildDir 'assets') -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Length -eq 0 } if ($empty) { - Write-Warning "Build produced $($empty.Count) empty file(s): $(($empty | Select-Object -First 20 -ExpandProperty Name) -join ', ')" + Write-Warning "Build produced $($empty.Count) empty (0-byte) asset(s) under assets/, e.g.: $(($empty | Select-Object -First 10 -ExpandProperty Name) -join ', ')" } if ($DryRun) { @@ -199,7 +199,7 @@ if ($DryRun) { # Phase 1 — upload new hashed assets without --delete so old bundles remain # on S3 while CloudFront still serves the old index.html from edge cache - # cached aggresively + # cached aggresively Write-Host " [1/4] Upload: hashed assets (assets/*)" -ForegroundColor Gray aws s3 sync $BuildDir "s3://$S3BucketName/" --only-show-errors ` --exclude "*" ` diff --git a/scripts/patch-fs.cjs b/scripts/patch-fs.cjs new file mode 100644 index 0000000000..4f344e9110 --- /dev/null +++ b/scripts/patch-fs.cjs @@ -0,0 +1,5 @@ +try { + require("graceful-fs").gracefulify(require("fs")); +} catch (err) { + console.warn(`[patch-fs] graceful-fs unavailable; EMFILE mitigation skipped: ${err.message}`); +}