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
wraithgar pushed a commit that referenced this pull request Dec 2, 2024
🤖 I have created a release *beep* *boop*
---


##
[8.0.0](v7.0.2...v8.0.0)
(2024-12-02)
### ⚠️ BREAKING CHANGES
* this module is now compatible with the following node versions:
^20.17.0 || >=22.9.0
* adds a new `type` prompt and changes the sort order of created
packages
### Features
*
[`5eeea50`](5eeea50)
[#313](#313) adds type,
sorting (#313) (@reggi)
### Bug Fixes
*
[`f4c1430`](f4c1430)
update node engines to ^20.17.0 || >=22.9.0 (#318) (@wraithgar)
### Chores
*
[`47339ef`](47339ef)
[#311](#311) bump
@npmcli/config from 8.3.4 to 9.0.0 (#311) (@dependabot[bot])
*
[`2ccbf30`](2ccbf30)
[#310](#310) bump
@npmcli/template-oss from 4.23.3 to 4.23.4 (#310) (@dependabot[bot],
@npm-cli-bot)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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