[Pkg-javascript-devel] NodeJS repository structure

Jérémy Lal jerry at edagames.com
Thu Oct 13 23:58:45 UTC 2011


On 14/10/2011 01:45, Jonas Smedegaard wrote:
> On 11-10-13 at 11:21pm, Jérémy Lal wrote:
>> On 13/10/2011 20:31, Jonas Smedegaard wrote:
>>> On 11-10-13 at 08:25pm, David Paleino wrote:
>>>> I noticed that we're putting libraries under /usr/lib/nodejs/, but 
>>>> there's also a /usr/share/nodejs/ populated by nodejs-dev.
>>>>
>>>> I've packaged libnode-sqlite3, which compiles a binding to 
>>>> libsqlite3-dev, so /u/lib/ is its perfect place. But I'm wondering 
>>>> why we're putting also arch-independent libraries in /u/lib/ ? 
>>>> Wouldn't it better to follow the commonly used scheme of /u/share 
>>>> for arch-indep and /u/lib for arch-dep?
>>>>
>>>> I haven't looked at nodejs code, but it doesn't seem too hard to 
>>>> implement, given nodejs-dev already populates that directory.
>>>>
>>>> What do you think about this?
>>>
>>> As a principle I totally agree.
>>>
>>> Jérémy is our Node expert, however - let's wait and hear his opinion 
>>> :-)
>>
>> Facts :
>> * arch-independent libs must go to /usr/share/nodejs
>> * arch-dependent libs must go to /usr/lib/nodejs
>> * node libs that are arch-dependent almost all have two files : a 
>>   dependent .node and an independent .js
>> * it is unwise to multiply nodejs search paths...
>>
>> The simple decision is to put all modules in /usr/lib/nodejs, I 
>> understand it's more important to have arch-dependent libs in the 
>> right place than having arch-independent libs in the right place, and 
>> all modules stay in the same dir.
>> More importantly this is the same pattern as python and ruby.
>>
>> I'm nonetheless open to discussion.
> 
> Care to elaborate why it is unwise to multiply nodejs search paths?

Node already looks for modules in .node_libraries, ./node_modules, /usr/lib/nodejs...
It's confusing, that's all. Also it adds one to an already long list of stat().

Also consider that lib, that contains both : a.js and a.node.
At some point a.js will be require()'d. 
a.js will expect a.node to be in the same dir, or something like that, because you can do
require('./a.node');
So a.js will need to be patched.

> I do not follow your argument that same is true for Python: 
> arch-independent Python library packages install below /usr/share.

I had a quick look but i swear /usr/share/python is almost empty here.
http://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html#s-paths
It is unclear (to me, at first glance) wether it's /usr/lib/pythonxx or what.

Jérémy.



More information about the Pkg-javascript-devel mailing list