Review main Merged

88921[TASK] Merge runTests.sh frontend build scripts into one reliable verb

Benjamin Franzke CR +2 V +2 Easy +3 −9 updated 04/03/25, 12:23

Commit message

Since `grunt scripts` and `grunt css` are incremental build verbs
(intended to be used after a full rebuild, e.g. by `grunt watch`)
and require cache files to be manually invalidated when switching
between different commits, the "easy" mode frontend building via
`runTests.sh` is now providing a single "build" command that will call
`npm run build` in order to rebuild all frontend assets.

`npm run build`:
  a) is fast enough since #106357 (~9sec instead of 40sec).
     It has equal runtime, since all build jobs are run
     in parallel on different CPU cores
  b) ensures that all caches are clean and that the result will pass CI

Also avoid using `npm ci`. `npm ci` is targeted for CI environments,
while `npm install` is targeted for usage on development machines (also
respects package-lock.json, see commit description for #96355), as it
will incremently update node_modules (fast) instead of always wiping it
off.
Please note that CI will still use `npm ci` since the build verification
is performed via `checkGruntClean`.

That means invocations of:

  Build/Scripts/runTests.sh -s buildJavascript
  Build/Scripts/runTests.sh -s buildCss

Are to be replaced by:

  Build/Scripts/runTests.sh -s build

For fine-grained build-target selection or advanced usage it is still
suggested to use nvm or nodejs directly and invoke scripts via `npm`
instead of the `runTests.sh` wrapper, as this avoids the need for
using a TYPO3-specific nodejs image:

  cd Build
  nvm use
  npm run build
  # for consecutive watching after an initial rebuild
  npm run watch:build
  # run JavaScript unit tests as a watcher
  npm run watch:test
  # building temporary sourcemaps
  npm run build -- --sourcemaps

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1315

  1. Benjamin Franzke uploaded patch set 1 04/02/25, 14:37

  2. Benjamin Franzke updated the commit message in patch set 2 04/02/25, 14:40

  3. Benjamin Franzke uploaded patch set 3 04/02/25, 14:41

  4. core-ci voted on patch set 3 V +1 04/02/25, 14:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76896

  5. Stefan Bürk commented on patch set 3 04/02/25, 16:03

    In general fine for me, and at least on linux it is pretty fast. When this get's merged we need to ensure that the TYPO3 Core Contribution guide is adopted/changed and some places to update the documentation for these calls. Thanks for that change. Should we consider to do that also in v12 to have that aligned in all currently supported versions ? Note for other reviewers - impact is only for local usage, the CI does not use the two old calls and no adoption needed.
    Sure about that ? Should that not be more like: ``` npm run watch:build ``` cannt find `watch` in `Build/package.json`. Beside that, in general possible to use ``` Build/Scripts/runTests.sh -s npm -- <npm command line args and options> ``` but sure about the impact on macs .... at least build parts should be doable.
  6. Stefan Bürk voted on patch set 3 V +1 04/02/25, 16:03

  7. Garvin Hicking commented on patch set 3 04/02/25, 16:51

    Reply

    I wonder if we could keep buildCss and buildJavascript as aliases for "build" jist to not break custom aliases for people like me? 😇
  8. Stefan Bürk commented on patch set 3 04/02/25, 21:25

    Reply

    Thought about that also - but when should we remove it than ? I'd say you will learn that pretty fast as a active contributor. Personally I would drop it directly. The output states to read the helptext. 😎
  9. Garvin Hicking commented on patch set 3 04/03/25, 05:50

    Reply

    My main reason would just be existing docs and support chat texts that mention the old command and get people annoyed why it doesnt work. the runTests sh output is quite intimidating, so I want to maximize the convenience, that would be my intent. we havw a high contribution hurdle so I just want to not unnecessarily raise it if possible. i do embrace the new build command!
  10. Benjamin Franzke uploaded patch set 4 V +1 04/03/25, 07:09

  11. Benjamin Franzke commented on patch set 4 04/03/25, 07:09

    Reply

    Imho the hurdle is to use runTests *at all*, frontend devs expect to just use `npm` without having to load our custom nodejs images that do not offer any advantage over `nvm` (for the contributor). But I do not want to open this discussion, just wanted to fix this wrapper for whoever thinks this is helpful for the personal development workflow… Anyway, I've changed to `build*)` to allow all previous verbs as alias.

    Reply

    Ack, `npm run watch:build` > Beside that, in general possible to use Yea, fine by me, but `runTests.sh -s npm -- ` is just not handy for frontend devs… ;)
  12. core-ci voted on patch set 4 V +1 04/03/25, 07:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76926

  13. Garvin Hicking commented on patch set 4 CR +1 V +1 04/03/25, 07:21

    Thanks, this variant would be a great step forward to me! I will take care of the contribution docs once merged.
  14. Georg Ringer voted on patch set 4 CR +2 V +2 04/03/25, 12:23

  15. Georg Ringer merged patch set 5 04/03/25, 12:23