here, I'm looking at:
http://wiki.commonjs.org/wiki/Packages/1.1
Specifically - search for "directories", and you'll end up with these texts:
- directories.lib - directory of modules to be loaded under the packages
namespace. *require(name/subfilename)* must return modules from this
directory. Definition must be relative to the package description file.
- directories - Object hash of package directories. Typical directories
include "lib", "src", "doc", "jars", "test" and "bin". Package manager
tools must use these directory definitions to find various package
components.
And from that I learn that I should be able to create a package from which
I should be able to require("mypackage/somemodule")
Did anybody here did it before?
On Monday, August 13, 2012 3:47:36 PM UTC+3, Christian Tellnes wrote:
>
> You can use getters like connect does.
>
> https://github.com/senchalabs/connect/blob/master/lib/connect.js#L86-92
>
>
>
> 2012/8/13 Osher E <[email protected] <javascript:>>:
> > Hi all
> >
> > most modules have an entry point, which is by default index.js.
> >
> > But what if my module does not have one entry point?
> > What if it is a colleciton of many small cross-project core utility
> modules
> > that i would not always want to load them all to use one of them?
> > I mean, by doing
> >
> > var core = require('core').logger
> > we require whatever is exported on the entry-point of core, and use
> only
> > logger.
> > and there could be twenty of them, where in this project I just need the
> > logger here.
> >
> > Please avoid the discussion of wither to wrap each utility as it's own
> > package...
> > Just assume that they do not justify that, but do need a package to live
> > in...
> >
> > I saw somewhere that I should be able to
> > var core = require('core/logger')
> > and should be able to direct in my package.json that 'core/logger' is
> > actually available at ./lib/logger
> > only that now i cant find that place that sais how to do it...
> >
> > Was I dreaming? Can anybody point it out for me? :)
> >
> > Thanks
> >
> > O.
> >
> > --
> > Job Board: http://jobs.nodejs.org/
> > Posting guidelines:
> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]<javascript:>
> > To unsubscribe from this group, send email to
> > [email protected] <javascript:>
> > For more options, visit this group at
> > http://groups.google.com/group/nodejs?hl=en?hl=en
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en