Symlink static assets in sites/assets/<app>/

This commit is contained in:
Akshay Mankar 2023-06-02 18:16:34 +02:00
parent f564435084
commit 59249c421d
Signed by untrusted user: axeman
GPG key ID: CA08F3AB62369B89

View file

@ -47,8 +47,7 @@ let
frappeApp = mkApp "frappe" frappeSrc frappeOfflineCache; frappeApp = mkApp "frappe" frappeSrc frappeOfflineCache;
erpnextApp = mkApp "erpnext" erpnextSrc erpnextOfflineCache; erpnextApp = mkApp "erpnext" erpnextSrc erpnextOfflineCache;
in runCommand "frappe-erpnext-apps-sites" {buildInputs = [yarn]; } ''
assets = runCommand "frappe-erpnext-assets" {buildInputs = [yarn]; } ''
mkdir -p $out/share/sites $out/share/apps mkdir -p $out/share/sites $out/share/apps
# Cannot symlink because the code which traverses path to find sites # Cannot symlink because the code which traverses path to find sites
@ -62,7 +61,12 @@ let
EOF EOF
cd $out/share/apps/frappe cd $out/share/apps/frappe
pwd
yarn --offline production yarn --offline production
'';
in assets symlinkPublic() {
find $out/share/apps/$1/$1/public -type d -mindepth 1 -maxdepth 1 | xargs -I '{}' bash -c "ln -s {} $out/share/sites/assets/$1/"'$(basename {})'
}
symlinkPublic frappe
symlinkPublic erpnext
''