qossmic / deptrac

Keep your architecture clean.
https://qossmic.github.io/deptrac
MIT License
2.59k stars 136 forks source link

v2.0.0 includes unnecessary files #1423

Closed takaram closed 1 month ago

takaram commented 1 month ago

When I install deptrac 2.0.0 with composer, I get both phar-compiled sources and original src, vendor directories. Therefore the package size is unnecessarily large.

$ tree -L 2 vendor/qossmic/deptrac
vendor/qossmic/deptrac
├── CHANGELOG.md
├── LICENCE.md
├── README.md
├── bin
│   └── deptrac
├── bootstrap.php
├── composer.json
├── config
│   ├── cache.php
│   ├── deptrac_template.yaml
│   └── services.php
├── deptrac.phar
├── deptrac.phar.asc
├── docs
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── SECURITY.md
│   ├── bc_policy.md
│   ├── blog
│   ├── blog.md
│   ├── collectors.md
│   ├── concepts.md
│   ├── configuration.md
│   ├── debugging.md
│   ├── deptrac.png
│   ├── examples
│   ├── extending_deptrac.md
│   ├── formatters.md
│   ├── index.md
│   ├── qossmic.png
│   └── upgrade.md
├── mkdocs.yml
├── src
│   ├── Contract
│   ├── Core
│   └── Supportive
└── vendor
    ├── autoload.php
    ├── composer
    ├── doctrine
    ├── jetbrains
    ├── nikic
    ├── phpdocumentor
    ├── phpstan
    ├── psr
    ├── scoper-autoload.php
    └── symfony

I believe Deptrac v2 tries to distribute the app as a phar file, like PHPStan.

Running vendor/bin/deptrac loads the classes from the directories and does not use the phar at all. This causes #1421.

Even running vendor/bin/deptrac.phar does not use phar-compiled classes when working directory is the package root (where vendor directory locates). When you cd into another directory, then deptrac.phar loads classes from the phar (thus the result of deptrac.phar --version differs). This is because deptrac tries to load $PWD/vendor/autoload.php ( https://github.com/qossmic/deptrac-src/blob/72caeb512cfccdbb334f555ec14ba04d1376a294/bin/deptrac#L19-L21 )

gennadigennadigennadi commented 1 month ago

I believe Deptrac v2 tries to distribute the app as a phar file, like PHPStan.

v2 has a phar and a plain php version of Deptrac.

deptrac.phar --version

Shows a wrong version because of the changed packaging process. The Deptrac-src repo is missing most recent tags. We use box to build the phar and it substitutes the version string based on a tag, which the src repo is not providing at the time the phar gets build.

But you are right, there is stuff that’s accidentally committed. E.g. some tmp zip files from the building process.