In my projcet node, I create independent modules in a folder with main.js as an entry point and place the helpers for this module in the same folder as different files.
Ex: Aggregator: |___package.json |___main.js |___node_modules |_____helper1.js |_____helper2.js
Therefore, node will resolve all the dependencies of my helper modules [Ex: Aggregator] from the local node_modules
folder. The reason for the structure above, I do not need to care about the path to require
I use package.json to indicate that the entry point is main.js incase require
for Aggregator
Ex: //Sample.js require('Aggregator'); // Resolves to Aggregator/main.js
Example: package.json aggregator module
{ "name": "Aggregator" , "description": "Returns Aggregates" , "keywords": ["aggregate"] , "author": "Tamil" , "contributors": [] , "dependencies": { "redis": "0.6.7" } , "lib" : "." , "main" : "./main.js" , "version" : "1.0" }
Here's what the dependency column is for? I referred to this link. My code works even if I specify the redis version as 10000 without warning. I tried to remove the redis module from the project to check if it picks up the node and resolves the dependency, but that is not the case. When to use this dependency attribute in package.json? Is this just a note for future reference?
npm version 1.1.0-beta-4; node version v0.6.6
Tamil source share