"Improved build scripts"

This commit is contained in:
Cris Stringfellow 2022-01-05 13:57:17 +08:00
parent 1099ab8e34
commit ef36b7bd0e
2 changed files with 7 additions and 7 deletions

View File

@ -25,8 +25,8 @@
"pkg": { "pkg": {
"patches": { "patches": {
"./node_modules/fetch-blob/streams.cjs": [ "./node_modules/fetch-blob/streams.cjs": [
"require('node:stream/web')", "Object.assign(globalThis, require('node:stream/web'))",
"require('stream').web" "Object.assign(globalThis, require('stream').web)"
] ]
}, },
"scripts": "build/*.js", "scripts": "build/*.js",

View File

@ -12,9 +12,9 @@ patch_required=$(grep -ER "require\([\"'](node:)?stream/web[\"']\)" node_modules
files=$(grep -rlER "require\([\"'](node:)?stream/web[\"']\)" node_modules/*) files=$(grep -rlER "require\([\"'](node:)?stream/web[\"']\)" node_modules/*)
if [[ ! -z "$patch_required" ]]; then if [[ ! -z "$patch_required" ]]; then
while IFS= read -r file; do while IFS= read -r file; do
echo '--->' $file #echo '--->' $file
grep -q $file package.json #grep -q $file package.json
if [ $? == 1 ]; then #if [ $? == 1 ]; then
echo '--->' $file "UNPATCHED!" echo '--->' $file "UNPATCHED!"
echo "Found an error!" echo "Found an error!"
echo "Found something you need to patch before building" echo "Found something you need to patch before building"
@ -25,8 +25,8 @@ if [[ ! -z "$patch_required" ]]; then
echo "You need to add all these to pkg.patches to replace with require('stream').web" echo "You need to add all these to pkg.patches to replace with require('stream').web"
./scripts/go_dev.sh ./scripts/go_dev.sh
exit 1 exit 1
fi #fi
echo "OK" #echo "OK"
done <<< $files done <<< $files
fi fi