justafish / ddev-drupal-core-dev

ddev addon for core development
Apache License 2.0
24 stars 10 forks source link

yarn v4 #12

Closed simesy closed 7 months ago

simesy commented 7 months ago

Hi there. I think - because of https://www.drupal.org/node/3428571 - In order to run the

ddev get justafish/ddev-drupal-core-dev

I needed to get yarn v4 with

ddev exec corepack enable
ddev exec yarn set version stable
simesy commented 7 months ago

So there is a ticket https://github.com/ddev/ddev/issues/5987 which I believe would see Ddev run corepack enable which means the only addition to this module would be to run ddev exec yarn set version stable (or something like this).

rpkoller commented 7 months ago

we've taken a look at the problem in a thread in the #drupalsouth-code-springt-channel together with @rfay. The problem is two fold. First from Drupal 11 on Drupal Core is using Yarn 4. In the corresponding PR https://github.com/ddev/ddev/pull/5988 to the issue @simesy linked, corepack enable is simply run. running ddev with an artifact from that PR still doesnt fix the issue. the following line in the post install actions is still failing:

  - cd ../ && ddev exec yarn --cwd="core"

problem is --cwdis not working as expected. Not matter if you manually run ddev exec yarn --cwd="core"on the host or yarn --cwd="core"inside the container the command fails to run. but if you run cd core && yarninside the container or cd core && ddev yarnon the host it then works, yarn is running.

so the best approach as soon as the yarn problem is fixed inside ddev would be to change the line in the install file to - cd ../ && cd core && ddev yarn . @rfay suggested another approach for the addon here:

Or the add-on can enable corepack already and then will work with or without

but another aspect we've noticed is that corepack is still an experimental feature )https://nodejs.org/api/corepack.html) and in addition to that it turned out that yarn fails and is not available anymore in case you disable the corepack again with ddev exec corepack disable, so @rfay even suggested to add yarn as a configuration option to the ddev config.yaml. that way you could set yarn to version 4 on drupal 11 based project types and to version 1.x on project types for drupal 8 to 10. that would be a more robust approach.

rfay commented 7 months ago

Fixed in

I guess you can close @simesy if you like it.

simesy commented 7 months ago

Testing with

From README

$ ddev corepack enable
Error: unknown command "corepack" for "ddev"

On ddev get justafish/ddev-drupal-core-dev

$ ddev get justafish/ddev-drupal-core-dev
Installing justafish/ddev-drupal-core-dev:v0.0.10
Downloading https://api.github.com/repos/justafish/ddev-drupal-core-dev/tarball/v0.0.10
v0.0.10_1807368910.tar.gz 12.32 KiB / ? [------------------------------------------------------------------------------------------=-------------] 126.14% 1s

Installing project-level components:
👍 web-build/Dockerfile
👍 docker-compose.core-dev-selenium.yaml
👍 core-dev/phpunit-firefox.xml
👍 core-dev/phpunit-chrome.xml
👍 commands/web/drupal
👍 commands/web/phpunit
👍 commands/web/nightwatch
👍 core-dev/gitignore
👍 core-dev/.env
👍 core-dev/src/Command/AdminLoginCommand.php
👍 core-dev/src/Command/BootCommand.php
👍 core-dev/src/Command/CacheCommand.php
👍 core-dev/src/Command/TestCommand.php
👍 core-dev/src/Command/TestBrowserCommand.php
👍 core-dev/src/Command/UninstallCommand.php

Executing post-install actions:
yarn install v1.22.22
[1/5] Validating package.json...
error Drupal@: The engine "yarn" is incompatible with this module. Expected version ">= 4.1.1". Got "1.22.22"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
simesy commented 7 months ago

I started a PR that just shows some progress. I'm still glitching.

simesy commented 7 months ago

CLosing this as there are other issues wher ethis is being looked at.