Of course we can follow a naming convention similar to the Java package structure, like com.domain.core.Framework (simply create com={},com.domain={},...),in which case, each time you wanted to reference the framework you would be required to type the unnecessarily long string.
Personally, I have not wanted to go use this convention, but understand the flexibility attained by using it. Instead, I use {frameworkName}.{util/type}.js for the file system name, and extend the FRAMEWORK object in js with the util/type name. An example is - FRAMEWORK.ajax.js for the file, FRAMEWORK.ajax for the ajax util.
In websites that I've worked on, the file system's package structure is usually:
/scripts/jquery/jquery.min.js
/scripts/core/framework.core.js
/scripts/ui/*
/scripts/thirdparty/*
/scripts/websites/*
Everything through /scripts/ is served up through a HTTP server (Apache) for speed as well as the ability to have the stream GZipped (compression) for performance optimization in the production environment.
The file structure is broken out such that the particular library that you are using contains all library related js files, as well as any plugins created for the library. In my case, jQuery is the library of choice, and so there is a dedicated jQuery directory.
Alongside the library dir, there is the CORE directory, for all core utility wrappers -- ajax, json, notifications, loggers, form, etc. A separate directory is also maintained for all user interface components, which would in some cases ideally be lazy loaded (using a dependency injection method like jQuery.require). The downside of using this of course, is that the end user has to make another request to get the js file, as opposed to having it be available through a minified / compressed file already cached from the first hit on the server. Sometimes, due to the size of a framework, this is simply necessary.
Aside from the library, core and ui directories, there should also be a directory for 'thirdparty' tools/plugins, in an effort to separate code. This directory should house any third party tools brought in, that do not depend on a particular library - an example of this may be any given WYSIWYG/WYSIWYM - like WYMEditor, HTMLBox, TinyMCE, etc.
Finally, a separate directory for the websites utilizing the code. In some cases, the framework you are creating may only serve up one website, in which case this directory may be redundant. But that being said, I like the separation of code so that I can decouple core, required methods, from website implementation specific code; allowing for a more framework oriented style of development. Also, the naming convention for the website directory should be {website}.{util/type}.js, and should extend the framework object like: FRAMEWORK.{website}.
Here's an example of how I have things setup right now --
jQuery
/scripts/jquery/jquery-1.4.min.js
/scripts/jquery/jquery.dimensions.js
Core
/scripts/core/tikku.core.js
/scripts/core/tikku.logger.js
/scripts/core/tikku.ajax.js
/scripts/core/tikku.json.js
/scripts/core/tikku.form.js
/scripts/core/tikku.notify.js
/scripts/core/tikku.resources.js
UI
/scripts/ui/tikku.accordion.js
/scripts/ui/tikku.carousel.js
/scripts/ui/tikku.dialog.js
/scripts/ui/tikku.dragdrop.js
/scripts/ui/tikku.contextmenu.js
/scripts/ui/tikku.tabs.js
Third-Party
/scripts/thirdparty/swfobject.js
WebSites
/scripts/websites/tikku/tikku.core.js
/scripts/websites/admin/admin.core.js
/scripts/jquery/jquery-1.4.min.js
/scripts/jquery/jquery.dimensions.js
Core
/scripts/core/tikku.core.js
/scripts/core/tikku.logger.js
/scripts/core/tikku.ajax.js
/scripts/core/tikku.json.js
/scripts/core/tikku.form.js
/scripts/core/tikku.notify.js
/scripts/core/tikku.resources.js
UI
/scripts/ui/tikku.accordion.js
/scripts/ui/tikku.carousel.js
/scripts/ui/tikku.dialog.js
/scripts/ui/tikku.dragdrop.js
/scripts/ui/tikku.contextmenu.js
/scripts/ui/tikku.tabs.js
Third-Party
/scripts/thirdparty/swfobject.js
WebSites
/scripts/websites/tikku/tikku.core.js
/scripts/websites/admin/admin.core.js
The resulting DOM structure is -
TT
| // core
+ -- log
+ debug(msg:String,opts:Object)
+ warn(msg:String,opts:Object)
+ error(msg:String,opts:Object)
+ -- ajax
+ send(opts:Object,async:Boolean)
+ sync(opts:Object)
+ asnc(opts:Object)
+ defaultOpts(Object)
+ -- json
+ -- form
+ -- notify
+ -- resources
| // ui
+ -- accordion
+ -- carousel
+ -- dialog
+ -- dragdrop
+ -- contextmenu
+ -- tabs
| // websites
+ -- tikku
+ -- admin // only avail if in 'admin' mode
| // core
+ -- log
+ debug(msg:String,opts:Object)
+ warn(msg:String,opts:Object)
+ error(msg:String,opts:Object)
+ -- ajax
+ send(opts:Object,async:Boolean)
+ sync(opts:Object)
+ asnc(opts:Object)
+ defaultOpts(Object)
+ -- json
+ -- form
+ -- notify
+ -- resources
| // ui
+ -- accordion
+ -- carousel
+ -- dialog
+ -- dragdrop
+ -- contextmenu
+ -- tabs
| // websites
+ -- tikku
+ -- admin // only avail if in 'admin' mode
I have given some insight into the contents of the log and ajax modules, but mainly wanted to illustrate the resulting structure after document.ready is fired.
Also note, global pointers can be created to point to the particular sub-level nodes. I like to have 'log' available within the global NS, so even though TT.log suffices, I create a global log var that points to TT.log. This allows me to use log.debug, log.warn and log.error w/ Firebug, similar to how I instantiate log4j in java.
Importing the framework
There are two environments that must be taken care of: (1) development and (2) production. In the development case, any given website requires a set of js files to include in the meta header. This list should be compressed for the production case. For compression, I recommend using Google's Closure Compiler, or Yahoo's Compressor (which works for CSS too).
It's worth noting that you will want to import your library's javascript BEFORE your framework's. You will also want to make sure to understand any dependencies for framework modules, as the order in which modules is imported dictates how they are initialized (remember the readyFunctionStack?).