exclude additional files and directories from final package#58
exclude additional files and directories from final package#58printminion-co wants to merge 1 commit intomainfrom
Conversation
…package in order to reduce build artifact size Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the artifact size by excluding unnecessary development and debug files from the production package. The changes target a ~40-50% reduction in artifact size (from 332MB to approximately 180-200MB) by removing source maps, test files, documentation, and development configuration files.
Key changes:
- Excludes JavaScript/TypeScript source maps (*.map files), which account for ~535MB of uncompressed space
- Removes test directories and test files across all vendor dependencies and applications
- Filters out development configuration files (linter configs, build tool configs, CI/CD files) and documentation that aren't needed in production deployments
Comments suppressed due to low confidence (1)
Makefile:1
- Excluding all LICENSE and COPYING files may violate open source license requirements, which often mandate that license files be distributed with the software. Consider preserving license files for dependencies, or at minimum document that license compliance has been verified and these files are intentionally excluded.
# SPDX-FileCopyrightText: 2025 STRATO GmbH
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| -x "**/examples/**" \ | ||
| -x "**/.gitlab-ci.yml" \ | ||
| -x "**/.travis.yml" \ | ||
| -x "**/Makefile" \ |
There was a problem hiding this comment.
This exclusion pattern will remove the root Makefile itself from the package, which may be needed for production operations. Consider using a more specific pattern like -x '**/vendor/**/Makefile' or -x '**/node_modules/**/Makefile' to only exclude Makefiles within dependencies.
| -x "**/Makefile" \ | |
| -x "**/vendor/**/Makefile" \ |
Artifact Size Optimization Analysis
Summary
Date: October 22, 2025
Current artifact size: 332MB (1.1GB uncompressed)
Estimated reduction: ~40-50% (saving ~130-165MB)
Analysis Results
Space Usage Breakdown
apps-external/: 1.1GB (largest component)
3rdparty/: 93M
dist/: 72M
apps/: 58M
core/: 25M
lib/: 17M
Major Space Wasters Identified
1. Source Map Files (*.map) - 535MB 🔴
CRITICAL: These debugging files account for the largest waste.
*.mapfiles2. Test Directories - ~20MB+
tests/,test/,__tests__/,spec/mail/vendor/wamania/php-stemmer/test: 18M3. Documentation Files - ~5-10MB
*.mdfiles (README, CHANGELOG): 5.2MBLICENSE*,COPYING*,CHANGELOG*: 1,416 files4. Development Configuration Files - ~2-5MB
.eslintrc*,.prettierrc*,.babelrc*tsconfig*.json,phpunit.xml*,phpstan.neon*.gitignore,.gitattributes,.npmignorewebpack*.js,rollup*.js,vite*.js,Gruntfile.jsExclusions Added to Makefile
The following exclusions were added to the
zip_dependenciestarget:JavaScript/TypeScript Development Files
PHP Development Files
Test Directories
Documentation Files
Editor and Linter Configs
CI/CD Files
Expected Results
Size Reduction Breakdown
Estimated Final Size
What's Still Included (Production Files Only)
✅ Compiled JavaScript bundles (dist/, js/ directories)
✅ PHP source code (lib/, apps/, apps-external/)
✅ Composer vendor dependencies (without test directories)
✅ Images, icons, and assets
✅ Configuration files needed at runtime
✅ Root-level LICENSE and documentation files
✅ All production code and dependencies
Validation
To validate the optimization:
Build a new artifact:
Check the new size:
Verify contents (should NOT contain):
Benefits
Notes