svallory / hypergen

The simple, fast, and scalable code generator that lives in your project.
http://www.hygen.io
MIT License
6 stars 0 forks source link

TypeError: Cannot read properties of undefined (reading 'reduce') at Generator.next (<anonymous>) #5

Open lewebsimple opened 5 months ago

lewebsimple commented 5 months ago

I just discovered your fork and needed the .hygen.cjs support but when executing hypergen ... inside my project it fails with the error from the title.

TypeError: Cannot read properties of undefined (reading 'reduce')
TypeError: Cannot read properties of undefined (reading 'reduce')
    at /home/pascal/.nvm/versions/node/v20.11.1/lib/node_modules/hypergen/dist/params.js:74:52
    at Generator.next (<anonymous>)
    at fulfilled (/home/pascal/.nvm/versions/node/v20.11.1/lib/node_modules/hypergen/dist/params.js:5:58)
svallory commented 1 month ago

@lewebsimple maaaan! Not sure how I missed the notification for this. So sorry for never getting back to you!

Looks like I messed up something there, but the issue seems to be in the findGenerators function returning undefined. Which should never happen.

I'll take a look at this soon.

And if you by any chance still remember any details on how to reproduce it, let me know!

But I'm guessing install, add config and no generators, right?

svallory commented 1 month ago

I just figured out what the issue is. It happens when the project was not initialized yet and you try to generate a generator.

Until a fix is up, the workaround is:

  1. Init the project running hypergen init self at the root
  2. Remove the init generator (sorry, another bug :/) rm -rf ./_templates/init
  3. Generate your first generator with hypergen generator new MyGenerator