I've been pondering the directory structure as it relates to downloading
from svn as well as from downloaded packages. After our meeting last
week, we basically were trying to accomplish:
1) keeping dojo-widget and dojo-ext inside of the dojo.namepaces
2) make them easy dropin add ons by default for downloaders
3) make them easy to use get all in svn by checking out a psuedo
repository with svn:externals pointing at the actual repository.
As we discussed at that meeting, here is an updated plan of attack just
in time for discussion (resolution?) at tomorrow's meeting :)
Currently we have something along the lines of:
The files that we want to require are identified by
dojo.require("dojo.dir.resource2"); As you can see, we hack a little
level of indirection there to skip "src" so we have dojo.dir.resource2
instead of dojo.src.dir.resource2.
My question is what does this buy us? It seems like the only thing that
it has going for it is avoiding having as many files in the root directory.
My proposal is to flatten the dojo tree by a level, while at the same
time trying to move some of the files that are in the root to a
different location in the tree. As an example, something along the
other resources of course would be here too
Now of course we probalby can't get rid of all the "loose" files in the
the current src/ dir. However, where it is possible, we should. In my
opinion, getting rid of some files, in combination with fewer items
being included because of being relocated to dojo.ext, this makes this
level of indirection unneeded.
The widget package might look like (or could look like something else
Button.js (the actual widget)
default.css (if any)
template.html (if any)
image.png (if any)
featureA.js <- mixin
featureB.js <- mixin
capability: dojo.uri.moduleUri("dojo.widget.Button", "default.css");
So back to the directory structure. Simply putting the widget directory
inside of the dojo directory will make it just "work"
(dojo.require("dojo.widget.Foo"); will resolve properly. If for some
reason (probably just to be difficult) you put the widget directory in
../path/foo/widget, and in that case you would have to do something like:
note: this is an "advanced thing though, not the default
For the ext package, things are the same as they are now, but they
should be reworked to be inside of the dojo.ext namespace. Simply unpack
the ext package into the dojoRoot/ext directory.
If you download all three packages (or a package containing all of them)
you would end up with something like:
So, now that we have looked at the directory structure of the packages,
lets look from a svn perspective:
...rest of core
additional psuedo repository:
dojo/ <-- svn::external to /dojo/toolkit/trunk
...modules from core
widget <-- svn external to /dojo/widget/trunk
ext <-- svn external to /dojo/ext/trunk
So to sum this up, making this change will make it so the following happens:
1) Simply expanding the toolkit dir, and including dojo.js stays
2) Expanding dojo-widget.tgz inside of dojoRoot will create a
widget directory with all the widgets in. No registry of the module is
required. including widgets stays as dojo.require("dojo.widget.Foo");
3) Expanding dojo-ext.tgz inside of dojoRoot will make all of the
dojo.ext stuff available. No module registration required.
Furthermore, Simply placing a directory and file inside of dojoRoot
make is available as dojo.require("dojo.foo.bar"). The convention is as
if dojo. look in dojoRoot/, else look in dojoRoot/../foo where foo.
Does this sound workable to everyone? I believe it keeps things simple.