mirror of
https://github.com/YunoHost-Apps/trilium_ynh.git
synced 2024-10-01 13:34:49 +02:00
Make Node.js build step more efficient
This commit is contained in:
parent
04a98b6ec2
commit
aad56a4e94
1 changed files with 15 additions and 11 deletions
|
@ -14,24 +14,28 @@ pkg_dependencies="nodejs npm libpng16-16 libpng-dev pkg-config autoconf libtool
|
||||||
function set_node_vars {
|
function set_node_vars {
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=12
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=12
|
||||||
ynh_use_nodejs
|
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 {
|
function build_node_app {
|
||||||
set_node_vars
|
set_node_vars
|
||||||
pushd $final_path || ynh_die
|
|
||||||
chown -R $app:$app $final_path
|
cat >> "$final_path/package.json" <<< "$(grep electron $final_path/package.json)"
|
||||||
sudo -u $app touch $final_path/.yarnrc
|
pushd "$final_path"
|
||||||
sudo -u $app "env PATH=$node_path" yarn --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1
|
chown -R $app:$app "$final_path"
|
||||||
chown -R root:root $final_path
|
sudo -u $app touch "$final_path/.yarnrc"
|
||||||
popd || ynh_die
|
sudo -u $app "env PATH=$node_path" yarn --cache-folder "$final_path/yarn-cache" --use-yarnrc "$final_path/.yarnrc" install --production 2>&1
|
||||||
|
chown -R root:root "$final_path"
|
||||||
|
popd
|
||||||
|
|
||||||
|
set_permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_permissions {
|
function set_permissions {
|
||||||
chown -R root:$app $final_path
|
chown -R root:$app "$final_path"
|
||||||
chmod -R g=u,g-w,o-rwx $final_path
|
chmod -R g=u,g-w,o-rwx "$final_path"
|
||||||
chown -R $app:$app $data_path
|
chown -R $app:$app "$data_path"
|
||||||
chmod -R g=u,g-w,o-rwx $data_path
|
chmod -R g=u,g-w,o-rwx "$data_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue