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: adds type #313

Merged
merged 2 commits into from
Dec 2, 2024
Merged

feat: adds type #313

merged 2 commits into from
Dec 2, 2024

Conversation

reggi
Copy link
Contributor

@reggi reggi commented Nov 22, 2024

Adds type to package.json for use when running npm init.

  1. Defaults to commonjs
  2. Validates against commonjs | module
  3. Allows npm init --init-type module -y
  4. Allows for init.type=module in .npmrc
  5. Improved tests to make it easier to manage removing / adding new prompts
  6. Utilizes new sort package.json feature

on the shoulders of #302
a part of the npm 11 roadmap npm/statusboard#898
statusboard issue here npm/statusboard#654
older rfc npm/rfcs#347

Note: Running npm init --init-type=module -y will not overwrite an existing package.json type field. This is deemed out of scope for init. To update an existing type edit it manually or field, use jq '.type = "module"' package.json > tmp.json && mv tmp.json package.json.

@reggi reggi requested a review from a team as a code owner November 22, 2024 20:21
jumoel
jumoel previously approved these changes Nov 25, 2024
Copy link

@jumoel jumoel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change!

lib/default-input.js Outdated Show resolved Hide resolved
@reggi
Copy link
Contributor Author

reggi commented Nov 27, 2024

failing because I added package-json 6.1.0 manually waiting for npm/package-json#134
do we consider this breaking because theres a a new field / promzard interrupt?

@wraithgar
Copy link
Member

do we consider this breaking because theres a a new field / promzard interrupt?

It only affects manually entered things, which usually isn't something we include in the semver contract. Only programmatic things. If someone were already using this programmatically would things not work where they did before?

@reggi reggi changed the title feat!: adds type feat: adds type Nov 27, 2024
@reggi
Copy link
Contributor Author

reggi commented Nov 27, 2024

@wraithgar nope I don't think so, at least not though intended means

@wraithgar
Copy link
Member

I don't think it is then. We'll be bumping engines here so we are gonna be doing a semver major anyways. We can change the first commit to a normal feat: imo.

@wraithgar wraithgar merged commit 5eeea50 into main Dec 2, 2024
20 of 22 checks passed
@wraithgar wraithgar deleted the reggi/init-type branch December 2, 2024 16:37
@github-actions github-actions bot mentioned this pull request Dec 2, 2024
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