jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.31k stars 4.01k forks source link

generatr-blueprint creates *.js files instead of *.mjs #26244

Open dwarakaprasad opened 1 month ago

dwarakaprasad commented 1 month ago
Overview of the issue

Generating a new blueprint using jhipster generate-blueprint creates files <root-folder>/generators/generator.js instead of *.mjs files.

Motivation for or Use Case
Reproduce the error
Related issues

25276 added this logic which only enables if local blueprint is selected.

Is this by design.

Suggest a Fix
JHipster Version(s)
JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
mshima commented 1 month ago

Local blueprint is used in project that can be type commonjs. Generators are type module, we need to use mjs extension or add a package.json with type module in .blueprint dir.

Non local blueprints are packages that we generate as type module. So it can have js extension. js is the preferred extension so we use it.

mshima commented 1 month ago

If you prefer mjs extension you can use --no-js option. Since js is the default now, would make sense to convert to --mjs.

dwarakaprasad commented 1 month ago

makes sense, thank you @mshima. Is there any plan in the future to convert the blueprints to typescript.

mshima commented 1 month ago

No plans for typescript blueprints in official blueprints and generate-blueprint command. I don’t see any advantage in adding the typescript complexity in blueprints. But it’s possible to create a typescript blueprint.

mshima commented 1 month ago

We should add an option extension with 'js' and 'mjs' options, which will default to 'mjs' for local blueprint and 'js' otherwise.

dwarakaprasad commented 1 month ago

We should add an option extension with 'js' and 'mjs' options, which will default to 'mjs' for local blueprint and 'js' otherwise

good suggestion, I will try to address this after the long weekend.

github-actions[bot] commented 1 month ago

JHipster has completed the sample check .yo-rc.json: Entities JDL: Application: successfully generated Frontend check: skipped Backend check: skipped E2E check: skipped

This check uses jhipster info output from the issue description to generate the sample. Bug report that does not contain this information will be marked as invalid.