woutdp / live_svelte

Svelte inside Phoenix LiveView with seamless end-to-end reactivity
https://hexdocs.pm/live_svelte
MIT License
1.01k stars 37 forks source link

Explicitly set npm install folder #96

Closed tonydangblog closed 7 months ago

tonydangblog commented 7 months ago

Summary

Explicitly set the folder for npm install in using the --prefix flag to prevent installation into the wrong folder.

Reason for change

In the current install_npm_deps script, we cd into the assets folder then perform the installation. This won't always work because if a package.json does not already exist in the assets folder, npm will look for the nearest parent folder containing either a package.json file or a node_modules folder and do the installation there.

Using the --prefix flag will force installation in the specified folder.

woutdp commented 7 months ago

Nice, thank you!