11#! /bin/bash
22
3- cd ../docs;
3+ cd " $( dirname " $0 " ) / ../docs"
44
55# Define the JSON file
6- MINT_JSON=" ../docs/ mint.json"
6+ MINT_JSON=" mint.json"
77
88# Define the exclusion lists
99EXCLUDE_LIST=(" node_modules" )
@@ -30,8 +30,6 @@ is_excluded() {
3030
3131 # Check if the exact file is in the file exclusion list
3232 for exclude_file in " ${EXCLUDE_FILE_LIST[@]} " ; do
33- # echo "exclude_file: $exclude_file"
34- # echo "file_path: $file_path"
3533 if [[ $file_path == " $exclude_file " ]]; then
3634 return 0 # The file is in the exclusion file list
3735 fi
@@ -42,8 +40,10 @@ is_excluded() {
4240
4341echo " Checking for missing files in mint.json..."
4442
43+ is_missing=0
44+
4545# Go over each .mdx file in all subdirectories within the current directory
46- find . -mindepth 2 -type f -name " *.mdx " | sort | while read -r file; do
46+ while IFS= read -r -d ' ' file; do
4747 # Check if the file is in the exclusion list
4848 if is_excluded " $file " ; then
4949 continue
@@ -58,9 +58,14 @@ find . -mindepth 2 -type f -name "*.mdx" | sort | while read -r file; do
5858 # echo "File $relative_path is listed in mint.json"
5959 :
6060 else
61- echo " 🔴🔴🔴 \" $relative_path \" is missing in docs/mint.json. That's a file responsible for rendering docs navigation."
62- echo " Please add the new docs page there or to the EXCLUDE_FILE_LIST of the current script."
63- echo " Otherwise the page will be really hard to navigate to :)"
64- exit 1 # Exit with an error code to fail the CI/CD process
61+ echo " \" $relative_path \" ,"
62+ is_missing=1
6563 fi
66- done
64+ done < <( find . -mindepth 2 -type f -name " *.mdx" -print0 | sort -z)
65+
66+ if [[ $is_missing -ne 0 ]]; then
67+ echo " 🔴🔴🔴 👆 those files are missing in docs/mint.json. That's a file responsible for rendering docs navigation."
68+ echo " Please add the new docs page there or to the EXCLUDE_FILE_LIST of the current script."
69+ echo " Otherwise the page will be really hard to navigate to :)"
70+ exit 1 # Exit with an error code to fail the CI/CD process
71+ fi
0 commit comments