Skip to content

Conversation

@printminion-co
Copy link
Contributor

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

  1. apps-external/: 1.1GB (largest component)

    • spreed: 223M
    • mail: 127M
    • password_policy: 113M
    • calendar: 102M
    • deck: 65M
    • richdocuments: 59M
    • text: 51M
    • whiteboard: 45M
    • tables: 37M
    • (and others...)
  2. 3rdparty/: 93M

  3. dist/: 72M

  4. apps/: 58M

  5. core/: 25M

  6. lib/: 17M

Major Space Wasters Identified

1. Source Map Files (*.map) - 535MB 🔴

CRITICAL: These debugging files account for the largest waste.

  • Source maps are only used for debugging JavaScript in browsers
  • Completely unnecessary in production deployments
  • Action: Excluded all *.map files

2. Test Directories - ~20MB+

  • 134 vendor test directories found
  • Test directories in apps: tests/, test/, __tests__/, spec/
  • Major offenders:
    • mail/vendor/wamania/php-stemmer/test: 18M
    • Various Horde library tests: ~2-3M combined
  • Action: Excluded all test directories and test files

3. Documentation Files - ~5-10MB

  • 808 documentation and config files:
    • *.md files (README, CHANGELOG): 5.2MB
    • LICENSE*, COPYING*, CHANGELOG*: 1,416 files
  • Action: Excluded documentation (keeping only root-level files)

4. Development Configuration Files - ~2-5MB

  • .eslintrc*, .prettierrc*, .babelrc*
  • tsconfig*.json, phpunit.xml*, phpstan.neon*
  • .gitignore, .gitattributes, .npmignore
  • webpack*.js, rollup*.js, vite*.js, Gruntfile.js
  • Action: Excluded all development configuration files

Exclusions Added to Makefile

The following exclusions were added to the zip_dependencies target:

JavaScript/TypeScript Development Files

-x "**/*.map"              # Source maps (535MB!)
-x "**/*.test.js"          # JavaScript test files
-x "**/*.spec.js"          # JavaScript spec files
-x "**/*.test.ts"          # TypeScript test files
-x "**/*.spec.ts"          # TypeScript spec files
-x "**/tsconfig*.json"     # TypeScript configs
-x "**/.babelrc*"          # Babel configs
-x "**/webpack*.js"        # Webpack configs
-x "**/rollup*.js"         # Rollup configs
-x "**/vite*.js"           # Vite configs
-x "**/Gruntfile.js"       # Grunt configs
-x "**/jest.config*"       # Jest test configs

PHP Development Files

-x "**/phpunit.xml*"       # PHPUnit configs
-x "**/.phpunit.result.cache"  # PHPUnit cache
-x "**/phpstan.neon*"      # PHPStan configs
-x "**/.php_cs*"           # PHP CS Fixer configs
-x "**/.php-cs-fixer*"     # PHP CS Fixer configs

Test Directories

-x "**/tests/**"           # Test directories
-x "**/test/**"            # Test directories
-x "**/__tests__/**"       # Jest/React test dirs
-x "**/spec/**"            # Spec directories
-x "**/vendor/*/test/**"   # Vendor test dirs
-x "**/vendor/*/tests/**"  # Vendor test dirs
-x "**/vendor/*/Test/**"   # Vendor Test dirs
-x "**/vendor/*/Tests/**"  # Vendor Tests dirs

Documentation Files

-x "**/*.md"               # Markdown files
-x "**/README*"            # README files
-x "**/CHANGELOG*"         # Changelog files
-x "**/LICENSE*"           # License files (except root)
-x "**/COPYING*"           # Copying files (except root)
-x "**/docs/**"            # Documentation dirs
-x "**/doc/**"             # Documentation dirs
-x "**/documentation/**"   # Documentation dirs
-x "**/examples/**"        # Example code

Editor and Linter Configs

-x "**/.eslintrc*"         # ESLint configs
-x "**/.prettierrc*"       # Prettier configs
-x "**/.stylelintrc*"      # Stylelint configs
-x "**/.jshintrc*"         # JSHint configs
-x "**/.npmignore"         # NPM ignore files
-x "**/.gitattributes"     # Git attributes

CI/CD Files

-x "**/.gitlab-ci.yml"     # GitLab CI configs
-x "**/.travis.yml"        # Travis CI configs
-x "**/Makefile"           # Makefiles in subdirs

Expected Results

Size Reduction Breakdown

  1. Source maps: ~535MB → ~200MB compressed (biggest win!)
  2. Test directories: ~20MB → ~8MB compressed
  3. Documentation: ~10MB → ~3MB compressed
  4. Config files: ~5MB → ~2MB compressed

Estimated Final Size

  • Before: 332MB compressed (1.1GB uncompressed)
  • After: ~180-200MB compressed (~600MB uncompressed)
  • Reduction: ~40-50% smaller artifact

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:

  1. Build a new artifact:

    make clean
    make zip_dependencies
  2. Check the new size:

    ls -lh ncw-server.zip
  3. Verify contents (should NOT contain):

    unzip -l ncw-server.zip | grep -E '\.(map|test\.js|spec\.js)$'
    unzip -l ncw-server.zip | grep -E '/(tests?|__tests__|spec)/'

Benefits

  1. Faster deployments: Smaller artifacts transfer faster
  2. Reduced storage: Less space needed in artifact repositories
  3. Security: No test code or development configs in production
  4. Cleaner deployments: Only production-necessary files included
  5. Bandwidth savings: ~130-165MB less data transferred per deployment

Notes

  • All exclusions are safe for production deployments
  • No runtime functionality is affected
  • Source maps are only useful for debugging, not needed in production
  • Tests and documentation are available in the source repository
  • This follows industry best practices for production artifacts

…package

in order to reduce build artifact size

Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" \
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
-x "**/Makefile" \
-x "**/vendor/**/Makefile" \

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants