-
Notifications
You must be signed in to change notification settings - Fork 79
Proposal: Remove or deprecate auto-integration in Ender 1.0 #166
Comments
A side effect of this is breaking compatibility with modules that do work with ender, but aren't labeled. In the past, I've successfully used spin.js with ender, but this module has no mention of ender in its Also, tangentially related, support for simple modules that use the |
Well, since spin.js uses The second approach you mention will work if the module itself does what you describe. I don't see how this would work with arbitrary code, though, because there can't be a |
In that case, I misunderstood your initial post and agree with what you're saying now. If this doesn't affect the |
@st-luke sounds like you'll be appreciative of a move to a pure commonjs system with the |
Absolutely. I think the commonjs style |
I'm in favor of the |
I like this idea in general, but is there any way to re-enable auto-integration in Ender 2.0 for projects that were built around that feature? I'm trying to update the modules in some of my existing libraries, and don't really want to manually re-add all those methods back to $. I could just keep an old version of Ender around, but Ender 2.0 fixed some annoying issues with 1.1 (barf on .DS_Store files, empty output for The other issue for me is that most people where I work use jQuery, so maintaining the $ façade does a lot to reduce friction/resistance to custom-built libraries ("why don't we just stick with the standard?"). It's a much easier sell when I can say "look, we can just swap in jQuery instead and pretty much everything still works", but now that's no longer the case. I could manually re-add all the functions to $, but that really seems like the wrong approach to restore functionality that was already there before. I'm fine with auto-integration being off by default, but if it's completely removed I may be stuck choosing between keeping old, stale Ender-built libraries with out-of-date modules or just switching back to jQuery on existing projects. The other alternative is to just update all the actual function calls throughout my code, but I'd still want everything under $ to avoid polluting the global namespace with a bunch of top-level vars for each module. This is something I don't worry about so much in Node, but on the client side, the As an example of when this would be a total pain in the arse, consider a project that uses Backbone (and therefore also Underscore, which has around 100 methods). I guess I could just do something like this for each module (but…ugh):
Seems like a lot of work just to get back to something that worked fine before. To me it would make a lot more sense to provide an optional flag to enable auto-integration and leave it off by default rather than just removing it altogether. |
I added a new ender build jeesh underscore --integrate underscore This would cause all the functions that Your other alternative is to do this manually at runtime like so: $.ender(require('underscore')) Does this cover the use case you're describing? |
Thanks Andrew! Is there any way to do this with a package.json? (I guess that approach involves the I do agree with the general principle of not automatically mashing every module's public methods into $. Just trying to maintain some of my simpler libraries that only include Jeesh + two or three other modules. |
Well, from Ender's perspective, it doesn't care if the package was included from the command line or the You could create a |
Cheers. I'm trying to sort out the new-as-of-yesterday issues with npm (no longer allows self-signed certs) and install the new Ender 2.0.1 (looks like some of the components have been updated to 1.0.2 already; possibly related?). Will take another run at building my old libraries once I've got everything in order here. |
Yeah, the update to 1.0.2 was to update Ender's version of NPM, but I missed a version number update in one of the submodules, and now that you can't force-publish, I just updated everything to 2.0.3 (ender) / 1.0.3 (ender-*). Going up to |
I did get 2.0.2 and the build (w/ The Lemme give this another whirl w/ 2.0.3. |
There's still something broken in Backbone after building the library w/ 2.0.3. It looks like
Not that this is the place to troubleshoot the Backbone module, but it's something that works with the old auto-integration of Ender 1.1, and doesn't with |
2.0.3 had no functional changes, so whatever issues you're having won't be resolved. I'm not sure what problem you're running into with As for having |
Yeah I've got the integration part sorted out (I think?) by just specifying all the modules after |
If I just add a breakpoint and manually do: |
It's an issue of how |
That seems to be the only remaining issue. Really appreciate your time on this. Gonna try rebuilding some other libraries that don't use Backbone. |
Actually, it seems like when |
Seems like the change happened when AMD compatibility was added in jashkenas/backbone@ea29bd9 Maybe we can put in a pull request that the |
Was just trying to fudge it by setting up Backbone before passing it to Can't quite pin down why I can't just pass the result of (Edit: err, I can do that, but if I try to set |
Fixing this in the actual Backbone repo seems like the correct solution here. |
What works for now is just specifying backbone@1.1.0 when building my library. My bad, this one had nothing to do with Ender. I'll get in touch w/ Jeremy about the Backbone change. |
So the other solution here, for anyone who wants to use Backbone 1.1.1 or newer, is to skip the
Then |
So I updated one of my projects with an Ender-(2.0.3)-built library. Backbone is now |
Submitted a fix for Backbone: jashkenas/backbone#3038 The fix is useful whether Backbone is integrated or not. When not integrated, you won't need to manually assign I've got it working with integration as well, but the catch is it'll only integrate with
For the sake of simplicity when building the library, I will probably just keep using it without integration, but at least it can work both ways for those who want it to. |
I've been doing some analysis of publicly available ender modules in NPM, and I'd like to share some takeaways. The first one is that I think ender should do away with auto-integration. By that, I mean, when there is no bridge specified in the package.json file. In these cases, Ender attempts to auto-integrate the module:
The problem with this is that the majority of the time, this is the wrong behavior (judging by modules in the wild). Here are the numbers I found:
noop
: 20In every category except the last, or 44 / 62 modules, integration is either doing nothing, or is actually incorrect behavior. This is with a pretty generous interpretation of what might be useful. Most of the modules in the 'should be noop' category are things like native node modules ported to the browser, modules that export generic names like
create
that will likely clobber existing functions, modules that are using theirmain
file as abridge
, and modules that export single functions but with useless internal objects or constants attached to those functions.There are only 33 modules that actually specify a
noop
bridge, when the number should really be more like 80.I think that it's better to make
noop
the default and force people to explicitly integrate their modules. It's easy to do and will avoid issues when people just offer modules through Ender without making sure they only export useful$.ender
methods.Note that my methodology might not be perfect, and there is a subjective element in a few cases, so for reference, here are the modules in each category:
No Exports
cookie-monster
cssclass
Davis
ender-twitter-bootstrap
es5
littering
process
reddy
sHistory
sugar
Export Only A Function
asyncify
aug
chainify
clearInterval
clearTimeout
dice-roll
fileup
framejax
houkou
houkou-tweak
konami
loop
setInterval
setTimeout
Should Be noop
assert
Buffer
campusbooks
console
ender-sc
eventhub
events.node
forEachAsync
future
join
JSON
json-storage
json-storage-model
json-tables
kizzy
lateral
path
sequence
url
util
Might Export Useful Methods
ahr2
bowser
categorizr
delayed
ender-deferred
ender-ejs
ender-validator
fidel
jolt
jaaulde-cookies
jsonapi
loadr
md5
navigator
pathjs
postmessage
serialize-form
webnotify
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: