Skip to content

refactor: reorganize zip module into smaller focused files#828

Merged
shyim merged 3 commits intomainfrom
refactor/reorganize-zip-module
Feb 3, 2026
Merged

refactor: reorganize zip module into smaller focused files#828
shyim merged 3 commits intomainfrom
refactor/reorganize-zip-module

Conversation

@shyim
Copy link
Member

@shyim shyim commented Feb 3, 2026

Extract code from the large zip.go file into focused modules:

  • internal/archiver/: generic zip/unzip utilities
  • cleanup.go: file cleanup and filtering logic
  • checksum.go: XXH128 file checksumming
  • packagist.go: Shopware version lookup via Packagist API

This improves code organization, testability, and makes the codebase easier to navigate.

Extract code from the large zip.go file into focused modules:
- internal/archiver/: generic zip/unzip utilities
- cleanup.go: file cleanup and filtering logic
- checksum.go: XXH128 file checksumming
- packagist.go: Shopware version lookup via Packagist API

This improves code organization, testability, and makes the codebase
easier to navigate.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 3, 2026 05:47
Copy link
Contributor

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 refactors the large zip.go file into smaller, more focused modules to improve code organization and testability. The refactoring extracts generic zip utilities, file cleanup logic, checksumming, and Packagist API integration into separate files while maintaining backward compatibility through proper function exports.

Changes:

  • Extracted generic zip/unzip utilities to a new internal/archiver package with comprehensive test coverage
  • Moved file cleanup and filtering logic to cleanup.go with dedicated test file
  • Moved XXH128 checksumming functionality to checksum.go
  • Extracted Shopware version lookup via Packagist API to packagist.go
  • Added helper methods (ResolvePath, ResolveName) to ConfigExtraBundle for consistent path resolution
  • Added shared helper function getShopwareVersionConstraintFromComposer to reduce code duplication between PlatformPlugin and ShopwareBundle
  • Updated all references across the codebase to use the new package structure

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/archiver/zip.go New package containing generic zip/unzip utilities (Unzip, CreateZip, AddZipFiles)
internal/archiver/zip_test.go Comprehensive tests for archiver package including zip slip security tests
internal/extension/cleanup.go File cleanup and filtering logic extracted from zip.go
internal/extension/cleanup_test.go Comprehensive tests for cleanup functionality
internal/extension/checksum.go XXH128 checksumming logic for extension files
internal/extension/packagist.go Shopware version lookup via Packagist API
internal/extension/config.go Added ResolvePath and ResolveName helper methods to ConfigExtraBundle
internal/extension/root.go Added shared getShopwareVersionConstraintFromComposer helper; updated to import archiver package
internal/extension/platform.go Refactored to use shared getShopwareVersionConstraintFromComposer helper
internal/extension/bundle.go Refactored to use shared getShopwareVersionConstraintFromComposer helper
internal/extension/validator_assets.go Updated to use ConfigExtraBundle.ResolvePath helper
internal/extension/asset.go Updated to use ConfigExtraBundle.ResolveName and ResolvePath helpers
internal/extension/git.go Updated to import and use archiver.Unzip
internal/extension/zip.go Significantly reduced by extracting code to focused modules
cmd/extension/extension_zip.go Updated to use archiver.CreateZip
cmd/project/project_extension_upload.go Updated to use archiver.AddZipFiles

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shyim shyim merged commit 7f819bb into main Feb 3, 2026
3 checks passed
@shyim shyim deleted the refactor/reorganize-zip-module branch February 3, 2026 06:27
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.

1 participant