jprichardson / cross-zip-cli

Zip/Unzip directories cross platform from the CLI. Great for npm scripts.
MIT License
26 stars 6 forks source link

When zipping a directory, the zip file is always created in its parent directory regardless of the desired path #4

Open jsepia opened 7 years ago

jsepia commented 7 years ago

Sample package.json:

{
  "name": "zip-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "cross-zip ./parent/child/grandchild output.zip"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "cross-zip-cli": "^1.0.0"
  }
}

Make a nested directory structure:

mkdir -p parent/child/grandchild
echo "foo" > parent/child/grandchild/data.txt

Run the script:

$ npm run test

> zip-test@1.0.0 test /Users/sepiaj/ws/zip-test
> cross-zip ./parent/child/grandchild ./output.zip

Expected result: The zip file appears in the CWD (or in this case, the root of the project), as a sibling to package.json.

Actual result: The zip file shows up in parent/child/.

jprichardson commented 7 years ago

Thanks for reporting. IRC... this may be a platform limitation. You'll want to dig in https://github.com/feross/cross-zip to find out more.

garretwilson commented 6 years ago

@jsepia, what platform are you running on? Placing the output file in a separate single subdirectory is working for me on Windows 10, e.g.

cross-zip source target/foobar.zip