hygen icon indicating copy to clipboard operation
hygen copied to clipboard

hygen init self fails if _templates directory is present

Open detj opened this issue 3 years ago • 7 comments

Problem

Hygen does not let you initialize if the _templates directory exists & is empty.

Steps to reproduce

  1. Create an empty _templates directory
  2. Run hpx hygen self init

Hygen reports the following:

Loaded templates: _templates
Error: I can't find action 'self' for generator 'init'.

      You can try:
      1. 'hygen init self' to initialize your project, and
      2. 'hygen generator new --name init' to build the generator you wanted.

      Check out the quickstart for more: http://www.hygen.io/quick-start
      
Hygen v6.0.4

The reported error message is also a bit misleading.

Probable solution

hygen can verify that the directory is empty and proceed with initialization.

detj avatar Nov 20 '20 07:11 detj

any fixes on that one?

erdinc avatar Sep 07 '22 08:09 erdinc

Hi @erdinc I think this can easily be fixed I'm wondering, what is the scenario for an empty _templates folder? (and also, is it possible to rm _templates before running?)

jondot avatar Sep 07 '22 09:09 jondot

it is not empty. it has the files after running hygen init self

but then when I run hygen generator new --name generator

I got this

➜  api git:(main) ✗ hygen generator new --name generator

Loaded templates: /opt/homebrew/lib/node_modules/hygen/src/templates
Error: I can't find action 'new' for generator 'generator'.

      You can try:
      1. 'hygen init self' to initialize your project, and
      2. 'hygen generator new --name generator' to build the generator you wanted.

      Check out the quickstart for more: http://www.hygen.io/docs/quick-start

Hygen v6.2.10

Available actions:
init: init repo, init self

erdinc avatar Sep 07 '22 09:09 erdinc

@jondot btw, I installed with npm

erdinc avatar Sep 07 '22 09:09 erdinc

Can you try updating to 6.2.11 (released short time ago) and re-run?

jondot avatar Sep 07 '22 09:09 jondot

@jondot new version fixed this issue

erdinc avatar Sep 07 '22 09:09 erdinc

Thanks for noticing and reaching out ❤️

jondot avatar Sep 07 '22 09:09 jondot