sorry for the jabber - but I have to add to my previous mail - that it's a
little more then just declaring what OO programmers would recognize as
public and private ...modules in a package.

Technically, one can cheat, and do
*var **logger* = *require*(*"./node_modules/my-org-core/lib/logger"*);

and by the spec, logger can be a lib/logger.js, or be a
lib/logger/index.js- which is great - we really got planty of
flexibility in that.

And that would work well, - especially under the convention that isaac
promotes:
- if you require it - install it locally
- if you *run *it - install it globally
But that would be coupling with this structure, and I'm not sure we want to
do that, because we built so far to allow possibilities, and not close them
down.

I believe there should be a way to do the same, but without coupling with
the folder structure.



On Wed, Aug 22, 2012 at 2:36 PM, Osher El-Netanany <[email protected]>wrote:

> That's really great in theory.
> In fact, you confuse between a module and a package.
>
> Try to claim that underscore does only one thing. It does not - it gathers
> helpers for many different problems.
>
> Underscore has one entry point that loads everything, and because of that
> - you can find other versions of it in many kind of transmutations, like
> nimble, backbone, and so forth, that essentially duplicate code with it.
>
>
> To be more practical -
> If you got a module that all it does is abstract the logger use - a 60
> lines of code, you don't publish it as a package, maintain it's own version
> number, it's own dependencies - that's less then ideal.
> I have like 30 such modules that form the infrastructure in my
> organization, and I want them to be accessible in a smart way, like the
> spec originally intended to:
>
> *var **logger* = *require*(*"my-org-core/logger"*);
>
> And let the implementation of require worry about loading any of the other
> 30 modules when it is actually called.
> I don't think it's too much to ask - all that is needed is a way to
> explain which of the *modules* in the *package* can be required
> independently, and which are not :-)
>
>
>
>
> On Wed, Aug 22, 2012 at 1:58 PM, Dominic Tarr <[email protected]>wrote:
>
>> each module should to just one thing. if it does a lot of things it
>> should really be separate modules.
>>
>> On Fri, Aug 17, 2012 at 5:01 PM, Osher E <[email protected]> wrote:
>> > here, I'm looking at:
>> >      http://wiki.commonjs.org/wiki/Packages/1.1
>> >
>> > Specifically - search for "directories", and you'll end up with the
>> > following findings in the texts, all of them under the section
>> >
>> > Package Descriptor File
>> >
>> >
>> > 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?
>> >
>> >
>> >
>> > Here's what I try:
>> >
>> > {
>> >   "name": "common-core",
>> >   "version": "0.0.1",
>> >   "description": "common tools - wrappers for logger and crypto, a
>> > config-base util and more",
>> >   "main": "index.js",
>> >   "directories.lib": "lib",
>> >   "directories": {
>> >     "test": "test",
>> >     "lib" : "lib"
>> >   },
>> >   "scripts": {
>> >     "test": "node node_modules/vows/bin/vows --spec"
>> >   },
>> >   "repository": "hg+http://private-lan:2782/common-core";,
>> >   "license": "none",
>> >   "dependencies": {
>> >     "log4js": "0.5.*",
>> >     "crypto": "0.0.3",
>> >     "underscore": "~1.3.3",
>> >     "validator": "~0.4.10"
>> >   },
>> >   "devDependencies": {
>> >     "vows": "*"
>> >   }
>> > }
>> >
>> > Classic Folder structure
>> >
>> > /common-core
>> >   /lib
>> >      config.js
>> >      logger.js
>> >      enc.js
>> >      minimo.js
>> >      ...and more
>> >   /test
>> >      ... all test files
>> >  package.json
>> >  index.js
>> >  README.md
>> >
>> > There just have to be a way to do it...
>> >
>> >
>> > On Friday, August 17, 2012 5:42:57 PM UTC+3, Osher E wrote:
>> >>
>> >> 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?
>> >>
>> >>>
>> > --
>> > 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
>>
>> --
>> 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
>>
>
>

-- 
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

Reply via email to