Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maintenance: #478: Verify vite bundle size
- Loading branch information
Benjamin Scharf
committed
May 3, 2024
1 parent
1b552ce
commit bde8b8d
Showing
5 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env ruby | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require 'yaml' | ||
require 'pathname' | ||
|
||
class VerifyViteBundleSize | ||
|
||
FILENAME = Pathname.new(__dir__).join('../tmp/vite-bundle-stats.yml') | ||
MAX_CHUNK_SIZE = 500 * 1_024 | ||
|
||
def self.run | ||
puts 'Verifying vite bundle size…' | ||
YAML.load(FILENAME.read).each_pair do |chunk_name, chunk_files| | ||
chunk_size = 0 | ||
chunk_files.each_value do |v| | ||
chunk_size += + v['gzip'] | ||
end | ||
if chunk_size > MAX_CHUNK_SIZE | ||
raise "Chunk #{chunk_name} has a size of #{chunk_size}, which is higher than the allowed #{MAX_CHUNK_SIZE}.\n" | ||
end | ||
end | ||
|
||
puts "All chunks are smaller than the allowed #{MAX_CHUNK_SIZE}." | ||
end | ||
end | ||
|
||
VerifyViteBundleSize.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters