@@ -17,6 +17,7 @@ JQASSISTANT_CONFIG_TEMPLATE=${JQASSISTANT_CONFIG_TEMPLATE:-"template-neo4jv5-jqa
1717NEO4J_INITIAL_PASSWORD=${NEO4J_INITIAL_PASSWORD:- " " } # Neo4j login password that was set to replace the temporary initial password
1818ARTIFACTS_DIRECTORY=${ARTIFACTS_DIRECTORY:- " artifacts" } # Directory with the Java artifacts to scan and analyze
1919TOOLS_DIRECTORY=${TOOLS_DIRECTORY:- " tools" } # Get the tools directory (defaults to "tools")
20+ SOURCE_DIRECTORY=${SOURCE_DIRECTORY:- " source" } # Get the source repository directory (defaults to "source")
2021
2122# # Get this "scripts" directory if not already set
2223# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
@@ -68,16 +69,26 @@ if [ -d "${ARTIFACTS_DIRECTORY}" ] ; then
6869 directoriesAndFilesToScan=" ${directoriesAndFilesToScan} ,./${ARTIFACTS_DIRECTORY} "
6970fi
7071
71- # Scan Typescript analysis json data files in the artifacts/typescript directory
72- typescriptAnalysisFiles=" $( find . -type f -path " */.reports/jqa/ts-output.json" -exec echo typescript:project::{} \; | tr ' \n' ' ,' | sed ' s/,$/\n/' ) "
73- if [ -n " ${typescriptAnalysisFiles} " ]; then
74- directoriesAndFilesToScan=" ${directoriesAndFilesToScan} ,${typescriptAnalysisFiles} "
72+ if [ -d " ${SOURCE_DIRECTORY} " ] ; then
73+ # Scan Typescript analysis json data files in the source directory
74+ typescriptAnalysisFiles=" $( find " ${SOURCE_DIRECTORY} " -type f -path " */.reports/jqa/ts-output.json" -exec echo typescript:project::{} \; | tr ' \n' ' ,' | sed ' s/,$/\n/' ) "
75+ if [ -n " ${typescriptAnalysisFiles} " ]; then
76+ directoriesAndFilesToScan=" ${directoriesAndFilesToScan} ,${typescriptAnalysisFiles} "
77+ fi
78+ # Scan package.json files for npm (nodes package manager) in the source directory
79+ npmPackageJsonFiles=" $( find " ${SOURCE_DIRECTORY} " -type d -name node_modules -prune -o -name ' package.json' -print0 | xargs -0 -r -I {} | tr ' \n' ' ,' | sed ' s/,$/\n/' ) "
80+ if [ -n " ${npmPackageJsonFiles} " ]; then
81+ directoriesAndFilesToScan=" ${directoriesAndFilesToScan} ,${npmPackageJsonFiles} "
82+ fi
7583fi
7684
7785# ------------------------------------------------------------------
7886
7987# Use jQAssistant to scan the downloaded artifacts and write the results into the separate, local Neo4j Graph Database
80- echo " resetAndScan: Using jQAssistant CLI version ${JQASSISTANT_CLI_VERSION} to scan: ${directoriesAndFilesToScan} "
88+ echo " resetAndScan: Using jQAssistant CLI version ${JQASSISTANT_CLI_VERSION} to scan the following files and directories:"
89+ for directoryOrFileToScan in ${directoriesAndFilesToScan// ,/ } ; do
90+ echo " - ${directoryOrFileToScan} "
91+ done
8192
8293" ${JQASSISTANT_BIN} " /jqassistant.sh scan -f " ${directoriesAndFilesToScan} "
8394
0 commit comments