Skip to content

Commit 103f0c2

Browse files
committed
fix: add a check to see ensure the unzipped size isn't too big
1 parent 5bf9543 commit 103f0c2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Build/CompressBuildFilesStep.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Ymir\Cli\Build;
1515

16+
use Symfony\Component\Console\Exception\RuntimeException;
1617
use Symfony\Component\Finder\Finder;
1718
use Symfony\Component\Finder\SplFileInfo;
1819
use Tightenco\Collect\Support\Arr;
@@ -63,6 +64,7 @@ public function perform(string $environment, ProjectConfiguration $projectConfig
6364
->append($this->getRequiredFiles())
6465
->append($this->getRequiredFileTypes())
6566
->append($this->getWordPressCoreFiles($projectConfiguration->getProjectType()));
67+
$totalSize = 0;
6668

6769
if ('bedrock' === $projectConfiguration->getProjectType()) {
6870
$files->exclude(['web/wp/wp-content']);
@@ -74,9 +76,14 @@ public function perform(string $environment, ProjectConfiguration $projectConfig
7476

7577
foreach ($files as $file) {
7678
$this->addFileToArchive($archive, $file);
79+
$totalSize += $file->getSize();
7780
}
7881

7982
$archive->close();
83+
84+
if ($totalSize >= 147005412) {
85+
throw new RuntimeException(sprintf('The uncompressed build is %s bytes. It must be less than 147005412 bytes to be able to deploy.', $totalSize));
86+
}
8087
}
8188

8289
/**

0 commit comments

Comments
 (0)