broccolijs / broccoli-funnel

MIT License
66 stars 37 forks source link

Exception is thrown in 1.0.8 with relative paths in broccoli-funnel #81

Closed MiguelMadero closed 7 years ago

MiguelMadero commented 7 years ago

The new code to handle exceptions incorrectly assumes that a symlink doesn't exist and thinks that srcDir is undefined throw new Error('You specified a"srcDir": ' + this.srcDir + 'which does not exist and did not specify"allowEmpty": true.');

The problem seems to be on exists-sync that doesn't expand the path correctly.

Example:

new Funnel('../static/js/', {
                    destDir: 'static'
                })

That will create a symlink like:

09:14 AM $ ls -l /Users/mmadero/code-zenefits/yourPeople3-bkp3/component-library/tmp/funnel-input_base_path-9rLzS07l.tmp/0 
lrwxr-xr-x  1 mmadero  staff  77 Nov  3 08:20 /Users/mmadero/code-zenefits/yourPeople3-bkp3/component-library/tmp/funnel-input_base_path-9rLzS07l.tmp/0 -> /Users/mmadero/code-zenefits/yourPeople3-bkp3/component-library/../static/js/

When calling existsSync(/Users/mmadero/code-zenefits/yourPeople3-bkp3/component-library/tmp/funnel-input_base_path-9rLzS07l.tmp/0 );, it returns false.

When it gets the relativeLink on https://github.com/ember-cli/exists-sync/blob/master/index.js#L15 from"/Users/mmadero/code-zenefits/yourPeople3-bkp3/component-library/../static/js/ it goes to Users/mmadero/code-zenefits/yourPeople3-bkp3/component-library/js.

There're no tests for this scenario on exists-sync, but I wanted to raise the issue in both repos in case someone runs into this or in case someone gets a chance to fix it before I do.

Diff

rwjblue commented 7 years ago

/cc @nathanhammond

nathanhammond commented 7 years ago

Dammit @rwjblue! I was this close to keeping this as fs.existsSync! 😜 Going to write a test and revert that part of the change until we can fix exists-sync.

rwjblue commented 7 years ago

HAHA, but just think about how much better we'll be for knowing that exists-sync has this bug!