shama / napa

:wine_glass: A helper for installing stuff without a package.json with npm.
MIT License
412 stars 34 forks source link

Flat structure #12

Closed bdecarne closed 8 years ago

bdecarne commented 10 years ago

Hi !

When i use the # feature on the angular ui bootstrap repo (https://github.com/angular-ui/bootstrap), the directory structure is flat : all files from the project are in the root directory.

i'm on windows

{
  "devDependencies": {
    "napa": "~0.4.1"
  },
  "scripts": {
    "install": "napa"
  },
  "napa": {
    "bootstrap": "twbs/bootstrap",
    "angular": "angular/bower-angular",
    "angular-ui-bootstrap": "angular-ui/bootstrap#v0.10.0"
  }
}
shama commented 10 years ago

It looks like the git tag for angular-ui/bootstrap should be: "angular-ui-bootstrap": "angular-ui/bootstrap#0.10.0" (without the 'v') based on their releases: https://github.com/angular-ui/bootstrap/releases

Also since that repo has a package.json you can use npm to install with: npm i angular-ui/bootstrap#0.10.0 --save

Try one of those and let me know if you still get a flat structure.

shama commented 10 years ago

Any update?

jchills commented 10 years ago

I ran into this issue today where all the directories are removed and the files are are flattened out into the root. The problem seems to be isolated to extracting '.zip' files. If I force the '.tar.gz' extension then the directory structure is intact. Setting strip: 0 also leaves the hierarchy intact, but leaves the root folder.

shama commented 10 years ago

@jchills With the same angular-ui-bootstrap repo? If a different one, could you send me a link to try and the expected folder structure? Thanks!

jchills commented 10 years ago

@shama All these repos had the same problem. If you remove the version number, they install correctly.

"devDependencies": {
    "napa": "^0.4.1"
},
"scripts": {
    "install": "napa"
},
"napa": {
    "angular-bootstrap": "angular-ui/bootstrap#0.10.0",
    "angular-kendo": "kendo-labs/angular-kendo#1.0.0",
    "bootstrap": "twbs/bootstrap#v3.1.1",
    "jquery": "jquery/jquery#1.11.0",
    "kendo-ui": "kendo-labs/bower-kendo-ui#2014.1.318"
}

Here is what I would expect the root folder to look like after Napa installs the repo

Repo Folders Files
angular-bootstrap 4 - docs, misc, src, template 10
angular-kendo 4 - app, demos, nuget, test 12
bootstrap 7 - dist, docs, font, grunt, js, less, test-infra 13
jQuery 5 - build, dist, speed, src, test 17
kendo-ui 3 - js, src, styles 4

Here was the change I made in index.js that resolved the problem locally. I'm running on a Windows system, so it was forcing the ".zip" extension.

  if (url.indexOf('#') !== -1 && url.indexOf('://') === -1) {
    var s = url.split('#')
    url = 'https://github.com/' + s[0] + '/archive/' + s[1]

    // JH - Force the .tar.gz file extension because the .zip version isn't extracting correctly.
    url += '.tar.gz'
  }

Let me know if you need anything else.

caseyWebb commented 8 years ago

Closed via 63a040b98ab50ccf56eb2b84e0a439b1d959bd9f

9mm commented 8 years ago

This still happens for me when trying to download (it flattens everything and destroys the zip structure): https://origincache.facebook.com/developers/resources/?id=FacebookSDKs-iOS-20160210.zip

I can't add FB IOS SDK from facebook because it's a different structure than their finalized zip from this page

https://developers.facebook.com/docs/ios/downloads