# What changed in sort-package-json

> 12 changes in sort-package-json 3 to 4 from its official release notes, upgrade guides and advisories: 3 breaking, 1 new APIs and options. Each one cited. Sources checked 2026-11-12. HTML: https://unstale.sh/npm/sort-package-json/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## sort-package-json 4

### Breaking changes

- The minimum supported Node.js version is now 22; Node.js 20 is no longer supported. (4.0.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v4.0.0)
- The polyfill was removed and Object.groupBy is called directly, so Node.js 20 contexts need an Object.groupBy polyfill to run this version. (4.0.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v4.0.0)

### Behavior and default changes

- sort-package-json now sorts keys in the allowScripts package field. (4.1.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v4.1.0)

## sort-package-json 3

### Breaking changes

- Support for Node v12.x through v18.x was dropped; the minimum supported version is now v20.x. (3.0.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.0.0)

### New APIs and options

- The devEngines field is supported. (3.6.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.6.0)

### Behavior and default changes

- sort-package-json now sorts wireit configuration. (3.7.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.7.0)
- Dependencies are sorted according to the detected package manager. (3.6.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.6.0)
- The sorter now sorts types and default keys in the exports field. (3.5.0) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.5.0)

### Fixes and other changes

- Reverts the change that dropped support for Node.js 20. (3.7.1) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.7.1)
- Stops forcing the types entry in exports to be first. (3.6.1) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.6.1)
- The sorter now handles colon-prefixed script names. (3.5.2) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.5.2)
- Improves sorting of scripts in package.json. (3.5.1) — [release notes](https://github.com/keithamus/sort-package-json/releases/tag/v3.5.1)
