Add Composer scripts


(Mathias Brodala) #1

Add Composer scripts

To simplify daily work for TYPO3 contributors and reduce the time for onboarding of new contributors Composer scripts can be used to define details of CLI tasks once and for all.

There is a change pending which already adds a few scripts and serves as a starting point:

https://review.typo3.org/54959

We need to discuss if we agree on this in general and if there are still issues to be tackled before this can be merged.

Impact

For example running unit tests becomes as simple as executing composer t:p:u or possibly just composer test. Setting up the Gerrit post commit hook is done automatically upon composer install.

Pro

  • Less repetition for daily work
  • No more errors due to typos or similar
  • Faster onboarding for new contributors

Con

  • None

Organizational

Topic Initiator: Sybille Peters
Topic Mentor: Mathias Brodala


(Claus Due) #2

One “Con” to add:

  • Composer has automatic switching if you use xdebug, it then spawns another PHP process that has xdebug disabled - which means that you cannot debug through the composer scripts. The xdebug shared object is not loaded at all.

While it isn’t directly a con as long as the original scripts remain in place, it does mean that there is one more difference to be aware of and two ways of calling the same script, each with its own implications. I’m not sure it is common knowledge that composer does this…


(Markus Klein) #3

Instead of the test-command I would prefer proper documentation on how to run tests via CLI, via PHPStorm, via “you name it” on docs.typo3.org.


(Mathias Brodala) #4

Of course, proper docs for all cases are essential and is in fact WIP. But I don’t really see a instead of here since both can coexist peacefully.


(Sybille Peters) #5

@liayn Some information has been added to the TYPO3 contribution guide in the past months:

If this is not sufficient enough, please propose changes (as issues) or make them yourself :grinning:

It might be a good idea to communicate this more, but we are still working on some changes for the Contribution Guide and I think it is a good idea to wait until this is done and then post a news entry about it.

And I agree with Mathias, having good docs and good command shortcuts are not 2 competing approaches, I think there should be both.

Another thing about docs: Documentation not only needs to be written, it needs to be maintained as well and kept up-to-date. So I wouldn’t go and document all the various ways you can setup your environment. What we have now is - I think - already pretty sufficient.


(Riccardo De Contardi) #6

No particular opinion on this topic


(Sybille Peters) #7

What I find most important about this patch right now:

  1. Does it in any way disrupt the current workflow?
  2. Does it do any other harm, e.g. if the commands are confusing or do not work?
  3. and, is it helpful?

About 1: It would be important to look at it closely and very thoroughly test it. Because it does things automatically on composer install, namely copying the commit hook. I have excessively tested this, e.g. removed hook directory entirely and run composer install.

About 2: That would be a clear “no” from me.

The unit test commands and everything else works like a charm.

We actually removed some of the commands, where there where objections (e.g. running functional tests, command for opening docs in browser) and things that might break or were not entirely portable. The current version is a very minimal subset of possible commands.

About 3: There are a number of commands to be executed, if you want to setup your sytem for core contribution.

Conclusion: If there are no serious concerns, why not merge it?


(Jigal Van Hemert) #8

In general: a good idea. The exact implementation can better be discussed in gerrit (because there is already a patch set active).


(Mathias Brodala) #9

That’s true and there is no way around this AFAIS, so if we ever decide to record code coverage we’ll need a different solution.


(Tymoteusz Motylewski) #10

I like the idea of installing commit hook on composer install.
It simplifies the setup for new contributors, and TYPO3 is considered not easy to set up for the first time. So I’m +1 for this.

About the xdebug being disabled, that’s an intrersting news, didn’t know about it.
However according to https://blog.riff.org/2018_01_27_tip_of_the_day_how_to_debug_composer_scripts_with_xdebug_and_phpstorm you can work arond this limitation by passing COMPOSER_ALLOW_XDEBUG env variable.


(Moritz) #11

I agree with Tymoteusz and am in favor of this. Just don’t forget to document it. :slight_smile:


(Mathias Brodala) #12

Thank you all for your feedback. Especially thanks to @tmotylewski for the Xdebug hint which is the only con mentioned AFAIS.

I’ll propose to get this merged finally.


(Claus Due) #13

Thanks for the tip! Looks like they added this shortly after adding the process shifting - very useful.


(system) #14

This topic was automatically closed after 14 days. New replies are no longer allowed.