yo icon indicating copy to clipboard operation
yo copied to clipboard

Running the generator from a local folder no longer works in 5.0.0

Open sneridagh opened this issue 2 years ago • 6 comments

Type of issue

Bug

My environment

  • OS version/details: eg. Windows 10 64-bit
  • Node version: v20.9.0 (run node --version in your terminal)
  • npm version: 10.1.0 (run npm --version in your terminal)
  • Version of yo : 5.0.0 (run yo --version in your terminal)

Expected behavior

Running the generator from a local folder no longer works in 5.0.0

Current behavior

It shows that you need a generator instead of running the generator

Steps to reproduce the behavior

Try to run from a local folder instead of specifying the generator.

Command line output

❯ yo ./packages/generator-volto/generators/addon volto-test-addon -description "test volto addon" --volto . --skip-install --no-interactive -o testaddon
Error ./packages/generator-volto/generators/addon volto-test-addon -description test volto addon --volto . --skip-install --no-interactive -o testaddon

You don't seem to have a generator with the name “undefined” installed.
But help is on the way:

You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/.
Install them with npm install undefined.

To see all your installed generators run yo --generators. Adding the --help option will also show subgenerators.

If yo cannot find the generator, run yo doctor to troubleshoot your system.

sneridagh avatar Nov 15 '23 08:11 sneridagh

I've tracked this down locally to the @yeoman/namespace package, which the yeoman-environment v4 uses to parse the generator's namespace, but it doesn't seem to work with local paths. I've created https://github.com/yeoman/yeoman-api/issues/5 for that problem, and just to note that there was a related issue in yeoman-environment at https://github.com/yeoman/environment/issues/497 for this too. cc @mshima

strmer15 avatar Jan 03 '24 18:01 strmer15

@mshima Is there any plan to patch this? It seems both related issues have been closed. The yeoman v4 packages now contains sub-dependencies with vulnerabilities, and this prevents us from upgrading to yo@v5.

tibbing avatar Feb 26 '24 09:02 tibbing

@tibbing because they have been fixed in https://github.com/yeoman/environment/commit/cd68282b238ea895d1dcff2f2a583bd47fb15aca.

mshima avatar Feb 26 '24 20:02 mshima

@tibbing because they have been fixed in yeoman/environment@cd68282.

@mshima Hmm, we are still observing the same error when generating locally using [email protected], [email protected] and [email protected]:

You don't seem to have a generator with the name “undefined” installed.

I guess yeoman-environment needs to be upgraded in yo as well?

tibbing avatar Feb 27 '24 12:02 tibbing

Same. @mshima, are you planning to upgrade yeoman-environment to at least v4.2.0? Seems like we need that for the yo to work with a local folder. Also happy to send a PR with the upgrade if you're busy

TomerAberbach avatar Apr 07 '24 17:04 TomerAberbach

Hey @mshima! Would be awesome to get this patched, as @TomerAberbach said it's probably as simple as to upgrade yeoman-environment to the latest version 🙂

tibbing avatar May 06 '24 14:05 tibbing