keithamus / sort-package-json

Sort an Object or package.json based on the well-known package.json keys
MIT License
790 stars 83 forks source link

feat: improve pnpm sorting #314

Closed westrik closed 5 months ago

westrik commented 5 months ago

https://github.com/keithamus/sort-package-json/pull/313 added the ability to deeply sort a pnpm object in package.json. This PR improves pnpm sorting in the following ways:

Example:

Before this change:

"pnpm": {
  "overrides": {
      "@react-stately/selection@~3.10.3": "3.10.3",
      "@react-stately/selection@~3.7.0": "3.7.0"
  }
}

After this change:

"pnpm": {
  "overrides": {
      "@react-stately/selection@~3.7.0": "3.7.0",
      "@react-stately/selection@~3.10.3": "3.10.3"
  }
}
keithamus commented 5 months ago

@samsternatretool what do you think?

samsternatretool commented 5 months ago

@keithamus LGTM from me! @westrik is on my team at Retool and he noticed some subtlety when it comes to sorting pnpm overrides after we merged my original change.

keithamus commented 5 months ago

Some failing tests in Node 12 because of Array#at. Will need to use an alternative or polyfill.

westrik commented 5 months ago

Some failing tests in Node 12 because of Array#at. Will need to use an alternative or polyfill.

updated with alternative

github-actions[bot] commented 5 months ago

:tada: This PR is included in version 2.10.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: