Networked Media Week 11

NPM

NPM is the node package manager (being extended to JavaScript in general). It is the common way to install any node package which enhances the functionality of node.

So far we have been using NPM to install packages we need to build our projects but we can also build our own packages to make our work easier. In particular, it used to package up our work to make it portable:

npm init
(Creates package.json)
npm install express --save
(Adds express to package.json dependencies so that it is installed when the package is installed.) Add:
"scripts": { "start": "node server.js" }
to package.json to tell it to start the server when we type "npm start"

GIT

Git is a versioning system. GitHub is popular public site for hosting git repositories. To add our code to a git repository we do the following one time:

git init
git add [FILES TO ADD TO GIT]
git remote add origin [REMOTE GITHUB REPO]
git commit
git push origin master					
				
then when we are ready to edit and make changes and save them we use the following:
git commit [FILE THAT WAS CHANGED] -m "[MESSAGE]"
git push origin master 
				
That will ensure that we have a stored copy of the previous versions of the files along with our new changes on GitHub and in our local GIT repos.

If we want our repo to be used elsewhere, perhaps on our server, we do the following:
git clone [REMOTE GITHUB REPO]
				
Any time we have new changes to we can pull them down with
git pull origin master