Init commit
This commit is contained in:
94
scripts/build/client.sh
Normal file
94
scripts/build/client.sh
Normal file
@@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
defaultLanguage="en-US"
|
||||
|
||||
# Supported languages (key:locale pairs) - Bash 3.2 compatible for macOS
|
||||
languages=(
|
||||
ar:ar
|
||||
ca:ca-ES
|
||||
cs:cs-CZ
|
||||
de:de-DE
|
||||
el:el-GR
|
||||
en:en-US
|
||||
eo:eo
|
||||
es:es-ES
|
||||
eu:eu-ES
|
||||
fa:fa-IR
|
||||
fi:fi-FI
|
||||
fr:fr-FR
|
||||
gd:gd
|
||||
gl:gl-ES
|
||||
hr:hr
|
||||
hu:hu-HU
|
||||
is:is
|
||||
it:it-IT
|
||||
ja:ja-JP
|
||||
kab:kab
|
||||
nb:nb-NO
|
||||
nl:nl-NL
|
||||
nn:nn
|
||||
oc:oc
|
||||
pl:pl-PL
|
||||
pt:pt-BR
|
||||
pt-PT:pt-PT
|
||||
ru:ru-RU
|
||||
sk:sk-SK
|
||||
sq:sq
|
||||
sv:sv-SE
|
||||
th:th-TH
|
||||
tok:tok
|
||||
tr:tr-TR
|
||||
uk:uk-UA
|
||||
vi:vi-VN
|
||||
zh-Hans:zh-Hans-CN
|
||||
zh-Hant:zh-Hant-TW
|
||||
)
|
||||
|
||||
|
||||
rm -rf ./client/dist
|
||||
|
||||
npm run build:embed
|
||||
|
||||
cd client
|
||||
|
||||
# Don't build other languages if --light arg is provided
|
||||
if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then
|
||||
additionalParams=""
|
||||
if [ ! -z ${1+x} ] && [ "$1" == "--source-map" ]; then
|
||||
additionalParams="--source-map=true"
|
||||
fi
|
||||
|
||||
NODE_OPTIONS=--max_old_space_size=8192 node_modules/.bin/ng build --configuration production --output-path "dist/build" $additionalParams
|
||||
|
||||
for entry in "${languages[@]}"; do
|
||||
key="${entry%%:*}"
|
||||
lang="${entry#*:}"
|
||||
|
||||
mv "dist/build/browser/$key" "dist/$lang"
|
||||
|
||||
if [ "$lang" != "en-US" ]; then
|
||||
# Do not duplicate assets
|
||||
rm -r "./dist/$lang/assets"
|
||||
fi
|
||||
done
|
||||
|
||||
mv "./dist/$defaultLanguage/assets" "./dist"
|
||||
|
||||
rm -r "dist/build"
|
||||
else
|
||||
additionalParams=""
|
||||
if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
|
||||
additionalParams="--named-chunks=true --output-hashing=none"
|
||||
|
||||
# For Vite
|
||||
export ANALYZE_BUNDLE=true
|
||||
fi
|
||||
|
||||
NODE_OPTIONS=--max_old_space_size=8192 node_modules/.bin/ng build --localize=false --output-path "dist/$defaultLanguage/" \
|
||||
--configuration production --stats-json $additionalParams
|
||||
fi
|
||||
|
||||
# Copy runtime locales
|
||||
cp -r "./src/locale" "./dist/locale"
|
||||
7
scripts/build/embed.sh
Normal file
7
scripts/build/embed.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
(cd client/src/standalone/player && npm run build)
|
||||
|
||||
cd client && ./node_modules/.bin/vite -c ./src/standalone/videos/vite.config.mjs build --mode=production
|
||||
12
scripts/build/index.sh
Normal file
12
scripts/build/index.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
npm run build:server
|
||||
|
||||
# Angular does not support project references, it's the reason why we can't builds concurrently
|
||||
if [ ! -z ${1+x} ]; then
|
||||
npm run build:client -- $1
|
||||
else
|
||||
npm run build:client
|
||||
fi
|
||||
12
scripts/build/peertube-cli.sh
Normal file
12
scripts/build/peertube-cli.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
cd ./apps/peertube-cli
|
||||
rm -rf ./dist
|
||||
|
||||
../../node_modules/.bin/tsc -b --verbose
|
||||
rm -rf ./dist
|
||||
mkdir ./dist
|
||||
|
||||
node ./scripts/build.js
|
||||
12
scripts/build/peertube-runner.sh
Normal file
12
scripts/build/peertube-runner.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
cd ./apps/peertube-runner
|
||||
rm -rf ./dist
|
||||
|
||||
../../node_modules/.bin/tsc -b --verbose
|
||||
rm -rf ./dist
|
||||
mkdir ./dist
|
||||
|
||||
node ./scripts/build.js
|
||||
16
scripts/build/server.sh
Normal file
16
scripts/build/server.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [ -z ${1+x} ] || [ "$1" != "--incremental" ]; then
|
||||
rm -rf ./dist ./packages/*/dist
|
||||
fi
|
||||
|
||||
npm run tsc -- -b --verbose server/tsconfig.json
|
||||
npm run resolve-tspaths:server
|
||||
|
||||
cp -r "./server/core/static" "./server/core/assets" ./dist/core
|
||||
cp -r "./server/locales" ./dist
|
||||
cp "./server/scripts/upgrade.sh" "./dist/scripts"
|
||||
|
||||
mkdir -p ./client/dist && cp -r ./client/src/assets ./client/dist
|
||||
9
scripts/build/tests.sh
Normal file
9
scripts/build/tests.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
rm -rf ./packages/tests/dist
|
||||
|
||||
npm run tsc -- -b --verbose ./packages/tests/tsconfig.json
|
||||
npm run resolve-tspaths:server-lib
|
||||
npm run resolve-tspaths:tests
|
||||
Reference in New Issue
Block a user