diff options
-rwxr-xr-x | scripts/build/client.sh | 6 | ||||
-rwxr-xr-x | scripts/build/server.sh | 4 | ||||
-rwxr-xr-x | scripts/clean/client/dist.sh | 6 | ||||
-rwxr-xr-x | scripts/clean/server/dist.sh | 4 | ||||
-rwxr-xr-x | scripts/clean/server/test.sh | 4 | ||||
-rwxr-xr-x | scripts/client-report.sh | 6 | ||||
-rwxr-xr-x | scripts/danger/clean/dev.sh | 4 | ||||
-rwxr-xr-x | scripts/danger/clean/modules.sh | 2 | ||||
-rwxr-xr-x | scripts/danger/clean/prod.sh | 2 | ||||
-rwxr-xr-x | scripts/dev/client.sh | 4 | ||||
-rwxr-xr-x | scripts/dev/index.sh | 4 | ||||
-rwxr-xr-x | scripts/dev/server.sh | 4 | ||||
-rwxr-xr-x | scripts/generate-api-doc.sh | 4 | ||||
-rwxr-xr-x | scripts/generate-code-contributors.sh | 4 | ||||
-rwxr-xr-x | scripts/help.sh | 4 | ||||
-rwxr-xr-x | scripts/play.sh | 6 | ||||
-rwxr-xr-x | scripts/release.sh | 40 | ||||
-rwxr-xr-x | scripts/test.sh | 8 | ||||
-rwxr-xr-x | scripts/travis.sh | 12 | ||||
-rwxr-xr-x | scripts/upgrade.sh | 18 | ||||
-rwxr-xr-x | scripts/watch/client.sh | 6 | ||||
-rwxr-xr-x | scripts/watch/server.sh | 4 |
22 files changed, 97 insertions, 59 deletions
diff --git a/scripts/build/client.sh b/scripts/build/client.sh index e3137df37..8e2004c66 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh | |||
@@ -1,6 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/sh |
2 | 2 | ||
3 | cd client || exit -1 | 3 | set -eu |
4 | |||
5 | cd client | ||
4 | 6 | ||
5 | rm -rf ./dist ./compiled | 7 | rm -rf ./dist ./compiled |
6 | 8 | ||
diff --git a/scripts/build/server.sh b/scripts/build/server.sh index 811da2154..41b59a212 100755 --- a/scripts/build/server.sh +++ b/scripts/build/server.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | rm -rf ./dist | 5 | rm -rf ./dist |
4 | 6 | ||
diff --git a/scripts/clean/client/dist.sh b/scripts/clean/client/dist.sh index ea6f7d644..19b89de77 100755 --- a/scripts/clean/client/dist.sh +++ b/scripts/clean/client/dist.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | cd client || exit -1 | 3 | set -eu |
4 | |||
5 | cd client | ||
4 | rm -rf compiled/ dist/ dll/ | 6 | rm -rf compiled/ dist/ dll/ |
diff --git a/scripts/clean/server/dist.sh b/scripts/clean/server/dist.sh index be8135b8f..50722cb44 100755 --- a/scripts/clean/server/dist.sh +++ b/scripts/clean/server/dist.sh | |||
@@ -1,3 +1,5 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | rm -rf dist/ | 5 | rm -rf dist/ |
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh index b56021874..7d353e375 100755 --- a/scripts/clean/server/test.sh +++ b/scripts/clean/server/test.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | for i in $(seq 1 6); do | 5 | for i in $(seq 1 6); do |
4 | dropdb "peertube_test$i" | 6 | dropdb "peertube_test$i" |
diff --git a/scripts/client-report.sh b/scripts/client-report.sh index 586cc2e47..4dd4b418b 100755 --- a/scripts/client-report.sh +++ b/scripts/client-report.sh | |||
@@ -1,5 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/sh |
2 | 2 | ||
3 | cd client || exit -1 | 3 | set -eu |
4 | |||
5 | cd client | ||
4 | 6 | ||
5 | npm run webpack-bundle-analyzer ./dist/stats.json | 7 | npm run webpack-bundle-analyzer ./dist/stats.json |
diff --git a/scripts/danger/clean/dev.sh b/scripts/danger/clean/dev.sh index cd8456772..14b45e13b 100755 --- a/scripts/danger/clean/dev.sh +++ b/scripts/danger/clean/dev.sh | |||
@@ -1,8 +1,10 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | set -eu | ||
4 | |||
3 | read -p "This will remove all directories and SQL tables. Are you sure? (y/*) " -n 1 -r | 5 | read -p "This will remove all directories and SQL tables. Are you sure? (y/*) " -n 1 -r |
4 | echo | 6 | echo |
5 | 7 | ||
6 | if [[ "$REPLY" =~ ^[Yy]$ ]]; then | 8 | if [[ "$REPLY" =~ ^[Yy]$ ]]; then |
7 | NODE_ENV=test npm run ts-node -- --type-check "./scripts/danger/clean/cleaner" | 9 | NODE_ENV=test npm run ts-node -- --type-check "scripts/danger/clean/cleaner" |
8 | fi | 10 | fi |
diff --git a/scripts/danger/clean/modules.sh b/scripts/danger/clean/modules.sh index 99555a693..f59d6b675 100755 --- a/scripts/danger/clean/modules.sh +++ b/scripts/danger/clean/modules.sh | |||
@@ -1,5 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | set -eu | ||
4 | |||
3 | read -p "This will remove all node server and client modules. Are you sure? " -n 1 -r | 5 | read -p "This will remove all node server and client modules. Are you sure? " -n 1 -r |
4 | 6 | ||
5 | if [[ "$REPLY" =~ ^[Yy]$ ]]; then | 7 | if [[ "$REPLY" =~ ^[Yy]$ ]]; then |
diff --git a/scripts/danger/clean/prod.sh b/scripts/danger/clean/prod.sh index 9103a7944..0675600c4 100755 --- a/scripts/danger/clean/prod.sh +++ b/scripts/danger/clean/prod.sh | |||
@@ -1,5 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | set -eu | ||
4 | |||
3 | read -p "This will remove all directories and SQL tables. Are you sure? (y/*) " -n 1 -r | 5 | read -p "This will remove all directories and SQL tables. Are you sure? (y/*) " -n 1 -r |
4 | echo | 6 | echo |
5 | 7 | ||
diff --git a/scripts/dev/client.sh b/scripts/dev/client.sh index 6d4e7000e..ecd934888 100755 --- a/scripts/dev/client.sh +++ b/scripts/dev/client.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | NODE_ENV=test concurrently -k \ | 5 | NODE_ENV=test concurrently -k \ |
4 | "npm run watch:client" \ | 6 | "npm run watch:client" \ |
diff --git a/scripts/dev/index.sh b/scripts/dev/index.sh index 938bf6056..dcbf62d37 100755 --- a/scripts/dev/index.sh +++ b/scripts/dev/index.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | NODE_ENV=test concurrently -k \ | 5 | NODE_ENV=test concurrently -k \ |
4 | "npm run watch:client" \ | 6 | "npm run watch:client" \ |
diff --git a/scripts/dev/server.sh b/scripts/dev/server.sh index 3130f1d87..bfe322ce1 100755 --- a/scripts/dev/server.sh +++ b/scripts/dev/server.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | if [ ! -f "./client/dist/index.html" ]; then | 5 | if [ ! -f "./client/dist/index.html" ]; then |
4 | echo "client/dist/index.html does not exist, compile client files..." | 6 | echo "client/dist/index.html does not exist, compile client files..." |
diff --git a/scripts/generate-api-doc.sh b/scripts/generate-api-doc.sh index 81b80a0be..7d48db7a5 100755 --- a/scripts/generate-api-doc.sh +++ b/scripts/generate-api-doc.sh | |||
@@ -1,3 +1,5 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | npm run spectacle-docs -- -t support/doc/api/html support/doc/api/openapi.yaml | 5 | npm run spectacle-docs -- -t support/doc/api/html support/doc/api/openapi.yaml |
diff --git a/scripts/generate-code-contributors.sh b/scripts/generate-code-contributors.sh index eb94d418d..9c2541cc2 100755 --- a/scripts/generate-code-contributors.sh +++ b/scripts/generate-code-contributors.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env bash | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | curl -s https://api.github.com/repos/chocobozzz/peertube/contributors | \ | 5 | curl -s https://api.github.com/repos/chocobozzz/peertube/contributors | \ |
4 | jq -r 'map("\\\n * [" + .login + "](" + .url + ")") | .[]' | \ | 6 | jq -r 'map("\\\n * [" + .login + "](" + .url + ")") | .[]' | \ |
diff --git a/scripts/help.sh b/scripts/help.sh index a822d5d2e..318bc63f5 100755 --- a/scripts/help.sh +++ b/scripts/help.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | printf "############# PeerTube help #############\n\n" | 5 | printf "############# PeerTube help #############\n\n" |
4 | printf "npm run ...\n" | 6 | printf "npm run ...\n" |
diff --git a/scripts/play.sh b/scripts/play.sh index ac2a10b12..69725da93 100755 --- a/scripts/play.sh +++ b/scripts/play.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | if [ ! -f "dist/server.js" ]; then | 5 | if [ ! -f "dist/server.js" ]; then |
4 | echo "Missing server file (server.js)." | 6 | echo "Missing server file (server.js)." |
@@ -7,7 +9,7 @@ fi | |||
7 | 9 | ||
8 | max=${1:-3} | 10 | max=${1:-3} |
9 | 11 | ||
10 | for i in $(seq 1 $max); do | 12 | for i in $(seq 1 "$max"); do |
11 | NODE_ENV=test NODE_APP_INSTANCE=$i node dist/server.js & | 13 | NODE_ENV=test NODE_APP_INSTANCE=$i node dist/server.js & |
12 | sleep 1 | 14 | sleep 1 |
13 | done | 15 | done |
diff --git a/scripts/release.sh b/scripts/release.sh index 8c440975f..6f4da6a29 100755 --- a/scripts/release.sh +++ b/scripts/release.sh | |||
@@ -1,11 +1,13 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | set -eu | ||
4 | |||
3 | shutdown() { | 5 | shutdown() { |
4 | # Get our process group id | 6 | # Get our process group id |
5 | PGID=$(ps -o pgid= $$ | grep -o [0-9]*) | 7 | PGID=$(ps -o pgid= $$ | grep -o "[0-9]*") |
6 | 8 | ||
7 | # Kill it in a new new process group | 9 | # Kill it in a new new process group |
8 | setsid kill -- -$PGID | 10 | setsid kill -- -"$PGID" |
9 | exit 0 | 11 | exit 0 |
10 | } | 12 | } |
11 | 13 | ||
@@ -16,7 +18,7 @@ if [ -z "$1" ]; then | |||
16 | exit -1 | 18 | exit -1 |
17 | fi | 19 | fi |
18 | 20 | ||
19 | if [ -z $GITHUB_TOKEN ]; then | 21 | if [ -z "$GITHUB_TOKEN" ]; then |
20 | echo "Need GITHUB_TOKEN env set." | 22 | echo "Need GITHUB_TOKEN env set." |
21 | exit -1 | 23 | exit -1 |
22 | fi | 24 | fi |
@@ -33,43 +35,41 @@ zip_name="peertube-$version.zip" | |||
33 | 35 | ||
34 | changelog=$(awk -v version="$version" '/## v/ { printit = $2 == version }; printit;' CHANGELOG.md | grep -v "$version" | sed '1{/^$/d}') | 36 | changelog=$(awk -v version="$version" '/## v/ { printit = $2 == version }; printit;' CHANGELOG.md | grep -v "$version" | sed '1{/^$/d}') |
35 | 37 | ||
36 | echo -e "Changelog will be:\n" | 38 | printf "Changelog will be:\n%s\n" "$changelog" |
37 | echo "$changelog" | ||
38 | echo | ||
39 | 39 | ||
40 | read -p "Are you sure to release? " -n 1 -r | 40 | read -p "Are you sure to release? " -n 1 -r |
41 | echo | 41 | echo |
42 | if [[ ! $REPLY =~ ^[Yy]$ ]] | 42 | if [[ ! $REPLY =~ ^[Yy]$ ]] |
43 | then | 43 | then |
44 | [[ "$0" = "$BASH_SOURCE" ]] && exit 0 | 44 | exit 0 |
45 | fi | 45 | fi |
46 | 46 | ||
47 | cd ./client || exit -1 | 47 | ( cd client |
48 | npm version --no-git-tag-version --no-commit-hooks $1 || exit -1 | 48 | npm version --no-git-tag-version --no-commit-hooks "$1" |
49 | ) | ||
49 | 50 | ||
50 | cd ../ || exit -1 | 51 | npm version -f --no-git-tag-version --no-commit-hooks "$1" |
51 | npm version -f --no-git-tag-version --no-commit-hooks $1 || exit -1 | ||
52 | 52 | ||
53 | git commit package.json client/package.json -m "Bumped to version $version" || exit -1 | 53 | git commit package.json client/package.json -m "Bumped to version $version" |
54 | git tag -s -a "$version" -m "$version" | 54 | git tag -s -a "$version" -m "$version" |
55 | 55 | ||
56 | npm run build || exit -1 | 56 | npm run build |
57 | rm "./client/dist/stats.json" || exit -1 | 57 | rm "./client/dist/stats.json" |
58 | 58 | ||
59 | cd ../ || exit -1 | 59 | cd .. |
60 | 60 | ||
61 | ln -s "PeerTube" "$directory_name" || exit -1 | 61 | ln -s "PeerTube" "$directory_name" |
62 | zip -r "PeerTube/$zip_name" "$directory_name/CREDITS.md" "$directory_name/FAQ.md" \ | 62 | zip -r "PeerTube/$zip_name" "$directory_name/CREDITS.md" "$directory_name/FAQ.md" \ |
63 | "$directory_name/LICENSE" "$directory_name/README.md" \ | 63 | "$directory_name/LICENSE" "$directory_name/README.md" \ |
64 | "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \ | 64 | "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \ |
65 | "$directory_name/client/package.json" "$directory_name/config" \ | 65 | "$directory_name/client/package.json" "$directory_name/config" \ |
66 | "$directory_name/dist" "$directory_name/package.json" \ | 66 | "$directory_name/dist" "$directory_name/package.json" \ |
67 | "$directory_name/scripts" "$directory_name/support" \ | 67 | "$directory_name/scripts" "$directory_name/support" \ |
68 | "$directory_name/tsconfig.json" "$directory_name/yarn.lock" \ | 68 | "$directory_name/tsconfig.json" "$directory_name/yarn.lock" |
69 | || exit -1 | 69 | |
70 | rm "$directory_name" || exit -1 | 70 | rm "$directory_name" |
71 | 71 | ||
72 | cd "PeerTube" || exit -1 | 72 | cd "PeerTube" |
73 | 73 | ||
74 | git push origin --tag | 74 | git push origin --tag |
75 | 75 | ||
diff --git a/scripts/test.sh b/scripts/test.sh index ee7f6e875..cf8895365 100755 --- a/scripts/test.sh +++ b/scripts/test.sh | |||
@@ -1,6 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/sh |
2 | 2 | ||
3 | npm run build:server || exit -1 | 3 | set -eu |
4 | npm run travis -- lint || exit -1 | 4 | |
5 | npm run build:server | ||
6 | npm run travis -- lint | ||
5 | 7 | ||
6 | mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts | 8 | mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts |
diff --git a/scripts/travis.sh b/scripts/travis.sh index ea0dc8699..79be23493 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | if [ $# -eq 0 ]; then | 5 | if [ $# -eq 0 ]; then |
4 | echo "Need test suite argument." | 6 | echo "Need test suite argument." |
@@ -21,9 +23,9 @@ elif [ "$1" = "api-slow" ]; then | |||
21 | npm run build:server | 23 | npm run build:server |
22 | mocha --timeout 5000 --exit --require ts-node/register/type-check --bail server/tests/api/index-slow.ts | 24 | mocha --timeout 5000 --exit --require ts-node/register/type-check --bail server/tests/api/index-slow.ts |
23 | elif [ "$1" = "lint" ]; then | 25 | elif [ "$1" = "lint" ]; then |
24 | cd client || exit -1 | 26 | ( cd client |
25 | npm run lint || exit -1 | 27 | npm run lint |
28 | ) | ||
26 | 29 | ||
27 | cd .. || exit -1 | 30 | npm run tslint -- --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" "shared/**/*.ts" |
28 | npm run tslint -- --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" "shared/**/*.ts" || exit -1 | ||
29 | fi | 31 | fi |
diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index bd90ce560..2be7b49df 100755 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh | |||
@@ -1,7 +1,6 @@ | |||
1 | #!/usr/bin/env bash | 1 | #!/bin/sh |
2 | 2 | ||
3 | # Strict mode | 3 | set -eu |
4 | set -e | ||
5 | 4 | ||
6 | # Backup database | 5 | # Backup database |
7 | SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date +\"%Y%m%d-%H%M\").bak" | 6 | SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date +\"%Y%m%d-%H%M\").bak" |
@@ -11,19 +10,18 @@ pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH" | |||
11 | # Get and Display the Latest Version | 10 | # Get and Display the Latest Version |
12 | VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) | 11 | VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) |
13 | echo "Latest Peertube version is $VERSION" | 12 | echo "Latest Peertube version is $VERSION" |
14 | wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O /var/www/peertube/versions/peertube-${VERSION}.zip | 13 | wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O "/var/www/peertube/versions/peertube-${VERSION}.zip" |
15 | cd /var/www/peertube/versions | 14 | cd /var/www/peertube/versions |
16 | unzip -o peertube-${VERSION}.zip | 15 | unzip -o "peertube-${VERSION}.zip" |
17 | rm -f peertube-${VERSION}.zip | 16 | rm -f "peertube-${VERSION}.zip" |
18 | 17 | ||
19 | # Upgrade Scripts | 18 | # Upgrade Scripts |
20 | rm -rf /var/www/peertube/peertube-latest | 19 | rm -rf /var/www/peertube/peertube-latest |
21 | ln -s /var/www/peertube/versions/peertube-${VERSION} /var/www/peertube/peertube-latest | 20 | ln -s "/var/www/peertube/versions/peertube-${VERSION}" /var/www/peertube/peertube-latest |
22 | cd /var/www/peertube/peertube-latest | 21 | cd /var/www/peertube/peertube-latest |
23 | yarn install --production --pure-lockfile | 22 | yarn install --production --pure-lockfile |
24 | cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml | 23 | cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml |
25 | 24 | ||
26 | echo "Differences in configuration files..." | 25 | echo "Differences in configuration files..." |
27 | diff /var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example /var/www/peertube/config/production.yaml | 26 | diff "/var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example" /var/www/peertube/config/production.yaml |
28 | 27 | ||
29 | exit 0 | ||
diff --git a/scripts/watch/client.sh b/scripts/watch/client.sh index 2481e2269..710c87037 100755 --- a/scripts/watch/client.sh +++ b/scripts/watch/client.sh | |||
@@ -1,5 +1,7 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | cd client || exit -1 | 3 | set -eu |
4 | |||
5 | cd client | ||
4 | 6 | ||
5 | npm run ng -- server --hmr --host 0.0.0.0 --disable-host-check --port 3000 | 7 | npm run ng -- server --hmr --host 0.0.0.0 --disable-host-check --port 3000 |
diff --git a/scripts/watch/server.sh b/scripts/watch/server.sh index 448f69552..42a594d85 100755 --- a/scripts/watch/server.sh +++ b/scripts/watch/server.sh | |||
@@ -1,4 +1,6 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/bin/sh |
2 | |||
3 | set -eu | ||
2 | 4 | ||
3 | NODE_ENV=test concurrently -k \ | 5 | NODE_ENV=test concurrently -k \ |
4 | "npm run tsc -- --sourceMap && npm run nodemon -- --delay 2 --watch ./dist dist/server" \ | 6 | "npm run tsc -- --sourceMap && npm run nodemon -- --delay 2 --watch ./dist dist/server" \ |