Skip to content

feat(plugin-commands-init): add support for --module flag in pnpm init #9463

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cezary-klauza
Copy link

add functionality to include "type": "module" in package.json when using --module or -m flag with pnpm init. Updated cliOptionsTypes and handler to handle the new flag and ensure proper sorting of fields in package.json

Closes #9416

add functionality to include "type": "module" in package.json when using
--module or -m flag with pnpm init. Updated cliOptionsTypes and handler
to handle the new flag and ensure proper sorting of fields in
package.json

Closes pnpm#9416
@cezary-klauza cezary-klauza requested a review from zkochan as a code owner April 27, 2025 12:09
Copy link

welcome bot commented Apr 27, 2025

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@zkochan
Copy link
Member

zkochan commented Apr 27, 2025

I'd use npm's convention: --init-type=module

Reference: npm/init-package-json#313

cezary-klauza and others added 2 commits April 28, 2025 16:49
allow users to specify the type field in package.json using the
--init-type option. The value can be set to "module" or "commonjs". The
option is also integrated with .npmrc, allowing users to define the
default value in their configuration file. Invalid values are validated
and result in an error.

BREAKING CHANGE: replaces the previous --module and -m option with
--init-type. Users must now use --init-type to specify the type field.
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.

pnpm init should add "type": "module" to package.json
2 participants