harvesthq / chosen

Deprecated - Chosen is a library for making long, unwieldy select boxes more friendly.
http://harvesthq.github.io/chosen/
Other
21.86k stars 4.11k forks source link

Include compiled JS in repo for bower #1333

Closed aq1018 closed 11 years ago

aq1018 commented 11 years ago

When installing chosen using bower:

bower install chosen

It fetches from this repo directly, and since there is no compiled JS file, it is currently not usable with bower.

koenpunt commented 11 years ago

Hm, they just got removed recently (#1316). A solution would be to set bower to use the release zip, but as far I can see there is no possibility to link to the actual release zip in the bower package definition.

kenearley commented 11 years ago

It looks like we can create a bower.json file and set main to be the most recent release's zip file.

https://github.com/bower/bower#defining-a-package

koenpunt commented 11 years ago

@kenearley I'd just tried that and it appears that setting main to the most recent release does not work..

kenearley commented 11 years ago

bummer :frowning:

kenearley commented 11 years ago

It looks like they are working on ways to handle compiled files in Bower. We may just have to wait until it's implemented. https://github.com/bower/bower/issues/584

kyrstenkelly commented 11 years ago

This worked for me!

In my bower.json:

"chosen": "https://github.com/harvesthq/chosen/releases/download/v0.12.0/chosen_v0.12.0.zip"

eastridge commented 11 years ago

@kenearley @aq1018

I've implemented this plugin to assist with this issue:

https://github.com/walmartlabs/grunt-release-component

kenearley commented 11 years ago

As @kyrstenkelly pointed out, you can specify the release zip file in your own project's dependencies in its bower.json file like so:

{
  "name": "my-project",
  "version": "1.0.0",
  "dependencies": {
    "jquery": "1.10.2",
    "chosen": "https://github.com/harvesthq/chosen/releases/download/0.13.0/chosen_v0.13.0.zip"
  }
}

Unfortunately, we cannot specify that zip file in a bower.json file in this project. That means, you can't get it from the command line with bower install chosen.

Although @eastridge's suggestion would work, it feels a bit heavy handed. Especially if the Bower team is working to address this issue.

eastridge commented 11 years ago

@kenearley just for context, we might be able to use the github releases "get the zip" feature once there is an API for it as all of our releases our automated. Presently there is no API. Once there is one my helper might be able to go away. I also didn't see any of the issues addressed in the bower re-write, am I missing something? Would love it if you pointed me at any links / docs / discussions for that.

kenearley commented 11 years ago

@eastridge There has been some discussion about being able to run a post install script. Also improvements to the registry

eastridge commented 11 years ago

Great links! Thanks

On Wed, Jul 17, 2013 at 12:13 PM, Ken Earley notifications@github.comwrote:

@eastridge https://github.com/eastridge There has been some discussion about being able to run a post install scripthttps://github.com/bower/bower/issues/145#issuecomment-10534589. Also improvements to the registryhttps://github.com/bower/bower/issues/584

— Reply to this email directly or view it on GitHubhttps://github.com/harvesthq/chosen/issues/1333#issuecomment-21136968 .

aq1018 commented 11 years ago

I agree with @eastridge, the best course of action for now is probably simply waiting for either the github to release the new API or bower to improve.

andrewbaldock commented 10 years ago

Referring back to @kyrstenkelly 's post. In our case the .js file we wanted in the zip is called "chosen.jquery.js", so we put this in our bower.json before installing:

"chosen.jquery": "https://github.com/harvesthq/chosen/releases/download/1.0.0/chosen_v1.0.0.zip"

Then instead of "bower install chosen", simply run "bower install".

luisrudge commented 10 years ago

This was the worst workaround to the problem. You guys should provide the compiled js file untill the release api thing is done. Bummer.

And the .zip solution didn't worked either:

λ bower install
bower not-cached    https://github.com/harvesthq/chosen/releases/download/1.0.0/chosen_v1.0.0.zip#*
bower resolve       https://github.com/harvesthq/chosen/releases/download/1.0.0/chosen_v1.0.0.zip#*
bower download      https://github.com/harvesthq/chosen/releases/download/1.0.0/chosen_v1.0.0.zip
bower not-cached    git://github.com/harvesthq/chosen.git#~1.0.0
bower resolve       git://github.com/harvesthq/chosen.git#~1.0.0
bower download      https://github.com/harvesthq/chosen/archive/1.0.0.tar.gz
bower extract       chosen.jquery#* chosen_v1.0.0.zip
bower extract       chosen#~1.0.0 archive.tar.gz
bower resolved      git://github.com/harvesthq/chosen.git#1.0.0
bower EPERM         EPERM, rename 'C:\Users\LUS~1\AppData\Local\Temp\NOTE-Lu¡s\bower\chosen.jquery-8912-HOtqg2'

Stack trace:
Error: EPERM, rename 'C:\Users\LUS~1\AppData\Local\Temp\NOTE-Lu¡s\bower\chosen.jquery-8912-HOtqg2'

Console trace:
Trace
    at StandardRenderer.error (C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\lib\renderers\StandardRende
rer.js:74:17)
    at Logger.updateNotifier.packageName (C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\bin\bower:109:18
)
    at Logger.EventEmitter.emit (events.js:95:17)
    at Logger.emit (C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\node_modules\bower-logger\lib\Logger.j
s:29:39)
    at C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\lib\commands\install.js:27:16
    at _rejected (C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:808:24)
    at C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:834:30
    at Promise.when (C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:1079:31)
    at Promise.promise.promiseDispatch (C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.j
s:752:41)
    at C:\Users\Lu¡s\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:574:44

System info:
Bower version: 1.2.8
Node version: 0.10.21
OS: Windows_NT 6.2.9200 x64
andrew-cs commented 10 years ago

@luisrudge we ended up switching to Select2... not for this reason though, for a completely different UI need.

stof commented 10 years ago

Having 3 different versions of the code in the VCS (coffee source, compiled code, compiled minified code) is insane:

All these are drawbacks of the previous process, which is why we changed it.

On the other hand, e never advocated to support bower, even before removing the compiled code. And the release API is available since a few months now as well. It is not our fault if bower does not use it while expecting to get files from github. If you want to have a working bower package, my suggestion is to contact the bower team to see how you can help them to get the support of build assets done.

luisrudge commented 10 years ago

@andrew-cs i would to, but i think chosen has a cleaner api and it's easier to style too...

luisrudge commented 10 years ago

@stof well, thanks for pointing me the issues, but i'm sure there is a way to solve that. Maybe you should drop support of coffee script as this is the first barrier someone would face to contribute to this project. This alone would solve this issue too :)

andrew-cs commented 10 years ago

@luisrudge agree with you there, especially about the API! We just had a requirement that at the time only Select2 fulfilled so we switched.

stof commented 10 years ago

@luisrudge I'm not the lead developer of the project, and CoffeeScript was used before I even started to contribute. So I would not be the one doing such choice.

and it would also require dropping the use of sass for the CSS, which would also increase the maintenance work needed (and remove the CSS customization capabilities for Sass users)

luisrudge commented 10 years ago

js can't coexist with coffee?

stof commented 10 years ago

@luisrudge you mean maintaining a JS codebase which would not be the compiled code ? This would be totally insane. Why would we maintain 2 codebases ?

luisrudge commented 10 years ago

ohhh, sorry.. I miswrote. I want to know why js can't coexist with sass.. Sorry

stof commented 10 years ago

@luisrudge well, if the goal is to be able to get the files from the repo itself for bower, Sass will cause the same issue for the CSS file than CoffeeScript is causing for the JS file

luisrudge commented 10 years ago

Oh, right. I agree... Maybe we could investigate how other projects are doing?

gaving commented 10 years ago

so came here wondering why I can't use chosen with bower, and leaving even more confused i.e. I thought the whole point of bower was to solve these sorts of issues

stof commented 10 years ago

@gaving I also think it should be bower job to fix the issue, which is why we rejected this request, telling to ask the bower team to finally implement the feature

lsocrate commented 10 years ago

I created a bower package for chosen. Get it with bower install chosen-bower.

koenpunt commented 10 years ago

The problem is not creating the package, the problem is maintaining.

pfiller commented 9 years ago

bower install chosen

As of 1.4.2, Chosen supports bower installs. Read the 1.4.2 release notes for details.