From 26b082d46edff1800ffb15c2633c13ccc28d48a6 Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sat, 25 May 2024 16:15:18 +0330 Subject: [PATCH 1/6] check avx2 when use bun --- scripts/styles.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/styles.sh b/scripts/styles.sh index acd8dcee9..df74dc27b 100755 --- a/scripts/styles.sh +++ b/scripts/styles.sh @@ -6,14 +6,25 @@ OUTPUT_STYLECSS=internal/view/assets/css/style.css INPUT_ARCHIVECSS=internal/view/assets/less/archive.less OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css +# Detect support of avx2 + +if [ -x "$(command -v bun)" ]; then + if grep -q avx2 /proc/cpuinfo; then + BUNEXCUTE="bun" + else + BUNEXCUTE="sde -chip-check-disable -- bun" + echo "Your cpu not support avx2 so We use sde for more information please lookat https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" + fi +fi + # Use bun is installled if [ -x "$(command -v bun)" ]; then - bun install - bun x prettier internal/view/ --write - bun x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS - bun x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS - bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS - bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS + $BUNEXCUTE install + $BUNEXCUTE x prettier internal/view/ --write + $BUNEXCUTE x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS + $BUNEXCUTE x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS + $BUNEXCUTE x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS + $BUNEXCUTE x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS exit 0 fi From 860d20fdb9b0341f18fd92119678ddba0cb88cb6 Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sun, 26 May 2024 02:21:03 +0330 Subject: [PATCH 2/6] change enviroment variable to just BUN --- scripts/styles.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/styles.sh b/scripts/styles.sh index df74dc27b..19307894e 100755 --- a/scripts/styles.sh +++ b/scripts/styles.sh @@ -10,21 +10,21 @@ OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css if [ -x "$(command -v bun)" ]; then if grep -q avx2 /proc/cpuinfo; then - BUNEXCUTE="bun" + BUN="bun" else - BUNEXCUTE="sde -chip-check-disable -- bun" + BUN="sde -chip-check-disable -- bun" echo "Your cpu not support avx2 so We use sde for more information please lookat https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" fi fi # Use bun is installled if [ -x "$(command -v bun)" ]; then - $BUNEXCUTE install - $BUNEXCUTE x prettier internal/view/ --write - $BUNEXCUTE x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS - $BUNEXCUTE x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS - $BUNEXCUTE x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS - $BUNEXCUTE x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS + $BUN install + $BUN x prettier internal/view/ --write + $BUN x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS + $BUN x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS + $BUN x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS + $BUN x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS exit 0 fi From 3a679715a20dba5d7fc80165836984936e2e3be3 Mon Sep 17 00:00:00 2001 From: Monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sat, 25 May 2024 23:43:42 +0000 Subject: [PATCH 3/6] better massage Co-authored-by: Mario Rugiero --- scripts/styles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/styles.sh b/scripts/styles.sh index 19307894e..2718e3f28 100755 --- a/scripts/styles.sh +++ b/scripts/styles.sh @@ -13,7 +13,7 @@ if [ -x "$(command -v bun)" ]; then BUN="bun" else BUN="sde -chip-check-disable -- bun" - echo "Your cpu not support avx2 so We use sde for more information please lookat https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" + echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" fi fi From baeb0a049a0ac20c9aba739bbd704886a3bb9166 Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sun, 26 May 2024 12:32:22 +0330 Subject: [PATCH 4/6] simpler method --- scripts/styles.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/styles.sh b/scripts/styles.sh index 2718e3f28..03c0ac7bb 100755 --- a/scripts/styles.sh +++ b/scripts/styles.sh @@ -7,14 +7,10 @@ INPUT_ARCHIVECSS=internal/view/assets/less/archive.less OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css # Detect support of avx2 - -if [ -x "$(command -v bun)" ]; then - if grep -q avx2 /proc/cpuinfo; then - BUN="bun" - else - BUN="sde -chip-check-disable -- bun" - echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" - fi +BUN="bun" +if grep -q avx2 /proc/cpuinfo; then + BUN="sde -chip-check-disable -- bun" + echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" fi # Use bun is installled From f7bf07f3d35094b0d19878b50199bffadbf4e003 Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sun, 26 May 2024 12:36:52 +0330 Subject: [PATCH 5/6] add missing reverse if --- scripts/styles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/styles.sh b/scripts/styles.sh index 03c0ac7bb..268319f3b 100755 --- a/scripts/styles.sh +++ b/scripts/styles.sh @@ -8,7 +8,7 @@ OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css # Detect support of avx2 BUN="bun" -if grep -q avx2 /proc/cpuinfo; then +if ! grep -q avx2 /proc/cpuinfo; then BUN="sde -chip-check-disable -- bun" echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" fi From e00f41b858aa1bd57aaf3bd85540e81fb725404c Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sun, 26 May 2024 13:41:38 +0330 Subject: [PATCH 6/6] patch with @fmartingr to check that in linux only --- scripts/styles.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/styles.sh b/scripts/styles.sh index 268319f3b..475d44c01 100755 --- a/scripts/styles.sh +++ b/scripts/styles.sh @@ -8,10 +8,15 @@ OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css # Detect support of avx2 BUN="bun" -if ! grep -q avx2 /proc/cpuinfo; then - BUN="sde -chip-check-disable -- bun" - echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" -fi +case `uname -o` in + GNU/Linux) + # Detect support of avx2 in linux hosts + if ! grep -q avx2 /proc/cpuinfo; then + BUN="sde -chip-check-disable -- bun" + echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" + fi + ;; +esac # Use bun is installled if [ -x "$(command -v bun)" ]; then