{"action":"created","issue":{"url":"https://api.github.com/repos/mjackson/npm-http-server/issues/6","labels_url":"https://api.github.com/repos/mjackson/npm-http-server/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/mjackson/npm-http-server/issues/6/comments","events_url":"https://api.github.com/repos/mjackson/npm-http-server/issues/6/events","html_url":"https://github.com/mjackson/npm-http-server/issues/6","id":115785367,"number":6,"title":"Deal with bower?","user":{"login":"kentcdodds","id":1500684,"avatar_url":"https://avatars.githubusercontent.com/u/1500684?v=3","gravatar_id":"","url":"https://api.github.com/users/kentcdodds","html_url":"https://github.com/kentcdodds","followers_url":"https://api.github.com/users/kentcdodds/followers","following_url":"https://api.github.com/users/kentcdodds/following{/other_user}","gists_url":"https://api.github.com/users/kentcdodds/gists{/gist_id}","starred_url":"https://api.github.com/users/kentcdodds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentcdodds/subscriptions","organizations_url":"https://api.github.com/users/kentcdodds/orgs","repos_url":"https://api.github.com/users/kentcdodds/repos","events_url":"https://api.github.com/users/kentcdodds/events{/privacy}","received_events_url":"https://api.github.com/users/kentcdodds/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-09T03:38:00Z","updated_at":"2015-12-18T11:43:31Z","closed_at":null,"body":"I don't know if this is something we really need to think about, but if we're hoping to make npmcdn.com really eliminate the need for bower I think this could be handy...\r\n\r\nIf you do this: `bower install https://npmcdn.com/lodash` it totally works, but what gets saved to disk is this:\r\n\r\n```\r\n~/Desktop/tmp\r\n🚀  $ tree .\r\n.\r\n├── bower.json\r\n└── bower_components\r\n    └── lodash\r\n        └── index\r\n\r\n2 directories, 2 files\r\n```\r\n\r\nThe resulting file is simply called `index` with no extension at all. If you have a version on it: `bower install https://npmcdn.com/lodash@3.9.3` then you get:\r\n\r\n```\r\n~/Desktop/tmp\r\n🚀  $ tree .\r\n.\r\n├── bower.json\r\n└── bower_components\r\n    └── lodash@3.9\r\n        └── index.3\r\n\r\n2 directories, 2 files\r\n```\r\n\r\nWhich is quite odd I think, and even though technically it should still work fine, I wouldn't be surprised if issues cropped up when people commit their `bower_components` directory and deploy that and then their server doesn't know what headers to set because the file extension is wrong.\r\n\r\nBasically what needs to happen is the url that bower is curling needs to end in the desired extension. However we can't just simply allow for `https://npmcdn.com/lodash@3.9.3.js` accross the board because then we'd need `https://npmcdn.com/lodash.js` and there are some packages that have `.js` in the name ([for example](https://www.npmjs.com/package/is.js)).\r\n\r\nSo I'm not certain of the best approach, but the more straightforward the better I think... I like the idea of allowing you to grab any file in the package as we have now, so I don't think we should change that behavior, but we need to come up with a way of allowing the last `/` URL part to be the desired name of the file.\r\n\r\n## Skip to the next header...\r\n\r\nSo what if we had a query param to indicate that the last `/` URL part shouldn't be part of the file search but should actually part of the name? Something like this:\r\n\r\n```\r\nhttps://npmcdn.com/bootstrap@3.3.5/dist/css/bootstrap.css/whatever-i-want.css?lastIsFilename=true\r\nhttps://npmcdn.com/bootstrap@3.3.5/dist/js/bootstrap.js/whatever-i-want.js?lastIsFilename=true\r\n```\r\n\r\n:point_up_2: contrived example... Bootstrap would actually work out alright in this case...\r\n\r\nI'm not wild about the `lastIsFilename` query param name, but I think you get the idea. This would result in bower downloading with something like this:\r\n\r\n## Skip to here\r\n\r\nTurns out that some of my assumptions were wrong. Given this kind of `bower.json`:\r\n\r\n```javascript\r\n\"dependencies\": {\r\n  \"bootstrap.css\": \"https://npmcdn.com/bootstrap@3.3.5/dist/css/bootstrap.css\",\r\n  \"bootstrap.js\": \"https://npmcdn.com/bootstrap@3.3.5/dist/js/bootstrap.js\"\r\n}\r\n```\r\n\r\nThat results in this file structure\r\n\r\n```\r\n~/Desktop/tmp\r\n🚀  $ tree .\r\n.\r\n├── bower.json\r\n└── bower_components\r\n    ├── bootstrap.css\r\n    │   └── index.css\r\n    └── bootstrap.js\r\n        └── index.js\r\n\r\n3 directories, 3 files\r\n```\r\n\r\n:-( Meaning that bower isn't using just the last filename and using that... But it *is* using the extension for the extension of `index` which pretty much solves the issue anyway. So basically all that needs to happen is the URL needs to be able to end in the extension of your choice... What do you think we could do to make that happen?"},"comment":{"url":"https://api.github.com/repos/mjackson/npm-http-server/issues/comments/165757717","html_url":"https://github.com/mjackson/npm-http-server/issues/6#issuecomment-165757717","issue_url":"https://api.github.com/repos/mjackson/npm-http-server/issues/6","id":165757717,"user":{"login":"nkbt","id":175264,"avatar_url":"https://avatars.githubusercontent.com/u/175264?v=3","gravatar_id":"","url":"https://api.github.com/users/nkbt","html_url":"https://github.com/nkbt","followers_url":"https://api.github.com/users/nkbt/followers","following_url":"https://api.github.com/users/nkbt/following{/other_user}","gists_url":"https://api.github.com/users/nkbt/gists{/gist_id}","starred_url":"https://api.github.com/users/nkbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkbt/subscriptions","organizations_url":"https://api.github.com/users/nkbt/orgs","repos_url":"https://api.github.com/users/nkbt/repos","events_url":"https://api.github.com/users/nkbt/events{/privacy}","received_events_url":"https://api.github.com/users/nkbt/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T11:43:31Z","updated_at":"2015-12-18T11:43:31Z","body":"Created PR #17"}}