diff --git a/scripts/check.sh b/scripts/check.sh index 253fe8447..ac155b5e7 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -1,17 +1,39 @@ #!/bin/bash -echo ------ cargo check -cargo c --all-features +set -o errexit +set -o nounset +set -o pipefail -echo ------ cargo clippy -cargo clippy --all-features -cargo clippy --tests +function rust() { + cargo fmt --check + cargo sort -c -w + cargo clippy --all-features --tests + cargo test +} -echo ------ cargo test -cargo t +function node() { + pnpm lint + pnpm check +} -echo ------ cargo fmt -cargo fmt --check - -echo ------ cargo sort -cargo sort -c -w +if [[ "$#" -eq 0 ]]; then + set -o xtrace + rust + node +else + case "$1" in + rust) + set -o xtrace + rust + ;; + node) + set -o xtrace + node + ;; + *) + echo "Invalid argument: $1" + exit 1 + ;; + esac + exit 0 +fi diff --git a/scripts/check_formats.sh b/scripts/check_formats.sh deleted file mode 100755 index b1e1a52c8..000000000 --- a/scripts/check_formats.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Run pnpm format -pnpm format - -# Change directory to src-tauri -cd src-tauri - -# Run cargo fmt -cargo fmt - diff --git a/scripts/format.sh b/scripts/format.sh new file mode 100755 index 000000000..464cdd705 --- /dev/null +++ b/scripts/format.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +function rust() { + cargo fmt +} + +function node() { + pnpm format +} + +if [[ "$#" -eq 0 ]]; then + set -o xtrace + rust + node +else + case "$1" in + rust) + set -o xtrace + rust + ;; + node) + set -o xtrace + node + ;; + *) + echo "Invalid argument: $1" + exit 1 + ;; + esac + exit 0 +fi