keithamus / sort-package-json

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

Please update `globby@10.0.0` to at least 11.0.0 #247

Closed loynoir closed 2 years ago

loynoir commented 2 years ago

Brief

sort-package-json@1.54.0 problem located

using globby@10.0.0 https://github.com/keithamus/sort-package-json/blob/v1.54.0/package.json#L77

History

globby@10.0.0 has problem "Including @types/glob in dependencies breaks typescript implementations"

https://github.com/sindresorhus/globby/issues/129

Fixed in "Get rid of glob dependency" https://github.com/sindresorhus/globby/pull/135

Drop glob and @types/glob dependencies

https://github.com/sindresorhus/globby/commits/v11.0.0

Comparison: package.json

globby@10.0.0 https://github.com/sindresorhus/globby/blob/v10.0.2/package.json#L59

globby@11.0.0 https://github.com/sindresorhus/globby/blob/v11.0.0/package.json#L59

Related

https://github.com/microsoft/TypeScript/issues/48341

gjgarryuan commented 2 years ago

I am facing the exact same problem.

If you can use npm 8 where overrides is available and you are not using Lerna, you can add the following in the package.json:

{
  ...,
  "overrides": {
    "sort-package-json": {
      "globby": "11.0.0"
    }
  }
}

I verified the above works for plain-old typescript project. However, if you are using Lerna, it is working unexpectedly and I submitted an issue to them here: https://github.com/lerna/lerna/issues/3102

gjgarryuan commented 2 years ago

There is also another work-around if you cannot use npm 8: https://github.com/rogeriochaves/npm-force-resolutions

loynoir commented 2 years ago

@garrychnca

According to https://github.com/pnpm/pnpm/issues/4457

I think, pnpm has fixed, or said prevent, all this kind problem forever, by default.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 1.56.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: