Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
dwarakaprasad opened this issue May 23, 2024 · 7 comments
Open
1 task done

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

dwarakaprasad opened this issue May 23, 2024 · 7 comments

Comments

@dwarakaprasad
Copy link
Contributor

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
  • Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member

mshima commented May 23, 2024

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
Copy link
Member

mshima commented May 23, 2024

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
Copy link
Contributor Author

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

@mshima
Copy link
Member

mshima commented May 23, 2024

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
Copy link
Member

mshima commented May 24, 2024

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

@dwarakaprasad
Copy link
Contributor Author

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.

Copy link
Contributor

github-actions bot commented May 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants