kevlened / isomorphic-webcrypto

:game_die: webcrypto library for Node, React Native and IE11+
https://www.w3.org/TR/WebCryptoAPI/
MIT License
116 stars 43 forks source link

Warning with react-native dependencies #38

Closed lk77 closed 3 years ago

lk77 commented 3 years ago

Hello,

we have a warning related to react-native in dev

https://github.com/kevlened/isomorphic-webcrypto/blob/734d23cf628c07a265366725d91e04aa9089fc7f/package.json#L66

we are using vue with pubnub, why those dependencies are in dev and not in optional ?

pubnub@4.29.11
    └─┬ isomorphic-webcrypto@2.3.6
      └── @unimodules/react-native-adapter@6.1.0

For what i understand you need it in your tests, so you could install it in your test scripts, like in the .travis.yml file with a :

npm i react-native --no-save

thanks

kevlened commented 3 years ago

That's fair, I'll move react-native to optional.

lk77 commented 3 years ago

thanks !

kevlened commented 3 years ago

react-native is now an optionalDependency in 2.3.7

Thanks for reporting!

kevlened commented 3 years ago

Unfortunately, the default for npm install is to include optionalDependencies by default. This causes anyone not using react-native to install it by default. Unfortunately, I don't think that's worth the cost of fixing the warning, so I'll be reverting the change.

lk77 commented 3 years ago

Arf, ok nevermind

lk77 commented 3 years ago

I believe my issue was misleading, sorry,

it's seems that the warning is caused by this optional dependency : @unimodules/react-native-adapter

you could try to do something like that :

"peerDependencies": { 
  "@unimodules/react-native-adapter": "*",
},
"peerDependenciesMeta": {
  "@unimodules/react-native-adapter": {
    "optional": true
  }
}

i think npm will not install it and will not warn the end user about it

i made a fork : https://github.com/lk77/isomorphic-webcrypto and it seems to work