twolfson / grunt-zip

Zip and unzip files via a grunt plugin
MIT License
87 stars 19 forks source link

Restore symbolic links when unzipping #52

Closed octachrome closed 6 years ago

octachrome commented 6 years ago

A fix for https://github.com/twolfson/grunt-zip/issues/41. Unit tests passing on Linux and macOS.

Limitations:

octachrome commented 6 years ago

Hmm, not sure why my tests are failing on Travis when they pass locally. I will look into it.

octachrome commented 6 years ago

Any chance this can be pushed to npm when merged? My build is broken because of a symlink issue :crying_cat_face:

octachrome commented 6 years ago

Oh just some time this week would be great, thanks. I'll use GitHub in the meantime.

twolfson commented 6 years ago

Landing this now :shipit:

twolfson commented 6 years ago

This has been released in 0.18.0. Thanks for the PR and quick responses!

octachrome commented 6 years ago

I just found an issue where fs.symlink raises EEXIST if the symlink already exists in the filesystem. This would be easily fixed using ensureSymlinkSync from fs-extra, or if you would rather not add a dependency I can implement a simpler version with existsSync and unlinkSync?

twolfson commented 6 years ago

Oh yikes. Does it have the same behavior if a normal file exists there as well?

I think this is contained enough that using unlinkSync is fine (prob can even use a try+catch+ignore err.code === 'ENOENT' than an exists check (1 fs call rather than 2))