Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include compiled JS in repo for bower #1333

Closed
aq1018 opened this issue Jul 6, 2013 · 30 comments
Closed

Include compiled JS in repo for bower #1333

aq1018 opened this issue Jul 6, 2013 · 30 comments

Comments

@aq1018
Copy link

aq1018 commented Jul 6, 2013

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
Copy link
Collaborator

koenpunt commented Jul 6, 2013

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
Copy link

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
Copy link
Collaborator

koenpunt commented Jul 8, 2013

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

@kenearley
Copy link

bummer 😦

@kenearley
Copy link

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

@kyrstenkelly
Copy link

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
Copy link

@kenearley @aq1018

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

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

@kenearley
Copy link

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
Copy link

@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
Copy link

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

@eastridge
Copy link

Great links! Thanks

On Wed, Jul 17, 2013 at 12:13 PM, Ken Earley notifications@gh.neting.ccwrote:

@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//issues/1333#issuecomment-21136968
.

@aq1018
Copy link
Author

aq1018 commented Jul 17, 2013

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
Copy link

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
Copy link

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
Copy link

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

@stof
Copy link
Collaborator

stof commented Feb 4, 2014

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

  • nothing ensures that contributors would rebuild it properly each time (meaning that they could be out of sync)
  • approximately 75% of contributions were changing the compiled files rather than the source (even though the contributing documentation was explicitly warning against this)
  • for PRs doing things fully, it would forbid having 2 concurrent mergeable PRs because of conflicts in the minified files
  • PRs were often sending lots of unrelated changes in the compiled code (thus increasing the potential for conflicts in it) because of using a different version of the compiler.

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
Copy link

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

@luisrudge
Copy link

@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
Copy link

@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
Copy link
Collaborator

stof commented Feb 4, 2014

@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
Copy link

js can't coexist with coffee?

@stof
Copy link
Collaborator

stof commented Feb 4, 2014

@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
Copy link

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

@stof
Copy link
Collaborator

stof commented Feb 4, 2014

@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
Copy link

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

@gaving
Copy link

gaving commented Feb 16, 2014

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
Copy link
Collaborator

stof commented Mar 5, 2014

@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
Copy link

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

@koenpunt
Copy link
Collaborator

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

@pfiller
Copy link
Contributor

pfiller commented Mar 28, 2015

bower install chosen

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests