1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lingva_ynh.git synced 2024-09-03 19:36:20 +02:00

pakai nodejs dan ubah izin

This commit is contained in:
Neko Nekowazarashi 2023-06-01 12:44:14 +07:00
parent a1a3eda723
commit 8e36867acd
6 changed files with 27 additions and 2 deletions

View file

@ -6,6 +6,7 @@ After=network.target
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=__YNH_NODE_LOAD_PATH__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=yarn run next start -p __PORT__ ExecStart=yarn run next start -p __PORT__

View file

@ -70,6 +70,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Rebuilding the app..." --weight=1 ynh_script_progression --message="Rebuilding the app..." --weight=1
ynh_use_nodejs
ynh_exec_warn_less yarn --cwd "$install_dir" build ynh_exec_warn_less yarn --cwd "$install_dir" build
#================================================= #=================================================

View file

@ -48,8 +48,8 @@ chown $app:$app "$install_dir/.env.local"
# CONFIGURATION FOR SUBPATH # CONFIGURATION FOR SUBPATH
#================================================= #=================================================
rm "$install_dir/public/manifest.json" ynh_secure_remove --file="$install_dir/public/manifest.json"
rm "$install_dir/next.config.js" ynh_secure_remove --file="$install_dir/next.config.js"
if [ "$path" = "/" ]; then if [ "$path" = "/" ]; then
next_path="" next_path=""
@ -69,11 +69,18 @@ ynh_replace_string --match_string="href=\"/apple" --replace_string="href=\"$next
ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx" ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx"
chown $app:www-data "$install_dir/public/manifest.json"
chown $app:www-data "$install_dir/next.config.js"
chmod 664 "$install_dir/public/manifest.json"
chmod 664 "$install_dir/next.config.js"
#================================================= #=================================================
# BUILD AND INSTALL THE APP # BUILD AND INSTALL THE APP
#================================================= #=================================================
ynh_script_progression --message="Building the app..." --weight=1 ynh_script_progression --message="Building the app..." --weight=1
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
yarn config set enableTelemetry 0 yarn config set enableTelemetry 0
ynh_exec_warn_less yarn --cwd "$install_dir" install ynh_exec_warn_less yarn --cwd "$install_dir" install
yarn --cwd "$install_dir" run next telemetry disable yarn --cwd "$install_dir" run next telemetry disable

View file

@ -42,6 +42,8 @@ ynh_remove_systemd_config
ynh_remove_nginx_config ynh_remove_nginx_config
ynh_secure_remove --file="/var/log/$app/$app.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,9 +10,14 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# starting nodejs for fresh install
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"

View file

@ -110,6 +110,9 @@ chown $app:$app "$install_dir/.env.local"
# CONFIGURATION FOR SUBPATH # CONFIGURATION FOR SUBPATH
#================================================= #=================================================
ynh_secure_remove --file="$install_dir/public/manifest.json"
ynh_secure_remove --file="$install_dir/next.config.js"
if [ "$path" = "/" ]; then if [ "$path" = "/" ]; then
next_path="" next_path=""
else else
@ -128,11 +131,17 @@ ynh_replace_string --match_string="href=\"/apple" --replace_string="href=\"$next
ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx" ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx"
chown $app:www-data "$install_dir/public/manifest.json"
chown $app:www-data "$install_dir/next.config.js"
chmod 664 "$install_dir/public/manifest.json"
chmod 664 "$install_dir/next.config.js"
#================================================= #=================================================
# REBUILD AND INSTALL THE APP # REBUILD AND INSTALL THE APP
#================================================= #=================================================
ynh_script_progression --message="Rebuilding the app..." --weight=1 ynh_script_progression --message="Rebuilding the app..." --weight=1
ynh_use_nodejs
ynh_exec_warn_less yarn --cwd "$install_dir" install ynh_exec_warn_less yarn --cwd "$install_dir" install
ynh_exec_warn_less yarn --cwd "$install_dir" build ynh_exec_warn_less yarn --cwd "$install_dir" build