@@ -34,13 +34,9 @@ set -euxo pipefail
3434# ALL_CHANGED_FILES=".github/scripts/changed-modules.sh" ./.github/scripts/changed-modules.sh
3535# Expected output: all modules, as the build script has been modified
3636#
37- # 8. This script is modified:
38- # ALL_CHANGED_FILES=".github/scripts/changed-modules.sh" ./.github/scripts/changed-modules.sh
39- # Expected output: all modules, as the build script has been modified
40- #
41- # 9. This script is modified:
42- # ALL_CHANGED_FILES=".github/scripts/changed-modules.sh" ./.github/scripts/changed-modules.sh
43- # Expected output: all modules, as the build script has been modified
37+ # 8. A .github file is modified:
38+ # ALL_CHANGED_FILES=".github/release-drafter.yml" ./.github/scripts/changed-modules.sh
39+ # Expected output: []
4440#
4541# There is room for improvement in this script. For example, it could detect if the changes applied to the docs or the .github dirs, and then do not include any module in the list.
4642# But then we would need to verify the CI scripts to ensure that the job receives the correct modules to build.
@@ -66,21 +62,24 @@ readonly no_build_modules=("packages/modules/k6")
6662modules=()
6763
6864# Find all package.json files in the repository, building a list of all the available modules.
69- for modFile in $( find " ${ROOT_DIR} " -name " package.json" -not -path " */node_modules/*" ) ; do
70- modules+=(" \" $( basename " $( dirname " ${modFile} " ) " ) \" " )
65+ # The list of modules is stored in the modules array, but the testcontainers-node module is excluded
66+ # as it is not a module.
67+ for packageJSONFile in $( find " ${ROOT_DIR} " -name " package.json" -not -path " */node_modules/*" ) ; do
68+ name=$( basename " $( dirname " ${packageJSONFile} " ) " )
69+ if [[ " ${name} " != " testcontainers-node" ]]; then
70+ if [[ " ${name} " != " testcontainers" ]]; then
71+ modules+=(" \" packages/modules/${name} \" " )
72+ else
73+ modules+=(" \" packages/testcontainers\" " )
74+ fi
75+ fi
7176done
7277# sort modules array
7378IFS=$' \n ' modules=($( sort <<< " ${modules[*]}" ) )
7479unset IFS
7580
76- # capture the root module
77- readonly rootModule=" \" packages/testcontainers\" "
78-
79- # merge all modules into a single array
80- allModules=(${rootModule} " ${modules[@]} " )
81-
82- # sort allModules array
83- IFS=$' \n ' allModules=($( sort <<< " ${allModules[*]}" ) )
81+ # sort modules array
82+ IFS=$' \n ' modules=($( sort <<< " ${modules[*]}" ) )
8483unset IFS
8584
8685# Get the list of modified files, retrieved from the environment variable ALL_CHANGED_FILES.
@@ -121,7 +120,7 @@ for file in $modified_files; do
121120 fi
122121 done
123122
124- modified_modules=${allModules [@]}
123+ modified_modules=${modules [@]}
125124 break
126125 fi
127126done
0 commit comments