From cd8eaf0b4921d90e41fe5577b432cb2bcb7cb2ba Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:12:12 +0700 Subject: [PATCH] perf(script): add fast mode to skip all slow actions --- scripts/dev.sh | 2 ++ scripts/libs/core.sh | 6 ++++++ scripts/libs/feature.sh | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/scripts/dev.sh b/scripts/dev.sh index 067708d..49ea8fb 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -13,6 +13,7 @@ #= - deploy - deploy changes to repository #= - wait - wait for workflows (only if enabled deploy) #= - test - enabled test latest changes first +#= - fast - enabled fast mode to skipped all slow command export COMPONENTS=( '1password' @@ -90,6 +91,7 @@ main() { feat_is_prompt && features+=("prompt") feat_is_test && features+=("test") feat_is_wait && features+=("wait") + feat_is_fast && features+=("fast") local suffix="" [ "${#features[@]}" -gt 0 ] && suffix=" with features '${features[*]}'" diff --git a/scripts/libs/core.sh b/scripts/libs/core.sh index 6e5ca85..e1589f9 100755 --- a/scripts/libs/core.sh +++ b/scripts/libs/core.sh @@ -64,12 +64,14 @@ core_start() { runner "$component" get-latest \ $ check_cmd_fail feat_is_dryrun \ + $ check_cmd_fail feat_is_fast \ $ check_must_success deploy-plugin \ $ exec_with_file asdf latest "$component" \ $ verify_asdf_latest runner "$component" list-all \ $ check_must_success get-latest deploy-plugin \ + $ check_cmd_fail feat_is_fast \ $ exec_with_file asdf list all "$component" \ $ verify_asdf_list @@ -86,22 +88,26 @@ core_start() { runner "$component" install-latest \ $ check_must_success get-latest \ $ check_cmd_pass feat_is_test \ + $ check_cmd_fail feat_is_fast \ $ exec_with_file asdf install "$component" latest \ $ verify_asdf_install "$install_path" runner "$component" shell-latest \ $ check_must_success get-latest \ $ check_must_success install-latest \ $ check_cmd_pass feat_is_test \ + $ check_cmd_fail feat_is_fast \ $ exec_with_file asdf shell "$component" "$latest" runner "$component" "test-latest" \ $ check_must_success get-latest \ $ check_must_success install-latest \ $ check_cmd_pass feat_is_test \ + $ check_cmd_fail feat_is_fast \ $ exec_with_file asdf "$component" test runner "$component" "uninstall-latest" \ $ check_must_success get-latest \ $ check_must_success install-latest \ $ check_cmd_pass feat_is_test \ + $ check_cmd_fail feat_is_fast \ $ exec_with_file asdf uninstall "$component" "$latest" runner "$component" "git-pull" \ diff --git a/scripts/libs/feature.sh b/scripts/libs/feature.sh index 5ce83c6..5e95cac 100755 --- a/scripts/libs/feature.sh +++ b/scripts/libs/feature.sh @@ -28,6 +28,10 @@ feat_is_test() { __feat_status test tst t } +feat_is_fast() { + __feat_status fast fst f +} + __feat_status() { local key enabled for enabled in ${FEAT_ENABLED//,/ }; do