deploy pre-built HTML: eliminate 'npm build'

This commit is contained in:
Julian Foad 2024-11-15 11:22:55 +00:00
parent 669e19fa12
commit 5ef92372d8
6 changed files with 7 additions and 43 deletions

View file

@ -45,9 +45,9 @@ ram.runtime = "50M"
[resources]
[resources.sources.main]
url = "https://github.com/scratchfoundation/scratch-gui/archive/refs/tags/v4.1.3.tar.gz"
sha256 = "77283288fa9a8bbad9a02099d6bfc9180244d23ae7011e4c4b97953c509705ac"
autoupdate.strategy = "latest_github_tag"
url = "https://jo.trax.im/api/packages/julianfoad/generic/scratch-gui-dist/4.1.3/scratch-gui-dist-4.1.3.tar.gz"
sha256 = "54a520f30b204c7829f932c1413cbaff956f197411d14190cf721e527d7e854a"
#autoupdate.strategy = "..."
[resources.system_user]

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# NodeJS version
nodejs_version=18
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -12,9 +12,6 @@ source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing nodejs..." --weight=50
ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -22,7 +19,7 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Setting up source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/sources"
ynh_setup_source --dest_dir="$install_dir/www"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
@ -30,18 +27,6 @@ chown -R "$app:www-data" "$install_dir"
#=================================================
# Build
#=================================================
ynh_script_progression --message="Installing $app..." --weight=40
pushd "$install_dir/sources"
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" install
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" BUILD_MODE=dist "$ynh_npm" run build
popd
mv "$install_dir/sources/build" "$install_dir/www"
ynh_secure_remove --file="$install_dir/sources"
chown -R "$app:www-data" "$install_dir"
#=================================================
# SYSTEM CONFIGURATION

View file

@ -14,8 +14,6 @@ ynh_script_progression --message="Removing system configurations related to $app
ynh_remove_nginx_config
ynh_remove_nodejs
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -23,8 +23,6 @@ chown -R "$app:www-data" "$install_dir"
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================

View file

@ -1,5 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,9 +12,6 @@ source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing nodejs..."
ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -20,7 +19,7 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1
ynh_setup_source --dest_dir="$install_dir/www" --full_replace=1
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
@ -28,19 +27,6 @@ chown -R "$app:www-data" "$install_dir"
#=================================================
# Build
#=================================================
ynh_script_progression --message="Installing $app..." --weight=40
pushd "$install_dir/sources"
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" install
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" BUILD_MODE=dist "$ynh_npm" run build
popd
ynh_secure_remove --file="$install_dir/www"
mv "$install_dir/sources/build" "$install_dir/www"
ynh_secure_remove --file="$install_dir/sources"
chown -R "$app:www-data" "$install_dir"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS