nativescript-community / ui-canvas

Implement Canvas into your NativeScript apps.
https://nativescript-community.github.io/ui-canvas/
Apache License 2.0
31 stars 9 forks source link

Issues when installing packages with peer dependencies #55

Closed dangrima90 closed 3 months ago

dangrima90 commented 3 months ago

Sorry for not following the template but this is not exactly a code issue and I do not think it's related to any particular NativeScript version or version of the plugin.

Something curious that I've noticed is that if I have an application which uses @nativescript-community/ui-svg its peer dependencies are not always installed. This depends on which command is run. Strange? I guess so 😄.. to explain:

Let's say we have an application that uses @nativescript-community/ui-svg and no node_modules have been installed yet. If the installation is done via the "nativescript commands", i.e., via ns build android, ns debug android, ns run ios, and so on in the node_modules you should only see @nativescript-community/ui-svg installed.

Very curious as ui-svg has a peer dependency on ui-canvas which means that npm should install it automatically. Now the next curious thing is that if npm install is executed, all the peer dependencies are then installed.

Images to showcase the behaviour:

@nativescript-community dependencies in the project:

image

After running ns debug android:

image

After running npm install:

image

Above you can see that now ui-canvas has been installed. Note that there's other @nativescript-community packages due to peer dependencies from internal libraries. Honestly I don't know if it's a NativeScript CLI issue or not. I noticed this whilst testing out ui-svg so sorry if it's not related to the library itself.

It's just curious that for example the ui-material-core was installed when running ns debug android, however ui-canvas wasn't. I know that I can install ui-canvas in my project directly (which I've tried), but that would mean that I would also need to install arraybuffers library in my project as well.

Some extra infromation:

Node Version: v20.10.0 NPM Version: v10.5.2

farfromrefug commented 3 months ago

@dangrima90 Thanks for the detail report. If i understand correctly i think the issue is with the nativescript cli calling npm install (if you did not do it before) without installing peer dependencies. Could be a flag the cli passes to the install command. The difference with material core is that it is not a peer dependency. May be you can report it on the cli repo.

In the meantime I just published a new version which remove the requirement for ui-canvas if you are only using SVGView

dangrima90 commented 3 months ago

@farfromrefug thank you for the update. I've been discussing this on discord and it does seem a cli issue. It's been mentioned to me here that nativescript cli passes --legacy-peer-deps when installing dependencies so most likely that's the reason for it.

I will close the issue as it's not a library issue per se. Still thanks for the updated version :)