On Wed, Mar 26, 2014 at 07:49:42AM -0700, Frank Z wrote: > But how do I assign my package.json to a particular node.js file? Just > stick it in the same folder??? Does it not clash with the package.json file > that comes with locally installed npm modules? Do I just make the Name key > in the json file the exact same as my js file?
In general, a node.js project will not be a single file -- it'll be a whole
folder, probably looking something like this:
index.js # your main script entry point. Name can vary.
package.json # information about your package. Yes, everything's a
package.
node_modules/ # this is where the modules you install with "npm install"
go
yourfirstdependency/
package.json # You get the idea that it's packages all the way down.
firstdep.js # Its entry point may be named differently.
>
> Maybe the package.json is simply for putting your project on npm?
While it certainly makes that possible, it's actually more core to your
project. Think of it as a roadmap or introduction to your project.
"Hi! I'm _______, version _____. I do this neat thing. To do that, I use _____
and ____ and ____. To test me, run ______ and also, if you want to start me as
a service, run ________"
A good portion of that's optional, but that's the idea.
It's really okay to make a new folder for every project. If you're used to
working in a heap of unrelated stuff, that feels weird at first -- it sure was
strange to me coming from using a ton of tiny ruby scripts -- but I think it's
refreshing once you get used to it.
Aria
pgpLtNhVEtmpu.pgp
Description: PGP signature
