Last active
August 22, 2017 09:23
-
-
Save sunnycyk/5a83c56f19d6f891255a320cccbcc3b4 to your computer and use it in GitHub Desktop.
myscript
This file contains hidden or 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 | |
echo "Start loopback scaffolding for $1" | |
echo "Enter name for application:" | |
read app | |
echo "Creating $app" | |
## create loopback and client framework | |
if [ $1 == "loopback" ]; then | |
lb $app | |
echo "install client framework" | |
echo "Enter name for client" | |
read newApp | |
if [ $# -eq 2 ]; | |
then | |
if [ $2 == "angular" ]; then | |
ng new $newApp --directory ./$app/client | |
# remove default route | |
sed "/router.get('\/'/s//\/\/router.get('\/'/g" ./$app/server/boot/root.js > ./$app/server/boot/tmp.js | |
mv ./$app/server/boot/tmp.js ./$app/server/boot/root.js | |
fi | |
else | |
ng new $newApp --directory ./$app/client | |
sed "/router.get('\/'/s//\/\/router.get('\/'/g" ./$app/server/boot/root.js > ./$app/server/boot/tmp.js | |
mv ./$app/server/boot/tmp.js ./$app/server/boot/root.js | |
fi | |
sed '/"files": {}/s//\"files\": { \"loopback#static\": {\"params\" : \"$!..\/client\/dist\"}}/g' ./$app/server/middleware.json > ./$app/server/tmp.json | |
mv ./$app/server/tmp.json ./$app/server/middleware.json | |
sed '/"node ."/s//"cd .\/client \&\& ng build \&\& cd .. \&\& node ."/g' ./$app/package.json > ./$app/tmp.json | |
mv ./$app/tmp.json ./$app/package.json | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment