clue/graph-composer

Add --dev argument and behave similar to composer by ignoring development dependencies

clue opened this issue · 8 comments

clue commented

The current behavior is to also visualize development dependencies. This should be changed to ignore them by default and add a new --dev argument flag which enables showing development dependencies.

A bit more complex than that.

--dev should show development dependencies of the package itself. dev-dependencies further by tree should be ignored always

clue commented

A bit more complex than that.

Indeed, just analyzing this whole thing took me like an hour. The actual package information is parsed by jms/composer-deps-analyzer and I think we've encountered a few minor flaws. The following observations have been performed on a temporarily patched version and I'll file a few PRs in the next couple of days.

Considering the project "clue/graph" for example. If you happen to install it via "composer install --no-dev", its graph will look like this:
install-nodev

And alternatively, if you install it via "composer install --dev" (the default), its graph will look like this:
install-dev

So the behavior depends on whether the development dependencies are installed. And in my opinion this is what makes most sense, in order to display what is actually installed.

Even if "phpunit/phpunit" is not installed in the former case, it still makes sense to provide just the indication that it is a development dependency. One thing I'd like to change though, is to give an additional indication that it's in fact not installed (like semi-transparency).

dev-dependencies further by tree should be ignored always

Agreed, and I think this should already be the case.

Additionally, I think instead of adding a "--dev" option, it's probably better to add an "--no-dev" option instead, to mimic composer's current behavior. No matter how the root package is installed, its graph should then looks like this:
nodev

Any thoughts?

mimicking composer's --no-dev option is a good idea. I do not have any idea how to make it happen but it is definitely a need :) +1

clue commented

@shprink, absolutely! I've opened a PR to support this in the underlying library just yesterday (schmittjoh/composer-deps-analyzer#9). I'll report progress in this ticket.

Good to know thanks. At the moment I had to re-install temporary repo with --no-dev to get the right diagram.
Good job btw, you saved my day :)

any news?

clue commented

any news?

Yeah, I've pushed an upstream PR (schmittjoh/composer-deps-analyzer#9), but haven't received any feedback so far.

Meanwhile, there's also a pending PR (#19) which implements this in our code base instead of pushing this upstream. I suppose any input is welcome :) Perhaps coordinate efforts and pick up either / decide on either PR? 👍

Not much to add, except a strong +1 for being able to ignore require-dev dependencies of my package and those of the require packages my package depends on.