Skip to content

Build: Use bower to manage client-side dependencies #1201

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

Closed
wants to merge 3 commits into from

Conversation

jzaefferer
Copy link
Member

Fixes #9507 (eventually). This is a work-in-progress, I wanted to share what I have so far. I've used the same approach as core and sizzle, using grunt-bowercopy to replicate the existing files.

The biggest issue I see is the jquery dependency. Specifying >=1.6 is nice to declare what version we depend on, but is wrong once we start actually using bower. With this in place, we end up installing 2.1.0, which is most certainly not the right version. What we really want here is 1.10.2 or, if we were to use the latest 1.x version, 1.11.0.

Which brings us to the next problem: Whatever that jQuery version is, it has no version in its file name, so we'd have to hard code that version in two places: Once in bower.json, once in the Gruntfile inside the bowercopy task. I think what we should do instead is this: Specify the actual jQuery version we want to use in bower.json, currently that should be 1.11.0, then copy that to jquery.js in the root, and update all the references to jquery-1.10.2.js to just jquery.js. In the future we could update to newer jQuery versions by just specifying the new version in bower.json and running grunt bowercopy again.

There's a tiny shortcoming on grunt-bowercopy which I've reported there.

jquery-mousewheel is an optional, non-dev dependency, since its by spinner (not just demos). I've currently put it under devDependencies, since there's no way to mark dependencies as optional (which is probably sane). Should this go into regular dependencies instead?

Both mousewheel and jshint can be updated to newer versions, that should happen after this is done. I don't want to clutter this PR with big diffs in external/. Even installing the same jshint version from bower causes some whitespace changes, keep that in mind when testing this PR locally.

Overall I like this approach. Bowercopy allows us to keep our external dependencies in exactly the same place as before, while getting rid of manually updating files. Just need to figure out how to deal with our main dependency...

@timmywil
Copy link
Member

The shortcoming in grunt-bowercopy has been fixed. See version 0.8.0.

@jzaefferer
Copy link
Member Author

After discussing this with Scott, a few things left do to, addressing the issues I mentioned above:

  1. Update *shint.js, replace * with “j”, along with an update of the grunt-bowercopy dependency
  2. Rename ./jquery-1.10.2.js to ./jquery.js, update all references
  3. Change jQuery dependency in bower.json to >=1.6 <1.11
  4. Update mousewheel to latest
  5. Check if jshint can be updated, since it doesn't support IE anymore and doesn't work in PhantomJS (can be addressed with bind polyfill

@tjvantoll
Copy link
Member

I like using jquery.js as a filename throughout the repo.

For the jQuery dependency in bower.json, will using a max version of 1.11 rather than 2.1 confuse people? I get that we want 1.11 installed in the repo, but I don't want people to think we don't support jQuery 2.x.

Is it possible to list a file both as a dependency and a devDependency? If so we could declare jQuery >= 1.6 as a dependency, and 1.11.0 as a devDependency.

@jzaefferer
Copy link
Member Author

For the jQuery dependency in bower.json, will using a max version of 1.11 rather than 2.1 confuse people? I get that we want 1.11 installed in the repo, but I don't want people to think we don't support jQuery 2.x.

Considering that this repo isn't in the bower registry, I hope this just doesn't matter.

Is it possible to list a file both as a dependency and a devDependency? If so we could declare jQuery >= 1.6 as a dependency, and 1.11.0 as a devDependency.

I tried that, it will just install 2.1.0.

@jzaefferer
Copy link
Member Author

I've updated this PR to address most of the issues outlined above. There's currently an issue with the mousewheel plugin that I hope to get addressed soon - it only affects tests anyway.

I've updated jshint as well. It doesn't run in IE8, but since we already catch that, I don't see a problem there.

@tjvantoll
Copy link
Member

This looks good to me.

@jzaefferer
Copy link
Member Author

Apart from getting the mousewheel plugin fixed, we also need to update the build-demos task in jqueryui.com

jzaefferer added a commit that referenced this pull request Mar 5, 2014
@jzaefferer
Copy link
Member Author

I've updated this again to drop the mousewheel plugin update. Should be good to land now. @scottgonzalez can you confirm?

"external": "qunit/qunit"
}
},
// can be updated to 3.1.9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment.

@scottgonzalez
Copy link
Member

I just want @rxaviers to confirm that the name change for jquery.js won't break anything in DB.

@rxaviers
Copy link
Member

rxaviers commented Mar 6, 2014

@scottgonzalez, DB updated accordingly.

@jzaefferer jzaefferer closed this in d789d7a Mar 6, 2014
@jzaefferer jzaefferer deleted the dev-dependencies branch March 6, 2014 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants