Use scripty instead of writing shell commands in package.json

This commit is contained in:
Chocobozzz
2016-04-30 11:17:50 +02:00
parent 1342381694
commit 9353449515
18 changed files with 128 additions and 39 deletions

9
scripts/build/client/sass.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env sh
npm run clean:client:sass
cd client || exit -1
# Compile index and angular files
concurrently \
"node-sass --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css" \
"node-sass angular/ --output angular/"

5
scripts/build/client/tsc.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
cd client || exit -1
npm run tsc

5
scripts/clean/client/sass.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
cd client || exit -1
rm -f stylesheets/index.css
find angular -regextype posix-egrep -regex ".*\.(css)$" -exec rm -f {} \;

4
scripts/clean/client/tsc.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
cd client || exit -1
find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \;

6
scripts/clean/server/test.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
for i in $(seq 1 6); do
printf "use peertube-test%s;\ndb.dropDatabase();" "$i" | mongo
rm -rf "./test$i"
done

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -r
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
rm -rf node_modules client/node_modules client/typings
fi

8
scripts/danger/clean/server.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env sh
read -p "This will remove certs, uploads, database (dev) and logs. Are you sure? " -n 1 -r
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
rm -rf ./certs ./logs ./uploads
printf "use peertube-dev;\ndb.dropDatabase();" | mongo
fi

7
scripts/dev.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
npm run build
NODE_ENV=test concurrently \
"npm run livereload" \
"npm run watch:client" \
"npm start"

24
scripts/help.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env sh
printf "############# PeerTube help #############\n\n"
printf "npm run ...\n"
printf " build -> Build the application\n"
printf " build:client -> Build the client (css, js files)\n"
printf " build:client:sass -> Build the sass files\n"
printf " build:client:tsc -> Build the javascript files\n"
printf " clean -> Clean the application\n"
printf " clean:client -> Clean the client (css, js files)\n"
printf " clean:client:sass -> Clean the sass build files\n"
printf " clean:client:tsc -> Clean the javascript files\n"
printf " clean:server:test -> Clean certificates, logs, uploads and database of the test instances\n"
printf " watch:client -> Watch the client files\n"
printf " watch:client:sass -> Watch the sass client files\n"
printf " watch:client:tsc -> Watch the typescript files\n"
printf " danger:clean:server -> /!\ Clean certificates, logs, uploads and database\n"
printf " danger:clean:modules -> /!\ Clean node and typescript modules\n"
printf " play -> Run 3 fresh nodes so that you can test the communication between them\n"
printf " dev -> Watch, run the livereload and run the server so that you can develop the application\n"
printf " livereload -> Run the livereload on the client\n"
printf " start -> Run the server\n"
printf " test -> Run the tests\n"
printf " help -> Print this help\n"

11
scripts/play.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env sh
if [ ! -f server.js ]; then
echo "Missing server file (server.js)."
exit -1
fi
for i in 1 2 3; do
NODE_ENV=test NODE_APP_INSTANCE=$i node server.js &
sleep 1
done

8
scripts/test.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env sh
cd client || exit -1
npm test
cd .. || exit -1
standard
mocha server/tests

7
scripts/watch/client/sass.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
cd client || exit -1
concurrently \
"node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css client/angular/**/ client/angular/**/**" \
"node-sass -w angular/ --output angular/"

5
scripts/watch/client/tsc.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
cd client || exit -1
npm run tsc:w