Bootstrapping a new hapi.js project
Whenever I start a new node.js project there’s a bit of mucking around to get the all the boilerplate just right.
mkdir newproject
git init
I’m using bitbucket for private repositories. Create the repo there first.
git remote add origin git@bitbucket.org:jeromyevans/newproject.git
vi README.md
git add README.md
Setup package.json and make it private
npm init #setup package.json
vi package.json
Add the key:
“private”: true
git add package.json
Setup hapi and grint
npm install hapi --save
#npm install -g grunt-cli (usually already available)
npm install grunt --save-dev
I don’t have a good way of seeding a Gruntfile yet, so I copy it from another source I always use a jshint task in grunt, so include that dev dependency
npm install grunt-contrib-jshint --save-dev
Create a .jshintrc from a good source (jshint options) vi .jshintrc git add .jshintrc
Create a .gitignore from a good source: node.js: https://github.com/github/gitignore/blob/master/Node.gitignore intellij: https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
vi .gitignore
git add .gitignore
Depending on the app, I’ll use grunt-nodemon to watch node src files npm install grunt-nodemon –save-dev