aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-04-30 11:17:50 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-04-30 12:56:36 +0200
commit9353449515ff6881a54ce6887297b7eab2855186 (patch)
treed3a6a3e84b3684e3689c4b40ed2e1d53b26a3dc8 /scripts
parent1342381694456da6bfcb01a6f9e23c54cc90c82e (diff)
downloadPeerTube-9353449515ff6881a54ce6887297b7eab2855186.tar.gz
PeerTube-9353449515ff6881a54ce6887297b7eab2855186.tar.zst
PeerTube-9353449515ff6881a54ce6887297b7eab2855186.zip
Use scripty instead of writing shell commands in package.json
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/client/sass.sh9
-rwxr-xr-xscripts/build/client/tsc.sh5
-rwxr-xr-xscripts/clean/client/sass.sh5
-rwxr-xr-xscripts/clean/client/tsc.sh4
-rwxr-xr-xscripts/clean/server/test.sh6
-rwxr-xr-xscripts/danger/clean/modules.sh7
-rwxr-xr-xscripts/danger/clean/server.sh8
-rwxr-xr-xscripts/dev.sh7
-rwxr-xr-xscripts/help.sh24
-rwxr-xr-xscripts/play.sh11
-rwxr-xr-xscripts/test.sh8
-rwxr-xr-xscripts/watch/client/sass.sh7
-rwxr-xr-xscripts/watch/client/tsc.sh5
13 files changed, 106 insertions, 0 deletions
diff --git a/scripts/build/client/sass.sh b/scripts/build/client/sass.sh
new file mode 100755
index 000000000..0caa0df20
--- /dev/null
+++ b/scripts/build/client/sass.sh
@@ -0,0 +1,9 @@
1#!/usr/bin/env sh
2
3npm run clean:client:sass
4cd client || exit -1
5
6# Compile index and angular files
7concurrently \
8 "node-sass --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css" \
9 "node-sass angular/ --output angular/"
diff --git a/scripts/build/client/tsc.sh b/scripts/build/client/tsc.sh
new file mode 100755
index 000000000..ec06b643a
--- /dev/null
+++ b/scripts/build/client/tsc.sh
@@ -0,0 +1,5 @@
1#!/usr/bin/env sh
2
3cd client || exit -1
4
5npm run tsc
diff --git a/scripts/clean/client/sass.sh b/scripts/clean/client/sass.sh
new file mode 100755
index 000000000..82c079f28
--- /dev/null
+++ b/scripts/clean/client/sass.sh
@@ -0,0 +1,5 @@
1#!/usr/bin/env sh
2
3cd client || exit -1
4rm -f stylesheets/index.css
5find angular -regextype posix-egrep -regex ".*\.(css)$" -exec rm -f {} \;
diff --git a/scripts/clean/client/tsc.sh b/scripts/clean/client/tsc.sh
new file mode 100755
index 000000000..775157a54
--- /dev/null
+++ b/scripts/clean/client/tsc.sh
@@ -0,0 +1,4 @@
1#!/usr/bin/env sh
2
3cd client || exit -1
4find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \;
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh
new file mode 100755
index 000000000..927671dd4
--- /dev/null
+++ b/scripts/clean/server/test.sh
@@ -0,0 +1,6 @@
1#!/usr/bin/env sh
2
3for i in $(seq 1 6); do
4 printf "use peertube-test%s;\ndb.dropDatabase();" "$i" | mongo
5 rm -rf "./test$i"
6done
diff --git a/scripts/danger/clean/modules.sh b/scripts/danger/clean/modules.sh
new file mode 100755
index 000000000..1aa6c732b
--- /dev/null
+++ b/scripts/danger/clean/modules.sh
@@ -0,0 +1,7 @@
1#!/usr/bin/env sh
2
3read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -r
4
5if [[ "$REPLY" =~ ^[Yy]$ ]]; then
6 rm -rf node_modules client/node_modules client/typings
7fi
diff --git a/scripts/danger/clean/server.sh b/scripts/danger/clean/server.sh
new file mode 100755
index 000000000..0a85eb249
--- /dev/null
+++ b/scripts/danger/clean/server.sh
@@ -0,0 +1,8 @@
1#!/usr/bin/env sh
2
3read -p "This will remove certs, uploads, database (dev) and logs. Are you sure? " -n 1 -r
4
5if [[ "$REPLY" =~ ^[Yy]$ ]]; then
6 rm -rf ./certs ./logs ./uploads
7 printf "use peertube-dev;\ndb.dropDatabase();" | mongo
8fi
diff --git a/scripts/dev.sh b/scripts/dev.sh
new file mode 100755
index 000000000..d617cd511
--- /dev/null
+++ b/scripts/dev.sh
@@ -0,0 +1,7 @@
1#!/usr/bin/env sh
2
3npm run build
4NODE_ENV=test concurrently \
5 "npm run livereload" \
6 "npm run watch:client" \
7 "npm start"
diff --git a/scripts/help.sh b/scripts/help.sh
new file mode 100755
index 000000000..3ed9f15cc
--- /dev/null
+++ b/scripts/help.sh
@@ -0,0 +1,24 @@
1#!/usr/bin/env sh
2
3printf "############# PeerTube help #############\n\n"
4printf "npm run ...\n"
5printf " build -> Build the application\n"
6printf " build:client -> Build the client (css, js files)\n"
7printf " build:client:sass -> Build the sass files\n"
8printf " build:client:tsc -> Build the javascript files\n"
9printf " clean -> Clean the application\n"
10printf " clean:client -> Clean the client (css, js files)\n"
11printf " clean:client:sass -> Clean the sass build files\n"
12printf " clean:client:tsc -> Clean the javascript files\n"
13printf " clean:server:test -> Clean certificates, logs, uploads and database of the test instances\n"
14printf " watch:client -> Watch the client files\n"
15printf " watch:client:sass -> Watch the sass client files\n"
16printf " watch:client:tsc -> Watch the typescript files\n"
17printf " danger:clean:server -> /!\ Clean certificates, logs, uploads and database\n"
18printf " danger:clean:modules -> /!\ Clean node and typescript modules\n"
19printf " play -> Run 3 fresh nodes so that you can test the communication between them\n"
20printf " dev -> Watch, run the livereload and run the server so that you can develop the application\n"
21printf " livereload -> Run the livereload on the client\n"
22printf " start -> Run the server\n"
23printf " test -> Run the tests\n"
24printf " help -> Print this help\n"
diff --git a/scripts/play.sh b/scripts/play.sh
new file mode 100755
index 000000000..33dc1a545
--- /dev/null
+++ b/scripts/play.sh
@@ -0,0 +1,11 @@
1#!/usr/bin/env sh
2
3if [ ! -f server.js ]; then
4 echo "Missing server file (server.js)."
5 exit -1
6fi
7
8for i in 1 2 3; do
9 NODE_ENV=test NODE_APP_INSTANCE=$i node server.js &
10 sleep 1
11done
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100755
index 000000000..93dbd8200
--- /dev/null
+++ b/scripts/test.sh
@@ -0,0 +1,8 @@
1#!/usr/bin/env sh
2
3cd client || exit -1
4npm test
5
6cd .. || exit -1
7standard
8mocha server/tests
diff --git a/scripts/watch/client/sass.sh b/scripts/watch/client/sass.sh
new file mode 100755
index 000000000..7d716cb7c
--- /dev/null
+++ b/scripts/watch/client/sass.sh
@@ -0,0 +1,7 @@
1#!/usr/bin/env sh
2
3cd client || exit -1
4
5concurrently \
6 "node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css client/angular/**/ client/angular/**/**" \
7 "node-sass -w angular/ --output angular/"
diff --git a/scripts/watch/client/tsc.sh b/scripts/watch/client/tsc.sh
new file mode 100755
index 000000000..f00656d2e
--- /dev/null
+++ b/scripts/watch/client/tsc.sh
@@ -0,0 +1,5 @@
1#!/usr/bin/env sh
2
3cd client || exit -1
4
5npm run tsc:w