jondot / hygen

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

Project with type Modules skips index.cjs #433

Open dan-turner opened 1 year ago

dan-turner commented 1 year ago

Hi team,

In addition to this related issue where prompt.cjs wasn't working, the same is true for index.cjs, which is required for projects with "type": "module" specified in the package.json

We need to add index.cjs to the hooksfiles variable. I will submit a PR.

dan-turner commented 1 year ago

PR submitted: https://github.com/jondot/hygen/pull/434

dan-turner commented 1 year ago

G'day @jondot! Any chance we could perhaps get this one in?

blikblum commented 11 months ago

I published hygen-neo with fix similar to #434 (https://github.com/blikblum/hygen/commit/e8f23c610439cd14888b32a4523b8b44b6013626). It has tests and improved typing

pjezusek commented 3 months ago

For those searching for a temporary solution like me, you can simply leave the js extension and add a package.json file to the _templates directory. It can be a very simple package.json without "type": "module", like this:

{
  "name": "package_name",
  "version": "0.1.0"
}

After that, Hygen will work again in ES Module projects.