Last active
May 17, 2019 07:36
-
-
Save wwwins/9fabdabe90d1b396612be1222c4cc99a to your computer and use it in GitHub Desktop.
Init node package.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Copyright 2018 isobar. All Rights Reserved. | |
# | |
# Usage: | |
# ./mk-node-package-conf.sh web-server wwwins | |
# | |
echo '>>>>> nodejs package.json init <<<<<' | |
if [ -z "$1" ] | |
then | |
echo "Usage:\n ./mk-node-package-conf.sh web-server wwwins" | |
exit 1 | |
fi | |
folder_name=$1 | |
pkg_name=$1 | |
author=$2 | |
template=/Users/isobar/github2/NodeProjectTemplate | |
mkdir $folder_name | |
cd $folder_name | |
cat > package.json << EOF | |
{ | |
"name": "$pkg_name", | |
"version": "1.0.0", | |
"description": "$pkg_name", | |
"main": "src/app.js", | |
"scripts": { | |
"setup": "cp -pRP $template/* .", | |
"start": "node src/app.js", | |
"debug": "DEBUG=express:* node src/app.js", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "$author", | |
"license": "MIT", | |
"dependencies": { | |
"dotenv": "^6.2.0", | |
"express": "^4.16.4", | |
"express-fileupload": "^1.0.0", | |
"form-data": "^2.3.3", | |
"log-timestamp": "^0.2.1", | |
"lowdb": "^1.0.0", | |
"pug": "^2.0.3", | |
"uuid": "^3.3.2" | |
} | |
} | |
EOF | |
cat > .env << EOF | |
HOST = localhost | |
PORT = 8888 | |
EXT_IP = 127.0.0.1 | |
DB_NAME = db.json | |
ENABLE_SSL = false | |
APP_HOME = $PWD/ | |
EOF | |
echo ">>>>> done <<<<<\n\nrunning cd $folder_name\nnpm install\nnpm run setup\nvi .env" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment