Closed Spunkie closed 6 years ago
That's strange. It's definitely a bug somewhere...
I have a pretty busy day, but I'll try and take a look sometime soon.
In the meanwhile, on your linux, can you try running the command:
zip --recurse-paths plg_example_2.0.1.install.zip plg_example/*
And also:
zip --recurse-paths plg_example_2.0.1.install.zip plg_example
And let me know if either of those produce the desired output?
Well apparently zip isn't installed by default on the docker node:8
image. So I first ran apt-get update
&& apt-get install zip
and confirmed the original issues still happens when running the pack:zip
script.
Both of those cmds produce this file structure.
plg_example_2.0.1.install.zip -- linux
|-- plg_example
|-- debug.php
|-- example.php
|-- example.xml
|-- media
|-- compiled
|-- css
|-- fonts
|-- images
|-- js
|-- scss
|-- index.html
I know this is annoying, but this is a bug of the underlying zip command on linux. As a workaround you can do something like:
cd <folder to zip> && bestzip ../<zip file>.zip . && cd ..
I know it looks ugly, but it works and cd should be cross platform.
Mum, good point. Do you want to try it out and send a PR if it looks good?
oserban's response works for me on my osx projects.
I know this is an old issue, but I just released v2.0.0 that includes quite a bit of reworking (and testing!) to normalize things. If you get a minute, please try it out and let me know is this is resolved or if you're still seeing problems here.
I've got a cross-os NPM scripts build system and part of that is using
bestzip
to package the repo into an installable zip. I've got the followingpack:zip
script in mypackage.json
but I'm getting different results when it's run on my windows machine versus a linux environment. Am I doing something wrong or is this a bug?Example Info
Repo file structure:
ENV vars:
NPM Script:
cross-env-shell
in this script simply allows me to use the$ENV_VAR
format on windows instead of the normal%ENV_VAR%
format. So for this specific example npm should end up running a cmd that looks likebestzip plg_example_2.0.1.install.zip plg_example/*
on both windows and linux.Example Output:
On windows it produces a zip with the correct file structure:
While on linux the resulting zip has this incorrect file structure:
This linux environment is based off the public
node:8
docker image so you should be able to use that to reproduce this issue if need be.