plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
448 stars 610 forks source link

Volto Generator 8.0.2 fails to create a new Volto project #5436

Closed ichim-david closed 9 months ago

ichim-david commented 10 months ago

With Yo 4.3.1 and 5.0.0 when running the following install commands: npm  install -g yo npm i @plone/generator-volto yo @plone/volto myproject

The project is failing to generate due to this exit error: An error occured while running @plone/volto:app#install Error @plone/volto volto-latest-generator this.yarnInstall is not a function

davisagli commented 10 months ago

Happens for me also.

Seems related to https://github.com/plone/volto/pull/5406 -- even if I have yo 4.x installed globally, @plone/generator-volto now uses 5.x, and https://github.com/yeoman/generator/issues/1294 says it no longer includes install actions by default.

/cc @sneridagh

sneridagh commented 10 months ago

We can change the helper with a command exec.

It's s oneliner and an import from the standard lib.

Eventually this package has to be converted to ESM, since yo has moved to it.

ichim-david commented 10 months ago

@sneridagh @davisagli I have to admit I don't really understand what skip-install is supposed to do. I tried to replace yarnInstall with addDepenencies and I still got a failure but simply commenting this line: https://github.com/plone/volto/blob/main/packages/generator-volto/generators/app/index.js#L255

got me this output: https://gist.github.com/ichim-david/7571a8e2bfce4c586337883c72a875e2

When I went inside the created project and entered yarn install it starting installing.

As such to me it would seem that it would work even without trying to install something since the dependency was null but again I don't understand this well enough to know if it would be a good or bad thing.

EDIT: I see that it copies the project also inside src/addons so it's not ok to simply comment that line

sneridagh commented 10 months ago

@ichim-david the generator run "yarn install" by default, once the generator ended. It seems they deprecated the built-in (yarnInstall) helper method, so we have two options:

https://github.com/plone/volto/blob/9e4a0447e9e26095329e33ce15dbcf1c0e6db945/packages/scripts/backportpr.js#L69

ichim-david commented 10 months ago

@sneridagh I've added https://github.com/plone/volto/pull/5438 this fix will ensure that yarn runs as soon as the project is created. The pattern is taken directly from the v5 branch https://github.com/yeoman/generator/blob/v5/lib/actions/install.js#L16C4-L16C83

I still think there is an issue with the generator since it adds an addon with the same name even though it says false for adding an addon however this might be a separate issue https://gist.github.com/ichim-david/02d91265037d97cdb96c9e6771deaae6

ichim-david commented 9 months ago

I still think there is an issue with the generator since it adds an addon with the same name even though it says false for adding an addon however this might be a separate issue https://gist.github.com/ichim-david/02d91265037d97cdb96c9e6771deaae6

This is actually on purpose apparently although from the docs it would appear only to be done so in the cookie-cutter template, instead, it is also applied when using only the generator. I've added the new issue https://github.com/plone/volto/issues/5439 where I mention this documentation miss.