Alorel / shrink-ray

Node.js compression middleware
MIT License
177 stars 16 forks source link

Add metadata to mark peer dependencies as optional for npm7+ #62

Open keeganstreet opened 2 years ago

keeganstreet commented 2 years ago

In npm 7 and npm 8, peer dependencies are installed by default.

iltorb and node-zopfli-es are only required for older versions of Node, and it doesn't make sense for them to be installed automatically when shrink-ray-current is installed.

This change adds a peerDependenciesMeta field to mark these peer dependencies as optional https://docs.npmjs.com/cli/v8/configuring-npm/package-json#peerdependenciesmeta

keeganstreet commented 2 years ago

Hi @Alorel , any chance you could release this patch?

The iltorb installation errors out in environments without python available. We don't need iltorb to be installed automatically (which is the default behaviour for peer dependencies in recent npm versions).

ShrijalFetchly commented 1 year ago

@keeganstreet @Alorel will this be merged?

keeganstreet commented 1 year ago

The maintainer is taking a bit of a break. The deprecated iltorb and node-zopfli-es packages can be blocked in consuming apps by adding the following config to the package.json file of the consuming app:

  "overrides": {
    "iltorb": "npm:node-noop",
    "node-zopfli-es": "npm:node-noop"
  }

This will install https://www.npmjs.com/package/node-noop (a placeholder package that doesn't do anything) instead of iltorb and node-zopfli-es.