I know this isn't necessarily a "great" SO question, but I don't know where else to turn... (if you do, let me know in the comments!).
I am developing a web application that uses Node.js not even as a web server, but strictly to execute build tools. So, I use NPM to install grunt, cssmin, some testing tools, and some other stuff. At this point I have used -g ('global') during the install phase from time to time, not really knowing any better because I'm new to Node and sometimes the instructions tell me to do this.
Now I'm at the stage to do an initial check-in to our code repository. In theory, another developer could "check it out" and run with it. But that's where I get confused.
How do I ... encapsulate...? all of my Node.js stuff such that it's portable? Ideally the other developer would simply install Node (if they haven't already), type grunt dist
into the command line, and it would build all the distributatbles for them. But obviously that won't be the case unless by coincidence they have already installed all the appropriate tools...?
I THINK this might be what I have to do going forward, but I would like some insight or suggestions on best practices:
- Install Node (of course!)
- NPM install required package (such as grunt), NOT using the global flag but using --save
- Check-in the application folder and its contents
Then the next developer would:
- Install Node (of course!)
- Check out the module from source control
- Navigate to the checked-out folder and
npm install
, which should theoretically "register" the dependencies with their local instance of Node.js? (this is the part I'm unsure of) - Profit. They can now do things like
grunt dist
and the Grunt task should run as expected
Does this sound reasonable? Are there additional factors I'm missing?