File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change 44if ! command -v dataform > /dev/null 2>&1 ; then
55 echo " Dataform is not installed."
66 echo " Trying to install Dataform..."
7- npm i -g @dataform/cli@latest
8- echo " Dataform installed successfully."
7+ if npm i -g @dataform/cli@latest; then
8+ echo " Dataform installed successfully."
9+ else
10+ echo " Failed to install Dataform."
11+ exit 1
12+ fi
913fi
1014
1115dataform compile
1216
13- exit 0
17+ if [[ $? -ne 0 ]]; then
18+ exit 1
19+ else
20+ exit 0
21+ fi
Original file line number Diff line number Diff line change 44if ! command -v dataform > /dev/null 2>&1 ; then
55 echo " Dataform is not installed."
66 echo " Trying to install Dataform..."
7- npm i -g @dataform/cli@latest
8- echo " Dataform installed successfully."
7+ if npm i -g @dataform/cli@latest; then
8+ echo " Dataform installed successfully."
9+ else
10+ echo " Failed to install Dataform."
11+ exit 1
12+ fi
913fi
1014
11- # Run Dataform formatting for SQLX files
15+ # Compute hash of all files in the project before and after formatting to detect changes
16+
17+ hash_before_format=$( find . -type f -exec md5sum {} \; | awk ' {print $1}' | sort | md5sum | awk ' {print $1}' )
18+
1219dataform format
1320
14- exit 0
21+ hash_after_format=$( find . -type f -exec md5sum {} \; | awk ' {print $1}' | sort | md5sum | awk ' {print $1}' )
22+
23+ if [ " $hash_before_format " != " $hash_after_format " ]; then
24+ exit 1
25+ else
26+ exit 0
27+ fi
You can’t perform that action at this time.
0 commit comments