From 75fb0c0b2efe7fb952d45d2bf111e9594f7d5b42 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 10 Jun 2017 22:57:31 +0200 Subject: [PATCH] Adapt scripts to typescript --- package.json | 7 ++++--- scripts/build.sh | 5 +++++ scripts/build/client/dev.sh | 7 ------- scripts/build/server/prod.sh | 5 +++++ scripts/dev.sh | 2 +- scripts/help.sh | 2 +- scripts/play.sh | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) create mode 100755 scripts/build.sh delete mode 100755 scripts/build/client/dev.sh create mode 100755 scripts/build/server/prod.sh diff --git a/package.json b/package.json index 71cd789ba..3ee935572 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 000000000..5be6afcdf --- /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 1fd0ad416..000000000 --- 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 000000000..811da2154 --- /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 3f5b83f12..1cfa638ad 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 0f672d520..51f55547e 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 ab812025c..3cfd82679 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