Closed chaudeco closed 8 years ago
Could you merge the latest master branch commit into your PR?
I'd really like to see Backbone Relational export only it's own objects instead of Backbone + RelationalModel, etc, etc. This of course would be a breaking change, but I feel makes sense to do. Thoughts anyone?
BBR would still be modifying the main Backbone object I assume?
@philfreo Yes, but I'd like to keep all the BBR objects within their own namespace.
So the following changes would happen:
Backbone.RelationalModel
=> Backbone.Relational.Model
Backbone.Collection
(the modified version) => Backbone.Relational.Collection
Backbone.BlockingQueue
=> Backbone.Relational.BlockingQueue
Backbone.Store
=> Backbone.Relational.Store
Backbone.Relation
=> Backbone.Relational.Relation
Backbone.HasMany
=> Backbone.Relational.HasMany
Backbone.HasOne
=> Backbone.Relational.HasOne
Backbone.Relational.store
=> Backbone.Relational.store
(stays the same!)(I think that covers everything)
So then the library would export only Backbone.Relational
Aha, yeah that makes sense as long as the upgrade path is well documented like this
@chaudeco Do you think you could make those changes, or should I take over from here? I'm hoping to get these updates pushed out sooner than later.
Any updates on this PR?
As for upgrade path, would it make sense to mark the old syntax deprecated
, but ship with a shim for 1 or 2 versions?
@PaulUithol As much as I wish the answer to that was no, that's probably the right thing to do.
Yes, a shim would be in order to make migration easier. I'm unsure of the best way to implementation for it right now.
I'm hoping to break up the current code base into separate modules (this issue was the first step) as well as introduce a build system (most likely gulp) to make the amd+cjs+umd bundle (most likely rollup). With that in place, having a compat bundle which would export in the same way as before in the Backbone namespace would be trivial.
In order to use ES6 module syntax, we need to return the extended Backbone object.
Then, we'll be able to import this extended Backbone object in other projects:
import Relational from 'Backbone-relational'