shama / napa

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

Support GitHub Releases #33

Closed kenmerthe closed 9 years ago

kenmerthe commented 9 years ago

I was trying to use napa to download atom-shell for Windows from their GitHub release page (https://github.com/atom/atom-shell/releases/download/v0.19.5/atom-shell-v0.19.5-win32-ia32.zip). It then proceeds to try to download it as a git repo since the URL contains "github.com" but does not contain "/archive/" (per the logic in pkg.js).

So for funzies, I added "?/archive/" to the end which did enable it to download and unzip the resource but then fell prey to #12 (DOHZ!). And so I am back to using the grunt (gulp!) atom-shell download plugin ... but using napa makes all my non-package.json-containing "modules" so much more consistent, unified, glorious, etc. :)

Of course, a fix to #12 could have been good enough but I thought I'd enter this issue for the sake of idealism ... or something.

So then, is there something obvious I am missing here? Maybe detecting GitHub repo URLs could be more specific (a la regex for example) or, at the very least, another exclusion could be made to check for "/releases/"? What do you guys think?

Cheers and good work friends

shama commented 9 years ago

I'm not sure I follow, what is the issue?

kenmerthe commented 9 years ago

A simple way to reproduce the issue (at least on my 64-bit Windows 7 machine) is with a fresh folder containing only the following package.json file:

{
  "devDependencies": {
    "napa": "^1.0.2"
  },
  "scripts": {
    "postinstall": "napa"
  },
  "napa": {
    "atom-shell": "https://github.com/atom/atom-shell/releases/download/v0.19.5/atom-shell-v0.19.5-win32-ia32.zip"
  }
}

The following will be output when running npm install:

npm WARN package.json @ No description
npm WARN package.json @ No repository field.
npm WARN package.json @ No README data
|
> @ postinstall G:\Stuff\Projects\napa-test
> napa

info git https://github.com/atom/atom-shell/releases/download/v0.19.5/atom-shell-v0.19.5-win32-ia32.zip into atom-shell
ERR! fatal: repository 'https://github.com/atom/atom-shell/releases/download/v0.19.5/atom-shell-v0.19.5-win32-ia32.zip/' not found

napa@1.0.2 node_modules\napa
├── npm-cache-filename@1.0.1
├── rimraf@2.2.8
├── npmlog@0.1.1 (ansi@0.3.0)
├── mkdirp@0.5.0 (minimist@0.0.8)
├── tar-pack@2.0.0 (uid-number@0.0.3, once@1.1.1, debug@0.7.4, graceful-fs@1.2.3, fstream@0.1.31, readable-stream@1.0.33, fstream-ignore@0.0.7, tar@0.1.20)
└── download@3.0.1 (get-stdin@3.0.2, url-regex@1.0.4, gulp-rename@1.2.0, each-async@1.1.0, nopt@3.0.1, vinyl@0.4.6, stream-combiner@0.2.1, rc@0.5.4, download-status@2.1.0,
through2@0.6.3, concat-stream@1.4.7, ware@1.2.0, decompress-tar@2.0.2, decompress-unzip@2.0.1, decompress-targz@2.0.2, vinyl-fs@0.3.13, request@2.49.0, decompress-tarbz2@2.
0.2)

As you would see, the issue is denoted by the error message ERR! fatal: repository 'https://github.com/.../atom-shell-v0.19.5-win32-ia32.zip/' not found. And, as far as I can tell, this is preventing the use of napa to install atom-shell's official binary releases (and other projects using GitHub Releases as well).

Let me know if you need any further clarification. :)

shama commented 9 years ago

Ah that's a bug. It's appending a / to the end of that URL for some reason. Thanks for the clarification. I'll look into a fix.

airtonix commented 9 years ago

also:

$ napa install witoldsz/angular-http-auth
info download https://github.com/witoldsz/angular-http-auth/archive/1.2.2.tar.gz into angular-http-auth
ERR! fatal: remote error: 
  Repository not found.
shama commented 9 years ago

@airtonix That looks like you're missing the v in front of v1.2.2 checking their releases: https://github.com/witoldsz/angular-http-auth/releases