sheerun / bower-away

A tool for migrating away from Bower (to Yarn)
307 stars 21 forks source link

bower_components symlink path issue #33

Open vadimkuragkovskiy opened 6 years ago

vadimkuragkovskiy commented 6 years ago

Hello,

I spotted an issue with the symlink path. If someone uses vagrant or docker or similar dev env the absolute path won't work in 100% cases.

For example I'm using docker and webdevops images. My application mounts in the docker with that path: /app/

The issue is that when I run yarn outside from docker console (my docker image doesn't have installed yarn and I don't want to add it here) it builds the symlink like this:

bower_components -> /Users/vadim/workspace/webdevops/app/node_modules/@bower_components

Historically we are building our js files using php script and grunt for css. (yep it's a shame. I hope sometime we will move to the webpack). Php application runs inside docker and seek into the ./bower_components dir which is a symlink. When php script tries to access the folder by the link above it receives the error because of the path /Users/vadim/workspace/webdevops/app/node_modules/@bower_components inside docker doesn't exist.

The correct absolute path for docker should be like /app/node_modules/@bower_components. If I fix the path my grunt won't work because it runs outside from docker and can't find the absolute path /app/node_modules/@bower_components inside the main system

As a solution in my case could be a relative path:

bower_components -> ./node_modules/@bower_components/

I'm not sure if it is a good idea for all possible cases, but it looks more flexible. I'm also not an expert in nodejs to send a pull request with the proposal of robust fix.

@sheerun What is your thoughts?