-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Download builder #1691
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
Comments
Please talk to @rxaviers about this instead of building one from scratch. |
Please, whoever is going to work on this, get in touch with me. I do have ideas to share. |
This issue can probably be closed? It's duplicate of #1780. |
I'd say it's the other way around. This issue is older. Right? |
Actually, #1780 was older as it was a port from http://bugs.jquery.com but that doesn't really matter; there are comments here. |
Is an online builder the answer? The more I think about it, the more I question its purpose. What problem are we really solving with an online download builder? Who are our target users? |
People do want custom builds. If you look at github.com for example, they're using a custom build. Ember can work with a small subset as well. Those are pretty advanced users though. Our hypothesis is that requiring the user to pull the whole repo, You could be right that it still won't be what people are looking for. I'm not sure how we determine this without building it. |
Dave, thanks for the answers. I completely understand and agree that "people do want custom builds". Although, I'd like to dig in a little bit in our current hypothesis.
I didn't understand the dependencies problem (aren't they locked)? |
Goals (TBD - I will edit this comment as points are clarified)
OBS: These goals are going to be changed in case we decide to distribute consumable modules instead of the monolithic --- like we do in UI, Mobile and Globalize. |
They're not. We specify concrete versions of our direct dependencies but dependencies of dependencies are vague. We have no control if they break in the future; the only way to control that would be to use The only way to be sure would be to commit dependencies but that would boost the repo size extremely to every dev. There's no perfect solution here. |
Got it thanks. Goals. updated. |
@rxaviers It's not just about dependencies of dependencies (but mostly); I wrote: "even then someone may unpublish a version of a library which we depend on and it'll break". Such a scenario is rare but possible. |
Simplified that in the above goals. Thanks |
If we have a separate repo used for a download builder, we could shrinkwrap or commit dependencies in that repo and it would only need to be committed every release (final or betas). I agree that if we tried committing dependencies and publishing that to Bower or npm people would come after us with torches and pitchforks, since their own projects would be massively bloated when most only want one thing--the minified file. |
About the dependencies issue, I just want to point out the download builder falls into the same problem developers (using CLI) do. Download Builder will fetch dependencies during deploy and is exposed to the same risks pointed out here (broken or unpublished dependencies). The only difference is that we manage the download builder environment and we'll be responsible to provide a fix somehow. We still need a way to prevent this problem if we really think it is a problem. |
Could you point to the issue(s) about this? |
Off the top of my head: Generally:
Ad. 2: to update the dependency instead of doing just
Ad. 3 in the first list: If we wanted to avoid the problem, we'd have to insert running a special cleanup scrip after the 4th point in the last list. The Angular team has sth like that: https://github.com/angular/angular.js/blob/master/scripts/clean-shrinkwrap.js I'm pretty sure we'd be making mistakes in the process over & over again. Fixing shrinkwrap is in the pipeline, I believe @othiym23 is involved in the process. But it hasn't happened yet; npm 3.0.0 the earliest. |
None of that matters. We'd only be shrinkwrapping at the time of release and there wouldn't be an existing |
Wow, synchronicity. This outlines the problems and proposes a solution. bower/bower#1606 |
Unless the plan is to make jQuery a meta-project and ship smaller standalone libraries like I hate to be #thatguy, but I frequently point to hand-crafted per-library build tools as an anti-pattern – "[h]andcrafted per-library build tools only add complexity to an already complex problem" – and it's one of the few things I say about modularity in JavaScript where nearly every library consumer agrees vehemently. People don't want to ship code they don't use. One solution is custom builds via a build tools. It is an especially useful solution in world where globals are dominant as a module system and you happen to have a small dependency graph. Once apps get more complicated and the dependency graph grows custom builds start to add to, rather than subtract from, complexity. Here's an example: Imagine a library X is really composed of smaller parts: A build tool lets one project define a smaller subset of X as a dependency. When you begin to combine multiple projects that depend on different subsets of X, you run into trouble. Let's say:
Do you leave it to the consumer to know they need a custom The best idea I've heard for resolving this problem goes like this: author in ES6 modules, transpile to builds that support ES6, AMD, CJS but retain their modularity. Also ship a globals build for people who prefer that. For people who need to ship minimal code allow them to tree-shake (in their preferred module syntax if it supports tree-shaking) at application build time instead of library build time. |
A "module first" approach, where the monolithic build is just an exception like any other sounds good to me. @trek, is there a node-based tool chain that would do what you describe out of the box? |
For the module approach, Core could take a look at Globalize, where modules are not as granular as source files, but assembled in functional groups. Similarly, there could be jquery.js (base), jquery/ajax.js, jquery/deferred.js, ... 👍 module approach. 👍 not pushing our handcrafted build tools onto consumers, but using it internally to assemble consumable/dist modules. |
@jaubourg All the tooling exists. There are several options: https://github.com/esnext/es6-module-transpiler is the one I recommend. Integrating it into an existing build process is trivial: here's a sample one using Broccoli https://github.com/trek/multi-publish-example/blob/master/Brocfile.js That repo is an example of authoring a small project in ES6 and transpiling to AMD, CJS, and Globals. npm publishing is also there. See the README for more info. |
Note that if we wanted to made the One way to be compatible with other module formats would be to transpile to |
And I'm happy to help however I can. Ember is already using ES6 modules so being able to do import {request} from "jquery/ajax/xhr"; And have everything else shake out as part of an application's build process is HUGELY valuable. We already tried a grunt-based custom build a while back and ran into the problem I described above, so I can say with 100% confidence that we wouldn't use a custom build tool. Angular 2.0 is also ES6 module based, so I imagine they'll be in the same boat. There probably is a subset of users who would use a build tool, but I'd suggesting making that small wrapper around a real modules setup. |
Some of you should chime in on bower/bower#1606 about having a place to publish modules. I'd strongly urge you to reconsider putting compile source into version control for future versions. I'm sure you're keenly aware of the many annoying problems this causes. I'd really love for some larger projects to come together and help Bower to solve this for us.
Not to worry! You can get this today without breaking public API and needing a version bump:
This is precisely what https://github.com/trek/multi-publish-example demonstrates: I'm building from The authoring code doesn't pollute npm because it's being npm ignored |
https://github.com/6to5/6to5 is also a popular ES6 to ES5 converter if you want to author in both ES6 modules and use ES6 language features. |
Because jQuery is in AMD format, we can leverage that to get custom builds. This could be optimized:
Now when further functions are looking for the Proof of concept: (I wrote this just for fun. I'm not expecting anything.) |
Settling on AMD was more of a marriage of convenience for us. At the time there wasn't any standard that seemed better, plus our previous custom build system was definitely ad-hoc and much uglier. At this point I would lean towards using ES6 modules and a tool like 6to5 to transpile that into AMD modules to something like We could still use the AMD files to do the custom build though! Did you check out the jQuery UI builder? Anything we can learn/borrow from that? |
I don't think it's likely we'll get this out at the same time as the 3.0 release, but it's not strictly tied to a release. |
Closing in favor of tracking in the Roadmap. |
Atleast if not a builder, jquery should be divided in libraries. For example, I just wanted to use the DOM manipulation part of jquery. I didn't want ajax included to increase the file size. Using a module like jquery/libs/core-dom would be great to reduce the file size. |
@srahulprdxn You can use the AMD modules in |
@mgol Thanks a lot for addressing. Exactly what I needed. |
Let's make one so people can't complain it's hard.
The text was updated successfully, but these errors were encountered: