Skip to content

Apache DataFusion SQL Query Engine

unify the prettier version adv(#20024) (#20311)

Sergey Zhukov80485d7516aa
diff --git a/ci/scripts/check_examples_docs.sh b/ci/scripts/check_examples_docs.sh
index 4b5699380d..62308b323b 100755
--- a/ci/scripts/check_examples_docs.sh
+++ b/ci/scripts/check_examples_docs.sh
@@ -33,10 +33,13 @@
set -euo pipefail
ROOT_DIR="$(git rev-parse --show-toplevel)"
+
+# Load centralized tool versions
+source "${ROOT_DIR}/ci/scripts/utils/tool_versions.sh"
+
EXAMPLES_DIR="$ROOT_DIR/datafusion-examples"
README="$EXAMPLES_DIR/README.md"
README_NEW="$EXAMPLES_DIR/README-NEW.md"
-PRETTIER_VERSION="2.7.1"
echo "▶ Generating examples README (Rust generator)…"
cargo run --quiet \
diff --git a/ci/scripts/doc_prettier_check.sh b/ci/scripts/doc_prettier_check.sh
index f074ab9283..95332eb65a 100755
--- a/ci/scripts/doc_prettier_check.sh
+++ b/ci/scripts/doc_prettier_check.sh
@@ -19,9 +19,13 @@
set -euo pipefail
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+ROOT_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
-PRETTIER_VERSION="2.7.1"
+
+# Load shared utilities and tool versions
+source "${ROOT_DIR}/ci/scripts/utils/tool_versions.sh"
+source "${ROOT_DIR}/ci/scripts/utils/git.sh"
+
PRETTIER_TARGETS=(
'{datafusion,datafusion-cli,datafusion-examples,dev,docs}/**/*.md'
'!datafusion/CHANGELOG.md'
@@ -29,8 +33,6 @@ PRETTIER_TARGETS=(
CONTRIBUTING.md
)
-source "${SCRIPT_DIR}/utils/git.sh"
-
MODE="check"
ALLOW_DIRTY=0
diff --git a/ci/scripts/utils/tool_versions.sh b/ci/scripts/utils/tool_versions.sh
new file mode 100644
index 0000000000..ac731ed0d5
--- /dev/null
+++ b/ci/scripts/utils/tool_versions.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# This file defines centralized tool versions used by CI and development scripts.
+# It is intended to be sourced by other scripts and should not be executed directly.
+
+PRETTIER_VERSION="2.7.1"
diff --git a/dev/update_config_docs.sh b/dev/update_config_docs.sh
index fafe6df2f5..f39bdda3ae 100755
--- a/dev/update_config_docs.sh
+++ b/dev/update_config_docs.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -20,13 +20,15 @@
set -e
-SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-cd "${SOURCE_DIR}/../" && pwd
+ROOT_DIR="$(git rev-parse --show-toplevel)"
+cd "${ROOT_DIR}"
+
+# Load centralized tool versions
+source "${ROOT_DIR}/ci/scripts/utils/tool_versions.sh"
TARGET_FILE="docs/source/user-guide/configs.md"
PRINT_CONFIG_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_config_docs"
PRINT_RUNTIME_CONFIG_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_runtime_config_docs"
-PRETTIER_VERSION="2.7.1"
echo "Inserting header"
cat <<'EOF' > "$TARGET_FILE"
diff --git a/dev/update_function_docs.sh b/dev/update_function_docs.sh
index 7233bb1344..86a272ae19 100755
--- a/dev/update_function_docs.sh
+++ b/dev/update_function_docs.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -20,13 +20,14 @@
set -e
-SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-cd "${SOURCE_DIR}/../" && pwd
+ROOT_DIR="$(git rev-parse --show-toplevel)"
+cd "${ROOT_DIR}"
+# Load centralized tool versions
+source "${ROOT_DIR}/ci/scripts/utils/tool_versions.sh"
TARGET_FILE="docs/source/user-guide/sql/aggregate_functions.md"
PRINT_AGGREGATE_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_functions_docs -- aggregate"
-PRETTIER_VERSION="2.7.1"
echo "Inserting header"
cat <<'EOF' > "$TARGET_FILE"