stitch icon indicating copy to clipboard operation
stitch copied to clipboard

Symlinks not working

Open quangv opened this issue 12 years ago • 2 comments

tl;dr symlinks outside of requiredPaths aren't allowed, but why not?


I don't think symlinks are working. When I have symlinks under my path

/app
/app/sympath
package = stitch.createPackage
    paths : [appPath]

package.compile (err, source)->
    console.log arguments

I just get null for err and undefined(nothing) for source

When I removed the symlink path, the source compiles as usual.


I just pulled latest, and did a cake test and after fixing a couple bugs (octal literal must be prefixed with 0o & reserved word "package", might be cause I'm using node 0.6x) everything seems to pass, including:

✔ paths may be symlinks

but symlinks still screws something up, and source returns nothing.


Updated:

Okay I realized now that you to manually add the symPath to paths, and it'll work.

package = stitch.createPackage
    paths : [appPath, appPath+'/sympath']

Should symlink path be followed automatically though, instead of having to define them?


Updated again:

Actually I don't think the above method works, the symlinks/stuff still isn't getting compiled.

Edit: It works but not as expected... if the file was app/sympath/mod, then you would have to require 'mod' as opposed to what I wanted originally which was require 'sympath/mod'


[Error: /home/quang/app/share/date.coffee isn't in the require path]

Okay I get it... it's not allowed cause the symlink is outside of the requiredPaths... hmm for security reasons?

quangv avatar May 24 '12 15:05 quangv

+1

benbuckman avatar Mar 05 '13 22:03 benbuckman

We've worked around this by removing the realPath call and assuming that the input package paths are already absolute. This is not ideal. I think Stitch should definitely support symlinks - it's common to symlink from node_modules/some_module (leveraging npm's updating functionality) to a client/js directory, for example (as we're doing).

Thoughts?

benbuckman avatar Mar 05 '13 23:03 benbuckman