Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ichim-david opened this issue Nov 24, 2023 · 6 comments
Closed

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

ichim-david opened this issue Nov 24, 2023 · 6 comments
Assignees

Comments

@ichim-david
Copy link
Member

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
Copy link
Member

Happens for me also.

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

/cc @sneridagh

@sneridagh
Copy link
Member

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
Copy link
Member Author

ichim-david commented Nov 25, 2023

@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
Copy link
Member

@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:

  • We just don't install, then the skip-install option should be removed, because it will always don't install.
  • We install by our own, something like

execCommand(`git cherry-pick ${PRInfo.mergeCommit}`);

@ichim-david ichim-david self-assigned this Nov 25, 2023
@ichim-david
Copy link
Member Author

@sneridagh I've added #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
Copy link
Member Author

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 #5439 where I mention this documentation miss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants