Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Adapt scripts to typescript

Chocobozzz75fb0c0b2efe
diff --git a/package.json b/package.json
index 71cd789ba3..3ee9355726 100644
--- a/package.json
+++ b/package.json
@@ -17,8 +17,8 @@
"url": "git://github.com/Chocobozzz/PeerTube.git"
},
"scripts": {
- "build": "npm run build:client:prod",
- "build:client:dev": "scripty",
+ "build": "scripty",
+ "build:server:prod": "scripty",
"build:client:prod": "scripty",
"clean": "npm run clean:client",
"clean:client": "scripty",
@@ -30,12 +30,13 @@
"reset-password": "scripty",
"play": "scripty",
"dev": "scripty",
- "start": "node server",
+ "start": "node dist/server",
"check": "scripty",
"upgrade": "scripty",
"update-host": "scripty",
"test": "scripty",
"help": "scripty",
+ "tsc": "tsc",
"postinstall": "cd client && yarn install"
},
"dependencies": {
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000000..5be6afcdf2
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env sh
+
+NODE_ENV=test concurrently \
+ "npm run build:client:prod" \
+ "npm run build:server:prod"
diff --git a/scripts/build/client/dev.sh b/scripts/build/client/dev.sh
deleted file mode 100755
index 1fd0ad4161..0000000000
--- a/scripts/build/client/dev.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env sh
-
-cd client || exit -1
-
-rm -rf ./compiled
-
-npm run webpack -- --config config/webpack.dev.js --progress --profile --colors --display-error-details --display-cached
diff --git a/scripts/build/server/prod.sh b/scripts/build/server/prod.sh
new file mode 100755
index 0000000000..811da21544
--- /dev/null
+++ b/scripts/build/server/prod.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env sh
+
+rm -rf ./dist
+
+npm run tsc
diff --git a/scripts/dev.sh b/scripts/dev.sh
index 3f5b83f129..1cfa638ad7 100755
--- a/scripts/dev.sh
+++ b/scripts/dev.sh
@@ -2,4 +2,4 @@
NODE_ENV=test concurrently -k \
"npm run watch:client" \
- "npm start"
+ "tsc && npm start"
diff --git a/scripts/help.sh b/scripts/help.sh
index 0f672d5209..51f55547e8 100755
--- a/scripts/help.sh
+++ b/scripts/help.sh
@@ -3,7 +3,7 @@
printf "############# PeerTube help #############\n\n"
printf "npm run ...\n"
printf " build -> Build the application for production (alias of build:client:prod)\n"
-printf " build:client:dev -> Build the client for development\n"
+printf " build:server:prod -> Build the server for production\n"
printf " build:client:prod -> Build the client for production\n"
printf " clean -> Clean the application\n"
printf " clean:client -> Clean the client build files (dist directory)\n"
diff --git a/scripts/play.sh b/scripts/play.sh
index ab812025cd..3cfd82679f 100755
--- a/scripts/play.sh
+++ b/scripts/play.sh
@@ -8,6 +8,6 @@ fi
max=${1:-3}
for i in $(seq 1 $max); do
- NODE_ENV=test NODE_APP_INSTANCE=$i node server.js &
+ NODE_ENV=test NODE_APP_INSTANCE=$i node dist/server.js &
sleep 1
done