node.js project setup Script
Inspired by http://stackoverflow.com/questions/5178334/folder-structure-for-a-nodejs-project
Usage
Usage: ./createNodeProject <folder> [default|application|coffee]
default - for default node.js project.
application - for MVC- / ORM-Framework like express or mongoose.
coffee - for CoffeeScript-based Express applications (using connect-assets).
#!/bin/bash
if [ $# -ne 2 ]; then
echo ""
echo "Usage: ./createNodeProject <folder> [default|application|coffee]"
echo ""
echo "default - for default node.js project."
echo "application - for MVC- / ORM-Framework like express or mongoose."
echo "coffee - for CoffeeScript-based Express applications (using connect-assets)."
echo ""
exit 1
else
ROOT=$1
TYPE=$2
if [ $TYPE == "default" ]; then
FOLDERS=( "lib" "vendor" "spec" "tests" )
fi
if [ $TYPE == "application" ]; then
FOLDERS=( "lib" "vendor" "spec" "tests" "models" "views" "public/img" "public/css" "public/js" "controllers" )
fi
if [ $TYPE == "coffee" ]; then
FOLDERS=( "lib" "vendor" "spec" "tests" "app" "public/img" "public/css" "public/js" "assets/js" "assets/css" "src" "views" )
fi
for f in ${FOLDERS[@]}
do
mkdir -p $ROOT/$f
done
exit 0
fi
Written by Philipp Haußleiter
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Script
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#