hygen
hygen copied to clipboard
hygen init self fails if _templates directory is present
Problem
Hygen does not let you initialize if the _templates
directory exists & is empty.
Steps to reproduce
- Create an empty
_templates
directory - 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.
any fixes on that one?
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?)
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
@jondot btw, I installed with npm
Can you try updating to 6.2.11 (released short time ago) and re-run?
@jondot new version fixed this issue
Thanks for noticing and reaching out ❤️