Merge pull request #239555 from Ma27/workaround-discourse-assets-issue

discourse.assets: work around `cannot execute: required file not found`
This commit is contained in:
Maximilian Bosch 2023-07-16 13:28:26 +02:00 committed by GitHub
commit f6de65f785
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,6 +39,8 @@
, nodePackages , nodePackages
, nodejs_16 , nodejs_16
, dart-sass-embedded , dart-sass-embedded
, jq
, moreutils
, plugins ? [] , plugins ? []
}@args: }@args:
@ -225,6 +227,8 @@ let
nodePackages.patch-package nodePackages.patch-package
yarn yarn
nodejs_16 nodejs_16
jq
moreutils
]; ];
outputs = [ "out" "javascripts" ]; outputs = [ "out" "javascripts" ];
@ -266,10 +270,19 @@ let
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
find app/assets/javascripts -name package.json -print0 \
| xargs -0 -I {} bash -c "jq 'del(.scripts.postinstall)' -r <{} | sponge {}"
yarn install --offline --cwd app/assets/javascripts/discourse yarn install --offline --cwd app/assets/javascripts/discourse
patchShebangs app/assets/javascripts/node_modules/ patchShebangs app/assets/javascripts/node_modules/
# Run `patch-package` AFTER the corresponding shebang inside `.bin/patch-package`
# got patched. Otherwise this will fail with
# /bin/sh: line 1: /build/source/app/assets/javascripts/node_modules/.bin/patch-package: cannot execute: required file not found
pushd app/assets/javascripts &>/dev/null
yarn run patch-package
popd &>/dev/null
redis-server >/dev/null & redis-server >/dev/null &
initdb -A trust $NIX_BUILD_TOP/postgres >/dev/null initdb -A trust $NIX_BUILD_TOP/postgres >/dev/null