diff --git a/scripts/_common.sh b/scripts/_common.sh index a862ce1..9a7d810 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,6 +7,9 @@ # nodejs version nodejs_version=16 +# Terraforming-mars commit +TM_version="a36d327" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 55db793..d573b19 100755 --- a/scripts/install +++ b/scripts/install @@ -19,19 +19,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Upgrade NPM ynh_npm install --global npm@6.14.18 - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 - -# Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source --dest_dir="$install_dir" - -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # NGINX CONFIGURATION #================================================= @@ -48,7 +35,8 @@ ynh_add_nginx_config #================================================= cd $install_dir -git clone https://github.com/terraforming-mars/terraforming-mars.git +ynh_exec_warn_less git clone https://github.com/terraforming-mars/terraforming-mars.git +git checkout $TM_version pushd $install_dir/terraforming-mars ynh_use_nodejs diff --git a/scripts/upgrade b/scripts/upgrade index e36bba5..0007687 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,35 +30,23 @@ ynh_npm install --global npm@6.14.18 #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 - -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --full-replace=1 - -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # BUILD APP #================================================= ynh_script_progression --message="Building app... This may take quiete some time" --weight=30 -pushd $install_dir +cd $install_dir +ynh_exec_warn_less git clone https://github.com/terraforming-mars/terraforming-mars.git +git checkout $TM_version + +pushd $install_dir/terraforming-mars ynh_use_nodejs - ynh_script_progression --message="Fetching Yarn dev dependencies... This can be very long, be patient !" --weight=18 - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout=100000 - - ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --weight=25 - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn run build - - ynh_script_progression --message="Cleaning cache... " --weight=3 - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1 + ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 + ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm install --network-timeout=100000 + ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 + ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm run build popd chmod 750 "$install_dir"