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

feat: add --init-type flag #8081

Merged
merged 3 commits into from
Feb 4, 2025
Merged

feat: add --init-type flag #8081

merged 3 commits into from
Feb 4, 2025

Conversation

reggi
Copy link
Contributor

@reggi reggi commented Feb 3, 2025

I saw a warning for this supported flag, wanted to fix it.

@reggi reggi requested a review from a team as a code owner February 3, 2025 18:48
@wraithgar
Copy link
Member

It's gonna be so nice when npm stops silently allowing undefined config to be passed to it.

@reggi reggi merged commit 3a80a7b into latest Feb 4, 2025
33 checks passed
@reggi reggi deleted the reggi/init-type branch February 4, 2025 15:59
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
@jonkoops
Copy link

Is there any particular reason that commonjs was selected as the default type? Would it not be more logical to initialize new package with module considering they would likely be authored in ESM?

@reggi
Copy link
Contributor Author

reggi commented Mar 12, 2025

Is there any particular reason that commonjs was selected as the default type? Would it not be more logical to initialize new package with module considering they would likely be authored in ESM?

@jonkoops the default in nodejs is commonjs, before this when you initialized it was implicit, now by default it's fixed.

@jonkoops
Copy link

Understandable, but npm init is to generate a new package. There is very little reason (if any) why the default for new packages should be CommonJS, using module is a much better starting point for new developers that are starting out now.

@jonkoops
Copy link

I'll log a separate issue for this, I think this PR was a good starting point, just needs some tweaking to make it more useful for new users, rather than lock them into legacy module systems.

@jonkoops
Copy link

See #8159

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

Successfully merging this pull request may close these issues.

3 participants