From 04a98b6ec22e3aadb0db4aa7e37350ff4b30aa02 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Sun, 25 Apr 2021 18:16:05 -0400 Subject: [PATCH] Use Node.JS 12 --- conf/systemd.service | 4 ++-- scripts/_common.sh | 6 +++--- scripts/install | 2 +- scripts/restore | 2 -- scripts/upgrade | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 60449dc..bcbe28b 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,9 +7,9 @@ Type=simple User=__APP__ Group=__APP__ Environment=TRILIUM_DATA_DIR=/home/yunohost.app/__APP__ -Environment="NODE_ENV=production" +Environment=NODE_ENV=production WorkingDirectory=__FINALPATH__/ -ExecStart=__YNH_NODE__ __FINALPATH__/src/www +ExecStart=/usr/bin/env bash -c "PATH=__NODEJS_PATH__:$PATH node __FINALPATH__/src/www" [Install] WantedBy=multi-user.target diff --git a/scripts/_common.sh b/scripts/_common.sh index aebf801..40db0d8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,9 +12,9 @@ pkg_dependencies="nodejs npm libpng16-16 libpng-dev pkg-config autoconf libtool #================================================= function set_node_vars { - ynh_exec_warn_less ynh_install_nodejs --nodejs_version=10 + ynh_exec_warn_less ynh_install_nodejs --nodejs_version=12 ynh_use_nodejs - node_PATH=$nodejs_path:$(sudo -u $app sh -c 'echo $PATH') + node_path=$nodejs_path:$(sudo -u $app sh -c 'echo $PATH') } function build_node_app { @@ -22,7 +22,7 @@ function build_node_app { pushd $final_path || ynh_die chown -R $app:$app $final_path sudo -u $app touch $final_path/.yarnrc - sudo -u $app "env PATH=$node_PATH" yarn --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1 + sudo -u $app "env PATH=$node_path" yarn --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1 chown -R root:root $final_path popd || ynh_die } diff --git a/scripts/install b/scripts/install index 2c6ea93..22bff19 100755 --- a/scripts/install +++ b/scripts/install @@ -114,7 +114,7 @@ build_node_app ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config -ynh_add_systemd_config -v ynh_node +ynh_add_systemd_config -v nodejs_path #================================================= # ADD A CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 0e6390c..c22dd52 100755 --- a/scripts/restore +++ b/scripts/restore @@ -92,8 +92,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=40 ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=10 - #================================================= # REINSTALL DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f409532..158ae80 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -106,7 +106,7 @@ build_node_app ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config -ynh_add_systemd_config -v ynh_node +ynh_add_systemd_config -v nodejs_path #================================================= # UPDATE A CONFIG FILE